Goby Underwater Autonomy Project
Series: 1.1, revision: 163, released on 2013-02-06 14:23:27 -0500
|
00001 /* Latitude/Longitude 00002 * Each are encoded into 3 bytes, giving a resolution of 00003 * about 2 meters. The compressed form is stored in a LATLON_COMPRESSED struct, 00004 * which is 3 bytes. 00005 */ 00006 typedef struct { 00007 char compressed[3]; 00008 } 00009 LATLON_COMPRESSED; 00010 00011 typedef union { 00012 long as_long; 00013 LATLON_COMPRESSED as_compressed; 00014 } 00015 00016 LONG_AND_COMP; 00017 00018 typedef struct 00019 { 00020 unsigned char compressed[3]; 00021 } 00022 TIME_DATE; 00023 00024 typedef union 00025 { 00026 long as_long; 00027 TIME_DATE as_time_date; 00028 } 00029 TIME_DATE_LONG; 00030 00031 typedef enum 00032 { 00033 SPEED_MODE_RPM = 0, 00034 SPEED_MODE_MSEC = 1, 00035 SPEED_MODE_KNOTS = 2 00036 } 00037 SPEED_MODE; 00038 00039 typedef enum 00040 { 00041 PS_DISABLED = 0, 00042 PS_SHIPS_POLE = 1, 00043 PS_GATEWAY_BUOY = 2, // "automatically" set... 00044 PS_NAMED_TRANSPONDER = 3, // could be a drifter, or moored; label indicates who... 00045 PS_VEHICLE_POSITION = 4, 00046 PS_LAST = 5, // Pay no attention to the PS_INVALID behind the curtain... 00047 PS_INVALID = 0x080 // Or'd in to indicate that the systems position is (temporarily) invalid (ship turning, etc.) 00048 } 00049 POSITION_SEND ; 00050 00051 LATLON_COMPRESSED Encode_latlon(double latlon_in); 00052 double Decode_latlon(LATLON_COMPRESSED latlon_in); 00053 unsigned char Encode_heading(float heading); 00054 double Decode_heading(unsigned char heading); 00055 char Encode_est_velocity(float est_velocity); 00056 float Decode_est_velocity(char est_velocity); 00057 unsigned char Encode_salinity(float salinity); 00058 float Decode_salinity(unsigned char sal); 00059 unsigned short Encode_depth(float depth); 00060 float Decode_depth(unsigned short depth); 00061 unsigned char Encode_temperature(float temperature); 00062 float Decode_temperature(unsigned char temperature); 00063 unsigned char Encode_sound_speed(float sound_speed); 00064 float Decode_sound_speed(unsigned char sound_speed); 00065 unsigned short Encode_hires_altitude(float alt); 00066 float Decode_hires_altitude(unsigned short alt); 00067 unsigned short Encode_gfi_pitch_oil(float gfi, float pitch, float oil); 00068 void Decode_gfi_pitch_oil(unsigned short gfi_pitch_oil, 00069 float *gfi, float *pitch, float *oil); 00070 TIME_DATE Encode_time_date(long secs_since_1970); 00071 long Decode_time_date(TIME_DATE input, short *mon, short *day, short *hour, 00072 short *min, short *sec); 00073 unsigned char Encode_watts(float volts, float amps); 00074 float Decode_watts(unsigned char watts_encoded); 00075 char Encode_speed(SPEED_MODE mode, float speed); 00076 float Decode_speed(SPEED_MODE mode, char speed); 00077 00078 double DecodeRangerLL(unsigned char c1, unsigned char c2,unsigned char c3, unsigned char c4,unsigned char c5); 00079 double DecodeRangerBCD2(unsigned char c1, unsigned char c2); 00080 double DecodeRangerBCD(unsigned char c1);