Blackbox device type 'file' (SITL) considered working when file handler is available
[inav.git] / src / main / navigation / rth_trackback.h
blobf3337bb4b7997cd036e37fdd1f61f9e3fd31ecab
1 /*
2 * This file is part of INAV.
4 * INAV is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * INAV is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with INAV. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "common/vector.h"
22 #define NAV_RTH_TRACKBACK_POINTS 50 // max number RTH trackback points
23 #define NAV_RTH_TRACKBACK_MIN_DIST_TO_START 50 // start recording when some distance from home (meters)
24 #define NAV_RTH_TRACKBACK_MIN_XY_DIST_TO_SAVE 20 // minimum XY distance between two points to store in the buffer (meters)
25 #define NAV_RTH_TRACKBACK_MIN_Z_DIST_TO_SAVE 10 // minimum Z distance between two points to store in the buffer (meters)
26 #define NAV_RTH_TRACKBACK_MIN_TRIP_DIST_TO_SAVE 10 // minimum trip distance between two points to store in the buffer (meters)
28 typedef struct
30 fpVector3_t pointsList[NAV_RTH_TRACKBACK_POINTS]; // buffer of points stored
31 int16_t lastSavedIndex; // last trackback point index saved
32 int16_t activePointIndex; // trackback points counter
33 int16_t WrapAroundCounter; // stores trackpoint array overwrite index position
34 } rth_trackback_t;
36 extern rth_trackback_t rth_trackback;
38 bool rthTrackBackCanBeActivated(void);
39 bool rthTrackBackSetNewPosition(void);
40 void rthTrackBackUpdate(bool forceSaveTrackPoint);
41 fpVector3_t *getRthTrackBackPosition(void);
42 void resetRthTrackBack(void);