|
|
|
@ -214,6 +214,7 @@ bool FlightTaskAuto::_evaluateTriplets()
@@ -214,6 +214,7 @@ bool FlightTaskAuto::_evaluateTriplets()
|
|
|
|
|
|
|
|
|
|
if (triplet_update || (_current_state != previous_state)) { |
|
|
|
|
_updateInternalWaypoints(); |
|
|
|
|
_updateAvoidanceWaypoints(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
@ -264,6 +265,33 @@ void FlightTaskAuto::_set_heading_from_mode()
@@ -264,6 +265,33 @@ void FlightTaskAuto::_set_heading_from_mode()
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void FlightTaskAuto::_updateAvoidanceWaypoints() |
|
|
|
|
{ |
|
|
|
|
_desired_waypoint.timestamp = hrt_absolute_time(); |
|
|
|
|
|
|
|
|
|
_target.copyTo(_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_1].position); |
|
|
|
|
Vector3f(NAN, NAN, NAN).copyTo(_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_1].velocity); |
|
|
|
|
Vector3f(NAN, NAN, NAN).copyTo(_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_1].acceleration); |
|
|
|
|
|
|
|
|
|
_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_1].yaw = _sub_triplet_setpoint->get().current.yaw; |
|
|
|
|
_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_1].yaw_speed = |
|
|
|
|
_sub_triplet_setpoint->get().current.yawspeed_valid ? |
|
|
|
|
_sub_triplet_setpoint->get().current.yawspeed : NAN; |
|
|
|
|
_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_1].point_valid = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_next_wp.copyTo(_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_2].position); |
|
|
|
|
Vector3f(NAN, NAN, NAN).copyTo(_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_2].velocity); |
|
|
|
|
Vector3f(NAN, NAN, NAN).copyTo(_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_2].acceleration); |
|
|
|
|
|
|
|
|
|
_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_2].yaw = _sub_triplet_setpoint->get().next.yaw; |
|
|
|
|
_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_2].yaw_speed = |
|
|
|
|
_sub_triplet_setpoint->get().next.yawspeed_valid ? |
|
|
|
|
_sub_triplet_setpoint->get().next.yawspeed : NAN; |
|
|
|
|
_desired_waypoint.waypoints[vehicle_trajectory_waypoint_s::POINT_2].point_valid = true; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool FlightTaskAuto::_isFinite(const position_setpoint_s sp) |
|
|
|
|
{ |
|
|
|
|
return (PX4_ISFINITE(sp.lat) && PX4_ISFINITE(sp.lon) && PX4_ISFINITE(sp.alt)); |
|
|
|
|