Skip to content

Commit

Permalink
Added non zero filer alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
CL16gtgh committed May 18, 2024
1 parent 7ab723e commit 0c6639f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions lib/systems/include/SteeringSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// TODO: evalaute reasonable thresholds for agreement
#define STEERING_DIVERGENCE_ERROR_THRESHOLD (14.0) // Steering sensors can disagree by x degrees before output is considered erroneous
#define STEERING_DIVERGENCE_WARN_THRESHOLD (8.0) // Warning condition will be raised when steering sensors diverge x degrees
#define NUM_SENSORS 2
#define DEFAULT_STEERING_ALPHA (0.0)

// Enums
enum class SteeringSystemStatus_e
Expand Down Expand Up @@ -52,18 +54,12 @@ class SteeringSystem
float filteredAngleSecondary_;
public:
SteeringSystem(SteeringEncoderInterface *primarySensor)
: primarySensor_(primarySensor)
: SteeringSystem(primarySensor, DEFAULT_STEERING_ALPHA)
{}

SteeringSystem(SteeringEncoderInterface *primarySensor, float filterAlpha)
: primarySensor_(primarySensor)
{
for (int i = 0; i < NUM_SENSORS; i++)
{
steeringFilters_[i] = Filter_IIR<float>(filterAlpha);
}

}
: SteeringSystem(primarySensor, filterAlpha, filterAlpha)
{}

SteeringSystem(SteeringEncoderInterface *primarySensor, float filterAlphaPrimary, float filterAlphaSecondary)
: primarySensor_(primarySensor)
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct inverters
// */

SysClock sys_clock;
SteeringSystem steering_system(&steering1);
SteeringSystem steering_system(&steering1, 0.8);
BuzzerController buzzer(BUZZER_ON_INTERVAL);

SafetySystem safety_system(&ams_interface, &wd_interface);
Expand Down

0 comments on commit 0c6639f

Please sign in to comment.