41 static const char start =
'E';
42 static const char stop =
'G';
43 static const char cal_trq =
'H';
44 static const char cal_fsr =
'L';
45 static const char new_trq =
'F';
46 static const char new_fsr =
'R';
47 static const char assist =
'c';
48 static const char resist =
'S';
49 static const char motors_on =
'x';
50 static const char motors_off =
'w';
51 static const char mark =
'N';
52 static const char update_param =
'f';
53 static const char perturb =
'Y';
56 static const char send_real_time_data =
'?';
57 static const char send_batt =
'~';
58 static const char send_cal_done =
'n';
59 static const char send_error_count =
'w';
60 static const char send_trq_cal =
'H';
61 static const char send_step_count =
's';
62 static const char cal_fsr_finished =
'n';
77 {ble_names::start, 0},
79 {ble_names::cal_trq, 0},
80 {ble_names::cal_fsr, 0},
81 {ble_names::assist, 0},
82 {ble_names::resist, 0},
83 {ble_names::motors_on, 0},
84 {ble_names::motors_off, 0},
86 {ble_names::perturb, 0},
87 {ble_names::new_fsr, 2},
88 {ble_names::new_trq, 4},
89 {ble_names::update_param, 4},
92 {ble_names::send_batt, 1},
93 {ble_names::send_real_time_data, 9},
94 {ble_names::send_error_count, 1},
95 {ble_names::send_cal_done, 0},
96 {ble_names::send_trq_cal, 2},
97 {ble_names::send_step_count, 2},
98 {ble_names::cal_fsr_finished, 0},
114 inline static int get_length_for_command(
char command)
118 for(
unsigned int i=0; i <
sizeof(ble::commands)/
sizeof(ble::commands[0]); i++)
120 if(command == ble::commands[i].command)
122 length = ble::commands[i].
length;
139 static const uint8_t k_max_joints = 6;
140 static uint8_t prev_controllers[k_max_joints] = {0, 0, 0, 0, 0, 0};
162 j_data->motor.enabled = 1;
174 tx_msg.
command = UART_command_names::update_status;
180 delayMicroseconds(10);
182 tx_msg.
command = UART_command_names::update_motor_enable_disable;
188 delayMicroseconds(10);
190 tx_msg.
command = UART_command_names::update_cal_fsr;
204 j_data->motor.enabled = 0;
216 tx_msg.
command = UART_command_names::update_status;
222 delayMicroseconds(100);
224 tx_msg.
command = UART_command_names::update_motor_enable_disable;
241 tx_msg.
command = UART_command_names::update_cal_trq_sensor;
251 tx_msg.
command = UART_command_names::update_cal_fsr;
256 tx_msg.
command = UART_command_names::update_refine_fsr;
288 j_data->motor.enabled = 1;
296 tx_msg.
command = UART_command_names::update_motor_enable_disable;
324 j_data->motor.enabled = 0;
332 tx_msg.
command = UART_command_names::update_motor_enable_disable;
354 uint8_t controller_id = (uint8_t)msg->data[1];
355 uint8_t set_num = (uint8_t)msg->data[2];
382 if (cont_data == NULL) {
385 if (cont_data != NULL) {
393 tx_msg.
command = UART_command_names::update_controller_params;
394 tx_msg.
joint_id = (uint8_t) joint_id;
401 UART_msg_t_utils::print_msg(tx_msg);
409 tx_msg.
command = UART_command_names::update_FSR_thesholds;
427 tx_msg.
command = UART_command_names::update_controller_param;
428 tx_msg.
joint_id = (uint8_t) msg->data[0];
439 const uint8_t max_joints = 6;
440 uint8_t used_joints[max_joints];
447 uint8_t rand_idx = (uint8_t)random(0, used_joint_len);
474 if (((is_hip + is_knee + is_ankle) > 1) || (is_hip + is_knee + is_ankle) == 0)
477 logger::println(
"ble_handlers::perturb()->Failed to reconcile joint type!");
482 uint8_t controller_id = 0;
Defines the BleMessage class used to hold command-data pairs exchanged between the GUI.
Declares a class used to store data for the Exo to access.
Declares the functions to pull controller parameters from the SD card and defines the mapping to the ...
Declares the functions needed and defines mapping between the INI keys and the exo components.
Stores the different status messages for the system.
Singleton class that manages the UART data. NOT THREAD SAFE. The class queues recieved messages.
Definition BleMessage.h:16
class to store information related to controllers.
Definition ControllerData.h:301
uint8_t parameter_set
Definition ControllerData.h:326
uint8_t controller
Definition ControllerData.h:320
Class to store all the data related to the exo.
Definition ExoData.h:38
void for_each_joint(F &&func)
performs a function for each joint
Definition ExoData.h:55
uint32_t mark
Definition ExoData.h:124
LegData right_leg
Definition ExoData.h:122
uint8_t get_used_joints(uint8_t *used_joints)
Definition ExoData.cpp:37
uint16_t get_status(void)
Get the status object.
Definition ExoData.cpp:98
LegData left_leg
Definition ExoData.h:121
void set_status(uint16_t status_to_set)
Set the status object.
Definition ExoData.cpp:88
class to store information related to joint.
Definition JointData.h:33
bool calibrate_torque_sensor
Definition JointData.h:51
config_defs::joint_id id
Definition JointData.h:44
bool is_used
Definition JointData.h:50
ControllerData controller
Definition JointData.h:46
JointData knee
Definition LegData.h:43
JointData ankle
Definition LegData.h:44
JointData hip
Definition LegData.h:42
Singleton Class to handle the UART Work.
Definition UARTHandler.h:54
void UART_msg(uint8_t msg_id, uint8_t len, uint8_t joint_id, float *buffer)
Packs and sends a UART message.
Definition UARTHandler.cpp:35
static UARTHandler * get_instance()
Get the instance object.
Definition UARTHandler.cpp:29
Helper function(s) to be used with the command array.
Definition ble_commands.h:107
Variables used by the Handlers to track state.
Definition ble_commands.h:137
Holds the functions that should be called when a command is received. All command handlers should hav...
Definition ble_commands.h:151
Creates a variable for each command value.
Definition ble_commands.h:39
Associates the command and ammount of data that it expects to be sent/received.
Definition ble_commands.h:73
joint_id
Definition ParseIni.h:106
const uint16_t trial_on
Definition StatusDefs.h:31
const uint16_t trial_off
Definition StatusDefs.h:30
Definition UART_msg_t.h:9
float data[UART_MSG_T_MAX_DATA_LEN]
Definition UART_msg_t.h:12
uint8_t len
Definition UART_msg_t.h:13
uint8_t joint_id
Definition UART_msg_t.h:11
uint8_t command
Definition UART_msg_t.h:10
Type to associate a command with an ammount of data.
Definition ble_commands.h:29
char command
Definition ble_commands.h:30
int length
Definition ble_commands.h:31