Subversion Repositories NaviCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
41 ingob 1
#ifndef _WAYPOINTS_H
2
#define _WAYPOINTS_H
3
 
4
#include "ubx.h"
5
 
277 killagreg 6
#define POINT_TYPE_INVALID 255
802 holgerb 7
#define POINT_TYPE_WP           0
8
#define POINT_TYPE_POI          1
9
#define POINT_TYPE_FS           2
10
#define POINT_TYPE_LAND         3
11
#define POINT_TYPE_FLYZONE      4
879 holgerb 12
#define POINT_TYPE_HOME         5
225 killagreg 13
 
602 holgerb 14
// the waypoints list
15
#define MAX_LIST_LEN 101
16
 
41 ingob 17
typedef struct
18
{
19
        GPS_Pos_t Position;             // the gps position of the waypoint, see ubx.h for details
277 killagreg 20
        s16 Heading;                    // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List
41 ingob 21
        u8  ToleranceRadius;    // in meters, if the MK is within that range around the target, then the next target is triggered
88 killagreg 22
        u8  HoldTime;                   // in seconds, if the was once in the tolerance area around a WP, this time defines the delay before the next WP is triggered
844 holgerb 23
        u8  Event_Flag;                 // future implementation and simulation
162 ingob 24
        u8  Index;              // to indentify different waypoints, workaround for bad communications PC <-> NC
225 killagreg 25
        u8  Type;                               // typeof Waypoint
397 holgerb 26
        u8  WP_EventChannelValue;  // Will be transferred to the FC and can be used as Poti value there
491 killagreg 27
        u8      AltitudeRate;           // rate to change the setpoint in steps of 0.1m/s
28
        u8      Speed;                          // rate to change the Position(0 = max) in steps of 0.1m/s
397 holgerb 29
        u8      CamAngle;                       // Camera servo angle in degree (255 -> POI-Automatic)
386 holgerb 30
        u8  Name[4];                // Name of that point (ASCII)
602 holgerb 31
        u8  AutoPhotoDistance;  // in [m]
32
    u8  reserve[1];                 // reserve
280 killagreg 33
} __attribute__((packed)) Point_t;
41 ingob 34
 
495 killagreg 35
 
36
#define WPL_STORE_TYPE_REL 0
37
#define WPL_STORE_TYPE_ABS 1
38
 
39
typedef struct
40
{
41
        u8 Index;
513 killagreg 42
        u8 res1;                  
495 killagreg 43
        u8 OverwriteFile;         // 0 = no, 1 = yes
44
        u8 reserved[7];
45
        s8 Name[12];
46
} __attribute__((packed)) WPL_Store_t;
47
 
496 killagreg 48
extern WPL_Store_t WPL_Store;
49
 
277 killagreg 50
// Init List, return TRUE on success
280 killagreg 51
u8 PointList_Init(void);
277 killagreg 52
// Clear List, return TRUE on success
280 killagreg 53
u8 PointList_Clear(void);
277 killagreg 54
// Returns number of points in the list
280 killagreg 55
u8 PointList_GetCount(void);
56
// return pointer to point at position
57
Point_t* PointList_GetAt(u8 index);
295 killagreg 58
// set a point in the list at index, returns its index on success, else 0
59
u8 PointList_SetAt(Point_t* pPoint);
277 killagreg 60
// goto the first WP in the list and return pointer to it
785 holgerb 61
Point_t* PointList_WPBegin(u32);
277 killagreg 62
// goto the last WP in the list and return pointer to it
280 killagreg 63
Point_t* PointList_WPEnd(void);
277 killagreg 64
// goto next WP in the list and return pointer to it
280 killagreg 65
Point_t* PointList_WPNext(void);
295 killagreg 66
// enables/disables waypoint function
280 killagreg 67
void PointList_WPActive(u8 set);
277 killagreg 68
// returns pointer to actual POI
280 killagreg 69
Point_t* PointList_GetPOI(void);
490 killagreg 70
// save actual point list to SD card
497 killagreg 71
#define WPL_ERROR                       0
72
#define WPL_OK                          1
73
#define WPL_FILEEXIST           2
74
#define WPL_NO_SDCARD_FOUND     3
75
#define WPL_NO_WAYPOINTS        4
513 killagreg 76
u8 PointList_WriteToFile(WPL_Store_t * pWPL_Store);
490 killagreg 77
// load actual point list from SD card
495 killagreg 78
u8 PointList_ReadFromFile(WPL_Store_t * pWPL_Store);
491 killagreg 79
// move actual point list to ref pos., the point in the list marked by RefIndex get the RefPos afterwards
503 holgerb 80
u8 PointList_Move(u8 RefIndex, GPS_Pos_t* pRefPos, u16 RotationAngle);
513 killagreg 81
// save actual gps positiin and heading to file
82
u8 PointList_SaveSinglePoint(WPL_Store_t * pWPL_Store);
83
// load target gps positiin and heading from file
84
u8 PointList_LoadSinglePoint(WPL_Store_t * pWPL_Store);
85
 
802 holgerb 86
s32 CheckPositionInFlyzone(s32 Longitude, s32 Latitude, u8 UpdateTimer);
87
 
577 holgerb 88
extern u32 SD_WaypointTimeout; // Setting on SD-Card
504 holgerb 89
extern void ClearWLP_Name(void);
517 holgerb 90
extern s16 HeadingOld;
602 holgerb 91
extern Point_t PointList[MAX_LIST_LEN];
92
extern u8 FsPointCnt;
41 ingob 93
 
785 holgerb 94
extern u8  PointCount;
95
extern u8  POICount;
96
extern u8  WPCount;
802 holgerb 97
extern u8  FlyzonePointCnt;
785 holgerb 98
 
41 ingob 99
#endif // _WAYPOINTS_H