Subversion Repositories NaviCtrl

Rev

Rev 557 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _GPS_POS_H
#define _GPS_POS_H

#define INVALID         0x00
#define NEWDATA         0x01
#define PROCESSED       0x02
#define SIMULATION      0x03

typedef struct
{
        s32 Longitude;  // in 1E-7 deg
        s32 Latitude;   // in 1E-7 deg
        s32 Altitude;   // in mm
        u8 Status;              // validity of data
} __attribute__((packed)) GPS_Pos_t;

typedef struct
{
        u8  Status;     // invalid, newdata, processed
        s32 North;              // in cm deviation from target
        s32 East;               // in cm deviation from target
        s32 Bearing;    // in deg to target
        s32 Distance;   // in cm to target
} __attribute__((packed)) GPS_Pos_Deviation_t;

/*
// transform the integer 1E-7 deg into float radians
float GPSPos_ToRadians(s32 deg);
// transform the integer 1E-7 deg into float deg
float GPSPos_ToDeg(s32 deg);
*/

// clear GPS position data
u8 GPSPos_Clear(GPS_Pos_t* pGPSPos);
// copy GPS position from source position to target position
u8 GPSPos_Copy(GPS_Pos_t* pGPSPosSrc, GPS_Pos_t* pGPSPosTgt);
// calculate the deviation from the source position to the target position
u8 GPSPos_Deviation(GPS_Pos_t* pReferencePos, GPS_Pos_t* pTargetPos, GPS_Pos_Deviation_t* pDeviation);
// clear position deviation
u8 GPSPos_Deviation_Clear(GPS_Pos_Deviation_t* pDeviation);
// Move the gps position according to north and east shift in cm
u8 GPSPos_ShiftCartesian(GPS_Pos_t* pGPSPos, s32 NorthShift, s32 EastShift);
// Move the gps position according to the direction of bearing in deg by the given distance in cm
u8 GPSPos_ShiftGeodetic(GPS_Pos_t* pGPSPos, s32 Bearing, s32 Distance);
// Move Pos so that distance to ReferencePos is limited to MaxDistance in cm
// returns 1 if Pos has been moved to fit the limit
u8 GPSPos_CatchDistance(GPS_Pos_t* pPos, GPS_Pos_t*  pReferencePos, s32 MaxDistance);

#endif //_GPS_POS_H