Subversion Repositories NaviCtrl

Rev

Rev 495 | Rev 497 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 495 Rev 496
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
 
9
 
10
typedef struct
10
typedef struct
11
{
11
{
12
        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
13
        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
14
        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
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
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
16
        u8  Event_Flag;                 // future implementation
16
        u8  Event_Flag;                 // future implementation
17
        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
18
        u8  Type;                               // typeof Waypoint
18
        u8  Type;                               // typeof Waypoint
19
        u8  WP_EventChannelValue;  // Will be transferred to the FC and can be used as Poti value there
19
        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
20
        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
21
        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)
22
        u8      CamAngle;                       // Camera servo angle in degree (255 -> POI-Automatic)
23
        u8  Name[4];                // Name of that point (ASCII)
23
        u8  Name[4];                // Name of that point (ASCII)
24
    u8  reserve[2];                 // reserve
24
    u8  reserve[2];                 // reserve
25
} __attribute__((packed)) Point_t;
25
} __attribute__((packed)) Point_t;
26
 
26
 
27
 
27
 
28
#define WPL_STORE_TYPE_REL 0
28
#define WPL_STORE_TYPE_REL 0
29
#define WPL_STORE_TYPE_ABS 1
29
#define WPL_STORE_TYPE_ABS 1
30
 
30
 
31
typedef struct
31
typedef struct
32
{
32
{
33
        u8 Index;
33
        u8 Index;
34
        u8 Type;                  // 0 = rel, 1 = abs
34
        u8 Type;                  // 0 = rel, 1 = abs
35
        u8 OverwriteFile;         // 0 = no, 1 = yes
35
        u8 OverwriteFile;         // 0 = no, 1 = yes
36
        u8 reserved[7];
36
        u8 reserved[7];
37
        s8 Name[12];
37
        s8 Name[12];
38
} __attribute__((packed)) WPL_Store_t;
38
} __attribute__((packed)) WPL_Store_t;
-
 
39
 
-
 
40
extern WPL_Store_t WPL_Store;
39
 
41
 
40
// Init List, return TRUE on success
42
// Init List, return TRUE on success
41
u8 PointList_Init(void);
43
u8 PointList_Init(void);
42
// Clear List, return TRUE on success
44
// Clear List, return TRUE on success
43
u8 PointList_Clear(void);
45
u8 PointList_Clear(void);
44
// Returns number of points in the list
46
// Returns number of points in the list
45
u8 PointList_GetCount(void);
47
u8 PointList_GetCount(void);
46
// return pointer to point at position
48
// return pointer to point at position
47
Point_t* PointList_GetAt(u8 index);
49
Point_t* PointList_GetAt(u8 index);
48
// set a point in the list at index, returns its index on success, else 0
50
// set a point in the list at index, returns its index on success, else 0
49
u8 PointList_SetAt(Point_t* pPoint);
51
u8 PointList_SetAt(Point_t* pPoint);
50
// goto the first WP in the list and return pointer to it
52
// goto the first WP in the list and return pointer to it
51
Point_t* PointList_WPBegin(void);
53
Point_t* PointList_WPBegin(void);
52
// goto the last WP in the list and return pointer to it
54
// goto the last WP in the list and return pointer to it
53
Point_t* PointList_WPEnd(void);
55
Point_t* PointList_WPEnd(void);
54
// goto next WP in the list and return pointer to it
56
// goto next WP in the list and return pointer to it
55
Point_t* PointList_WPNext(void);
57
Point_t* PointList_WPNext(void);
56
// enables/disables waypoint function
58
// enables/disables waypoint function
57
void PointList_WPActive(u8 set);
59
void PointList_WPActive(u8 set);
58
// returns pointer to actual POI
60
// returns pointer to actual POI
59
Point_t* PointList_GetPOI(void);
61
Point_t* PointList_GetPOI(void);
60
// save actual point list to SD card
62
// save actual point list to SD card
61
#define WPL_ERROR               0
63
#define WPL_ERROR               0
62
#define WPL_OK                  1
64
#define WPL_OK                  1
63
#define WPL_FILEEXIST   2
65
#define WPL_FILEEXIST   2
64
u8 PointList_SaveToFile(WPL_Store_t * pWPL_Store);
66
u8 PointList_SaveToFile(WPL_Store_t * pWPL_Store);
65
// load actual point list from SD card
67
// load actual point list from SD card
66
u8 PointList_ReadFromFile(WPL_Store_t * pWPL_Store);
68
u8 PointList_ReadFromFile(WPL_Store_t * pWPL_Store);
67
// move actual point list to ref pos., the point in the list marked by RefIndex get the RefPos afterwards
69
// move actual point list to ref pos., the point in the list marked by RefIndex get the RefPos afterwards
68
u8 PointList_Move(u8 RefIndex, GPS_Pos_t* pRefPos);
70
u8 PointList_Move(u8 RefIndex, GPS_Pos_t* pRefPos);
69
 
71
 
70
 
72
 
71
#endif // _WAYPOINTS_H
73
#endif // _WAYPOINTS_H
72
 
74