Difference between revisions of "PFMENU DOCS MC"
From DIDEAS Wiki
m (→states) |
m (→states) |
||
Line 178: | Line 178: | ||
===states=== | ===states=== | ||
+ | * cmd 1420, 1421 to access state | ||
<pre> | <pre> | ||
typedef enum { | typedef enum { |
Revision as of 19:53, 7 May 2009
Contents
motor controller
- 1105 : get speed (and other info)
- 1108 : set current offsets
- 1109 : set motor mode
- 1110 : set motor torque
- 1111 : getdata
- 1112 : set qei X resolution (2x or 4x)
- 1113 : enable / disable mode zero current offset calibration (
- 1114 : set ctrl param vQ and vD
- 1115 : set ctrl param vQ and vD, and then set motor mode
- cmd 1115 is the primary to set motor torque and mode.
- parameters are 1115 <qPq> <qPd> <Mode>
- Modes are :
- 0 for shorted motor leads (safety mode)
- 2 for zero encoder
- 3 for close current loop torque mode
- 4 for open loop voltage mode w/constant flux angle (adjust w/ set_position)
- 6 for open loop voltage mode w/flux angle set by encoder (normal mode)
- 7 to read and set motor controller current offsets
- qPq and qPd are q15 format control reference parameters in the Q and D direction.
- in modes (2?) and 3 - the Q and D parameters represent current with 1amp = ~1093
- in mode 4 and 6 - the Q and D parameters represent voltage such that voltage on the motor is : Vq = qPq / 32768 * POWER SUPPLY VOLAGE
- qPq and qPd are q15 format control reference parameters in the Q and D direction.
- eg: a parameter of 800 with a supply of 21.6 volts -> vmot = .8/32.7 * 21.6 = 0.5 volts
- 1116 : read current offsets
- typically auto set by commanding mode 7.
- 1117 : set motor filter (both Q and D)
- 1118 : read ADCs (in_param==16 -> read all 16 channels), else thats the channel offset and read 10 channels
overload current monitor
- 1120 - reads overload config parameters
data->param[0] = OverloadMonitor.max_phase_filter_sum >> 10; data->param[1] = OverloadMonitor.max_bat_filter_sum >> 10; data->param[2] = OverloadMonitor.phase_filter_decay; data->param[3] = OverloadMonitor.bat_filter_decay;
defaults are 22400 22400 4915 4915
or :
for the sum : 0.07 * 32768 * 10e3 / 1024
for the decay : 0.15 * 32768
- 1121 <param> - to see the present intermediate values and overload flag. if param is one, will reset overload flag.
data->param[0] = OverloadMonitor.sum_1 >> 10; data->param[1] = OverloadMonitor.sum_2 >> 10; data->param[2] = OverloadMonitor.sum_bat >> 10; data->param[3] = OverloadMonitor.i_phase_1; data->param[4] = OverloadMonitor.i_phase_2; data->param[5] = OverloadMonitor.i_bat; data->param[6] = OverloadMonitor.trip; data->param[7] = OverloadMonitor.enable; data->param[8] = tkmot_get_error(); data->param[9] = tkmot_get_overload();
- 1122 <4x params> - use to set the overload config parameters
OverloadMonitor.max_phase_filter_sum = data->param[0] * 1024L; OverloadMonitor.max_bat_filter_sum = data->param[1] * 1024L; OverloadMonitor.phase_filter_decay = data->param[2]; OverloadMonitor.bat_filter_decay = data->param[3];
- 1123 : enable/disable overload current monitor
- The computation at 10KHZ, sums the ABS of a Q15 current and subtracts the decay value on each cycle
- the time (in sec) for the to trip is (when in 'integer' units)
t = MAX_SUM / (I_Q15 - DECAY) / 10000
- when in fraction units:
t = 0.07 / (f_Q15 - 0.015)
For the defaults:
- 30 amps, 80mS
- 25 amps, 100mS
- 20 amps, 132mS
- 15 amps, 195mS
- 10 amps, 373mS
dataport
- 1257 - dataport_set_select(val)
- 0 : received values from SC
- 1 : electronic fuse sums
- 2 : all 5 SM values
IMPED
- 1330 - get imp
- 1331 - set imp
- 1333 - set mc_sm to allow imped updates
- 1340 - impdebug -> called imp_debug_params
param[0] = imp.pos; param[1] = imp.rel_pos; param[2] = imp.speed; param[4] = imp.kp*1e6; param[5] = imp.kb*1e6; param[6] = imp.kp_enc*1e6; param[7] = imp.kb_rpm*1e6;
MC SM
- 1411 - mc_sm debug
- 0 mc_sm_debug
- 1 mc_sm_ctrl_debug
- 2 mc_imp_debug / mc_imp_debug_param+4
- 1420 - get mode
- 1421 - set mode (21 for imp mode)
- 1422 - set ankle error state
- 1430 - get max pos, max neg current (mA)
- 1431 - set max pos, max neg current (mA) (disable torque limit)
- 1432 - get torque limit : max pos, max neg torque
- 1433 - set torque limit : max positive, max negative torque
- 1435 - set max and min position
- 1437 - set tics timeout (for torque offset)
- 1439 - set max pos, max neg current (mA) (enable torque limit)
- 1440 - get sm_ctlr parm
- 1460
- 1461
- 1464
- 1466
debug (1411) options
- 0 mc_sm_debug
param[0] = sm->state; param[1] = sm->last_state; param[2] = sm->tics_in_current_state; param[3] = sm->tics_since_last_update; param[4] = sm->motor_is_active;
- 1 mc_sm_ctrl_debug
param[0] = ctrl->torque * 1000; param[1] = ctrl->current * 1000; param[2] = ctrl->qIq; param[3] = ctrl->qId; param[4] = ctrl->max_pos_current; param[5] = ctrl->max_neg_current; param[6] = ctrl->max_motor_enc_pos; param[7] = ctrl->max_motor_enc_pos; param[8] = ctrl->torque_offset * 1000; param[9] = ctrl->enable_imp_current_update;
- 2 mc_imp_debug / mc_imp_debug_param+4
param[0] = imp.pos; param[1] = imp.rel_pos; param[2] = imp.speed; param[4] = imp.kp*1e6; param[5] = imp.kb*1e6; param[6] = imp.kp_enc*1e6; param[7] = imp.kb_rpm*1e6;
states
- cmd 1420, 1421 to access state
typedef enum { MCSM_INIT, MCSM_IDLE, MCSM_MODE7, MCSM_MODE2, MCSM_MODE4A, MCSM_MODE4B, MCSM_MODE4C, MCSM_MODE4D, MCSM_MODE4_FIN, MCSM_BOOT_COMPLETE=20, MCSM_IMP_MODE=30, MCSM_RESISTANCE_MODE, MCSM_ACTIVE, MCSM_OVERLOAD, MCSM_UPDATE_TIMEOUT, MCSM_ANKLE_READY, MCSM_RELAXED_MODE, // 36 MCSM_ANKLE_ERROR=40, MCSM_ERROR=44, MCSM_POS_ERROR_POSITIVE=50, MCSM_POS_ERROR_NEGATIVE=52, MCSM_ENC_ERROR=60, } MC_STATE_T;