Skip to content

Commit

Permalink
simple_offboard: reset stored setpoint on auto_arm only if needed to …
Browse files Browse the repository at this point in the history
  • Loading branch information
okalachev committed Apr 10, 2023
1 parent ae05710 commit 6890337
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clover/src/simple_offboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,8 @@ bool serve(enum setpoint_type_t sp_type, float x, float y, float z, float vx, fl
nav_from_sp_flag = false;
}

if (auto_arm || setpoint_type == VELOCITY || setpoint_type == ATTITUDE || setpoint_type == RATES) {
bool to_auto_arm = auto_arm && (state.mode != "OFFBOARD" || !state.armed);
if (to_auto_arm || setpoint_type == VELOCITY || setpoint_type == ATTITUDE || setpoint_type == RATES) {
// invalidate position setpoint
setpoint_position.header.frame_id = "";
setpoint_altitude.header.frame_id = "";
Expand Down

0 comments on commit 6890337

Please sign in to comment.