mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-1350 change destination for ReturnToBase to takeoffLocation
This commit is contained in:
parent
9ec21d2ade
commit
8dcee11cb8
@ -37,6 +37,7 @@
|
||||
|
||||
|
||||
#if defined(REVOLUTION)
|
||||
#include <takeofflocation.h>
|
||||
// Private constants
|
||||
|
||||
// Private types
|
||||
@ -66,16 +67,26 @@ void pathFollowerHandler(bool newinit)
|
||||
FlightModeSettingsGet(&settings);
|
||||
PathDesiredData pathDesired;
|
||||
PathDesiredGet(&pathDesired);
|
||||
TakeOffLocationData takeoffLocation;
|
||||
TakeOffLocationGet(&takeoffLocation);
|
||||
switch (flightStatus.FlightMode) {
|
||||
case FLIGHTSTATUS_FLIGHTMODE_RETURNTOBASE:
|
||||
// Simple Return To Base mode - keep altitude the same, fly to home position
|
||||
|
||||
// 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 = 0;
|
||||
pathDesired.Start.East = 0;
|
||||
pathDesired.Start.Down = positionState.Down - settings.ReturnToHomeAltitudeOffset;
|
||||
pathDesired.End.North = 0;
|
||||
pathDesired.End.East = 0;
|
||||
pathDesired.End.Down = positionState.Down - settings.ReturnToHomeAltitudeOffset;
|
||||
pathDesired.StartingVelocity = 1;
|
||||
pathDesired.EndingVelocity = 0;
|
||||
|
@ -40,8 +40,6 @@ typedef enum {
|
||||
|
||||
// Private variables
|
||||
static HandlerStatus_t handlerStatus;
|
||||
static const uint8_t TakeOffStatusInvalid = TAKEOFFLOCATION_STATUS_INVALID;
|
||||
static const uint8_t TakeOffStatusValid = TAKEOFFLOCATION_STATUS_VALID;
|
||||
// Private functions
|
||||
static void SetTakeOffLocation();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user