Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MIDAS/src/finite-state-machines/fsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ FSMState FSM::tick_fsm(FSMState& state, StateEstimate state_estimate, CommandFla

case FSMState::STATE_BURNOUT:
// if low acceleration is too brief than go on to the previous state
if ((state_estimate.acceleration >= sustainer_coast_detection_acceleration_threshold) && ((current_time - burnout_time) < sustainer_coast_time)) {
if ((state_estimate.acceleration >= sustainer_coast_detection_acceleration_threshold) && ((current_time - burnout_time) < sustainer_coast_time && ((current_time - burnout_time) > minimum_time_for_burnout_to_first_boost))) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with this logic, this will still trigger the back transition to FIRST_BOOST if the instantaneous acceleration occurs, the only thing this guards is it will prevent the FSM from doing so in the first 0.25s that the FSM is in the BURNOUT state.

What we're looking for instead is that

  1. state_estimate.acceleration exceeds the threshold
  2. The elapsed time is less than the coast time
    AND
    both of the above conditions are met for at least x seconds (in our case, 0.25s). Consider the following flight:

t-0: IDLE
t+0: FIRST_BOOST
t+3: BURNOUT
t+3.75: accel sensor issue causes it to read +16g accel
t+3.76: accel sensor issue clears and accel returns to normal

With the current code:
At 3.76s...

  • state_estimate.acceleration (16g) >= the threshold ✅
  • (current_time - burnout_time) = 0.75s, < sustainer_coast_time
  • (current_time - burnout_time) = 0.75s, > minimum_time_for_burnout_to_first_boost (0.25s) ✅
    So the back transition is triggered even though it shouldn't be.

With the logic outlined above, in the same condition

  • state_estimate.acceleration (16g) >= the threshold ✅
  • (current_time - burnout_time) = 0.76s, < sustainer_coast_time
  • Conditions above have been met for 0.01s, < minimum_time_for_burnout_to_first_boost
    So we don't back transition

state = FSMState::STATE_FIRST_BOOST;
break;
}
Expand Down
6 changes: 5 additions & 1 deletion MIDAS/src/finite-state-machines/thresholds.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,8 @@

// The minimum expected jerk for a main deployment event (m/s^3)
// (Core Setting)
#define booster_main_jerk_threshold 300
#define booster_main_jerk_threshold 300

// Time to wait before deciding to go from BURNOUT to FIRST_BOOST. (ms)

#define minimum_time_for_burnout_to_first_boost 250