31 #include <boost/make_shared.hpp> 47 const size_t MIN_LENGTH = 8;
49 if (sentence.body.size() != MIN_LENGTH)
51 std::stringstream error;
52 error <<
"Expected ClockSteering length >= " << MIN_LENGTH
53 <<
", actual length = " << sentence.body.size();
56 novatel_gps_msgs::ClockSteeringPtr
msg = boost::make_shared<novatel_gps_msgs::ClockSteering>();
58 msg->source = sentence.body[0];
59 msg->steering_state = sentence.body[1];
66 if (!
ParseDouble(sentence.body[3], msg->pulse_width))
68 throw ParseException(
"Error parsing pulse_width in ClockSteering.");
86 if (!
ParseDouble(sentence.body[7], msg->drift_rate))
88 throw ParseException(
"Error parsing drift_rate in ClockSteering.");
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.
uint32_t ParseUInt32(const uint8_t *buffer)
Converts a buffer containing 4 bytes into an unsigned 32-bit int.
float ParseFloat(const uint8_t *buffer)
Converts a buffer containing 4 bytes into a float.
static const std::string MESSAGE_NAME
novatel_gps_msgs::ClockSteeringPtr ParseAscii(const NovatelSentence &sentence) noexcept(false) override
Converts sentence into a ROS message pointer and returns it.