40 std::make_pair(
"4013", 0), std::make_pair(
"4027", 1), std::make_pair(
"4001", 2),
41 std::make_pair(
"4007", 3), std::make_pair(
"5906", 4), std::make_pair(
"5908", 5),
42 std::make_pair(
"5938", 6), std::make_pair(
"5939", 7), std::make_pair(
"4226", 8)};
45 std::make_pair(
"4007", 0), std::make_pair(
"5906", 1), std::make_pair(
"4226", 2)};
48 std::make_pair(
"4007", 0), std::make_pair(
"5906", 1), std::make_pair(
"5938", 2),
49 std::make_pair(
"5939", 3), std::make_pair(
"4226", 4)};
52 std::make_pair(
"4014", 0), std::make_pair(
"4082", 1)};
54 std::pair<std::string, uint32_t>
imu_pairs[] = {std::make_pair(
"4226", 0),
55 std::make_pair(
"4050", 1)};
97 if (!(ID_temp ==
"4013" || ID_temp ==
"4001" || ID_temp ==
"4014" ||
109 }
catch (std::runtime_error& e)
111 throw std::runtime_error(e.what());
121 CallbackMap::key_type key =
"NavSatFix";
127 for (CallbackMap::iterator
callback =
134 }
catch (std::runtime_error& e)
136 throw std::runtime_error(e.what());
148 CallbackMap::key_type key =
"INSNavSatFix";
154 for (CallbackMap::iterator
callback =
161 }
catch (std::runtime_error& e)
163 throw std::runtime_error(e.what());
176 CallbackMap::key_type key =
"PoseWithCovarianceStamped";
183 for (CallbackMap::iterator
callback =
190 }
catch (std::runtime_error& e)
192 throw std::runtime_error(e.what());
205 CallbackMap::key_type key =
"INSPoseWithCovarianceStamped";
211 for (CallbackMap::iterator
callback =
218 }
catch (std::runtime_error& e)
220 throw std::runtime_error(e.what());
233 if (ID_temp ==
"4014" || ID_temp ==
"4082" || ID_temp ==
"5902")
241 }
catch (std::runtime_error& e)
243 throw std::runtime_error(e.what());
247 CallbackMap::key_type key2 =
"DiagnosticArray";
258 }
catch (std::runtime_error& e)
260 throw std::runtime_error(e.what());
272 CallbackMap::key_type key =
"Imu";
278 for (CallbackMap::iterator
callback =
285 }
catch (std::runtime_error& e)
287 throw std::runtime_error(e.what());
300 CallbackMap::key_type key =
"Localization";
306 for (CallbackMap::iterator
callback =
313 }
catch (std::runtime_error& e)
315 throw std::runtime_error(e.what());
328 CallbackMap::key_type key1 =
"GPST";
332 if (ID_temp ==
"4007")
334 for (CallbackMap::iterator
callback =
341 }
catch (std::runtime_error& e)
343 throw std::runtime_error(e.what());
353 CallbackMap::key_type key1 =
"GPST";
357 if (ID_temp ==
"4226")
359 for (CallbackMap::iterator
callback =
366 }
catch (std::runtime_error& e)
368 throw std::runtime_error(e.what());
381 if (ID_temp ==
"4013" || ID_temp ==
"4001")
386 for (CallbackMap::iterator
callback =
393 }
catch (std::runtime_error& e)
395 throw std::runtime_error(e.what());
399 CallbackMap::key_type key2 =
"GPSFix";
404 for (CallbackMap::iterator
callback =
411 }
catch (std::runtime_error& e)
413 throw std::runtime_error(e.what());
427 if (ID_temp ==
"4013" || ID_temp ==
"4001")
432 for (CallbackMap::iterator
callback =
439 }
catch (std::runtime_error& e)
441 throw std::runtime_error(e.what());
445 CallbackMap::key_type key2 =
"INSGPSFix";
450 for (CallbackMap::iterator
callback =
457 }
catch (std::runtime_error& e)
459 throw std::runtime_error(e.what());
479 std::size_t sbf_block_length;
484 "ROSaic reading SBF block " + ID_temp +
" made up of " +
485 std::to_string(sbf_block_length) +
" bytes...");
491 "Not a valid SBF block, parts of the SBF block are yet to be received. Ignore..");
498 (ID_temp ==
"4013" || ID_temp ==
"4027" ||
499 ID_temp ==
"4001" || ID_temp ==
"4007" ||
500 ID_temp ==
"5906" || ID_temp ==
"5908" ||
501 ID_temp ==
"5938" || ID_temp ==
"5939"))
512 (ID_temp ==
"4013" || ID_temp ==
"4027" ||
513 ID_temp ==
"4001" || ID_temp ==
"4226"))
524 (ID_temp ==
"4007" || ID_temp ==
"5906"))
547 (ID_temp ==
"4007" || ID_temp ==
"5906" ||
548 ID_temp ==
"5938" || ID_temp ==
"5939"))
567 (ID_temp ==
"4014" || ID_temp ==
"4082"))
587 boost::char_separator<char> sep(
"\r");
588 typedef boost::tokenizer<boost::char_separator<char>> tokenizer;
592 std::string block_in_string(
595 tokenizer tokens(block_in_string, sep);
597 "The NMEA message contains " + std::to_string(nmea_size) +
598 " bytes and is ready to be parsed. It reads: " +
605 std::string block_in_string(
609 std::to_string(response_size) +
610 " bytes and reads:\n " +
622 "Invalid command just sent to the Rx! The Rx's response contains " +
623 std::to_string(response_size) +
" bytes and reads:\n " +
637 "The connection descriptor for the TCP connection is " + cd);
653 }
catch (std::runtime_error& e)
656 "Incomplete message: " + std::string(e.what()));
bool gnss_gpsfix_complete(uint32_t id)
Wether all blocks from GNSS have arrived for GpsFix Message.
static std::string do_imu_
bool isConnectionDescriptor()
bool isResponse()
Determines whether data_ currently points to an NMEA message.
const uint8_t * search()
Searches the buffer for the beginning of the next message (NMEA or SBF)
std::unordered_map< std::string, uint32_t > PoseWithCovarianceStampedMap
RxMessage rx_message_
RxMessage parser.
bool gnss_pose_complete(uint32_t id)
Wether all blocks from GNSS have arrived for Pose Message.
bool publish_tf
Whether or not to publish the tf of the localization.
void readCallback(Timestamp recvTimestamp, const uint8_t *data, std::size_t &size)
Searches for Rx messages that could potentially be decoded/parsed/published.
bool ins_gpsfix_complete(uint32_t id)
Wether all blocks from INS have arrived for GpsFix Message.
std::pair< std::string, uint32_t > diagnosticarray_pairs[]
std::pair< std::string, uint32_t > navsatfix_pairs[]
static std::string do_insnavsatfix_
static std::string do_gpsfix_
static LocalizationMap localization_map
void log(LogLevel logLevel, const std::string &s)
Log function to provide abstraction of ROS loggers.
static std::string do_diagnostics_
boost::mutex g_response_mutex
Mutex to control changes of global variable "g_response_received".
bool isNMEA()
Determines whether data_ currently points to an NMEA message.
const uint8_t * getPosBuffer()
Gets the current position in the read buffer.
bool publish_gpst
Whether or not to publish the TimeReferenceMsg message with GPST.
bool diagnostics_complete(uint32_t id)
Wether all blocks have arrived for Diagnostics Message.
static boost::mutex callback_mutex_
void handle()
Called every time rx_message is found to contain some potentially useful message. ...
static std::string do_inslocalization_
void newData(Timestamp recvTimestamp, const uint8_t *data, std::size_t &size)
Put new data.
bool gnss_navsatfix_complete(uint32_t id)
Wether all blocks from GNSS have arrived for NavSatFix Message.
bool isSBF()
Determines whether data_ currently points to an SBF block.
bool g_response_received
Determines whether a command reply was received from the Rx.
static std::string do_insgpsfix_
bool ins_pose_complete(uint32_t id)
Wether all blocks from INS have arrived for Pose Message.
bool ins_navsatfix_complete(uint32_t id)
Wether all blocks from INS have arrived for NavSatFix Message.
std::unordered_map< std::string, uint32_t > LocalizationMap
std::pair< std::string, uint32_t > localization_pairs[]
static NavSatFixMap navsatfix_map
boost::mutex g_cd_mutex
Mutex to control changes of global variable "g_cd_received".
bool ins_localization_complete(uint32_t id)
Wether all blocks have arrived for Localization Message.
std::size_t messageSize()
std::string g_rx_tcp_port
Rx TCP port, e.g. IP10 or IP11, to which ROSaic is connected to.
std::size_t getCount()
Returns the count_ variable.
bool publish_localization
Whether or not to publish the LocalizationMsg message.
ROSaicNodeBase * node_
Pointer to Node.
bool g_cd_received
Determines whether the connection descriptor was received from the Rx.
std::string septentrio_receiver_type
Septentrio receiver type, either "gnss" or "ins".
std::pair< std::string, uint32_t > gpsfix_pairs[]
uint16_t getBlockLength()
Gets the length of the SBF block.
static DiagnosticArrayMap diagnosticarray_map
static std::string do_inspose_
bool publish_gpsfix
Whether or not to publish the GPSFixMsg message.
boost::condition_variable g_cd_condition
Condition variable complementing "g_cd_mutex".
bool publish_imu
Whether or not to publish the ImuMsg message.
std::unordered_map< std::string, uint32_t > ImuMap
const uint8_t * getEndBuffer()
Gets the end position in the read buffer.
boost::condition_variable g_response_condition
Condition variable complementing "g_response_mutex".
std::unordered_map< std::string, uint32_t > GPSFixMap
static GPSFixMap gpsfix_map
std::unordered_map< std::string, uint32_t > NavSatFixMap
Handles callbacks when reading NMEA/SBF messages.
std::pair< std::string, uint32_t > pose_pairs[]
std::unordered_map< std::string, uint32_t > DiagnosticArrayMap
void callback(const sensor_msgs::NavSatFixConstPtr &fix)
bool publish_diagnostics
Whether or not to publish the DiagnosticArrayMsg message.
bool found()
Has an NMEA message, SBF block or command reply been found in the buffer?
bool publish_pose
Whether or not to publish the PoseWithCovarianceStampedMsg message.
static PoseWithCovarianceStampedMap pose_map
Settings * settings_
Settings.
static std::string do_navsatfix_
bool publish_navsatfix
Whether or not to publish the NavSatFixMsg message.
static std::string do_pose_
std::pair< std::string, uint32_t > imu_pairs[]