Rev 577 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 577 | Rev 602 | ||
---|---|---|---|
1 | #ifndef _WAYPOINTS_H |
1 | #ifndef _WAYPOINTS_H |
2 | #define _WAYPOINTS_H |
2 | #define _WAYPOINTS_H |
3 | 3 | ||
4 | #include "ubx.h" |
4 | #include "ubx.h" |
5 | 5 | ||
6 | #define POINT_TYPE_INVALID 255 |
6 | #define POINT_TYPE_INVALID 255 |
7 | #define POINT_TYPE_WP 0 |
7 | #define POINT_TYPE_WP 0 |
8 | #define POINT_TYPE_POI 1 |
8 | #define POINT_TYPE_POI 1 |
- | 9 | #define POINT_TYPE_FS 2 |
|
- | 10 | ||
- | 11 | // the waypoints list |
|
- | 12 | #define MAX_LIST_LEN 101 |
|
9 | 13 | ||
10 | typedef struct |
14 | typedef struct |
11 | { |
15 | { |
12 | GPS_Pos_t Position; // the gps position of the waypoint, see ubx.h for details |
16 | GPS_Pos_t Position; // the gps position of the waypoint, see ubx.h for details |
13 | s16 Heading; // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List |
17 | s16 Heading; // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List |
14 | u8 ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
18 | u8 ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
15 | 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 |
19 | 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 |
16 | u8 Event_Flag; // future implementation |
20 | u8 Event_Flag; // future implementation |
17 | u8 Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
21 | u8 Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
18 | u8 Type; // typeof Waypoint |
22 | u8 Type; // typeof Waypoint |
19 | u8 WP_EventChannelValue; // Will be transferred to the FC and can be used as Poti value there |
23 | u8 WP_EventChannelValue; // Will be transferred to the FC and can be used as Poti value there |
20 | u8 AltitudeRate; // rate to change the setpoint in steps of 0.1m/s |
24 | u8 AltitudeRate; // rate to change the setpoint in steps of 0.1m/s |
21 | u8 Speed; // rate to change the Position(0 = max) in steps of 0.1m/s |
25 | u8 Speed; // rate to change the Position(0 = max) in steps of 0.1m/s |
22 | u8 CamAngle; // Camera servo angle in degree (255 -> POI-Automatic) |
26 | u8 CamAngle; // Camera servo angle in degree (255 -> POI-Automatic) |
23 | u8 Name[4]; // Name of that point (ASCII) |
27 | u8 Name[4]; // Name of that point (ASCII) |
- | 28 | u8 AutoPhotoDistance; // in [m] |
|
24 | u8 reserve[2]; // reserve |
29 | u8 reserve[1]; // reserve |
25 | } __attribute__((packed)) Point_t; |
30 | } __attribute__((packed)) Point_t; |
26 | 31 | ||
27 | 32 | ||
28 | #define WPL_STORE_TYPE_REL 0 |
33 | #define WPL_STORE_TYPE_REL 0 |
29 | #define WPL_STORE_TYPE_ABS 1 |
34 | #define WPL_STORE_TYPE_ABS 1 |
30 | 35 | ||
31 | typedef struct |
36 | typedef struct |
32 | { |
37 | { |
33 | u8 Index; |
38 | u8 Index; |
34 | u8 res1; |
39 | u8 res1; |
35 | u8 OverwriteFile; // 0 = no, 1 = yes |
40 | u8 OverwriteFile; // 0 = no, 1 = yes |
36 | u8 reserved[7]; |
41 | u8 reserved[7]; |
37 | s8 Name[12]; |
42 | s8 Name[12]; |
38 | } __attribute__((packed)) WPL_Store_t; |
43 | } __attribute__((packed)) WPL_Store_t; |
39 | 44 | ||
40 | extern WPL_Store_t WPL_Store; |
45 | extern WPL_Store_t WPL_Store; |
41 | 46 | ||
42 | // Init List, return TRUE on success |
47 | // Init List, return TRUE on success |
43 | u8 PointList_Init(void); |
48 | u8 PointList_Init(void); |
44 | // Clear List, return TRUE on success |
49 | // Clear List, return TRUE on success |
45 | u8 PointList_Clear(void); |
50 | u8 PointList_Clear(void); |
46 | // Returns number of points in the list |
51 | // Returns number of points in the list |
47 | u8 PointList_GetCount(void); |
52 | u8 PointList_GetCount(void); |
48 | // return pointer to point at position |
53 | // return pointer to point at position |
49 | Point_t* PointList_GetAt(u8 index); |
54 | Point_t* PointList_GetAt(u8 index); |
50 | // set a point in the list at index, returns its index on success, else 0 |
55 | // set a point in the list at index, returns its index on success, else 0 |
51 | u8 PointList_SetAt(Point_t* pPoint); |
56 | u8 PointList_SetAt(Point_t* pPoint); |
52 | // goto the first WP in the list and return pointer to it |
57 | // goto the first WP in the list and return pointer to it |
53 | Point_t* PointList_WPBegin(void); |
58 | Point_t* PointList_WPBegin(void); |
54 | // goto the last WP in the list and return pointer to it |
59 | // goto the last WP in the list and return pointer to it |
55 | Point_t* PointList_WPEnd(void); |
60 | Point_t* PointList_WPEnd(void); |
56 | // goto next WP in the list and return pointer to it |
61 | // goto next WP in the list and return pointer to it |
57 | Point_t* PointList_WPNext(void); |
62 | Point_t* PointList_WPNext(void); |
58 | // enables/disables waypoint function |
63 | // enables/disables waypoint function |
59 | void PointList_WPActive(u8 set); |
64 | void PointList_WPActive(u8 set); |
60 | // returns pointer to actual POI |
65 | // returns pointer to actual POI |
61 | Point_t* PointList_GetPOI(void); |
66 | Point_t* PointList_GetPOI(void); |
62 | // save actual point list to SD card |
67 | // save actual point list to SD card |
63 | #define WPL_ERROR 0 |
68 | #define WPL_ERROR 0 |
64 | #define WPL_OK 1 |
69 | #define WPL_OK 1 |
65 | #define WPL_FILEEXIST 2 |
70 | #define WPL_FILEEXIST 2 |
66 | #define WPL_NO_SDCARD_FOUND 3 |
71 | #define WPL_NO_SDCARD_FOUND 3 |
67 | #define WPL_NO_WAYPOINTS 4 |
72 | #define WPL_NO_WAYPOINTS 4 |
68 | u8 PointList_WriteToFile(WPL_Store_t * pWPL_Store); |
73 | u8 PointList_WriteToFile(WPL_Store_t * pWPL_Store); |
69 | // load actual point list from SD card |
74 | // load actual point list from SD card |
70 | u8 PointList_ReadFromFile(WPL_Store_t * pWPL_Store); |
75 | u8 PointList_ReadFromFile(WPL_Store_t * pWPL_Store); |
71 | // move actual point list to ref pos., the point in the list marked by RefIndex get the RefPos afterwards |
76 | // move actual point list to ref pos., the point in the list marked by RefIndex get the RefPos afterwards |
72 | u8 PointList_Move(u8 RefIndex, GPS_Pos_t* pRefPos, u16 RotationAngle); |
77 | u8 PointList_Move(u8 RefIndex, GPS_Pos_t* pRefPos, u16 RotationAngle); |
73 | // save actual gps positiin and heading to file |
78 | // save actual gps positiin and heading to file |
74 | u8 PointList_SaveSinglePoint(WPL_Store_t * pWPL_Store); |
79 | u8 PointList_SaveSinglePoint(WPL_Store_t * pWPL_Store); |
75 | // load target gps positiin and heading from file |
80 | // load target gps positiin and heading from file |
76 | u8 PointList_LoadSinglePoint(WPL_Store_t * pWPL_Store); |
81 | u8 PointList_LoadSinglePoint(WPL_Store_t * pWPL_Store); |
77 | 82 | ||
78 | extern u32 SD_WaypointTimeout; // Setting on SD-Card |
83 | extern u32 SD_WaypointTimeout; // Setting on SD-Card |
79 | extern void ClearWLP_Name(void); |
84 | extern void ClearWLP_Name(void); |
80 | extern s16 HeadingOld; |
85 | extern s16 HeadingOld; |
- | 86 | extern Point_t PointList[MAX_LIST_LEN]; |
|
- | 87 | extern u8 FsPointCnt; |
|
81 | 88 | ||
82 | #endif // _WAYPOINTS_H |
89 | #endif // _WAYPOINTS_H |
83 | 90 |