Skip to content

Commit

Permalink
Stop high level commander instead of disable, when
Browse files Browse the repository at this point in the history
receiving low level set points.
  • Loading branch information
krichardsson committed Jun 15, 2023
1 parent 2cf04d7 commit 8c77356
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/modules/src/commander.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ void commanderSetSetpoint(setpoint_t *setpoint, int priority)
xQueueOverwrite(setpointQueue, setpoint);
xQueueOverwrite(priorityQueue, &priority);
if (priority > COMMANDER_PRIORITY_HIGHLEVEL) {
// Disable the high-level planner so it will forget its current state and
// start over if we switch from low-level to high-level in the future.
crtpCommanderHighLevelDisable();
// Stop the high-level planner so it will forget its current state
crtpCommanderHighLevelStop();
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/modules/src/crtp_commander_high_level.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,9 @@ bool crtpCommanderHighLevelGetSetpoint(setpoint_t* setpoint, const state_t *stat
yaw = radians(state->attitude.yaw);
if (plan_is_stopped(&planner)) {
// Return a null setpoint - when the HLcommander is stopped, it wants the
// motors to be off. Only reason they should be spinning is if the
// HLcommander has been preempted by a streaming setpoint command.
// motors to be off.
// Note: this set point will be overridden by low level set points, for instance received from an external source,
// due to the priority. To switch back to the high level commander, use the `commanderRelaxPriority()` functionality.
*setpoint = nullSetpoint;
return true;
}
Expand Down

0 comments on commit 8c77356

Please sign in to comment.