Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
UBLOX Class Reference

#include <ublox.h>

Classes

struct  __attribute__
 
struct  GNSSPosECEF
 
struct  GNSSPVT
 
struct  GNSSVelECEF
 
union  UBX_message_t
 
struct  UTCTime
 

Public Types

enum  { ACK_ACK = 0x01, ACK_NACK = 0x00 }
 
enum  {
  AID_ALM = 0x30, AID_AOP = 0x33, AID_EPH = 0x31, AID_HUI = 0x02,
  AID_INI = 0x01
}
 
enum  {
  CFG_ANT = 0x13, CFG_BATCH = 0x93, CFG_CFG = 0x09, CFG_DAT = 0x06,
  CFG_DGNSS = 0x70, CFG_DOSC = 0x61, CFG_DYNSEED = 0x85, CFG_ESRC = 0x60,
  CFG_FIXSEED = 0x84, CFG_GEOFENCE = 0x69, CFG_GNSS = 0x3E, CFG_HNR = 0x5C,
  CFG_INF = 0x02, CFG_ITFM = 0x39, CFG_LOGFILTER = 0x47, CFG_MSG = 0x01,
  CFG_NAV5 = 0x24, CFG_NAVX5 = 0x23, CFG_NMEA = 0x17, CFG_ODO = 0x1E,
  CFG_PM2 = 0x3B, CFG_PMS = 0x86, CFG_PRT = 0x00, CFG_PWR = 0x57,
  CFG_RATE = 0x08, CFG_RINV = 0x34, CFG_RST = 0x04, CFG_RXM = 0x11,
  CFG_SBAS = 0x16, CFG_SMGR = 0x62, CFG_TMODE2 = 0x3D, CFG_TMODE3 = 0x71,
  CFG_TP5 = 0x31, CFG_TXSLOT = 0x53, CFG_USB = 0x1B
}
 
enum  {
  NAV_AOPSTATUS = 0x60, NAV_ATT = 0x05, NAV_CLOCK = 0x22, NAV_DGPS = 0x31,
  NAV_DOP = 0x04, NAV_EOE = 0x61, NAV_GEOFENCE = 0x39, NAV_HPPOSECEF = 0x13,
  NAV_HPPOSLLH = 0x14, NAV_ODO = 0x09, NAV_ORB = 0x34, NAV_POSECEF = 0x01,
  NAV_POSLLH = 0x02, NAV_PVT = 0x07, NAV_RELPOSNED = 0x3C, NAV_RESETODO = 0x10,
  NAV_SAT = 0x35, NAV_SBAS = 0x32, NAV_SOL = 0x06, NAV_STATUS = 0x03,
  NAV_SVINFO = 0x30, NAV_SVIN = 0x3B, NAV_TIMEBDS = 0x24, NAV_TIMEGAL = 0x25,
  NAV_TIMEGLO = 0x23, NAV_TIMEGPS = 0x20, NAV_TIMELS = 0x26, NAV_TIMEUTC = 0x21,
  NAV_VELECEF = 0x11, NAV_VELNED = 0x12
}
 
enum  { START_BYTE_1 = 0xB5, START_BYTE_2 = 0x62 }
 
enum  { NMEA_START_BYTE1 = '$', NMEA_START_BYTE2 = 'G' }
 
enum  {
  CLASS_NAV = 0x01, CLASS_RXM = 0x02, CLASS_INF = 0x04, CLASS_ACK = 0x05,
  CLASS_CFG = 0x06, CLASS_UPD = 0x09, CLASS_MON = 0x0A, CLASS_AID = 0x0B,
  CLASS_TIM = 0x0D, CLASS_ESF = 0x10, CLASS_MGA = 0x13, CLASS_LOG = 0x21
}
 
enum  FixType {
  FIX_TYPE_NO_FIX = 0x00, FIX_TYPE_DEAD_RECKONING = 0x01, FIX_TYPE_2D = 0x02, FIX_TYPE_3D = 0x03,
  FIX_TYPE_GPS_AND_DEAD_RECKONING = 0x04, FIX_TYPE_TIME_ONLY = 0x05
}
 
enum  parse_state_t {
  START, GOT_START_FRAME, GOT_CLASS, GOT_MSG_ID,
  GOT_LENGTH1, GOT_LENGTH2, GOT_PAYLOAD, GOT_CK_A,
  GOT_CK_B, DONE
}
 

Public Member Functions

void check_connection_status ()
 
uint64_t get_last_pvt_timestamp ()
 
