Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions MIDAS/src/finite-state-machines/fsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ FSMState FSM::tick_fsm(FSMState& state, StateEstimate state_estimate, CommandFla

case FSMState::STATE_FIRST_BOOST:
// if acceleration spike was too brief then go back to idle
if ((state_estimate.acceleration < sustainer_idle_to_first_boost_acceleration_threshold) && ((current_time - launch_time) < sustainer_idle_to_first_boost_time_threshold)) {
if ((state_estimate.acceleration < sustainer_idle_to_first_boost_acceleration_threshold) && ((current_time - launch_time) < sustainer_burnout_to_first_boost_time_threshold)) {
state = FSMState::STATE_IDLE;
break;
}
Comment on lines 155 to 160
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is incorrect, this conditional is a guard against instantaneous (non-sustained) accelerations while the vehicle is on pad (or, in the IDLE state). I believe the logic here is correct as-is before, and this change should likely be reverted.

Expand All @@ -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
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
5 changes: 4 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,7 @@

// 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

// Minimum time to wait before deciding to go from BURNOUT to FIRST_BOOST. (ms)
#define sustainer_burnout_to_first_boost_time_threshold 250
Comment on lines +243 to +244
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment could use some work. Nominally, the rocket should never go BURNOUT -> FIRST_BOOST, so it doesn't necessarily make sense to call it "minimum time to wait before x".

A better comment could be "Minimum duration of sustained acceleration before fallback to boost"

Loading