Difference between revisions of "PFMENU DOCS"
From DIDEAS Wiki
m |
|||
(34 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{pf_top_nav}} | |
− | |||
− | |||
+ | [[sc_mc_python_examples|Python examples for state controller commands]] | ||
+ | =Ankle code that interprets these commands= | ||
+ | tk_cmdset.c | ||
+ | * Contains switch statements with cases corresponding to the following codes | ||
=state controller= | =state controller= | ||
+ | Note : by default, arguments left blank w/PFCMD, are assumed to be zero. | ||
+ | |||
+ | * 100 write clock (year, month,day, weekday, hour, min sec) | ||
+ | * 101 read clock | ||
+ | |||
*[[cmd_104_full | 104]] read debug data | *[[cmd_104_full | 104]] read debug data | ||
− | + | ==sub option 0== | |
** SM status (17 seems to be good) | ** SM status (17 seems to be good) | ||
** SM mode | ** SM mode | ||
Line 18: | Line 25: | ||
** motor qId | ** motor qId | ||
** motor speed (RPM) | ** motor speed (RPM) | ||
+ | |||
+ | |||
+ | |||
+ | *115 see last section | ||
+ | *116 see last section | ||
+ | *117 see last section | ||
+ | *118 see last section | ||
*120 read SG_torque const and offset | *120 read SG_torque const and offset | ||
*121 write sg_torque_const | *121 write sg_torque_const | ||
− | + | ||
− | *123 | + | *123 - set MC ac enable |
* 124 - calibration sensor offset 'C' | * 124 - calibration sensor offset 'C' | ||
* 125 - read results | * 125 - read results | ||
Line 36: | Line 50: | ||
** ioadc_get_one AANGSC | ** ioadc_get_one AANGSC | ||
− | * 126 read feature bits | + | * 126 read feature bits (from RAM) |
− | + | * 127 set feature bits (from RAM) | |
− | * 127 set feature bits | + | ** see command 211 for all feature bits |
** 0x1 current updates | ** 0x1 current updates | ||
** 0x2 enabled relaxed | ** 0x2 enabled relaxed | ||
Line 65: | Line 79: | ||
** power exponent / 10 (torque squared = 20) | ** power exponent / 10 (torque squared = 20) | ||
** SG torque constant (over 10e3) (up2 = 852, up3=550) | ** SG torque constant (over 10e3) (up2 = 852, up3=550) | ||
+ | ==140 EEPROM== | ||
+ | *140 read <addr> : reads 10 values | ||
+ | *141 write addr, val | ||
+ | *144 *DNM* returns base address and sizes of tables. | ||
+ | *146 load walking parameters from EEPROM into RAM | ||
+ | *147 save current (RAM) walking parameters into EEPROM | ||
+ | *148 load calibration table from EEPROM into RAM | ||
− | ==150 (dataport)== | + | *xx142 read next++ |
+ | *xx143 write next++ <val> | ||
+ | *xx145 set next addr | ||
+ | *xx148 find start of erased region <addr> <len> | ||
+ | *xx149 erase region <addr> <len> : len is rounded up 16 bytes | ||
+ | |||
+ | ==150 (dataport) NOT IMPLEMENTED == | ||
*150 enable MIT comm | *150 enable MIT comm | ||
*151 set dataport readback block | *151 set dataport readback block | ||
Line 116: | Line 143: | ||
* 193 : set script count | * 193 : set script count | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==200 sensor min max== | ||
+ | *200 | ||
+ | *201 | ||
+ | *204 | ||
+ | |||
+ | ==210 eeprom init table== | ||
+ | *see [[PF_EEPROM]] for details | ||
+ | * 210 read INIT table | ||
+ | * 211 write INIT table <bit pattern from below> | ||
+ | |||
+ | <pre> | ||
+ | // not all bits are necessarily implemented in code (aka they may have no effect....) | ||
+ | // bit patterns for the feature bits | ||
+ | #define FEATURE_USE_IMU 0x80 (if enabled, and IMU absent, MC comm will break.) | ||
+ | #define FEATURE_LOAD_CALB_TABLE 0x40 | ||
+ | #define FEATURE_LOAD_WALKING_PARAM 0x20 | ||
+ | |||
+ | #define FEATURE_SET_TORQUE_ZERO 0x10 | ||
+ | #define FEATURE_SET_CURRENT_ZERO 0x08 | ||
+ | #define FEATURE_MIT_COMM 0x04 | ||
+ | #define FEATURE_RELAXED 0x02 | ||
+ | #define FEATURE_MC_CURRENT_UPDATES 0x01 // this SM to send torque commands to the MC | ||
+ | </pre> | ||
+ | |||
+ | *212 read INIT table run level | ||
+ | *213 write INIT table run level (if unable to initialize at a given run-level, the level will be automatically reduced.) | ||
+ | <pre> | ||
+ | Run levels: | ||
+ | #define RUN_LEVEL_UNTESTED 0 | ||
+ | #define RUN_LEVEL_BENCHTEST 10 | ||
+ | #define RUN_LEVEL_TESTJIG 20 | ||
+ | #define RUN_LEVEL_POLETEST 30 // need to have calibration tables | ||
+ | #define RUN_LEVEL_WALK_CODE_DFLT 40 // uses values in statemachine.h | ||
+ | #define RUN_LEVEL_WALK_LOAD_DFLT 50 // tries to load the defaults table. | ||
+ | #define RUN_LEVEL_WALK_STUDY 60 | ||
+ | #define RUN_LEVEL_WALK_DEMO 70 | ||
+ | |||
+ | </pre> | ||
+ | *214 : FUTURE // get FUP baudrate in EEPROM | ||
+ | *215 : FUTURE // set FUP baudrate in EEPROM | ||
+ | |||
+ | ==220 enables == | ||
+ | *222 get walking state enable PVF | ||
+ | *223 set walking state enable PVF | ||
+ | *225 set MC COMM ENABLE | ||
+ | *227 set IMU COMM ENABLE | ||
+ | |||
+ | *228 : // get current baud rate (void) | ||
+ | *229 : // set current baud rate (port, value) | ||
+ | |||
+ | ==230 IMU control== | ||
+ | |||
+ | *230 get walking state enable imu | ||
+ | *231 set walking state enable imu. change dataselect to 2, or if inparam>2 to that value | ||
+ | *232 get default IMU command | ||
+ | *233 set default IMU command | ||
+ | |||
+ | |||
+ | == 250 commands == | ||
+ | |||
+ | *250 : | ||
+ | <pre> | ||
+ | INT16_T ecode_state_fixed; // must be zero for table to be valid | ||
+ | UINT16_T robot_serial_number; | ||
+ | UINT16_T SC_serial_number; | ||
+ | UINT16_T FET_serial_number; | ||
+ | UINT16_T IMU_serial_number; | ||
+ | UINT16_T AAE_serial_number; | ||
+ | UINT16_T BSE_serial_number; | ||
+ | UINT16_T BATRCP_serial_number; | ||
+ | </pre> | ||
+ | *252 : | ||
+ | <pre> | ||
+ | int run_level; | ||
+ | int feature_bits; | ||
+ | int ecode_state_calb; | ||
+ | int ecode_state_fixed; | ||
+ | int ecode_motor_calb; | ||
+ | int ecode_motor_fixed; | ||
+ | int ecode_walking_param; | ||
+ | int diag_ecode; | ||
+ | </pre> | ||
=benchtest commands= | =benchtest commands= | ||
Line 131: | Line 244: | ||
*Command 117 is used to read back the model estimates of motor resistance and model temperatures. Divide by 1000 for SI units. | *Command 117 is used to read back the model estimates of motor resistance and model temperatures. Divide by 1000 for SI units. | ||
− | *Command 118 | + | *Command 118 <stop at integer temp> <restart at integer temp> : Is used to set the thermal limits. When a limit is reached the test commands zero motor current until the low (restart) temperature is reached. |
+ | |||
+ | |||
+ | |||
+ | <pre> | ||
+ | case 115 : // set test cycle paramters | ||
+ | ecode = process_test_cycle_parameters(data->param); // statemachine_test.c | ||
+ | out_param = data->param[0]; | ||
+ | break; | ||
+ | case 116: // set test cycle paramters | ||
+ | ecode = run_test_type1(data->param); | ||
+ | out_param = data->param[0]; | ||
+ | break; | ||
+ | case 118 : // set thermal limits - using 2 its -> aka 60 55 | ||
+ | set_motor_thermal_limits(data->param[0], data->param[1]); // takes 2 floating point temperatures | ||
+ | // let fall through to case 117 | ||
+ | case 117 : // read motor thermal | ||
+ | { | ||
+ | float Rmot, Tw, Tc, Th; | ||
+ | Rmot = get_motor_thermal(&Tw, &Tc, &Th); | ||
+ | data->param[0] = Rmot * 1000; | ||
+ | data->param[1] = Tw * 1000; | ||
+ | data->param[2] = Tc * 1000; | ||
+ | data->param[3] = Th * 1000; | ||
+ | out_param = data->param[0]; | ||
+ | } | ||
+ | break; | ||
+ | </pre> |
Latest revision as of 16:31, 20 March 2012
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
Python examples for state controller commands
Ankle code that interprets these commands
tk_cmdset.c
- Contains switch statements with cases corresponding to the following codes
state controller
Note : by default, arguments left blank w/PFCMD, are assumed to be zero.
- 100 write clock (year, month,day, weekday, hour, min sec)
- 101 read clock
- 104 read debug data
sub option 0
- SM status (17 seems to be good)
- SM mode
- ankle_torque * 100
- motor_position / 20 (rotations * 100?)
- motor velocity rads per sec (*100)
- ankle angle in degress (*100) from motor
- desired motor current (*100)
- motor qIq
- motor qId
- motor speed (RPM)
- 115 see last section
- 116 see last section
- 117 see last section
- 118 see last section
- 120 read SG_torque const and offset
- 121 write sg_torque_const
- 123 - set MC ac enable
- 124 - calibration sensor offset 'C'
- 125 - read results
- sg_torque_cost * 1e6
- ankle_torque * 1000
- GetFilterTorque
- GetFilter2Torque
- adc_sg_offset
- ioadc_get_one TQSGSC
- ioadc_get_one LDSGSC
- ioadc_get_one LSSGSC
- ioadc_get_one AANGSC
- 126 read feature bits (from RAM)
- 127 set feature bits (from RAM)
- see command 211 for all feature bits
- 0x1 current updates
- 0x2 enabled relaxed
- 0x4 enable mit comm
- 128 get motor offset
- 129 reset motor offset
130 (VS and power)
- 130 read VS tune parameters
- 131 write VS tune parameters (131 3000 80 4000 0 4000 250)
- early_stance_imp_k/10 (3000 is default of 300)
- early_stance_imp_b/10 (80 is default of 8)
- late_stance_imp_k/10 (4000 is default of 400)
- late_stance_imp_b/10 (0 is default)
- swing_imp_k/10 (4000 is default of 400)
- swing_imp_b/10 (250 is default of 25)
131 3000 80 4000 0 4000 250
- 132 read power tune parameters
- 133 write power tune parameters (133 250 30 0 200 852)
- impulse_current / 10 (25 amps = 250)
- islip gain / 10 (3.0 amps/deg = 30)
- power delay (in SM cycles)
- power exponent / 10 (torque squared = 20)
- SG torque constant (over 10e3) (up2 = 852, up3=550)
140 EEPROM
- 140 read <addr> : reads 10 values
- 141 write addr, val
- 144 *DNM* returns base address and sizes of tables.
- 146 load walking parameters from EEPROM into RAM
- 147 save current (RAM) walking parameters into EEPROM
- 148 load calibration table from EEPROM into RAM
- xx142 read next++
- xx143 write next++ <val>
- xx145 set next addr
- xx148 find start of erased region <addr> <len>
- xx149 erase region <addr> <len> : len is rounded up 16 bytes
150 (dataport) NOT IMPLEMENTED
- 150 enable MIT comm
- 151 set dataport readback block
- 152 get dataport readback block
- 157 set dataport select : 0 - walking, 1 = testjig, 2 imp_values
160
- 160 : get walking surface (0 = level, 2 = stair descent)
- 161 : set walking surface (20 = LG, 22 = SG)
- 162 : get slope angle * 10 (10 deg = 100)
- 163 : set walking surface / 10
170
- force statemachine state
- 170 77 <STATE>
- requires 2nd parameter to be 77 else ignored.
#define STATE_IDLE 0 #define STATE_RELAXED 1 #define STATE_SWING 2 #define STATE_EARLY_STANCE 3 #define STATE_LATE_STANCE 4 #define STATE_LATE_STANCE_POWER 5 #define STATE_MOTOR_RESISTANCE 6 #define STATE_MOTOR_ERROR 8 #define STATE_INIT 9 #define STATE_STAIR_DESCENT_SWING 10 #define STATE_STAIR_DESCENT_STANCE 11 #define STATE_STAIR_DESCENT_LATE_STANCE 12 #define STATE_VIRTUAL_SPRING 13 #define STATE_BENCHTEST 15
180
- 180 : read stair descent params
- 180 : holdoff ms, rate (10*deg/sec), CP_imp_k*10, CP_imp_b*10, S_imp_k*10, S_imp_b*10, max_angle*10, torque_thresh*10, late_stance_ang * 10
- 181 : write stair descent params
- 181 50 600 4000 100 0 300 170 80 -5
holdoff ms, rate (10*deg/sec), CP_imp_k*10, CP_imp_b*10, S_imp_k*10, S_imp_b*10, max_angle*10, torque_thresh*10, late_stance_ang * 10
190 scripts
- 190 : statemachine_get_script_element(int pos, int *step_count, SURFACE_TYPE_T *surface_type, int *slope_angle);
- 191 : statemachine_set_script_element(int pos, int step_count, SURFACE_TYPE_T surface_type, int slope_angle);
- 192 : read script count
- 193 : set script count
200 sensor min max
- 200
- 201
- 204
210 eeprom init table
- see PF_EEPROM for details
- 210 read INIT table
- 211 write INIT table <bit pattern from below>
// not all bits are necessarily implemented in code (aka they may have no effect....) // bit patterns for the feature bits #define FEATURE_USE_IMU 0x80 (if enabled, and IMU absent, MC comm will break.) #define FEATURE_LOAD_CALB_TABLE 0x40 #define FEATURE_LOAD_WALKING_PARAM 0x20 #define FEATURE_SET_TORQUE_ZERO 0x10 #define FEATURE_SET_CURRENT_ZERO 0x08 #define FEATURE_MIT_COMM 0x04 #define FEATURE_RELAXED 0x02 #define FEATURE_MC_CURRENT_UPDATES 0x01 // this SM to send torque commands to the MC
- 212 read INIT table run level
- 213 write INIT table run level (if unable to initialize at a given run-level, the level will be automatically reduced.)
Run levels: #define RUN_LEVEL_UNTESTED 0 #define RUN_LEVEL_BENCHTEST 10 #define RUN_LEVEL_TESTJIG 20 #define RUN_LEVEL_POLETEST 30 // need to have calibration tables #define RUN_LEVEL_WALK_CODE_DFLT 40 // uses values in statemachine.h #define RUN_LEVEL_WALK_LOAD_DFLT 50 // tries to load the defaults table. #define RUN_LEVEL_WALK_STUDY 60 #define RUN_LEVEL_WALK_DEMO 70
- 214 : FUTURE // get FUP baudrate in EEPROM
- 215 : FUTURE // set FUP baudrate in EEPROM
220 enables
- 222 get walking state enable PVF
- 223 set walking state enable PVF
- 225 set MC COMM ENABLE
- 227 set IMU COMM ENABLE
- 228 : // get current baud rate (void)
- 229 : // set current baud rate (port, value)
230 IMU control
- 230 get walking state enable imu
- 231 set walking state enable imu. change dataselect to 2, or if inparam>2 to that value
- 232 get default IMU command
- 233 set default IMU command
250 commands
- 250 :
INT16_T ecode_state_fixed; // must be zero for table to be valid UINT16_T robot_serial_number; UINT16_T SC_serial_number; UINT16_T FET_serial_number; UINT16_T IMU_serial_number; UINT16_T AAE_serial_number; UINT16_T BSE_serial_number; UINT16_T BATRCP_serial_number;
- 252 :
int run_level; int feature_bits; int ecode_state_calb; int ecode_state_fixed; int ecode_motor_calb; int ecode_motor_fixed; int ecode_walking_param; int diag_ecode;
benchtest commands
Command current sequence
A series of currents can be commanded for a fixed number of cycles. A table stores the motor currents, and time interval for the current to be commanded. The table can be filled in any order, and positions can be over written without problems. The end of the test loop is marked with a duration of 0.
- 115 0 <POSITION> <DURATION> <TORQUE VALUE>
- Position : Store at the specified row in the table. Table positions starts at 0. However the position value of -1 is used to write into position zero and ALSO re-initialize values.
- Duration is in 2mS units. A duration of zero indicates the end of the test loop sequence
- Torque value : 1 amp = 1092
Motor thermal model
- Command 117 is used to read back the model estimates of motor resistance and model temperatures. Divide by 1000 for SI units.
- Command 118 <stop at integer temp> <restart at integer temp> : Is used to set the thermal limits. When a limit is reached the test commands zero motor current until the low (restart) temperature is reached.
case 115 : // set test cycle paramters ecode = process_test_cycle_parameters(data->param); // statemachine_test.c out_param = data->param[0]; break; case 116: // set test cycle paramters ecode = run_test_type1(data->param); out_param = data->param[0]; break; case 118 : // set thermal limits - using 2 its -> aka 60 55 set_motor_thermal_limits(data->param[0], data->param[1]); // takes 2 floating point temperatures // let fall through to case 117 case 117 : // read motor thermal { float Rmot, Tw, Tc, Th; Rmot = get_motor_thermal(&Tw, &Tc, &Th); data->param[0] = Rmot * 1000; data->param[1] = Tw * 1000; data->param[2] = Tc * 1000; data->param[3] = Th * 1000; out_param = data->param[0]; } break;