void init (UART *uart)
 
bool new_data ()
 
uint32_t num_messages_received ()
 
bool present ()
 
GNSSPVT read ()
 
void read_cb (uint8_t byte)
 
void read_ecef (int32_t *pos_ecef, int32_t *vel_ecef, uint32_t &p_acc_ecef, uint32_t &s_acc_ecef)
 
const NAV_PVT_t & read_full ()
 
GNSSPosECEF read_pos_ecef ()
 
GNSSVelECEF read_vel_ecef ()
 
 UBLOX ()
 

Static Public Attributes

static constexpr uint32_t BAUD_RATE {115200}
 
static constexpr UART::uart_mode_t UART_MODE {UART::MODE_8N1}
 

Private Member Functions

void calculate_checksum (const uint8_t msg_cls, const uint8_t msg_id, const uint16_t len, const UBX_message_t &payload, uint8_t &ck_a, uint8_t &ck_b) const
 
bool decode_message ()
 
void enable_message (uint8_t msg_cls, uint8_t msg_id, uint8_t rate)
 
void finish_init ()
 
void increment_detect_baudrate_async ()
 
bool send_ubx_message (uint8_t msg_class, uint8_t msg_id, UBX_message_t &message, uint16_t len)
 
void set_baudrate (const uint32_t baudrate)
 
void set_dynamic_mode ()
 
void set_nav_rate (uint8_t period_ms)
 
void start_detect_baudrate_async ()
 

Private Attributes

size_t baudrate_search_index_ {0}
 
const uint32_t baudrates [BAUDRATE_SEARCH_COUNT] = {115200, 19200, 57600, 9600, 38400}
 
uint16_t buffer_head_ = 0
 
uint8_t ck_a_
 
uint8_t ck_b_
 
uint32_t current_baudrate_ = BAUD_RATE
 
bool got_ack_ = false
 
bool got_message_ = false
 
bool got_nack_ = false
 
UBX_message_t in_message_ = {}
 
bool is_initialized_ {false}
 
uint32_t last_baudrate_change_ms_ {0}
 
uint64_t last_pvt_timestamp_ = 0
 
uint32_t last_valid_message_ {0}
 
uint16_t length_
 
bool looking_for_nmea_ = true
 
uint8_t message_class_
 
uint8_t message_type_
 
NAV_PVT_t nav_message_ = {}
 
volatile bool new_data_ = false
 
uint32_t num_errors_ = 0
 
volatile uint32_t num_messages_received_ = 0
 
UBX_message_t out_message_ = {}
 
parse_state_t parse_state_
 
NAV_POSECEF_t pos_ecef_ = {}
 
uint8_t prev_byte_ = 0
 
bool searching_baudrate_ {false}
 
UARTserial_ = nullptr
 
uint64_t time_ = 0
 
NAV_VELECEF_t vel_ecef_ = {}
 

Static Private Attributes

static constexpr size_t BAUDRATE_SEARCH_COUNT {5}
 
static constexpr uint32_t BAUDRATE_SEARCH_TIME_MS {1000}
 
static constexpr uint32_t TIMEOUT_MS {5000}
 

Detailed Description

Definition at line 14 of file ublox.h.

Member Enumeration Documentation

anonymous enum
Enumerator
ACK_ACK 
ACK_NACK 

Definition at line 57 of file ublox.h.

anonymous enum
Enumerator
AID_ALM 
AID_AOP 
AID_EPH 
AID_HUI 
AID_INI 

Definition at line 63 of file ublox.h.

anonymous enum
Enumerator
CFG_ANT 
CFG_BATCH 
CFG_CFG 
CFG_DAT 
CFG_DGNSS 
CFG_DOSC 
CFG_DYNSEED 
CFG_ESRC 
CFG_FIXSEED 
CFG_GEOFENCE 
CFG_GNSS 
CFG_HNR 
CFG_INF 
CFG_ITFM 
CFG_LOGFILTER 
CFG_MSG 
CFG_NAV5 
CFG_NAVX5 
CFG_NMEA 
CFG_ODO 
CFG_PM2 
CFG_PMS 
CFG_PRT 
CFG_PWR 
CFG_RATE 
CFG_RINV 
CFG_RST 
CFG_RXM 
CFG_SBAS 
CFG_SMGR 
CFG_TMODE2 
CFG_TMODE3 
CFG_TP5 
CFG_TXSLOT 
CFG_USB 

Definition at line 72 of file ublox.h.

