Rev 492 | Rev 735 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 492 | Rev 557 | ||
---|---|---|---|
1 | #ifndef _GPS_POS_H |
1 | #ifndef _GPS_POS_H |
2 | #define _GPS_POS_H |
2 | #define _GPS_POS_H |
3 | 3 | ||
4 | #define INVALID 0x00 |
4 | #define INVALID 0x00 |
5 | #define NEWDATA 0x01 |
5 | #define NEWDATA 0x01 |
6 | #define PROCESSED 0x02 |
6 | #define PROCESSED 0x02 |
- | 7 | #define SIMULATION 0x03 |
|
7 | 8 | ||
8 | typedef struct |
9 | typedef struct |
9 | { |
10 | { |
10 | s32 Longitude; // in 1E-7 deg |
11 | s32 Longitude; // in 1E-7 deg |
11 | s32 Latitude; // in 1E-7 deg |
12 | s32 Latitude; // in 1E-7 deg |
12 | s32 Altitude; // in mm |
13 | s32 Altitude; // in mm |
13 | u8 Status; // validity of data |
14 | u8 Status; // validity of data |
14 | } __attribute__((packed)) GPS_Pos_t; |
15 | } __attribute__((packed)) GPS_Pos_t; |
15 | 16 | ||
16 | typedef struct |
17 | typedef struct |
17 | { |
18 | { |
18 | u8 Status; // invalid, newdata, processed |
19 | u8 Status; // invalid, newdata, processed |
19 | s32 North; // in cm deviation from target |
20 | s32 North; // in cm deviation from target |
20 | s32 East; // in cm deviation from target |
21 | s32 East; // in cm deviation from target |
21 | s32 Bearing; // in deg to target |
22 | s32 Bearing; // in deg to target |
22 | s32 Distance; // in cm to target |
23 | s32 Distance; // in cm to target |
23 | } __attribute__((packed)) GPS_Pos_Deviation_t; |
24 | } __attribute__((packed)) GPS_Pos_Deviation_t; |
24 | 25 | ||
25 | /* |
26 | /* |
26 | // transform the integer 1E-7 deg into float radians |
27 | // transform the integer 1E-7 deg into float radians |
27 | float GPSPos_ToRadians(s32 deg); |
28 | float GPSPos_ToRadians(s32 deg); |
28 | // transform the integer 1E-7 deg into float deg |
29 | // transform the integer 1E-7 deg into float deg |
29 | float GPSPos_ToDeg(s32 deg); |
30 | float GPSPos_ToDeg(s32 deg); |
30 | */ |
31 | */ |
31 | // clear GPS position data |
32 | // clear GPS position data |
32 | u8 GPSPos_Clear(GPS_Pos_t* pGPSPos); |
33 | u8 GPSPos_Clear(GPS_Pos_t* pGPSPos); |
33 | // copy GPS position from source position to target position |
34 | // copy GPS position from source position to target position |
34 | u8 GPSPos_Copy(GPS_Pos_t* pGPSPosSrc, GPS_Pos_t* pGPSPosTgt); |
35 | u8 GPSPos_Copy(GPS_Pos_t* pGPSPosSrc, GPS_Pos_t* pGPSPosTgt); |
35 | // calculate the deviation from the source position to the target position |
36 | // calculate the deviation from the source position to the target position |
36 | u8 GPSPos_Deviation(GPS_Pos_t* pReferencePos, GPS_Pos_t* pTargetPos, GPS_Pos_Deviation_t* pDeviation); |
37 | u8 GPSPos_Deviation(GPS_Pos_t* pReferencePos, GPS_Pos_t* pTargetPos, GPS_Pos_Deviation_t* pDeviation); |
37 | // clear position deviation |
38 | // clear position deviation |
38 | u8 GPSPos_Deviation_Clear(GPS_Pos_Deviation_t* pDeviation); |
39 | u8 GPSPos_Deviation_Clear(GPS_Pos_Deviation_t* pDeviation); |
39 | // Move the gps position according to north and east shift in cm |
40 | // Move the gps position according to north and east shift in cm |
40 | u8 GPSPos_ShiftCartesian(GPS_Pos_t* pGPSPos, s32 NorthShift, s32 EastShift); |
41 | u8 GPSPos_ShiftCartesian(GPS_Pos_t* pGPSPos, s32 NorthShift, s32 EastShift); |
41 | // Move the gps position according to the direction of bearing in deg by the given distance in cm |
42 | // Move the gps position according to the direction of bearing in deg by the given distance in cm |
42 | u8 GPSPos_ShiftGeodetic(GPS_Pos_t* pGPSPos, s32 Bearing, s32 Distance); |
43 | u8 GPSPos_ShiftGeodetic(GPS_Pos_t* pGPSPos, s32 Bearing, s32 Distance); |
43 | // Move Pos so that distance to ReferencePos is limited to MaxDistance in cm |
44 | // Move Pos so that distance to ReferencePos is limited to MaxDistance in cm |
44 | // returns 1 if Pos has been moved to fit the limit |
45 | // returns 1 if Pos has been moved to fit the limit |
45 | u8 GPSPos_CatchDistance(GPS_Pos_t* pPos, GPS_Pos_t* pReferencePos, s32 MaxDistance); |
46 | u8 GPSPos_CatchDistance(GPS_Pos_t* pPos, GPS_Pos_t* pReferencePos, s32 MaxDistance); |
46 | 47 | ||
47 | #endif //_GPS_POS_H |
48 | #endif //_GPS_POS_H |
48 | 49 |