Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/gps/gps.h"
#include "modules/core/abi.h"
#include "led.h"
#include "math/pprz_geodetic_float.h"
#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include "gps_sirf.h"
#include "pprzlink/pprzlink_device.h"
#include "mcu_periph/uart.h"
Go to the source code of this file.
Data Structures | |
struct | sirf_msg_2 |
Message ID 2 from GPS. More... | |
struct | sirf_msg_41 |
Message ID 41 from GPS. More... | |
Macros | |
#define | Invert2Bytes(x) ((x>>8) | (x<<8)) |
#define | Invert4Bytes(x) ((x>>24) | ((x<<8) & 0x00FF0000) | ((x>>8) & 0x0000FF00) | (x<<24)) |
Functions | |
void | sirf_parse_char (uint8_t c) |
void | sirf_parse_msg (void) |
void | gps_sirf_msg (void) |
void | sirf_parse_2 (void) |
void | sirf_parse_41 (void) |
void | gps_sirf_init (void) |
void | gps_sirf_event (void) |
Variables | |
struct GpsSirf | gps_sirf |
int | start_time = 0 |
int | ticks = 0 |
int | start_time2 = 0 |
int | ticks2 = 0 |
struct sirf_msg_2 |
Message ID 2 from GPS.
Total payload length should be 41 bytes.
Definition at line 43 of file gps_sirf.c.
Data Fields | ||
---|---|---|
uint8_t | ch10prn | |
uint8_t | ch11prn | |
uint8_t | ch12prn | |
uint8_t | ch1prn | pseudo-random noise, 12 channels |
uint8_t | ch2prn | |
uint8_t | ch3prn | |
uint8_t | ch4prn | |
uint8_t | ch5prn | |
uint8_t | ch6prn | |
uint8_t | ch7prn | |
uint8_t | ch8prn | |
uint8_t | ch9prn | |
uint8_t | hdop | horizontal dilution of precision *5 (0.2 precision) |
uint8_t | mode1 | |
uint8_t | mode2 | |
uint8_t | msg_id | hex value 0x02 ( = decimal 2) |
uint8_t | num_sat | Number of satellites in fix. |
uint32_t | tow | time of week in seconds * 10^2 |
int16_t | vx | x-velocity * 8 in m/s |
int16_t | vy | y-velocity * 8 in m/s |
int16_t | vz | z-velocity * 8 in m/s |
uint16_t | week | |
int32_t | x_pos | x-position in m |
int32_t | y_pos | y-position in m |
int32_t | z_pos | z-position in m |
struct sirf_msg_41 |
Message ID 41 from GPS.
Total payload length should be 91 bytes.
Definition at line 73 of file gps_sirf.c.
Data Fields | ||
---|---|---|
uint8_t | add_info | Additional mode info. |
int32_t | alt_ellipsoid | in meters *10^2 |
int32_t | alt_msl | in meters *10^2 |
int16_t | climb_rate | in m/s * 10^2 |
int32_t | clock_bias | in m * 10^2 |
uint32_t | clock_bias_err | in m * 10^2 |
int32_t | clock_drift | in m/s * 10^2 |
uint32_t | clock_drift_err | in m/s * 10^2 |
uint16_t | cog | course over ground, in degrees clockwise from true north * 10^2 |
uint8_t | day | |
uint32_t | distance | Distance traveled since reset in m. |
uint16_t | distance_err | in meters |
uint32_t | ehpe | estimated horizontal position error, in meters * 10^2 |
uint16_t | ehve | estimated horizontal velocity error in m/s * 10^2 |
uint32_t | ete | estimated time error, in seconds * 10^2 |
uint32_t | evpe | estimated vertical position error, in meters * 10^2 |
uint16_t | extended_week_number | |
uint8_t | hdop | Horizontal dilution of precision x 5 (0.2 precision) |
uint16_t | heading_err | in degrees * 10^2 |
int16_t | heading_rate | in deg/s * 10^2 |
uint8_t | hour | |
int32_t | latitude | in degrees (+= North) *10^7 |
int32_t | longitude | in degrees (+= East) *10*7 |
int16_t | mag_var | not implemented |
int8_t | map_datum | |
uint8_t | minute | |
uint8_t | month | |
uint8_t | msg_id | hex value 0x29 (= decimal 41) |
uint16_t | nav_type | |
uint16_t | nav_valid | if equal to 0x0000, then navigation solution is valid |
uint8_t | num_sat | Number of satellites used for solution. |
uint32_t | sat_id | satellites used in solution. Each satellite corresponds with a bit, e.g. bit 1 ON = SV 1 is used in solution |
uint16_t | second | |
uint16_t | sog | speed over ground, in m/s * 10^2 |
uint32_t | tow | time of week in seconds *10^3] |
uint16_t | year |
#define Invert2Bytes | ( | x | ) | ((x>>8) | (x<<8)) |
Definition at line 39 of file gps_sirf.c.
#define Invert4Bytes | ( | x | ) | ((x>>24) | ((x<<8) & 0x00FF0000) | ((x>>8) & 0x0000FF00) | (x<<24)) |
Definition at line 40 of file gps_sirf.c.
void gps_sirf_event | ( | void | ) |
Definition at line 287 of file gps_sirf.c.
References dev, gps_sirf, gps_sirf_msg(), GpsSirf::msg_available, and sirf_parse_char().
void gps_sirf_init | ( | void | ) |
Definition at line 122 of file gps_sirf.c.
References gps_sirf, GpsSirf::msg_available, GpsSirf::msg_len, GpsSirf::msg_valid, and GpsSirf::read_state.
void gps_sirf_msg | ( | void | ) |
Definition at line 130 of file gps_sirf.c.
References GpsState::fix, get_sys_time_usec(), GPS_FIX_3D, gps_sirf, GPS_SIRF_ID, GpsState::last_3dfix_ticks, GpsState::last_3dfix_time, GpsState::last_msg_ticks, GpsState::last_msg_time, GpsSirf::msg_valid, sys_time::nb_sec, sys_time::nb_sec_rem, sirf_parse_msg(), and GpsSirf::state.
Referenced by gps_sirf_event().
void sirf_parse_2 | ( | void | ) |
Definition at line 232 of file gps_sirf.c.
References GpsState::ecef_pos, GpsState::ecef_vel, GpsState::fix, GPS_FIX_3D, gps_sirf, GPS_VALID_POS_ECEF_BIT, GPS_VALID_VEL_ECEF_BIT, Invert2Bytes, Invert4Bytes, GpsState::last_3dfix_time, GpsSirf::msg_buf, GpsSirf::msg_valid, sys_time::nb_sec, p, start_time, start_time2, GpsSirf::state, ticks, ticks2, GpsState::valid_fields, GpsState::week, EcefCoor_i::x, EcefCoor_i::y, and EcefCoor_i::z.
Referenced by sirf_parse_msg().
void sirf_parse_41 | ( | void | ) |
Definition at line 197 of file gps_sirf.c.
References LlaCoor_i::alt, GpsState::cacc, GpsState::course, GpsState::fix, GPS_FIX_2D, GPS_FIX_3D, GPS_FIX_NONE, gps_sirf, GPS_VALID_COURSE_BIT, GPS_VALID_HMSL_BIT, GPS_VALID_POS_LLA_BIT, GpsState::gspeed, GpsState::hmsl, Invert2Bytes, Invert4Bytes, LlaCoor_i::lat, GpsState::lla_pos, LlaCoor_i::lon, GpsSirf::msg_buf, GpsSirf::msg_valid, GpsState::nb_channels, GpsState::num_sv, p, GpsState::pacc, GpsState::pdop, GpsState::sacc, GpsSirf::state, GpsState::tow, and GpsState::valid_fields.
Referenced by sirf_parse_msg().
void sirf_parse_char | ( | uint8_t | c | ) |
Definition at line 147 of file gps_sirf.c.
References GOT_A0, GOT_A2, GOT_B0, gps_sirf, GpsSirf::msg_available, GpsSirf::msg_buf, GpsSirf::msg_len, GpsSirf::read_state, and UNINIT.
Referenced by gps_sirf_event().
void sirf_parse_msg | ( | void | ) |
Definition at line 261 of file gps_sirf.c.
References gps_sirf, GpsSirf::msg_buf, GpsSirf::msg_len, GpsSirf::msg_valid, sys_time::nb_sec, sirf_parse_2(), sirf_parse_41(), start_time2, and ticks2.
Referenced by gps_sirf_msg().
struct GpsSirf gps_sirf |
Definition at line 1 of file gps_sirf.c.
Referenced by gps_sirf_event(), gps_sirf_init(), gps_sirf_msg(), sirf_parse_2(), sirf_parse_41(), sirf_parse_char(), and sirf_parse_msg().
int start_time = 0 |
Definition at line 192 of file gps_sirf.c.
Referenced by sirf_parse_2(), and sys_time_register_timer().
int start_time2 = 0 |
Definition at line 194 of file gps_sirf.c.
Referenced by sirf_parse_2(), and sirf_parse_msg().
int ticks = 0 |
Definition at line 193 of file gps_sirf.c.
Referenced by msec_of_sys_time_ticks(), sec_of_sys_time_ticks(), sirf_parse_2(), and usec_of_sys_time_ticks().
int ticks2 = 0 |
Definition at line 195 of file gps_sirf.c.
Referenced by sirf_parse_2(), and sirf_parse_msg().