Difference between revisions of "PFCMD PY"
From DIDEAS Wiki
m (→do_command.py) |
m (→robo_config.py) |
||
Line 135: | Line 135: | ||
read specific tables from the robot.</pre> | read specific tables from the robot.</pre> | ||
===examples=== | ===examples=== | ||
+ | |||
+ | *list tables on robo with SWIFI at IP ...192 | ||
+ | robo_config.py -i 192.168.192.192 -l | ||
+ | *list IMU tables : | ||
+ | robo_config.py -p 10 -Z IMU -l | ||
+ | |||
+ | *read the boot_status table | ||
+ | robo_config.py -p 10 -s -R boot_status_obj | ||
+ | |||
+ | *read all tables, and save to file | ||
+ | robo_config.py -p 10 -l -s --read_all -O output_file_kvf.txt | ||
+ | |||
+ | *write all the sections in the KVF file: | ||
+ | robo_config.py -p 10 -T calb_params_kvf.txt --write_all | ||
+ | |||
+ | *write a specific section from the KVF file, and read it back: | ||
+ | robo_config.py -p 10 -l -T calb_params_kvf_.txt -W EE_state_calb_param -s -R EE_state_calb_param | ||
+ | |||
+ | *write and verify a section : (UNDER DEVELOPMENT) | ||
+ | robo_config.py -p 10 -l -T calb_params_kvf_.txt -V EE_state_calb_param | ||
+ | |||
+ | |||
+ | ===Coming options:=== | ||
+ | * The -s option will only be required to display a table only if the -O option is present. | ||
+ | * The -Q option will be used to suppress automatic table display. | ||
+ | * The -V option will write and verify a section | ||
+ | * All table names can be expressed as a number from the list. | ||
+ | * The -M option will perform at read, modify, write, verify cycle. This will allow certain the modification of only some values of a table. | ||
+ | |||
+ | ===Issues=== | ||
+ | * Tables read back aren't tested to be valid WRT to its CRC or magic number. | ||
+ | * Typos can cause the program to fail in unexpected / or unobvious ways. | ||
+ | * Using a non-existant section name crashs the problem | ||
+ | * In a KVF file, using an unknown field name outputs a message that will never be seen. | ||
==update_firmware.py== | ==update_firmware.py== |
Revision as of 17:01, 16 December 2010
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
do_command.py
Usage: do_command.py [options] Options: -h, --help show this help message and exit -i IP_ADDRESS, --ip_address=IP_ADDRESS make a TCP connection to the specified IP (instead of using serial) -P PORT, --port=PORT port number for TCP connections. -c COM_PORT, -p COM_PORT, --com_port=COM_PORT COM PORT number for serial port connection -b BAUDRATE, --baud_rate=BAUDRATE baurdrate when using serial port (default is 115200) -g GET_TYPE get IO channels : options are [ai, di, ao, do] --suffix=SPECIAL_COMMAND_SUFFIX suffix for special commands (thus variations on the special commands can be used.) -D REPEAT_DELAY, --delay=REPEAT_DELAY special command repeat delay in milliseconds -v GET_VERSION, --version=GET_VERSION execute the version command on each of the specified platforms. Eg -v smi does all platforms. -n REPEAT_COUNT, --repeat_count=REPEAT_COUNT number of times to repeat the supplied special command(s) -T, --set_time use the PC time to set the robot clock -t TIMEOUT, --timeout=TIMEOUT serial or TCP communcations timeout (sec) -X, --hex_mode display the special command results in hex -F, --float_mode interpret the data from the special command as floating point numbers -f LOG_FILE_NAME, --file_name=LOG_FILE_NAME log the results to a file. -S STRUCT_STRING, --struct_string=STRUCT_STRING use struct.unpack(STRUT_STRING, data) to process the result of the special command. Eg -S =10L -R READ_ADDRESS, --read_address=READ_ADDRESS read memory from address (int or hex) -W WRITE_ADDRESS, --write_address=WRITE_ADDRESS write data to address (int or hex) -d DATA_FILENAME, --data_filename=DATA_FILENAME text file source for data that is written. file should contain numbers (UINT8_T) separated with a char from [,;:= ]. these numbers will be turned into a bytestream for use with memory write. -L READ_LENGTH, --read_length=READ_LENGTH length of memory buffer to read -M MEMORY_TYPE, --memory_type=MEMORY_TYPE numeric code to specify the memory type and platform for read and write. Use -H for a list. -s, --special -s N [arg1, ... ] issue special command N with arguments. Args may be negative, and multiple commands may be issued by repeating the -s -V, --write_data list of SPACE separated values available for memory write command. Eg -V 1 2 3 -H, --memory_type_help list the ID numbers for various robot memory types.
HOSTCMD_SC_RAM_MEM_TYPE 1 HOSTCMD_SC_FLASH_MEM_TYPE 2 HOSTCMD_SC_MFG_EEPROM_MEM_TYPE 3 HOSTCMD_SC_USR_EEPROM_MEM_TYPE 4 HOSTCMD_MC_RAM_MEM_TYPE 5 HOSTCMD_MC_FLASH_MEM_TYPE 6 HOSTCMD_IMU_RAM_MEM_TYPE 11 HOSTCMD_IMU_FLASH_MEM_TYPE 12 HOSTCMD_IMU_MFG_EEPROM_MEM_TYPE 13 HOSTCMD_IMU_USR_EEPROM_MEM_TYPE 14
examples
- Using two special commands, each 10 times to read the SC and MC state:
do_command.py -p <COM PORT> -n 10 -s 104 -s 1420
- Read IMU data and display as a float:
do_command.py -p <COM PORT> -F -s 2025
- Read IMU and run through a strut string to produce 4 ints, 4 longs, and 4 floats (length = 40)
do_command.py -p <COM PORT> -S =4h4L4F -s 2030
- Read 512 bytes of IMU FLASH memory at address 4096:
do_command.py -p <COM PORT> -L 0x200 -R 0x1000 -M 12
- Write 3 bytes ('A','B','C') to SC USR EEPROM at address 0xff0, then read it back
do_command.py -p <COM PORT> -W 0xff0 -V 65 66 67 -M 4 -R 0xff0
- Write a list of numbers from a file to SC USR_EEPROM
do_command.py -p <COM PORT> -W 0xff0 -d eeprom_data.txt -M 4 -R 0xff0
robo_config.py
robo_config is used to read / write / modify tables on the robot.
Usage: robo_config.py [options] Options: -h, --help show this help message and exit -i IP_ADDRESS, --ip_address=IP_ADDRESS Connect to robo via TCP to specified address or DNS name -p COM_PORT, -c COM_PORT, --com_port=COM_PORT communcation port for serial communcation -P TCP_PORT, --tcp_port=TCP_PORT TCP port to use when using an IP address connection -b BAUD_RATE, --baud_rate=BAUD_RATE baudrate for serial communcation. default is 115.2kbaud --debug=DEBUG_LEVEL set debug level, not necessarly consistently implmented or used -Q, --quiet not necessarly used. --dump_table read header string table from robot, decode it and save it to text file dump_table.txt -l, --list List available shared variables and their addresses from robot -Z TARGET_DEVICE, --target_device=TARGET_DEVICE Which processor is the target of the application. OPTIONS = SC, MC, IMU (or the first letter of) -T TABLE_FILE_LIST, --table_file=TABLE_FILE_LIST specify the table file used with the -W and -M options -M MODIFY_TABLE_LIST, --modify_table=MODIFY_TABLE_LIST specify which tables from calibration file may be modified. -W WRITE_TABLE_LIST, --write_table=WRITE_TABLE_LIST specify which tables from calibration file may be written. --WA, --write_all (under development) if specified, then all sections in the KVF are written -s, --stdout when reading tables to a file, output will be to screen. -O OUTPUT_FILE_LIST, --output_file=OUTPUT_FILE_LIST when reading table, they can be written to the file specified here. -A, --read_all read all tables in the robot -R READ_TABLE_LIST, --read_table=READ_TABLE_LIST read specific tables from the robot.
examples
- list tables on robo with SWIFI at IP ...192
robo_config.py -i 192.168.192.192 -l
- list IMU tables :
robo_config.py -p 10 -Z IMU -l
- read the boot_status table
robo_config.py -p 10 -s -R boot_status_obj
- read all tables, and save to file
robo_config.py -p 10 -l -s --read_all -O output_file_kvf.txt
- write all the sections in the KVF file:
robo_config.py -p 10 -T calb_params_kvf.txt --write_all
- write a specific section from the KVF file, and read it back:
robo_config.py -p 10 -l -T calb_params_kvf_.txt -W EE_state_calb_param -s -R EE_state_calb_param
- write and verify a section : (UNDER DEVELOPMENT)
robo_config.py -p 10 -l -T calb_params_kvf_.txt -V EE_state_calb_param
Coming options:
- The -s option will only be required to display a table only if the -O option is present.
- The -Q option will be used to suppress automatic table display.
- The -V option will write and verify a section
- All table names can be expressed as a number from the list.
- The -M option will perform at read, modify, write, verify cycle. This will allow certain the modification of only some values of a table.
Issues
- Tables read back aren't tested to be valid WRT to its CRC or magic number.
- Typos can cause the program to fail in unexpected / or unobvious ways.
- Using a non-existant section name crashs the problem
- In a KVF file, using an unknown field name outputs a message that will never be seen.
update_firmware.py
This script analyzes the firmware, then adds source code to the project that facilitate the sharing of data structures between the robot and the PC. It is run by the MPLAB compiler as part of a pre-build script.
At present there are two files created:
- pygen_header_bzip2_str.h : The file declares a const that contains the source code (compressed) for 'interesting' data structures. This 'string' can be read from the robot and is used to decipher the data structures.
- pygen_shared_object_hash_codes.h : For each of the 'interesting' data structures from the source code, a HASH is made of the typedef source code. These hashes are used to link data in an EEPROM table with the source code data structure.
key_value_file.py
Usage: key_value_file.py [options] Options: -h, --help show this help message and exit -p FILENAME_PATH, --path=FILENAME_PATH path to append to file names -f FILENAME, --filename=FILENAME KVF files to read, repeat option to read a list of files. -w WRITE_FILENAME, --write_filename=WRITE_FILENAME name of the KVF file to write. -d, --display