Skip to content

Commit

Permalink
Navigator: Loiter: always establish new Loiter with center at current…
Browse files Browse the repository at this point in the history
… pos

When switching into Hold mode establish a Loiter around current position,
even if we were before already loitering (eg in Mission mode).

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
  • Loading branch information
sfuhrer authored and bkueng committed Jul 4, 2023
1 parent 288e3ae commit f275085
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/modules/navigator/loiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Loiter::on_activation()
reposition();

} else {
// this is executed when the flight mode is switched to Hold manually, not through a reposition
set_loiter_position();
}

Expand Down Expand Up @@ -92,16 +93,11 @@ Loiter::set_loiter_position()
_mission_item.nav_cmd = NAV_CMD_IDLE;

} else {
if (pos_sp_triplet->current.valid && pos_sp_triplet->current.type == position_setpoint_s::SETPOINT_TYPE_LOITER) {
setLoiterItemFromCurrentPositionSetpoint(&_mission_item);
if (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
setLoiterItemFromCurrentPositionWithBreaking(&_mission_item);

} else {
if (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
setLoiterItemFromCurrentPositionWithBreaking(&_mission_item);

} else {
setLoiterItemFromCurrentPosition(&_mission_item);
}
setLoiterItemFromCurrentPosition(&_mission_item);
}

}
Expand Down

0 comments on commit f275085

Please sign in to comment.