From f3df4592780249a33e06400fc4b5e6568a7ebc5c Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Fri, 16 May 2014 21:56:44 +0200 Subject: [PATCH] OP-1350 remove checks for valid TakeOffLocation. It is already handled in takeoffLocationHandler --- .../ManualControl/pathfollowerhandler.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/flight/modules/ManualControl/pathfollowerhandler.c b/flight/modules/ManualControl/pathfollowerhandler.c index 9c2133662..fa02c5b41 100644 --- a/flight/modules/ManualControl/pathfollowerhandler.c +++ b/flight/modules/ManualControl/pathfollowerhandler.c @@ -73,21 +73,14 @@ void pathFollowerHandler(bool newinit) case FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE: // Simple Return To Base mode - keep altitude the same applying configured delta, fly to takeoff position - if (takeoffLocation.Status == TAKEOFFLOCATION_STATUS_VALID) { - pathDesired.Start.North = takeoffLocation.North; - pathDesired.Start.East = takeoffLocation.East; - pathDesired.End.North = takeoffLocation.North; - pathDesired.End.East = takeoffLocation.East; - } else { - // in case for some bad reason takeofflocation isn't valid, fails back to home location. - pathDesired.Start.North = 0; - pathDesired.Start.East = 0; - pathDesired.End.North = 0; - pathDesired.End.East = 0; - } - + pathDesired.Start.North = takeoffLocation.North; + pathDesired.Start.East = takeoffLocation.East; pathDesired.Start.Down = positionState.Down - settings.ReturnToBaseAltitudeOffset; + + pathDesired.End.North = takeoffLocation.North; + pathDesired.End.East = takeoffLocation.East; pathDesired.End.Down = positionState.Down - settings.ReturnToBaseAltitudeOffset; + pathDesired.StartingVelocity = 1; pathDesired.EndingVelocity = 0; pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT;