TeensyNanoExoCode
Loading...
Searching...
No Matches
InclinationDetector.h
Go to the documentation of this file.
1#ifndef INCLINATION_DETECTOR_H
2#define INCLINATION_DETECTOR_H
3#include <Arduino.h>
4#include <queue>
5#include <utility>
6
7enum class Inclination : uint8_t
8{
9 Decline = 0,
10 Level = 1,
11 Incline = 2,
12};
13
19{
20 public:
22
28 void set_decline_angle(float threshold);
34 void set_incline_angle(float threshold);
35
43 Inclination check(const bool is_stance, const bool fsr_calibrating, const float norm_angle);
44
45 private:
46 /* Exposed through getters/setters */
47 std::pair<float, float> _decline_stance_phase_percent;
48 float _incline_angle_theshold;
49 float _decline_angle_threshold;
50
51 /* Internal */
52 bool _previous_fsr_calibrating;
53 int _calibration_step_count;
54 const int _steps_until_calibrated = 4;
55 bool _previous_should_calibrate;
56 bool _returned_this_stance;
57 Inclination _prev_estimate;
58 bool _prev_stance;
59 float _prev_stance_time;
60 float _current_stance_start;
61
62 /* Feature Data for Threshold Determination */
63 float _incline_features_sum;
64 float _decline_features_sum;
65 float _calibrated_stance_entry_angle;
66 float _calibrated_stance_exit_angle;
67
68 enum class Edge: int
69 {
70 None = 0,
71 Rising = 1,
72 Falling = 2,
73 };
74
81 Edge _check_for_edge(const bool is_stance);
89 float _update_stance_phase(const Edge edge, const bool is_stance);
94 void _calculate_gait_features();
101 void _update_gait_features(const Edge edge, const float norm_angle);
110 bool _incline_check(const float norm_angle);
119 bool _decline_check(const float norm_angle);
128 bool _should_calibrate(const bool fsr_calibrating, const InclinationDetector::Edge edge);
129};
130
131#endif
Inclination
Definition InclinationDetector.h:8
Given stance and ankle angle data, return the current estimate of inclination.
Definition InclinationDetector.h:19
InclinationDetector()
Definition InclinationDetector.cpp:15
void set_decline_angle(float threshold)
Set the decline angle object.
Definition InclinationDetector.cpp:38
void set_incline_angle(float threshold)
Set the incline angle threshold.
Definition InclinationDetector.cpp:33
Inclination check(const bool is_stance, const bool fsr_calibrating, const float norm_angle)
check the current data
Definition InclinationDetector.cpp:155