Difference between revisions of "Pf calb table py"

From DIDEAS Wiki
Jump to: navigation, search
m
m (delete the old "new" requirements for tables)
Line 1: Line 1:
 
{{pf_top_nav}}
 
{{pf_top_nav}}
=new=
 
*application that can transfer tables between robot and text files
 
*built on a module that can do the same
 
*requires modules that can scan firmware .h files
 
 
 
 
 
==parse robot source code==
 
Parses the robot firmware
 
 
*Build a data structure for all complex data types
 
*Look for special macros that used to map data types, global variable names, and variable ID for query
 
 
<pre>
 
#define RAM_ADDRESS_MACRO(type, variable_name)  (&variable_name),((void*)sizeof(type))
 
#define EEPROM_ADDRESS_MACRO(type, ee_address)  ((void*)ee_address),((void*)sizeof(type))
 
#define RAM_EEPROM_ADDRESS_MACRO(type, variable_name, ee_address)  (&variable_name),((void*)ee_address),((void*)sizeof(type))
 
 
 
 
float robot_param_calb;
 
float sensors;
 
 
const void * SHARED_OBJECT_ADDRESSES[] = {
 
  RAM_EEPROM_ADDRESS_MACRO(SC_PARAM_T, robot_param_calb, EEPROM_SC_PARAM_ADDR),                         
 
  RAM_ADDRESS_MACRO(SENSORS_PARAM_T, sensors),
 
  EEPROM_ADDRESS_MACRO(MC_PARAM_T, EEPROM_MC_PARAM_ADDR),
 
  EEPROM_ADDRESS_MACRO(IMU_PARAM_T, EEPROM_IMU_PARAM_ADDR),
 
} ;
 
 
</pre>
 
 
Note: a table may only exist in RAM or EEPROM, or exist in both.
 
 
==Create a table image==
 
Need a python module that given a table type, and a set of keys and values will create a robot 'table' memory image. 
 
*the module should return a list of keys that were specified
 
*the module should return a list of unknown keys that were specified
 
example:
 
  create_table_image('SC_PARAM_T', calb_dict);
 
 
==get table properties from robot==
 
*Query the robot to look up the RAM or EEPROM address of the table by table ID.
 
 
==write a table to RAM or EEPROM==
 
*Given a variable id and table image, write the table to the robot
 
 
==read a table from RAM or EEPROM==
 
*Given a variable id, get the table from the ROBOT
 
*validate it
 
 
==save table to text file==
 
Given a python table object, save it a text file with key value pairs and other information about the environment
 
 
==parse text file, build key:value list==
 
The file will contain comments and key value pairs separated by a wide range of delimiters.  There are a few special key names that python will use to match the text file to elements of the source code:
 
 
===example text file===
 
<pre>
 
# comments about the source of the file
 
# saved on Jan 1 2010  16:22:02
 
# robot version string "SVN 512, build date 123009:150002"
 
 
 
# key, value pairs that will be used to identify the table in the firmware source code
 
DATA_STRUCTURE_NAME = CALB_PARAM_T
 
GLOBAL_VARIABLE_NAME = robot_param_calb
 
FIRMWARE_VERSION_REQUIRED = 1.00, 2.00
 
 
# start of key value pairs that will be written to EEPROM, RAM
 
spring_stiffness_push = 1000  # newton meters per radian
 
spring_stiffness_pull = 500  # newton meters per radian
 
 
DATA_STRUCTURE_NAME = ROBOT_PARAM_T
 
es_stiff = 100
 
</pre>
 
 
===relevent firmware supporting example text file===
 
<pre>
 
typedef struct {
 
  float spring_stiffness_push;
 
  float spring_stiffness_push;
 
  int16 joint_ankle_resolution;
 
} CALB_PARAM_T;
 
 
CALB_PARAM_T robot_param_calb;
 
 
</pre>
 
 
 
 
 
 
 
 
=old=
 
=old=
 
Calibration tables live in a file called calb_table.py.
 
Calibration tables live in a file called calb_table.py.

Revision as of 20:21, 7 December 2010

PF Users Navigation:

Edit

old

Calibration tables live in a file called calb_table.py.

The table is formatted as a python dictionary of dictionarys. The first dictionary uses a key equal to the robot code name. Eg "S01", "WB2", etc.

The 2nd dictionary level is has two keys 'name' and 'value_list'. Value list is a list of numbers that represent the calibration coefficients. See the following example:

example calibration table entry

calb_table_x201['S01'] = {'name' : 'DS_S01_2009_05_01',
           'value_list' : [

                     9999.0, 9.9, -9.9,   # motor current offset sin params : offset, amplitude , phase
                     9999.0, 9.9, 9.9,
                     
                     -421.59, -14.17,     # pyramid
                     
                     13000.0, -544, -2293,  # hall sensor max plantar,zero, 8deg dors 

                     -0.04, 0.03,  # hall segment boundary (seg a to b, seg b to c)

                     -7912.4000, -2384.5000, -282.9800,  -2.8549,  # hall fit poly seg a
                     -26904.0000, -287.6500, -93.0930,   0.0227,   # seg b
                     -1324.7000, 818.5000, -189.2800,   0.7572,    # seg c
                     
                     623.0,         # k3  nM per radian
                     462.0, 1407,    # series spring
                     ] } ;


names of coefficients in the value list

v_x201_keys=[
    'phase_a_offset, phase_a_amplitude, phase_a_phase',
    'phase_b_offset, phase_b_amplitude, phase_b_phase',
    'pyramid_m','pyramid_b',
    
    'hall_seg_ab_boundary',     'hall_seg_bc_boundary',

    'hall_max_plantar', 'hall_zero', 'hall_max_dors',

    'hall_poly_fit_seg_a0',  'hall_poly_fit_seg_a1',  'hall_poly_fit_seg_a2',  'hall_poly_fit_seg_a3',
    'hall_poly_fit_seg_b0',  'hall_poly_fit_seg_b1',  'hall_poly_fit_seg_b2',  'hall_poly_fit_seg_b3',
    'hall_poly_fit_seg_c0',  'hall_poly_fit_seg_c1',  'hall_poly_fit_seg_c2',  'hall_poly_fit_seg_c3',

    'k3_const_nmpr',
    'k2_pull_nmpr', 'k2_push_nmpr'
    ];