32 #include <boost/make_shared.hpp> 46 novatel_gps_msgs::InscovPtr
51 std::stringstream error;
52 error <<
"Unexpected inscov message size: " << bin_msg.data_.size();
55 novatel_gps_msgs::InscovPtr ros_msg = boost::make_shared<novatel_gps_msgs::Inscov>();
57 ros_msg->novatel_msg_header = h_parser.
ParseBinary(bin_msg);
63 for (
int i = 0; i < 9; i++, offset += 8)
65 ros_msg->position_covariance[i] =
ParseDouble(&bin_msg.data_[offset]);
67 for (
int i = 0; i < 9; i++, offset += 8)
69 ros_msg->attitude_covariance[i] =
ParseDouble(&bin_msg.data_[offset]);
71 for (
int i = 0; i < 9; i++, offset += 8)
73 ros_msg->velocity_covariance[i] =
ParseDouble(&bin_msg.data_[offset]);
78 novatel_gps_msgs::InscovPtr
83 std::stringstream error;
84 error <<
"Unexpected number of fields in INSCOV log: " << sentence.body.size();
87 novatel_gps_msgs::InscovPtr ros_msg = boost::make_shared<novatel_gps_msgs::Inscov>();
89 ros_msg->novatel_msg_header = h_parser.
ParseAscii(sentence);
93 valid &=
ParseUInt32(sentence.body[0], ros_msg->week);
94 valid &=
ParseDouble(sentence.body[1], ros_msg->seconds);
97 for (
int i = 0; i < 9; i++, offset++)
99 valid &=
ParseDouble(sentence.body[offset], ros_msg->position_covariance[i]);
101 for (
int i = 0; i < 9; i++, offset++)
103 valid &=
ParseDouble(sentence.body[offset], ros_msg->attitude_covariance[i]);
105 for (
int i = 0; i < 9; i++, offset++)
107 valid &=
ParseDouble(sentence.body[offset], ros_msg->velocity_covariance[i]);
static constexpr size_t BINARY_LENGTH
const std::string GetMessageName() const override
uint32_t GetMessageId() const override
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.
novatel_gps_msgs::InscovPtr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
static constexpr size_t ASCII_FIELDS
static constexpr uint32_t MESSAGE_ID
novatel_gps_msgs::InscovPtr ParseBinary(const BinaryMessage &bin_msg) override
Converts bin_msg into a ROS message pointer and returns it.