31 #include <boost/make_shared.hpp> 49 std::stringstream error;
50 error <<
"Unexpected time message size: " <<
msg.data_.size();
54 novatel_gps_msgs::TimePtr ros_msg = boost::make_shared<novatel_gps_msgs::Time>();
60 ros_msg->clock_status =
"VALID";
63 ros_msg->clock_status =
"CONVERGING";
66 ros_msg->clock_status =
"ITERATING";
69 ros_msg->clock_status =
"INVALID";
73 std::stringstream error;
74 error <<
"Unexpected clock status: " << clock_status;
82 ros_msg->utc_month =
msg.data_[32];
83 ros_msg->utc_day =
msg.data_[33];
84 ros_msg->utc_hour =
msg.data_[34];
85 ros_msg->utc_minute =
msg.data_[35];
91 ros_msg->utc_status =
"Invalid";
94 ros_msg->utc_status =
"Valid";
97 ros_msg->utc_status =
"Warning";
101 std::stringstream error;
102 error <<
"Unexpected UTC status: " << utc_status;
110 novatel_gps_msgs::TimePtr
113 novatel_gps_msgs::TimePtr
msg = boost::make_shared<novatel_gps_msgs::Time>();
116 std::stringstream error;
117 error <<
"Unexpected number of fields in TIME log: " << sentence.body.size();
121 msg->clock_status = sentence.body[0];
122 valid &=
ParseDouble(sentence.body[1], msg->offset);
123 valid &=
ParseDouble(sentence.body[2], msg->offset_std);
124 valid &=
ParseDouble(sentence.body[3], msg->utc_offset);
125 valid &=
ParseUInt32(sentence.body[4], msg->utc_year, 10);
126 valid &=
ParseUInt8(sentence.body[5], msg->utc_month, 10);
127 valid &=
ParseUInt8(sentence.body[6], msg->utc_day, 10);
128 valid &=
ParseUInt8(sentence.body[7], msg->utc_hour, 10);
129 valid &=
ParseUInt8(sentence.body[8], msg->utc_minute, 10);
130 valid &=
ParseUInt32(sentence.body[9], msg->utc_millisecond, 10);
131 msg->utc_status = sentence.body[10];
bool ParseUInt8(const std::string &string, uint8_t &value, int32_t base=10)
Parses a string containing an integer number into a uint16_t.
novatel_gps_msgs::TimePtr ParseAscii(const NovatelSentence &sentence) noexcept(false) override
Converts sentence into a ROS message pointer and returns it.
double ParseDouble(const uint8_t *buffer)
Converts a buffer containing 8 bytes into a double.
static constexpr size_t ASCII_FIELD
uint32_t ParseUInt32(const uint8_t *buffer)
Converts a buffer containing 4 bytes into an unsigned 32-bit int.
uint32_t GetMessageId() const override
novatel_gps_msgs::TimePtr ParseBinary(const BinaryMessage &bin_msg) noexcept(false) override
Converts bin_msg into a ROS message pointer and returns it.
static constexpr uint16_t MESSAGE_ID
const std::string GetMessageName() const override
static const std::string MESSAGE_NAME
static constexpr size_t BINARY_LENGTH