|
56 | 56 | #include <ublox_msgs/msg/nav_posecef.hpp> |
57 | 57 | #include <ublox_msgs/msg/nav_status.hpp> |
58 | 58 |
|
| 59 | +#include <nmea_msgs/msg/sentence.hpp> |
| 60 | + |
59 | 61 | #include <ublox_gps/adr_udr_product.hpp> |
60 | 62 | #include <ublox_gps/fix_diagnostic.hpp> |
61 | 63 | #include <ublox_gps/fts_product.hpp> |
@@ -217,11 +219,11 @@ void UbloxNode::addFirmwareInterface() { |
217 | 219 |
|
218 | 220 | void UbloxNode::addProductInterface(const std::string & product_category, |
219 | 221 | const std::string & ref_rov) { |
220 | | - if (product_category == "HPG" && ref_rov == "REF") { |
| 222 | + if ((product_category == "HPG" || product_category == "HPS") && ref_rov == "REF") { |
221 | 223 | components_.push_back(std::make_shared<HpgRefProduct>(nav_rate_, meas_rate_, updater_, rtcms_, this)); |
222 | | - } else if (product_category == "HPG" && ref_rov == "ROV") { |
| 224 | + } else if ((product_category == "HPG" || product_category == "HPS") && ref_rov == "ROV") { |
223 | 225 | components_.push_back(std::make_shared<HpgRovProduct>(nav_rate_, updater_, this)); |
224 | | - } else if (product_category == "HPG") { |
| 226 | + } else if (product_category == "HPG" || product_category == "HPS") { |
225 | 227 | components_.push_back(std::make_shared<HpPosRecProduct>(nav_rate_, meas_rate_, frame_id_, updater_, rtcms_, this)); |
226 | 228 | } else if (product_category == "TIM") { |
227 | 229 | components_.push_back(std::make_shared<TimProduct>(frame_id_, updater_, this)); |
@@ -441,6 +443,8 @@ void UbloxNode::getRosParams() { |
441 | 443 |
|
442 | 444 | this->declare_parameter("publish.tim.tm2", false); |
443 | 445 |
|
| 446 | + this->declare_parameter("publish.nmea", true); |
| 447 | + |
444 | 448 | // INF parameters |
445 | 449 | this->declare_parameter("inf.all", true); |
446 | 450 | this->declare_parameter("inf.debug", false); |
@@ -489,6 +493,10 @@ void UbloxNode::getRosParams() { |
489 | 493 | if (getRosBoolean(this, "publish.aid.hui")) { |
490 | 494 | aid_hui_pub_ = this->create_publisher<ublox_msgs::msg::AidHUI>("aidhui", 1); |
491 | 495 | } |
| 496 | + if (getRosBoolean(this, "publish.nmea")) { |
| 497 | + // Larger queue depth to handle all NMEA strings being published consecutively |
| 498 | + nmea_pub_ = this->create_publisher<nmea_msgs::msg::Sentence>("nmea", 20); |
| 499 | + } |
492 | 500 |
|
493 | 501 | // Create subscriber for RTCM correction data to enable RTK |
494 | 502 | this->subscription_ = this->create_subscription<rtcm_msgs::msg::Message>("/rtcm", 10, std::bind(&UbloxNode::rtcmCallback, this, std::placeholders::_1)); |
@@ -606,6 +614,16 @@ void UbloxNode::subscribe() { |
606 | 614 | 1); |
607 | 615 | } |
608 | 616 |
|
| 617 | + if (getRosBoolean(this, "publish.nmea")) { |
| 618 | + gps_->subscribe_nmea([this](const std::string &sentence) { |
| 619 | + nmea_msgs::msg::Sentence m; |
| 620 | + m.header.stamp = this->now(); |
| 621 | + m.header.frame_id = frame_id_; |
| 622 | + m.sentence = sentence; |
| 623 | + nmea_pub_->publish(m); |
| 624 | + }); |
| 625 | + } |
| 626 | + |
609 | 627 | for (const std::shared_ptr<ComponentInterface> & component : components_) { |
610 | 628 | component->subscribe(gps_); |
611 | 629 | } |
|
0 commit comments