Rev 291 | Rev 348 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 291 | Rev 295 | ||
---|---|---|---|
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_BOTH 2 // only command 's' |
- | |
10 | - | ||
11 | extern u8 WPIndex; // list index of GPS point representig the current WP, can be maximal WPCount |
- | |
12 | extern u8 POIIndex; // list index of GPS Point representing the current POI, can be maximal WPCount |
- | |
13 | extern u8 WPCount; // number of waypoints |
- | |
14 | extern u8 PointCount; // number of wp in the list can be maximal equal to MAX_LIST_LEN |
- | |
15 | extern u8 POICount; |
- | |
16 | 9 | ||
17 | typedef struct |
10 | typedef struct |
18 | { |
11 | { |
19 | GPS_Pos_t Position; // the gps position of the waypoint, see ubx.h for details |
12 | GPS_Pos_t Position; // the gps position of the waypoint, see ubx.h for details |
20 | s16 Heading; // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List |
13 | s16 Heading; // orientation, 0 no action, 1...360 fix heading, neg. = Index to POI in WP List |
21 | u8 ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
14 | u8 ToleranceRadius; // in meters, if the MK is within that range around the target, then the next target is triggered |
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 |
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 |
23 | u8 Event_Flag; // future implementation |
16 | u8 Event_Flag; // future implementation |
24 | u8 Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
17 | u8 Index; // to indentify different waypoints, workaround for bad communications PC <-> NC |
25 | u8 Type; // typeof Waypoint |
18 | u8 Type; // typeof Waypoint |
26 | u8 WP_EventChannelValue; // |
19 | u8 WP_EventChannelValue; // |
27 | u8 AltitudeRate; // rate to change the setpoint |
20 | u8 AltitudeRate; // rate to change the setpoint |
28 | u8 reserve[8]; // reserve |
21 | u8 reserve[8]; // reserve |
29 | } __attribute__((packed)) Point_t; |
22 | } __attribute__((packed)) Point_t; |
30 | - | ||
31 | extern Point_t* GPS_pPoi; // pointer to the actual point of interrest |
- | |
32 | extern u8 POICount; |
- | |
33 | - | ||
34 | 23 | ||
35 | // Init List, return TRUE on success |
24 | // Init List, return TRUE on success |
36 | u8 PointList_Init(void); |
25 | u8 PointList_Init(void); |
37 | // Clear List, return TRUE on success |
26 | // Clear List, return TRUE on success |
38 | u8 PointList_Clear(void); |
27 | u8 PointList_Clear(void); |
39 | // Returns number of points in the list |
28 | // Returns number of points in the list |
40 | u8 PointList_GetCount(void); |
29 | u8 PointList_GetCount(void); |
41 | // return pointer to point at position |
30 | // return pointer to point at position |
42 | Point_t* PointList_GetAt(u8 index); |
31 | Point_t* PointList_GetAt(u8 index); |
43 | // appends a point to the list, returns TRUE on success |
32 | // set a point in the list at index, returns its index on success, else 0 |
44 | u8 PointList_Append(Point_t* pwp); |
33 | u8 PointList_SetAt(Point_t* pPoint); |
45 | // goto the first WP in the list and return pointer to it |
34 | // goto the first WP in the list and return pointer to it |
46 | Point_t* PointList_WPBegin(void); |
35 | Point_t* PointList_WPBegin(void); |
47 | // goto the last WP in the list and return pointer to it |
36 | // goto the last WP in the list and return pointer to it |
48 | Point_t* PointList_WPEnd(void); |
37 | Point_t* PointList_WPEnd(void); |
49 | // goto next WP in the list and return pointer to it |
38 | // goto next WP in the list and return pointer to it |
50 | Point_t* PointList_WPNext(void); |
39 | Point_t* PointList_WPNext(void); |
51 | // disables waypoint function |
40 | // enables/disables waypoint function |
52 | void PointList_WPActive(u8 set); |
41 | void PointList_WPActive(u8 set); |
53 | // returns pointer to actual POI |
42 | // returns pointer to actual POI |
54 | Point_t* PointList_GetPOI(void); |
43 | Point_t* PointList_GetPOI(void); |
55 | 44 | ||
56 | 45 | ||
57 | #endif // _WAYPOINTS_H |
46 | #endif // _WAYPOINTS_H |
58 | 47 |