mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 01:33:34 +08:00
Loiter: Face travel direction when performing reposition
This commit is contained in:
@@ -45,6 +45,8 @@
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <geo/geo.h>
|
||||
|
||||
#include <systemlib/mavlink_log.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
@@ -117,6 +119,15 @@ Loiter::reposition()
|
||||
memcpy(&pos_sp_triplet->current, &rep->current, sizeof(rep->current));
|
||||
pos_sp_triplet->next.valid = false;
|
||||
|
||||
// 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);
|
||||
|
||||
_navigator->set_can_loiter_at_sp(pos_sp_triplet->current.type == position_setpoint_s::SETPOINT_TYPE_LOITER);
|
||||
|
||||
_navigator->set_position_setpoint_triplet_updated();
|
||||
|
||||
Reference in New Issue
Block a user