32 #include <boost/make_shared.hpp> 46 novatel_gps_msgs::NovatelCorrectedImuDataPtr
51 std::stringstream error;
52 error <<
"Unexpected corrimudata message size: " << bin_msg.data_.size();
55 novatel_gps_msgs::NovatelCorrectedImuDataPtr ros_msg = boost::make_shared<novatel_gps_msgs::NovatelCorrectedImuData>();
57 ros_msg->novatel_msg_header = h_parser.
ParseBinary(bin_msg);
58 ros_msg->novatel_msg_header.message_name =
"CORRIMUDATA";
60 ros_msg->gps_week_num =
ParseUInt32(&bin_msg.data_[0]);
61 ros_msg->gps_seconds =
ParseDouble(&bin_msg.data_[4]);
62 ros_msg->pitch_rate =
ParseDouble(&bin_msg.data_[12]);
63 ros_msg->roll_rate =
ParseDouble(&bin_msg.data_[20]);
64 ros_msg->yaw_rate =
ParseDouble(&bin_msg.data_[28]);
65 ros_msg->lateral_acceleration =
ParseDouble(&bin_msg.data_[36]);
66 ros_msg->longitudinal_acceleration =
ParseDouble(&bin_msg.data_[44]);
67 ros_msg->vertical_acceleration =
ParseDouble(&bin_msg.data_[52]);
72 novatel_gps_msgs::NovatelCorrectedImuDataPtr
77 std::stringstream error;
78 error <<
"Unexpected number of fields in CORRIMUDATA log: " << sentence.body.size();
81 novatel_gps_msgs::NovatelCorrectedImuDataPtr
msg = boost::make_shared<novatel_gps_msgs::NovatelCorrectedImuData>();
83 msg->novatel_msg_header = h_parser.
ParseAscii(sentence);
87 valid &=
ParseUInt32(sentence.body[0], msg->gps_week_num);
88 valid &=
ParseDouble(sentence.body[1], msg->gps_seconds);
89 valid &=
ParseDouble(sentence.body[2], msg->pitch_rate);
90 valid &=
ParseDouble(sentence.body[3], msg->roll_rate);
91 valid &=
ParseDouble(sentence.body[4], msg->yaw_rate);
92 valid &=
ParseDouble(sentence.body[5], msg->lateral_acceleration);
93 valid &=
ParseDouble(sentence.body[6], msg->longitudinal_acceleration);
94 valid &=
ParseDouble(sentence.body[7], msg->vertical_acceleration);
static constexpr size_t ASCII_FIELDS
uint32_t GetMessageId() const override
static constexpr size_t BINARY_LENGTH
static constexpr uint16_t MESSAGE_ID
double ParseDouble(const uint8_t *buffer)
Converts a buffer containing 8 bytes into a double.
static const std::string MESSAGE_NAME
uint32_t ParseUInt32(const uint8_t *buffer)
Converts a buffer containing 4 bytes into an unsigned 32-bit int.
const std::string GetMessageName() const override
novatel_gps_msgs::NovatelCorrectedImuDataPtr ParseAscii(const NovatelSentence &sentence) noexcept(false) override
Converts sentence into a ROS message pointer and returns it.
novatel_gps_msgs::NovatelCorrectedImuDataPtr ParseBinary(const BinaryMessage &bin_msg) noexcept(false) override
Converts bin_msg into a ROS message pointer and returns it.