Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop high level commander instead of disable #1298

Merged
merged 1 commit into from
Jun 15, 2023
Merged
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
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