TeensyNanoExoCode
Loading...
Searching...
No Matches
PiLogger.h
Go to the documentation of this file.
1#ifndef PILOGGER_H
2#define PILOGGER_H
3
4#include "ExoData.h"
5
6class PiLogger
7{
8 public:
9 PiLogger(ExoData* data) : _data(data) {}
10
12 {
13 _start();
14
15 _print_tab("LTFsr", _data->left_leg.toe_fsr);
16 _print_tab("LTSta", _data->left_leg.toe_stance);
17 _print_tab("LJTor", _data->left_leg.ankle.torque_reading);
18 _print_tab("LJPos", _data->left_leg.ankle.joint_position);
19 _print_tab("LJVel", _data->left_leg.ankle.joint_velocity);
20 _print_tab("LMPos", _data->left_leg.ankle.motor.p);
21 _print_tab("LMVel", _data->left_leg.ankle.motor.v);
22 _print_tab("LMCur", _data->left_leg.ankle.motor.i);
23 _print_tab("LMCom", _data->left_leg.ankle.motor.last_command);
24
25 _print_tab("LTFsr", _data->right_leg.toe_fsr);
26 _print_tab("LTSta", _data->right_leg.toe_stance);
27 _print_tab("LJTor", _data->right_leg.ankle.torque_reading);
28 _print_tab("LJPos", _data->right_leg.ankle.joint_position);
29 _print_tab("LJVel", _data->right_leg.ankle.joint_velocity);
30 _print_tab("LMPos", _data->right_leg.ankle.motor.p);
31 _print_tab("LMVel", _data->right_leg.ankle.motor.v);
32 _print_tab("LMCur", _data->right_leg.ankle.motor.i);
33 _print_tab("LMCom", _data->right_leg.ankle.motor.last_command);
34
35 _print_tab("Error", _data->error_code);
36 _print_tab("ErJID", _data->error_joint_id);
37 uint16_t exo_status = _data->get_status();
38 bool active_trial = (exo_status == status_defs::messages::trial_on) ||
41 (exo_status == status_defs::messages::error);
42 _print_tab("ActiveTrial", active_trial);
43
44 _end();
45 }
46
47 private:
48 ExoData* _data;
49
50 String _format(String name, float value)
51 {
52 return name+":"+String(value);
53 }
54
55 void _print_tab(String name, float value)
56 {
57 Serial.print(_format(name, value)+"\t");
58 }
59
60 void _start()
61 {
62 Serial.println("piLoggerStart");
63 }
64
65 void _end()
66 {
67 Serial.println("piLoggerEnd");
68 }
69
70};
71
72#endif
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
LegData right_leg
Definition ExoData.h:122
int error_joint_id
Definition ExoData.h:130
int error_code
Definition ExoData.h:129
uint16_t get_status(void)
Get the status object.
Definition ExoData.cpp:98
LegData left_leg
Definition ExoData.h:121
float joint_velocity
Definition JointData.h:61
float joint_position
Definition JointData.h:58
float torque_reading
Definition JointData.h:47
MotorData motor
Definition JointData.h:45
bool toe_stance
Definition LegData.h:69
JointData ankle
Definition LegData.h:44
float toe_fsr
Definition LegData.h:59
float i
Definition MotorData.h:41
float p
Definition MotorData.h:39
float v
Definition MotorData.h:40
float last_command
Definition MotorData.h:38
Definition PiLogger.h:7
void sendUpdate()
Definition PiLogger.h:11
PiLogger(ExoData *data)
Definition PiLogger.h:9
const uint16_t trial_on
Definition StatusDefs.h:31
const uint16_t fsr_calibration
Definition StatusDefs.h:34
const uint16_t error
Definition StatusDefs.h:39
const uint16_t fsr_refinement
Definition StatusDefs.h:35