Difference between revisions of "PFMENU DOCS MC"
From DIDEAS Wiki
m (→overload current monitor) |
m (→motor controller) |
||
Line 2: | Line 2: | ||
=motor controller= | =motor controller= | ||
+ | *1056 : read abs encoder debug parameters as updated in ISR | ||
+ | param[0] = abs_enc.enc_position; | ||
+ | param[1] = abs_enc.num_rotations; | ||
+ | param[2] = abs_enc.enc_position + (INT32_T) abs_enc.num_rotations * (INT32_T)abs_enc.resolution; | ||
+ | param[3] = ((long)abs_enc.last_diff*10000L) + abs_enc.sequential_errors; | ||
+ | param[4] = abs_enc.zero_mech_ang_measured; | ||
+ | param[5] = abs_enc.zero_mech_ang_stored; | ||
+ | param[6] = abs_enc.resolution; | ||
+ | param[7] = abs_enc.half_resolution; | ||
+ | param[7] = abs_enc.max_encoder_error; | ||
+ | param[8] = abs_enc.incremental_encoder_offset; | ||
+ | param[9] = abs_enc.invalid_count; | ||
+ | |||
+ | |||
+ | |||
*1100 : set mode | *1100 : set mode | ||
*1101 : get mode | *1101 : get mode |
Revision as of 20:59, 12 December 2009
PF Users Navigation:
- PCB; Lifefix_users; Pf_users; benchtest_users; CalibFix Users; Hardware; Assembly ; iochan ;
- PCA : PCB ; AKENC SC/MC 218 ; FET 217 ; IMU219 ; Swifi ; Rev200_mods ; PCA Inventory
- Special Commands to the Ankle (PFCMD) : State Controller Commands; Motor Controller Commands; Python Examples; IMU Commands ;PFCMD_PY; Pf_calb_table_py; Virtual spring test; PF EEPROM
- DOC: Pf_users; Powerfoot Keyboard User Interface; Steps for Manual Tuning; "Dashboard" Program For Assisting with Tuning
- NEW (CEB) WIKI
- Torque Feedback Controller Guide
Contents
motor controller
- 1056 : read abs encoder debug parameters as updated in ISR
param[0] = abs_enc.enc_position; param[1] = abs_enc.num_rotations; param[2] = abs_enc.enc_position + (INT32_T) abs_enc.num_rotations * (INT32_T)abs_enc.resolution; param[3] = ((long)abs_enc.last_diff*10000L) + abs_enc.sequential_errors; param[4] = abs_enc.zero_mech_ang_measured; param[5] = abs_enc.zero_mech_ang_stored; param[6] = abs_enc.resolution; param[7] = abs_enc.half_resolution; param[7] = abs_enc.max_encoder_error; param[8] = abs_enc.incremental_encoder_offset; param[9] = abs_enc.invalid_count;
- 1100 : set mode
- 1101 : get mode
- 1102 : set torque
- 1103 : get torque
- 1104 : set speed
- 1105 : get speed (and other info)
- 1106 : get encoder
- 1107 : set encoder zero
- 1108 : set current offsets
- 1109 : set motor mode
- 1110 : set motor torque
- 1111 : getdata
- 1112 : REMOVED
- 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 and status
- 1121 <param> - like command 1120, but pass param==1 to reset sums and trips
- 1122 <4x params> - use to set the overload config parameters
- format : 1122 <motor maxsum> <bat maxsum> <motor decay> <bat decay>
- The computation at 1KHZ, sums the ABS of the the scaled (1/256) current and subtracts the decay value
- the time in mS for the to trip :
t = (1mS) * MAX_SUM / (AMPS - DECAY)
- some defaults 11500 / ((I_PHASE - 3.0) * 1092 * 1/256
desired fuse values.
- 30 amps, 80mS
- 25 amps, 100mS
- 20 amps, 132mS
- 15 amps, 195mS
- 10 amps, 373mS
encoder
- 1050 : get 2x / 4x mode
- 1051 : set 2x / 4x mode (in_param == 2 or 4)
- 1052 : get direction
- 1053 : set direction (in_param == +1 or -1)
- 1055 : config for MR (0) or MILE encoder (1)
dataport
- 1210 - (to be replaced w/ 1228) get baud
- 1211 - (to be repalced w/ 1229) set baud (1,2,4,8,10)
- 1228 : set current dataport baudrate (port)
- 1229 : set current dataport baudrate (port, value) value is actual baud, will return actual baud
- 1251 - set read back data variable
- [data_position] [variable_id]
- the data position is 0 to 4, and variable id is from this list
- 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 ff params
- 1441 - set ff params
- 1442 - return ff debug params
- 1443 - enable/disable ff
- 1460
- 1461 - set IMP torque offset
- 1464 (disabled) - switch to mode4, command a qVq and qVd
- 1466 (disabled) - switch to mode6, command a qVq and qVd
- 1468 - get resistance pulse and duration
- 1469 - set resistance pulse amplitude and duration
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;
- case 5 :
data->param[0] = ff->hard_limit; // CMD_DOC: data->param[1] = ff->activate_pos; // CMD_DOC: data->param[2] = ff->torque_at_limit * 1000; // CMD_DOC: data->param[3] = ff->zone; // CMD_DOC: data->param[4] = ff->pos_scale_factor * 1e6; // CMD_DOC: data->param[5] = ff->scale_factor * 1e9; // CMD_DOC: data->param[6] = ctrl->torque * 1000; data->param[7] = ctrl->current * 1000; data->param[8] = ctrl->qIq; data->param[9] = enc_pos; data->param[9] = mc_filter.hall;
- case 6 :
data->param[0] = ff->hard_limit; // CMD_DOC: data->param[1] = ff->activate_pos; // CMD_DOC: data->param[2] = ff->torque_at_limit * 1000; // CMD_DOC: data->param[3] = ff->zone; // CMD_DOC: data->param[4] = ff->pos_scale_factor * 1e6; // CMD_DOC: data->param[5] = ff->scale_factor * 1e9; // CMD_DOC: data->param[6] = ctrl->torque * 1000; data->param[7] = ctrl->current * 1000; data->param[8] = ctrl->qIq; data->param[9] = mc_filter.hall;
- case 7 :
int i; extern INT32_T debug_ary[10]; for(i=0;i<10;i++) data->param[i] = debug_ary[i];
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;