31 #define SBP_DEBUGGING 0 32 #define SBP_INFOREPORTING 1 37 #define SBP_TIMEOUT_HEARTBEAT 2000 40 # define Debug(fmt, args ...) \ 42 hal.console->printf("%s:%d: " fmt "\n", \ 43 __FUNCTION__, __LINE__, \ 45 hal.scheduler->delay(1); \ 48 # define Debug(fmt, args ...) 52 # define Info(fmt, args ...) \ 54 gcs().send_text(MAV_SEVERITY_INFO, fmt "\n", ## args); \ 57 # define Info(fmt, args ...) 65 Debug(
"SBP Driver Initialized");
90 Debug(
"PIKSI: Not enough TXSPACE");
161 Debug(
"CRC Error Occurred!");
218 return MIN(abs(tow1_ms - tow2_ms), mod - abs(tow1_ms - tow2_ms));
232 Info(
"No Heartbeats from Piksi! Status to NO_FIX.");
238 Info(
"Received a heartbeat from non-SBPv2 device. Current driver only supports SBPv2. Status to NO_FIX.");
247 Info(
"Piksi reported an error. Status to NO_FIX.");
274 Debug(
"Message Marked as Invalid. NO FIX! Flags: {GPS_TIME: %d, VEL_NED: %d, POS_LLH: %d, DOPS: %d}",
364 switch (state.
state) {
412 *((uint8_t*)&(state.
crc) + state.
n_read) = data;
470 pages += (msg_len - 48) / 104 + 1;
482 memcpy(pkt.
data, msg_buff,
MIN(msg_len, 48));
485 for (uint8_t i = 0; i < pages - 1; i++) {
491 index : uint8_t(i + 2),
495 memcpy(pkt2.
data, &msg_buff[48 + i * 104],
MIN(msg_len - (48 + i * 104), 104));
uint32_t time_week_ms
GPS time (milliseconds from start of GPS week)
static const uint16_t SBP_DOPS_MSGTYPE
void logging_log_full_update()
struct PACKED AP_GPS_SBP2::sbp_ext_event_t::flags flags
static const uint8_t SBP_PREAMBLE
uint32_t last_gps_time_ms
the system time we got the last GPS timestamp, milliseconds
bool _attempt_state_update()
float safe_sqrt(const T v)
uint32_t last_iar_num_hypotheses
uint8_t heartbeat_buff[4]
struct sbp_vel_ned_t last_vel_ned
#define Debug(fmt, args ...)
GPS_Status status
driver fix status
Interface definition for the various Ground Control System.
bool have_vertical_velocity
does GPS give vertical velocity? Set to true only once available.
Vector3f velocity
3D velocity in m/s, in NED format
void logging_log_raw_sbp(uint16_t msg_type, uint16_t sender_id, uint8_t msg_len, uint8_t *msg_buff)
void WriteBlock(const void *pBuffer, uint16_t size)
struct sbp_heartbeat_t last_heartbeat
enum AP_GPS_SBP2::sbp_parser_state_t::@34 state
virtual uint32_t txspace()=0
struct sbp_pos_llh_t last_pos_llh
#define SBP_TIMEOUT_HEARTBEAT
struct sbp_dops_t last_dops
int32_t lat
param 3 - Latitude * 10**7
uint32_t crc_error_counter
Receiving valid messages and 3D RTK Fixed.
uint32_t last_heartbeat_received_ms
uint32_t last_injected_data_ms
AP_GPS & gps
access to frontend (for parameters)
float wrap_360(const T angle, float unit_mod)
int32_t alt
param 2 - Altitude in centimeters (meters * 100) see LOCATION_ALT_MAX_M
static const uint16_t SBP_VEL_NED_MSGTYPE
Receiving valid messages and 3D lock with differential improvements.
AP_GPS_SBP2(AP_GPS &_gps, AP_GPS::GPS_State &_state, AP_HAL::UARTDriver *_port)
bool is_zero(const T fVal1)
Receiving valid messages and 3D RTK Float.
static const uint16_t SBP_POS_LLH_MSGTYPE
static const uint16_t SBP_EXT_EVENT_MSGTYPE
#define Info(fmt, args ...)
virtual size_t write(uint8_t)=0
static bool _detect(struct SBP2_detect_state &state, uint8_t data)
static DataFlash_Class * instance(void)
struct sbp_ext_event_t last_event
uint16_t last_full_update_wn
uint16_t time_week
GPS week number.
enum SBP2_detect_state::@37 state
AP_GPS::GPS_State & state
public state for this instance
struct PACKED AP_GPS_SBP2::sbp_vel_ned_t::flags flags
uint32_t last_full_update_tow
bool should_df_log() const
uint16_t vdop
vertical dilution of precision in cm
virtual uint32_t available()=0
Location location
last fix location
int32_t lng
param 4 - Longitude * 10**7
struct PACKED AP_GPS_SBP2::sbp_dops_t::flags flags
struct PACKED AP_GPS_SBP2::sbp_gps_time_t::flags flags
Receiving valid GPS messages but no lock.
static const uint16_t SBP_HEARTBEAT_MSGTYPE
bool have_vertical_accuracy
does GPS give vertical position accuracy? Set to true only once available.
void inject_data(const uint8_t *data, uint16_t len) override
float speed_accuracy
3D velocity RMS accuracy estimate in m/s
AP_HAL::UARTDriver * port
UART we are attached to.
bool have_horizontal_accuracy
does GPS give horizontal position accuracy? Set to true only once available.
float horizontal_accuracy
horizontal RMS accuracy estimate in m
float ground_speed
ground speed in m/sec
static const uint16_t SBP_GPS_TIME_MSGTYPE
struct AP_GPS_SBP2::sbp_parser_state_t parser_state
Receiving valid messages and 3D lock.
float vertical_accuracy
vertical RMS accuracy estimate in m
int32_t distMod(int32_t tow1_ms, int32_t tow2_ms, int32_t mod)
uint16_t hdop
horizontal dilution of precision in cm
#define LOG_PACKET_HEADER_INIT(id)
void _sbp_process_message()
struct PACKED AP_GPS_SBP2::sbp_pos_llh_t::flags flags
uint16_t crc16_ccitt(const uint8_t *buf, uint32_t len, uint16_t crc)
uint8_t num_sats
Number of visible satellites.
bool have_speed_accuracy
does GPS give speed accuracy? Set to true only once available.
float ground_course
ground course in degrees
struct sbp_gps_time_t last_gps_time