33 #include <boost/make_shared.hpp> 51 std::stringstream error;
52 error <<
"Unexpected velocity message size: " << bin_msg.data_.size();
55 novatel_gps_msgs::NovatelVelocityPtr ros_msg = boost::make_shared<novatel_gps_msgs::NovatelVelocity>();
57 ros_msg->novatel_msg_header = h_parser.
ParseBinary(bin_msg);
60 uint16_t solution_status =
ParseUInt16(&bin_msg.data_[0]);
63 std::stringstream error;
64 error <<
"Unknown solution status: " << solution_status;
71 std::stringstream error;
72 error <<
"Unknown position type: " << pos_type;
76 ros_msg->latency =
ParseFloat(&bin_msg.data_[8]);
78 ros_msg->horizontal_speed =
ParseDouble(&bin_msg.data_[16]);
79 ros_msg->track_ground =
ParseDouble(&bin_msg.data_[24]);
80 ros_msg->vertical_speed =
ParseDouble(&bin_msg.data_[32]);
87 novatel_gps_msgs::NovatelVelocityPtr
msg = boost::make_shared<novatel_gps_msgs::NovatelVelocity>();
89 msg->novatel_msg_header = h_parser.
ParseAscii(sentence);
93 std::stringstream error;
94 error <<
"Unexpected number of BESTVEL message fields: " << sentence.body.size();
98 msg->solution_status = sentence.body[0];
99 msg->velocity_type = sentence.body[1];
100 valid = valid &&
ParseFloat(sentence.body[2], msg->latency);
101 valid = valid &&
ParseFloat(sentence.body[3], msg->age);
102 valid = valid &&
ParseDouble(sentence.body[4], msg->horizontal_speed);
103 valid = valid &&
ParseDouble(sentence.body[5], msg->track_ground);
104 valid = valid &&
ParseDouble(sentence.body[6], msg->vertical_speed);
static constexpr size_t ASCII_LENGTH
uint16_t ParseUInt16(const uint8_t *buffer)
Converts a buffer containing 2 bytes into an unsigned 16-bit int.
uint32_t GetMessageId() const override
const std::string GetMessageName() const override
novatel_gps_msgs::NovatelVelocityPtr ParseAscii(const NovatelSentence &sentence) noexcept(false) override
Converts sentence into a ROS message pointer and returns it.
const size_t MAX_POSITION_TYPE
novatel_gps_msgs::NovatelVelocityPtr ParseBinary(const BinaryMessage &bin_msg) noexcept(false) override
Converts bin_msg into a ROS message pointer and returns it.
double ParseDouble(const uint8_t *buffer)
Converts a buffer containing 8 bytes into a double.
const std::string POSITION_TYPES[]
static constexpr size_t BINARY_LENGTH
float ParseFloat(const uint8_t *buffer)
Converts a buffer containing 4 bytes into a float.
const std::string SOLUTION_STATUSES[]
const size_t MAX_SOLUTION_STATUS
static const std::string MESSAGE_NAME
static constexpr uint16_t MESSAGE_ID