TeensyNanoExoCode
Loading...
Searching...
No Matches
error_handlers.h
Go to the documentation of this file.
1#ifndef ERROR_HANDLERS_H
2#define ERROR_HANDLERS_H
3
4#if defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY41)
5
6#include "ExoData.h"
7#include "Exo.h"
8#include "error_types.h"
9#include "uart_commands.h"
10
11// Handles errors
12namespace error_handlers
13{
14
15 void soft(Exo* exo, ExoData* exo_data, int error_code)
16 {
17 // TODO: Recalibrate/Warn user
18
19 return;
20 }
21 void hard(Exo* exo, ExoData* exo_data, int error_code)
22 {
23 exo_data->for_each_joint([](JointData* joint_data, float* args) {if (joint_data->is_used) joint_data->motor.enabled = 0;});
24 return;
25 }
26 void fatal(Exo* exo, ExoData* exo_data, int error_code)
27 {
28 exo_data->for_each_joint([](JointData* joint_data, float* args) {if (joint_data->is_used) joint_data->motor.enabled = 0;});
29 return;
30 }
31}
32
33#endif
34
35#endif // defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY41)
Declares for the different exo class that all the other components will live in.
Declares a class used to store data for the Exo to access.
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
class to store information related to joint.
Definition JointData.h:33
bool is_used
Definition JointData.h:50
MotorData motor
Definition JointData.h:45
bool enabled
Definition MotorData.h:50