Go to the documentation of this file.
38 #include <boost/asio/ip/tcp.hpp>
39 #include <boost/asio/ip/udp.hpp>
40 #include <boost/asio/serial_port.hpp>
41 #include <boost/asio/io_service.hpp>
42 #include <boost/atomic.hpp>
46 #include <ublox/serialization/ublox_msgs.h>
115 uint16_t uart_in, uint16_t uart_out);
129 bool sendRtcm(
const std::vector<uint8_t> &message);
141 void reset(
const boost::posix_time::time_duration& wait);
149 bool configReset(uint16_t nav_bbr_mask, uint16_t reset_mode);
159 const boost::posix_time::time_duration& wait);
175 bool configUart1(
unsigned int baudrate, uint16_t in_proto_mask,
176 uint16_t out_proto_mask);
194 bool configUsb(uint16_t tx_ready, uint16_t in_proto_mask,
195 uint16_t out_proto_mask);
212 bool configRtcm(std::vector<uint8_t> ids, std::vector<uint8_t> rates);
222 bool configSbas(
bool enable, uint8_t usage, uint8_t max_sbas);
239 std::vector<float> arp_position,
240 std::vector<int8_t> arp_position_hp,
241 float fixed_pos_acc);
265 bool setRate(uint8_t class_id, uint8_t message_id, uint8_t rate);
296 bool setPpp(
bool enable,
float protocol_version);
310 bool setUseAdr(
bool enable,
float protocol_version);
337 template <
typename T>
344 template <
typename T>
360 template <
typename T>
362 unsigned int message_id);
369 template <
typename T>
370 bool read(T& message,
384 template <
typename ConfigT>
385 bool poll(ConfigT& message,
386 const std::vector<uint8_t>& payload = std::vector<uint8_t>(),
396 bool poll(uint8_t class_id, uint8_t message_id,
397 const std::vector<uint8_t>& payload = std::vector<uint8_t>());
406 template <
typename ConfigT>
407 bool configure(
const ConfigT& message,
bool wait =
true);
417 uint8_t class_id, uint8_t msg_id);
494 mutable boost::atomic<Ack>
ack_;
502 template <
typename T>
505 if (!
setRate(T::CLASS_ID, T::MESSAGE_ID, rate))
return;
506 subscribe<T>(callback);
509 template <
typename T>
514 template <
typename T>
516 unsigned int message_id) {
520 template <
typename ConfigT>
522 const std::vector<uint8_t>& payload,
523 const boost::posix_time::time_duration& timeout) {
524 if (!
poll(ConfigT::CLASS_ID, ConfigT::MESSAGE_ID, payload))
return false;
525 return read(message, timeout);
528 template <
typename T>
529 bool Gps::read(T& message,
const boost::posix_time::time_duration& timeout) {
534 template <
typename ConfigT>
541 ack_.store(ack, boost::memory_order_seq_cst);
546 if (!writer.
write(message)) {
547 ROS_ERROR(
"Failed to encode config message 0x%02x / 0x%02x",
548 message.CLASS_ID, message.MESSAGE_ID);
552 worker_->send(out.data(), writer.
end() - out.data());
554 if (!
wait)
return true;
564 #endif // UBLOX_GPS_H
bool save_on_shutdown_
Whether or not to save Flash BBR on shutdown.
bool isInitialized() const
void reset(const boost::posix_time::time_duration &wait)
Reset I/O communications.
Callback handlers for incoming u-blox messages.
constexpr static int kWriterSize
Size of write buffer for output messages.
bool configRtcm(std::vector< uint8_t > ids, std::vector< uint8_t > rates)
Configure the RTCM messages with the given IDs to the set rate.
bool configured_
Whether or not the I/O port has been configured.
bool setTimtm2(uint8_t rate)
Enable or disable TIM-TM2 (time mark message).
void processAck(const ublox_msgs::Ack &m)
Callback handler for UBX-ACK message.
void setSaveOnShutdown(bool save_on_shutdown)
If called, when the node shuts down, it will send a command to save the flash memory.
bool configGnss(ublox_msgs::CfgGNSS gnss, const boost::posix_time::time_duration &wait)
Configure the GNSS, cold reset the device, and reset the I/O.
boost::atomic< Ack > ack_
Stores last received ACK accessed by multiple threads.
bool setRate(uint8_t class_id, uint8_t message_id, uint8_t rate)
Set the rate at which the U-Blox device sends the given message.
bool clearBbr()
Send a message to the receiver to delete the BBR data stored in flash.
CallbackHandlers callbacks_
Callback handlers for u-blox messages.
bool configUsb(uint16_t tx_ready, uint16_t in_proto_mask, uint16_t out_proto_mask)
Configure the USB Port.
bool setDynamicModel(uint8_t model)
Set the device dynamic model.
bool setFixMode(uint8_t mode)
Set the device fix mode.
uint8_t msg_id
The message ID of the ACK.
bool configUart1(unsigned int baudrate, uint16_t in_proto_mask, uint16_t out_proto_mask)
Configure the UART1 Port.
bool setUseAdr(bool enable, float protocol_version)
Enable or disable ADR (automotive dead reckoning).
bool configTmode3Fixed(bool lla_flag, std::vector< float > arp_position, std::vector< int8_t > arp_position_hp, float fixed_pos_acc)
Set the TMODE3 settings to fixed.
bool config_on_startup_flag_
bool disableUart1(ublox_msgs::CfgPRT &prev_cfg)
Disable the UART Port. Sets in/out protocol masks to 0. Does not modify other values.
boost::function< void(const T &)> Callback
A callback function.
bool read(T &message, const boost::posix_time::time_duration &timeout)
Read a u-blox message of the given type.
void initializeUdp(std::string host, std::string port)
Initialize UDP I/O.
void insert(typename CallbackHandler_< T >::Callback callback)
AckType
Types for ACK/NACK messages, WAIT is used when waiting for an ACK.
void initializeTcp(std::string host, std::string port)
Initialize TCP I/O.
bool setDeadReckonLimit(uint8_t limit)
Set the dead reckoning time limit.
void subscribeAcks()
Subscribe to ACK/NACK messages and UPD-SOS-ACK messages.
bool read(T &message, const boost::posix_time::time_duration &timeout=default_timeout_)
constexpr static double kDefaultAckTimeout
Default timeout for ACK messages in seconds.
boost::shared_ptr< Worker > worker_
Processes I/O stream data.
bool sendRtcm(const std::vector< uint8_t > &message)
Send rtcm correction message.
uint16_t meas_rate
The measurement [ms], see CfgRate.msg.
constexpr static unsigned int kBaudrates[]
Possible baudrates for u-blox devices.
bool setUTCtime()
Configure the U-Blox to UTC time.
Handles communication with and configuration of the u-blox device.
bool write(const T &message, uint8_t class_id=T::CLASS_ID, uint8_t message_id=T::MESSAGE_ID)
uint8_t class_id
The class ID of the ACK.
bool setPpp(bool enable, float protocol_version)
Enable or disable PPP (precise-point-positioning).
void subscribe(typename CallbackHandler_< T >::Callback callback, unsigned int rate)
Configure the U-Blox send rate of the message & subscribe to the given message.
bool disableTmode3()
Set the TMODE3 settings to disabled. Should only be called for High Precision GNSS devices,...
void initializeSerial(std::string port, unsigned int baudrate, uint16_t uart_in, uint16_t uart_out)
Initialize the Serial I/O port.
void setWorker(const boost::shared_ptr< Worker > &worker)
Set the I/O worker.
bool isConfigured() const
boost::function< void(unsigned char *, std::size_t &)> Callback
void subscribe_nmea(boost::function< void(const std::string &)> callback)
Subscribe to the given Ublox message.
AckType type
The ACK type.
bool configTmode3SurveyIn(unsigned int svin_min_dur, float svin_acc_limit)
Set the TMODE3 settings to survey-in.
void setConfigOnStartup(const bool config_on_startup)
Set the internal flag for enabling or disabling the initial configurations.
bool poll(ConfigT &message, const std::vector< uint8_t > &payload=std::vector< uint8_t >(), const boost::posix_time::time_duration &timeout=default_timeout_)
void resetSerial(std::string port)
Reset the Serial I/O port after u-blox reset.
bool configSbas(bool enable, uint8_t usage, uint8_t max_sbas)
Configure the SBAS settings.
void set_nmea_callback(boost::function< void(const std::string &)> callback)
Add a callback handler for nmea messages.
static const boost::posix_time::time_duration default_timeout_
The default timeout for ACK messages.
void processUpdSosAck(const ublox_msgs::UpdSOS_Ack &m)
Callback handler for UBX-UPD-SOS-ACK message.
uint16_t nav_rate
Navigation rate in measurement cycles, see CfgRate.msg.
bool saveOnShutdown()
Execute save on shutdown procedure.
bool setDgnss(uint8_t mode)
Set the DGNSS mode (see CfgDGNSS message for details).
Stores ACK/NACK messages.
void setRawDataCallback(const Worker::Callback &callback)
Set the callback function which handles raw data.
void subscribeId(typename CallbackHandler_< T >::Callback callback, unsigned int message_id)
Subscribe to the message with the given ID. This is used for messages which have the same format but ...
bool configure(const ConfigT &message, bool wait=true)
Send the given configuration message.
bool waitForAcknowledge(const boost::posix_time::time_duration &timeout, uint8_t class_id, uint8_t msg_id)
Wait for an acknowledge message until the timeout.
void processNack(const ublox_msgs::Ack &m)
Callback handler for UBX-NACK message.
bool configReset(uint16_t nav_bbr_mask, uint16_t reset_mode)
Send a reset message to the u-blox device.
void close()
Closes the I/O port, and initiates save on shutdown procedure if enabled.
bool configRate(uint16_t meas_rate, uint16_t nav_rate)
Configure the device navigation and measurement rate settings.
ublox_gps
Author(s): Johannes Meyer
autogenerated on Wed Dec 7 2022 03:47:53