the_quimdc_command_line_interface
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
the_quimdc_command_line_interface [2016/05/17 14:30] – [Motor Parameters] coolstage | the_quimdc_command_line_interface [2022/06/24 11:50] (current) – [Data Publication] cbernier | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== The QuimDC Command Line Interface ====== | ||
+ | The QuimDC Command Line Interface (C.L.I.) aims to behave like the linux bash. | ||
+ | |||
+ | |||
+ | ===== Features ===== | ||
+ | |||
+ | * You can type " | ||
+ | * You can use " | ||
+ | * You can use " | ||
+ | * You can move to the right and to the left using the Right and Left arrow keys | ||
+ | * You can retrieve the last past commands using the Up and Down arrow keys < | ||
+ | * All debug commands begin by " | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Official API ===== | ||
+ | |||
+ | This section describes all the command type available through CLI. | ||
+ | |||
+ | ==== Help Command ==== | ||
+ | |||
+ | Display the list of all available commands except debug commands with their syntax. | ||
+ | < | ||
+ | > help | ||
+ | - motor_reset_position <int> | ||
+ | - help | ||
+ | - srst | ||
+ | - rword <int> | ||
+ | - set_echo <int> | ||
+ | - loop_mesurement [< | ||
+ | - ref_pwm [< | ||
+ | - ref_speed [< | ||
+ | - ref_position [< | ||
+ | - ref_current [< | ||
+ | - encoder_motor [< | ||
+ | - current_motor [< | ||
+ | - speed_motor [< | ||
+ | - pwm_motor [< | ||
+ | - motor_watchdog_value [< | ||
+ | - speed_pid_p [< | ||
+ | - speed_pid_i [< | ||
+ | - speed_pid_d [< | ||
+ | - speed_pid_do [< | ||
+ | - speed_pid_fixed_point_divider [< | ||
+ | - speed_pid_uIAntiWU_Limit [< | ||
+ | - current_pid_p [< | ||
+ | - current_pid_i [< | ||
+ | - current_pid_d [< | ||
+ | - current_pid_do [< | ||
+ | - current_pid_fixed_point_divider [< | ||
+ | - current_pid_uIAntiWU_Limit [< | ||
+ | - position_pid_p [< | ||
+ | - position_pid_i [< | ||
+ | - position_pid_d [< | ||
+ | - position_pid_do [< | ||
+ | - position_pid_fixed_point_divider [< | ||
+ | - position_pid_uIAntiWU_Limit [< | ||
+ | - pwm_duty_max [< | ||
+ | - bemf_compensation [< | ||
+ | - minimal_speed [< | ||
+ | - offset_current_start [< | ||
+ | - loop_function [< | ||
+ | - ticks_per_turn_motor [< | ||
+ | - resistance_motor [< | ||
+ | - kv_motor [< | ||
+ | - nominal_power_voltage [< | ||
+ | - polarity [< | ||
+ | - position_speed_period [< | ||
+ | - print_board_states | ||
+ | - enter_operational_mode | ||
+ | - leave_operational_mode | ||
+ | - publish_freq [< | ||
+ | - emergency_stop [< | ||
+ | - homing [< | ||
+ | - print_gpio_list | ||
+ | - print_gpio [< | ||
+ | - freeWheelGpio [< | ||
+ | - homingGpio [< | ||
+ | - negLimitSwitchGpio [< | ||
+ | - posLimitSwitchGpio [< | ||
+ | - is_homing_done [< | ||
+ | - invertNegLimitSwitchGpio [< | ||
+ | - invertPosLimitSwitchGpio [< | ||
+ | - invertHomingGpio [< | ||
+ | - max_position_error [< | ||
+ | - pwm_offset [< | ||
+ | - acceleration_period [< | ||
+ | - deceleration_limit [< | ||
+ | - acceleration_limit [< | ||
+ | - max_current [< | ||
+ | - max_speed [< | ||
+ | - save_parameters_to_flash | ||
+ | - load_parameters_from_flash | ||
+ | - erase_flash | ||
+ | - spi_xfer_dbg <int> <int> < | ||
+ | - spi_xfer8_dbg <int> < | ||
+ | - spi_xfer16_dbg <int> < | ||
+ | - board_brake [< | ||
+ | - board_getAllExtEncPin < | ||
+ | - board_printSupplyVoltage | ||
+ | - board_sleep < | ||
+ | - board_reset < | ||
+ | - board_printDriverFault | ||
+ | - board_resetDriver | ||
+ | - board_setRightMotorPwm < | ||
+ | - board_motorControl < | ||
+ | - board_activateDrivers < | ||
+ | - board_getCurrent < | ||
+ | - board_seeCurrent | ||
+ | - board_getMotorEnc < | ||
+ | - config_DriverParam | ||
+ | - com_spi <int> <int> <int> | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | ==== Board States ==== | ||
+ | |||
+ | The print_board_states displays useful informations according to the current loop function of each motor. Here is an example with motor 1 in position speed current closed loop and motor 2 in pwm open loop : | ||
+ | |||
+ | < | ||
+ | > | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | D: | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | ==== Save parameters ==== | ||
+ | |||
+ | You can save the parameters using save_parameters_to_flash. | ||
+ | < | ||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | ==== Operational Mode ==== | ||
+ | |||
+ | To enter operational mode use : | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | To leave operational mode use : | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Data Publication ==== | ||
+ | Some information like average speed, PWM duty cycle, voltage, and current can be published periodically to the serial port. To enable this auto-publishing mode for a specific motor, use : | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | To disable auto-publishing mode, use : | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Motor Parameters ==== | ||
+ | === Getter and Setter === | ||
+ | Some functions are used to access specific parameters for each motor. They can take up to 2 parameters : | ||
+ | < | ||
+ | - func_name [< | ||
+ | </ | ||
+ | |||
+ | |||
+ | Let's use ref_speed as an example : | ||
+ | |||
+ | |||
+ | * With **0 parameter**, | ||
+ | < | ||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | |||
+ | * With **1 parameter**, | ||
+ | < | ||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | |||
+ | * With **2 parameters**, | ||
+ | < | ||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | |||
+ | List of commands : | ||
+ | |||
+ | ^Name ^ Type value ^ Range value ^ Comment ^ | ||
+ | | ref_speed | int | [0; | ||
+ | | ref_position | int | [0; | ||
+ | | ref_current | int | [0; | ||
+ | | speed_pid_p | int | [0; | ||
+ | | speed_pid_i | int | [0; | ||
+ | | speed_pid_d | int | [0; | ||
+ | | speed_pid_do | int | [0; | ||
+ | | speed_pid_fixed_point_divider | int | [0; | ||
+ | | speed_pid_uIAntiWU_Limit | int | [0; | ||
+ | | current_pid_p | int | [0; | ||
+ | | current_pid_i | int | [0; | ||
+ | | current_pid_d | int | [0; | ||
+ | | current_pid_do | int | [0; | ||
+ | | current_pid_fixed_point_divider | int | [0; | ||
+ | | current_pid_uIAntiWU_Limit | int | [0; | ||
+ | | position_pid_p | int | [0; | ||
+ | | position_pid_i | int | [0; | ||
+ | | position_pid_d | int | [0; | ||
+ | | position_pid_do | int | [0; | ||
+ | | position_pid_fixed_point_divider | int | [0; | ||
+ | | position_pid_uIAntiWU_Limit | int | [0; | ||
+ | | loop_function | int | 0,1,2,3 | | | ||
+ | | ticks_per_turn_motor | int | [0; | ||
+ | | resistance_motor | float | [0.0;inf] | Ohm (type inf to set the value to INFINITY) | | ||
+ | | kv_motor | float | [0.0;inf] | Rpm/V (type inf to set the value to INFINITY) | | ||
+ | | nominal_power_voltage | float | [0.0;inf] | V (type inf to set the value to INFINITY) | | ||
+ | | polarity | int | -1 or 1 | only -1 and 1 are supported any other value will have unexpected results | | ||
+ | | position_speed_period | int | [0; | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | === Getter and Setter for both motor === | ||
+ | |||
+ | Some functions allow you to get and set one parameter for both motors at the same time. They can take up to 1 parameter : | ||
+ | |||
+ | < | ||
+ | - func_name [<int value>] | ||
+ | </ | ||
+ | |||
+ | |||
+ | Let's use motor_watchdog_value as an example : | ||
+ | |||
+ | |||
+ | * With **0 parameter**, | ||
+ | < | ||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | |||
+ | * With **1 parameter**, | ||
+ | < | ||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | |||
+ | List of commands : | ||
+ | |||
+ | ^Name ^ Type value ^ Range value ^ Comment ^ | ||
+ | | motor_watchdog_value | int | [-1; | ||
+ | |||
+ | |||
+ | |||
+ | === Getter === | ||
+ | Some functions are read only, they take up to 1 parameter : | ||
+ | < | ||
+ | - func_name [< | ||
+ | </ | ||
+ | |||
+ | Let's use encoder_motor as an example : | ||
+ | |||
+ | |||
+ | |||
+ | * With **0 parameter**, | ||
+ | < | ||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | |||
+ | * With **1 parameter**, | ||
+ | < | ||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
+ | |||
+ | List of commands : | ||
+ | |||
+ | * encoder_motor | ||
+ | * current_motor | ||
+ | |||
+ | ^Name ^ Type value ^ Range value ^ Comment ^ | ||
+ | | encoder_motor | int | [0;65535] | 16 bits counter | ||
+ | | current_motor | int | [0;4096] | 12 bits ADC | | ||
+ | |||
+ | |||
+ | |||
+ | ---- | ||
+ | ===== Flash memory layout (deprecated) ===== | ||
+ | |||
+ | See "[[How to write a parameter in the flash]]" | ||
+ | |||
+ | |||
+ | The maximum length of a command is 64 characters. Each flash page is composed of 2048 "32 bits" units. But because of the prefetch buffer, only 512 units are available. One unit can store 4 characters so we can save 2048 characters per page. | ||
+ | |||
+ | Therefore we can save 32 command lines per page. The first page will be reserved for some configuration. The following table describes the flash memory layout for the command history. | ||
+ | |||
+ | ^Group' | ||
+ | |Configurations | ADDR_CHECK_HISTORY_INIT | ||
+ | | ::: | ... | ... | ... | | ||
+ | | ::: | ADDR_NUMBER_HISTORY_SAVED | ||
+ | | ::: | unused | ||
+ | | ::: | ... ||| | ||
+ | |Command 1 | ADDR_FIRST_HISTORY_CMD | ||
+ | | ::: | None | 0x0807F044 | ||
+ | | ::: | ... | ... | ... | | ||
+ | |Command 2 | None | **0x0807F080** | ||
+ | | ::: | None | 0x0807F084 | ||
+ | | ::: | None | 0x0807F084 | ||
+ | | ::: | None | 0x0807F084 | ||
+ | | ::: | None | 0x0807F084 | ||
+ | |Command 3 | None | **0x0807F0C0** | ||
+ | | ::: | ... | ... | ... | | ||
+ | | ... | ... | ... | ... | | ||
+ | |||
+ | |||
+ | For example, here the Command 1 is " | ||
+ | |||
+ | |||
+ | ---- |
the_quimdc_command_line_interface.txt · Last modified: 2022/06/24 11:50 by cbernier