Set virtual waypoint for VTOL_TAKEOFF item

This commit is contained in:
sander
2016-04-02 21:29:27 +01:00
committed by Lorenz Meier
parent 4fc24dce60
commit cbe7bd2198
2 changed files with 15 additions and 6 deletions
+10 -1
View File
@@ -335,10 +335,19 @@ void
MissionBlock::mission_item_to_position_setpoint(const struct mission_item_s *item, struct position_setpoint_s *sp)
{
/* set the correct setpoint for vtol transition */
if(item->nav_cmd == NAV_CMD_DO_VTOL_TRANSITION) {
if(item->nav_cmd == NAV_CMD_DO_VTOL_TRANSITION && PX4_ISFINITE(item->yaw)) {
sp->type = position_setpoint_s::SETPOINT_TYPE_POSITION;
waypoint_from_heading_and_distance(_navigator->get_global_position()->lat,
_navigator->get_global_position()->lon,
item->yaw,
1000000.0f,
&sp->lat,
&sp->lon);
sp->alt = _navigator->get_global_position()->alt;
}
/* don't change the setpoint for non-position items */
if (!item_contains_position(item)) {
return;