47 #define SBF_CONFIG_TIMEOUT 500 // ms, timeout for waiting ACK 48 #define SBF_PACKET_TIMEOUT 2 // ms, if now data during this delay assume that full update received 49 #define DISABLE_MSG_INTERVAL 1000000 // us, try to disable message with this interval 52 #define SBF_TRACE_PARSER(...) {} 53 #define SBF_TRACE_RXMSG(...) {} 56 #define SBF_WARN(...) {GPS_WARN(__VA_ARGS__);} 57 #define SBF_DEBUG(...) {} 62 uint8_t dynamic_model)
64 , _gps_position(gps_position)
65 , _satellite_info(satellite_info)
66 , _dynamic_model(dynamic_model)
108 const char *config_cmds;
136 while (*config_cmds != 0) {
137 msg[i] = *config_cmds;
139 if (msg[i++] ==
'\n') {
175 int length =
static_cast<int>(strlen(msg));
177 return (
write(msg, length) == length);
186 int length =
static_cast<int>(strlen(msg));
188 if (
write(msg, length) != length) {
199 bool found_response =
false;
203 int ret =
read(reinterpret_cast<uint8_t *>(buf) + offset,
sizeof(buf) - offset - 1, timeout);
212 buf[offset++] =
'\0';
214 if (!found_response && strstr(buf,
"$R: ") !=
nullptr) {
215 SBF_DEBUG(
"READ %d: %s", (
int)offset, buf);
216 found_response =
true;
219 if (offset >=
sizeof(buf)) {
225 return found_response;
257 for (
int i = 0; i < ret; i++) {
321 }
else if (ret > 0) {
353 uint8_t *p_buf =
reinterpret_cast<uint8_t *
>(&
_buf);
368 crc16(
const uint8_t *data_p, uint32_t length)
374 x = crc >> 8 ^ *data_p++;
376 crc =
static_cast<uint16_t
>((crc << 8) ^ (x << 12) ^ (x << 5) ^ x);
478 memset(&timeinfo, 0,
sizeof(timeinfo));
480 timeinfo.tm_year = 1980 - 1900;
482 timeinfo.tm_mday = 6 +
_buf.
WNc * 7;
483 timeinfo.tm_hour = 0;
485 timeinfo.tm_sec =
_buf.
TOW / 1000;
487 epoch = mktime(&timeinfo);
495 memset(&ts, 0,
sizeof(ts));
497 ts.tv_nsec = (
_buf.
TOW % 1000) * 1000 * 1000;
569 switch (restart_type) {
586 return (res) ? 0 : -2;
int parseChar(const uint8_t b)
Parse the binary SBF packet.
#define SBF_ID_PVTGeodetic
float cog
Course over ground: this is defined as the angle of the vehicle with respect to the local level North...
#define SBF_CONFIG_RTCM_STATIC_OFFSET
#define SBF_PACKET_TIMEOUT
union GPSBaseStationSupport::BaseSettings::@4 settings
GPSDriverSBF(GPSCallbackPtr callback, void *callback_user, struct vehicle_gps_position_s *gps_position, struct satellite_info_s *satellite_info, uint8_t dynamic_model)
virtual ~GPSDriverSBF() override
RTCMParsing * _rtcm_parsing
int setBaudrate(int baudrate)
set the Baudrate
float ve
Velocity in the East direction.
#define SBF_CONFIG_TIMEOUT
int configure(unsigned &baudrate, OutputMode output_mode) override
bool sendMessageAndWaitForAck(const char *msg, const int timeout)
Send a message and waits for acknowledge.
void reset()
reset the parsing state
int read(uint8_t *buf, int buf_length, int timeout)
read from device
uint16_t _rx_payload_index
uint8_t error
PVT error code.
FixedPositionSettings fixed_position
#define SBF_CONFIG_BAUDRATE
double height
Marker ellipsoidal height (with respect to the ellipsoid specified by Datum)
int write(const void *buf, int buf_length)
write to the device
#define SBF_CONFIG_RTCM_STATIC_COORDINATES
static char msg[NUM_MSG][CONFIG_USART1_TXBUFSIZE]
int32_t timestamp_time_relative
int payloadRxAdd(const uint8_t b)
Add payload rx byte.
uint8_t mode_type
Bit field indicating the PVT mode type, as follows: 0: No PVT available (the Error field indicates th...
void gotRTCMMessage(uint8_t *buf, int buf_length)
got an RTCM message from the device
float vn
Velocity in the North direction.
#define SBF_ID_VelCovGeodetic
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
int(* GPSCallbackPtr)(GPSCallbackType type, void *data1, int data2, void *user)
Callback function for platform-specific stuff.
#define SBF_CONFIG_RESET_HOT
double latitude
Marker latitude, from −π/2 to +π/2, positive North of Equator.
struct vehicle_gps_position_s * _gps_position
#define SBF_CONFIG_RESET_WARM
#define GPS_READ_BUFFER_SIZE
buffer size for the read() call. Messages can be longer than that.
uint16_t crc16(const uint8_t *data_p, uint32_t length)
Calculate buffer CRC16.
request RTCM output. This is used for (fixed position) base stations
#define SBF_TRACE_PARSER(...)
uint16_t length
block revision number, starting from 0 at the initial block definition, and incrementing each time ba...
double longitude
Marker longitude, from −π to +π, positive East of Greenwich.
In cold start mode, the receiver has no information from the last position at startup.
#define SBF_TRACE_RXMSG(...)
float cov_ve_ve
Variance of the east-velocity estimate.
In warm start mode, the receiver has approximate information for time, position, and coarse satellite...
int reset(GPSRestartType restart_type) override
Reset GPS device.
uint16_t messageLength() const
uint32_t TOW
The Length field is a 2-byte unsigned integer containing the size of the SBF block.
#define SBF_CONFIG_RTCM_STATIC2
uint8_t * message() const
int payloadRxDone(void)
Finish payload rx.
GPS driver base class with Base Station Support.
uint16_t msg_id
The CRC field is the 16-bit CRC of all the bytes in an SBF block from and including the ID field to t...
void decodeInit(void)
Reset the parse state machine for a fresh start.
#define SBF_TX_CFG_PRT_BAUDRATE
sbf_decode_state_t _decode_state
#define SBF_CONFIG_RTCM_STATIC1
uint8_t _rate_count_lat_lon
float undulation
Geoid undulation computed from the global geoid model defined in the document ’Technical Characteris...
uint16_t WNc
The GPS week number associated with the TOW.
uint64_t _last_timestamp_time
BaseSettings _base_settings
uint8_t nr_sv
Total number of satellites used in the PVT computation.
#define SBF_CONFIG_FORCE_INPUT
struct satellite_info_s * _satellite_info
int receive(unsigned timeout) override
receive & handle new data from the device
bool sendMessage(const char *msg)
Send a message.
#define SBF_CONFIG_RECEIVER_DYNAMICS
In hot start mode, the receiver was powered down only for a short time (4 hours or less)...
#define gps_absolute_time
Get the current time in us.
sbf_payload_vel_cov_geodetic_t payload_vel_col_geodetic
sbf_payload_pvt_geodetic_t payload_pvt_geodetic
#define SBF_CONFIG_RESET_COLD
float cov_vn_vn
Variance of the north-velocity estimate.
Septentrio protocol as defined in PPSDK SBF Reference Guide 4.1.8.
void setClock(timespec &t)
float vu
Velocity in the Up direction.
sbf_payload_dop_t payload_dop
bool addByte(uint8_t b)
add a byte to the message
float cov_vu_vu
Variance of the up - velocity estimate.
uint16_t crc16
The Sync field is a 2-byte array always set to 0x24, 0x40.