From 7338fe889e805852764b38d428612d0dbaf81dba Mon Sep 17 00:00:00 2001
From: sander <sander@droneslab.com>
Date: Sat, 9 Apr 2016 13:24:20 +0200
Subject: [PATCH] Only set virtual waypoint for VTOL_TAKEOFF. Fixes #4193

---
 src/modules/navigator/mission_block.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/modules/navigator/mission_block.cpp b/src/modules/navigator/mission_block.cpp
index 315ffc4d4f..9440d8442a 100644
--- a/src/modules/navigator/mission_block.cpp
+++ b/src/modules/navigator/mission_block.cpp
@@ -336,7 +336,8 @@ MissionBlock::mission_item_to_position_setpoint(const struct mission_item_s *ite
 {
 	/* set the correct setpoint for vtol transition */
 
-	if(item->nav_cmd == NAV_CMD_DO_VTOL_TRANSITION && PX4_ISFINITE(item->yaw)) {
+	if(item->nav_cmd == NAV_CMD_DO_VTOL_TRANSITION && PX4_ISFINITE(item->yaw)
+			&& item->params[0] >= vehicle_status_s::VEHICLE_VTOL_STATE_FW - 0.5f) {
 		sp->type = position_setpoint_s::SETPOINT_TYPE_POSITION;
 		waypoint_from_heading_and_distance(_navigator->get_global_position()->lat,
 										   _navigator->get_global_position()->lon,
-- 
GitLab