anonymous enum
Enumerator
NAV_AOPSTATUS 
NAV_ATT 
NAV_CLOCK 
NAV_DGPS 
NAV_DOP 
NAV_EOE 
NAV_GEOFENCE 
NAV_HPPOSECEF 
NAV_HPPOSLLH 
NAV_ODO 
NAV_ORB 
NAV_POSECEF 
NAV_POSLLH 
NAV_PVT 
NAV_RELPOSNED 
NAV_RESETODO 
NAV_SAT 
NAV_SBAS 
NAV_SOL 
NAV_STATUS 
NAV_SVINFO 
NAV_SVIN 
NAV_TIMEBDS 
NAV_TIMEGAL 
NAV_TIMEGLO 
NAV_TIMEGPS 
NAV_TIMELS 
NAV_TIMEUTC 
NAV_VELECEF 
NAV_VELNED 

Definition at line 111 of file ublox.h.

anonymous enum
Enumerator
START_BYTE_1 
START_BYTE_2 

Definition at line 29 of file ublox.h.

anonymous enum
Enumerator
NMEA_START_BYTE1 
NMEA_START_BYTE2 

Definition at line 35 of file ublox.h.

anonymous enum
Enumerator
CLASS_NAV 
CLASS_RXM 
CLASS_INF 
CLASS_ACK 
CLASS_CFG 
CLASS_UPD 
CLASS_MON 
CLASS_AID 
CLASS_TIM 
CLASS_ESF 
CLASS_MGA 
CLASS_LOG 

Definition at line 41 of file ublox.h.

Enumerator
FIX_TYPE_NO_FIX 
FIX_TYPE_DEAD_RECKONING 
FIX_TYPE_2D 
FIX_TYPE_3D 
FIX_TYPE_GPS_AND_DEAD_RECKONING 
FIX_TYPE_TIME_ONLY 

Definition at line 19 of file ublox.h.

Enumerator
START 
GOT_START_FRAME 
GOT_CLASS 
GOT_MSG_ID 
GOT_LENGTH1 
GOT_LENGTH2 
GOT_PAYLOAD 
GOT_CK_A 
GOT_CK_B 
DONE 

Definition at line 145 of file ublox.h.

Constructor & Destructor Documentation

UBLOX::UBLOX ( )

Definition at line 13 of file ublox.cpp.

Member Function Documentation

void UBLOX::calculate_checksum ( const uint8_t  msg_cls,
const uint8_t  msg_id,
const uint16_t  len,
const UBX_message_t payload,
uint8_t &  ck_a,
uint8_t &  ck_b 
) const
private

Definition at line 387 of file ublox.cpp.

void UBLOX::check_connection_status ( )

Definition at line 71 of file ublox.cpp.

bool UBLOX::decode_message ( )
private

Definition at line 327 of file ublox.cpp.

void UBLOX::enable_message ( uint8_t  msg_cls,
uint8_t  msg_id,
uint8_t  rate 
)
private

Definition at line 158 of file ublox.cpp.

void UBLOX::finish_init ( )
private

Definition at line 38 of file ublox.cpp.

uint64_t UBLOX::get_last_pvt_timestamp ( )
inline

Definition at line 458 of file ublox.h.

void UBLOX::increment_detect_baudrate_async ( )
private

Definition at line 61 of file ublox.cpp.

void UBLOX::init ( UART uart)

Definition at line 16 of file ublox.cpp.

bool UBLOX::new_data ( )

Definition at line 286 of file ublox.cpp.

uint32_t UBLOX::num_messages_received ( )
inline

Definition at line 456 of file ublox.h.

bool UBLOX::present ( )

Definition at line 133 of file ublox.cpp.

UBLOX::GNSSPVT UBLOX::read ( )

Definition at line 291 of file ublox.cpp.

void UBLOX::read_cb ( uint8_t  byte)

Definition at line 167 of file ublox.cpp.

void UBLOX::read_ecef ( int32_t *  pos_ecef,
int32_t *  vel_ecef,
uint32_t &  p_acc_ecef,
uint32_t &  s_acc_ecef 
)
const UBLOX::NAV_PVT_t & UBLOX::read_full ( )

Definition at line 322 of file ublox.cpp.

UBLOX::GNSSPosECEF UBLOX::read_pos_ecef ( )

Definition at line 310 of file ublox.cpp.

UBLOX::GNSSVelECEF UBLOX::read_vel_ecef ( )

Definition at line 316 of file ublox.cpp.

