Skip to content

Commit

Permalink
PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jbinz authored and l-jost committed Jul 22, 2023
1 parent 87a2400 commit 0aa981b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion flight_computer/src/tasks/task_preprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ SI_data_t Preprocessing::GetSIData() const noexcept { return m_si_data; }

/* Check if there is a Calibration Error */
if (m_fsm_enum == READY) {
/* This corresponds to an angle of circa 15° */
if (m_state_est_input.acceleration_z > 0.5F || m_state_est_input.acceleration_z < -0.5F) {
faulty_calibration_counter++;
} else {
faulty_calibration_counter = 0;
}
if (faulty_calibration_counter > MAX_FAULTY_CALIB) {
if (faulty_calibration_counter > kMaxFaultyCalib) {
add_error(CATS_ERR_CALIB);
} else {
clear_error(CATS_ERR_CALIB);
Expand Down
5 changes: 3 additions & 2 deletions flight_computer/src/tasks/task_preprocessing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ class Preprocessing final : public Task<Preprocessing, 512> {
state_estimation_input_t m_state_est_input = {.acceleration_z = 0.0F, .height_AGL = 0.0F};
float32_t m_height_0 = 0.0F;

/* Variable to keep track for the calibration health */
/* Variable to keep track of the calibration health */
int32_t faulty_calibration_counter = 0;
static constexpr int32_t MAX_FAULTY_CALIB = 100;
/* with a sampling frequency of 100 Hz this yields 1s */
static constexpr int32_t kMaxFaultyCalib = 100;

/* Gyro Calib tag */
bool m_gyro_calibrated = false;
Expand Down

0 comments on commit 0aa981b

Please sign in to comment.