31 #include <boost/make_shared.hpp> 47 novatel_gps_msgs::InspvaxPtr
52 std::stringstream error;
53 error <<
"Unexpected inspvax message size: " << bin_msg.data_.size();
56 novatel_gps_msgs::InspvaxPtr ros_msg = boost::make_shared<novatel_gps_msgs::Inspvax>();
58 ros_msg->novatel_msg_header = h_parser.
ParseBinary(bin_msg);
61 uint16_t solution_status =
ParseUInt16(&bin_msg.data_[0]);
64 std::stringstream error;
65 error <<
"Unknown solution status: " << solution_status;
72 std::stringstream error;
73 error <<
"Unknown position type: " << pos_type;
81 ros_msg->longitude =
ParseDouble(&bin_msg.data_[16]);
82 ros_msg->altitude =
ParseDouble(&bin_msg.data_[24]);
83 ros_msg->undulation =
ParseFloat(&bin_msg.data_[32]);
84 ros_msg->north_velocity =
ParseDouble(&bin_msg.data_[36]);
85 ros_msg->east_velocity =
ParseDouble(&bin_msg.data_[44]);
86 ros_msg->up_velocity =
ParseDouble(&bin_msg.data_[52]);
91 ros_msg->latitude_std =
ParseFloat(&bin_msg.data_[84]);
92 ros_msg->longitude_std =
ParseFloat(&bin_msg.data_[88]);
93 ros_msg->altitude_std =
ParseFloat(&bin_msg.data_[92]);
95 ros_msg->north_velocity_std =
ParseFloat(&bin_msg.data_[96]);
96 ros_msg->east_velocity_std =
ParseFloat(&bin_msg.data_[100]);
97 ros_msg->up_velocity_std =
ParseFloat(&bin_msg.data_[104]);
99 ros_msg->roll_std =
ParseFloat(&bin_msg.data_[108]);
100 ros_msg->pitch_std =
ParseFloat(&bin_msg.data_[112]);
101 ros_msg->azimuth_std =
ParseFloat(&bin_msg.data_[116]);
103 ros_msg->extended_status);
104 ros_msg->seconds_since_update =
ParseUInt16(&bin_msg.data_[124]);
109 novatel_gps_msgs::InspvaxPtr
114 std::stringstream error;
115 error <<
"Unexpected number of fields in INSPVA log: " << sentence.body.size();
118 novatel_gps_msgs::InspvaxPtr
msg = boost::make_shared<novatel_gps_msgs::Inspvax>();
120 msg->novatel_msg_header = h_parser.
ParseAscii(sentence);
124 msg->ins_status = sentence.body[0];
125 msg->position_type = sentence.body[1];
126 valid &=
ParseDouble(sentence.body[2], msg->latitude);
127 valid &=
ParseDouble(sentence.body[3], msg->longitude);
128 valid &=
ParseDouble(sentence.body[4], msg->altitude);
129 valid &=
ParseFloat(sentence.body[5], msg->undulation);
130 valid &=
ParseDouble(sentence.body[6], msg->north_velocity);
131 valid &=
ParseDouble(sentence.body[7], msg->east_velocity);
132 valid &=
ParseDouble(sentence.body[8], msg->up_velocity);
134 valid &=
ParseDouble(sentence.body[10], msg->pitch);
135 valid &=
ParseDouble(sentence.body[11], msg->azimuth);
136 valid &=
ParseFloat(sentence.body[12], msg->latitude_std);
137 valid &=
ParseFloat(sentence.body[13], msg->longitude_std);
138 valid &=
ParseFloat(sentence.body[14], msg->altitude_std);
139 valid &=
ParseFloat(sentence.body[15], msg->north_velocity_std);
140 valid &=
ParseFloat(sentence.body[16], msg->east_velocity_std);
141 valid &=
ParseFloat(sentence.body[17], msg->up_velocity_std);
142 valid &=
ParseFloat(sentence.body[18], msg->roll_std);
143 valid &=
ParseFloat(sentence.body[19], msg->pitch_std);
144 valid &=
ParseFloat(sentence.body[20], msg->azimuth_std);
147 uint32_t extended_solution_status = 0;
148 valid = valid &&
ParseUInt32(sentence.body[21], extended_solution_status, 16);
150 extended_solution_status, msg->extended_status);
153 valid &=
ParseUInt16(sentence.body[22], msg->seconds_since_update);
novatel_gps_msgs::InspvaxPtr ParseAscii(const NovatelSentence &sentence) noexcept(false) override
Converts sentence into a ROS message pointer and returns it.
uint16_t ParseUInt16(const uint8_t *buffer)
Converts a buffer containing 2 bytes into an unsigned 16-bit int.
static const std::string MESSAGE_NAME
uint32_t GetMessageId() const override
const size_t MAX_POSITION_TYPE
const std::string GetMessageName() const override
double ParseDouble(const uint8_t *buffer)
Converts a buffer containing 8 bytes into a double.
const std::string POSITION_TYPES[]
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.
const std::string SOLUTION_STATUSES[]
void GetExtendedSolutionStatusMessage(uint32_t status, novatel_gps_msgs::NovatelExtendedSolutionStatus &msg)
const size_t MAX_SOLUTION_STATUS
static constexpr uint32_t MESSAGE_ID
static constexpr size_t BINARY_LENGTH
static constexpr size_t ASCII_FIELDS
novatel_gps_msgs::InspvaxPtr ParseBinary(const BinaryMessage &bin_msg) noexcept(false) override
Converts bin_msg into a ROS message pointer and returns it.