bool UBLOX::send_ubx_message ( uint8_t  msg_class,
uint8_t  msg_id,
UBX_message_t message,
uint16_t  len 
)
private

Definition at line 90 of file ublox.cpp.

void UBLOX::set_baudrate ( const uint32_t  baudrate)
private

Definition at line 112 of file ublox.cpp.

void UBLOX::set_dynamic_mode ( )
private

Definition at line 139 of file ublox.cpp.

void UBLOX::set_nav_rate ( uint8_t  period_ms)
private

Definition at line 148 of file ublox.cpp.

void UBLOX::start_detect_baudrate_async ( )
private

Definition at line 55 of file ublox.cpp.

Member Data Documentation

constexpr uint32_t UBLOX::BAUD_RATE {115200}
static

Definition at line 441 of file ublox.h.

constexpr size_t UBLOX::BAUDRATE_SEARCH_COUNT {5}
staticprivate

Definition at line 480 of file ublox.h.

size_t UBLOX::baudrate_search_index_ {0}
private

Definition at line 484 of file ublox.h.

constexpr uint32_t UBLOX::BAUDRATE_SEARCH_TIME_MS {1000}
staticprivate

Definition at line 481 of file ublox.h.

const uint32_t UBLOX::baudrates[BAUDRATE_SEARCH_COUNT] = {115200, 19200, 57600, 9600, 38400}
private

Definition at line 482 of file ublox.h.

uint16_t UBLOX::buffer_head_ = 0
private

Definition at line 493 of file ublox.h.

uint8_t UBLOX::ck_a_
private

Definition at line 501 of file ublox.h.

uint8_t UBLOX::ck_b_
private

Definition at line 502 of file ublox.h.

uint32_t UBLOX::current_baudrate_ = BAUD_RATE
private

Definition at line 479 of file ublox.h.

bool UBLOX::got_ack_ = false
private

Definition at line 495 of file ublox.h.

bool UBLOX::got_message_ = false
private

Definition at line 494 of file ublox.h.

bool UBLOX::got_nack_ = false
private

Definition at line 496 of file ublox.h.

UBX_message_t UBLOX::in_message_ = {}
private

Definition at line 491 of file ublox.h.

bool UBLOX::is_initialized_ {false}
private

Definition at line 477 of file ublox.h.

uint32_t UBLOX::last_baudrate_change_ms_ {0}
private

Definition at line 485 of file ublox.h.

uint64_t UBLOX::last_pvt_timestamp_ = 0
private

Definition at line 506 of file ublox.h.

uint32_t UBLOX::last_valid_message_ {0}
private

Definition at line 487 of file ublox.h.

uint16_t UBLOX::length_
private

Definition at line 500 of file ublox.h.

bool UBLOX::looking_for_nmea_ = true
private

Definition at line 509 of file ublox.h.

uint8_t UBLOX::message_class_
private

Definition at line 498 of file ublox.h.

uint8_t UBLOX::message_type_
private

Definition at line 499 of file ublox.h.

NAV_PVT_t UBLOX::nav_message_ = {}
private

Definition at line 517 of file ublox.h.

volatile bool UBLOX::new_data_ = false
private

Definition at line 514 of file ublox.h.

uint32_t UBLOX::num_errors_ = 0
private

Definition at line 503 of file ublox.h.

volatile uint32_t UBLOX::num_messages_received_ = 0
private

Definition at line 504 of file ublox.h.

UBX_message_t UBLOX::out_message_ = {}
private

Definition at line 490 of file ublox.h.

parse_state_t UBLOX::parse_state_
private

Definition at line 497 of file ublox.h.

NAV_POSECEF_t UBLOX::pos_ecef_ = {}
private

Definition at line 518 of file ublox.h.

uint8_t UBLOX::prev_byte_ = 0
private

Definition at line 510 of file ublox.h.

bool UBLOX::searching_baudrate_ {false}
private

Definition at line 483 of file ublox.h.

UART* UBLOX::serial_ = nullptr
private

Definition at line 512 of file ublox.h.

uint64_t UBLOX::time_ = 0
private

Definition at line 507 of file ublox.h.

constexpr uint32_t UBLOX::TIMEOUT_MS {5000}
staticprivate

Definition at line 488 of file ublox.h.

constexpr UART::uart_mode_t UBLOX::UART_MODE {UART::MODE_8N1}
static

Definition at line 442 of file ublox.h.

NAV_VELECEF_t UBLOX::vel_ecef_ = {}
private

Definition at line 519 of file ublox.h.


The documentation for this class was generated from the following files:


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:58