mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 14:28:54 +08:00
Reposition: Do not yaw for small dispsplacements
This commit is contained in:
@@ -121,12 +121,17 @@ Loiter::reposition()
|
||||
|
||||
// set yaw
|
||||
|
||||
// calculate direction the vehicle should point to.
|
||||
pos_sp_triplet->current.yaw = get_bearing_to_next_waypoint(
|
||||
_navigator->get_global_position()->lat,
|
||||
_navigator->get_global_position()->lon,
|
||||
pos_sp_triplet->current.lat,
|
||||
pos_sp_triplet->current.lon);
|
||||
float travel_dist = get_distance_to_next_waypoint(_navigator->get_global_position()->lat, _navigator->get_global_position()->lon,
|
||||
pos_sp_triplet->current.lat, pos_sp_triplet->current.lon);
|
||||
|
||||
if (travel_dist > 1.0f) {
|
||||
// calculate direction the vehicle should point to.
|
||||
pos_sp_triplet->current.yaw = get_bearing_to_next_waypoint(
|
||||
_navigator->get_global_position()->lat,
|
||||
_navigator->get_global_position()->lon,
|
||||
pos_sp_triplet->current.lat,
|
||||
pos_sp_triplet->current.lon);
|
||||
}
|
||||
|
||||
_navigator->set_can_loiter_at_sp(pos_sp_triplet->current.type == position_setpoint_s::SETPOINT_TYPE_LOITER);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user