diff --git a/nav2_amcl/src/amcl_node.cpp b/nav2_amcl/src/amcl_node.cpp index 15c572d2ed9..9c6f6c780e9 100644 --- a/nav2_amcl/src/amcl_node.cpp +++ b/nav2_amcl/src/amcl_node.cpp @@ -1215,7 +1215,7 @@ AmclNode::updateParametersCallback( map_sub_ = create_subscription( map_topic_, std::bind(&AmclNode::mapReceived, this, std::placeholders::_1), - nav2::qos::LatchedSubscriptionQoS()); + nav2::qos::LatchedSubscriptionQoS(1)); } } @@ -1387,7 +1387,7 @@ AmclNode::initPubSub() map_sub_ = create_subscription( map_topic_, std::bind(&AmclNode::mapReceived, this, std::placeholders::_1), - nav2::qos::LatchedSubscriptionQoS()); + nav2::qos::LatchedSubscriptionQoS(1)); RCLCPP_INFO(get_logger(), "Subscribed to map topic."); } diff --git a/nav2_costmap_2d/include/nav2_costmap_2d/costmap_subscriber.hpp b/nav2_costmap_2d/include/nav2_costmap_2d/costmap_subscriber.hpp index c817125f50d..4edc6227bbd 100644 --- a/nav2_costmap_2d/include/nav2_costmap_2d/costmap_subscriber.hpp +++ b/nav2_costmap_2d/include/nav2_costmap_2d/costmap_subscriber.hpp @@ -53,7 +53,7 @@ class CostmapSubscriber costmap_sub_ = nav2::interfaces::create_subscription( parent, topic_name_, std::bind(&CostmapSubscriber::costmapCallback, this, std::placeholders::_1), - nav2::qos::LatchedSubscriptionQoS()); + nav2::qos::LatchedSubscriptionQoS(1)); costmap_update_sub_ = nav2::interfaces::create_subscription( parent, topic_name_ + "_updates", diff --git a/nav2_costmap_2d/plugins/costmap_filters/binary_filter.cpp b/nav2_costmap_2d/plugins/costmap_filters/binary_filter.cpp index c805a537396..68f55f570c1 100644 --- a/nav2_costmap_2d/plugins/costmap_filters/binary_filter.cpp +++ b/nav2_costmap_2d/plugins/costmap_filters/binary_filter.cpp @@ -144,7 +144,7 @@ void BinaryFilter::filterInfoCallback( mask_sub_ = node->create_subscription( mask_topic_, std::bind(&BinaryFilter::maskCallback, this, std::placeholders::_1), - nav2::qos::LatchedSubscriptionQoS()); + nav2::qos::LatchedSubscriptionQoS(1)); } void BinaryFilter::maskCallback( diff --git a/nav2_costmap_2d/plugins/costmap_filters/keepout_filter.cpp b/nav2_costmap_2d/plugins/costmap_filters/keepout_filter.cpp index c432a917e59..c7204803eac 100644 --- a/nav2_costmap_2d/plugins/costmap_filters/keepout_filter.cpp +++ b/nav2_costmap_2d/plugins/costmap_filters/keepout_filter.cpp @@ -133,7 +133,7 @@ void KeepoutFilter::filterInfoCallback( mask_sub_ = node->create_subscription( mask_topic_, std::bind(&KeepoutFilter::maskCallback, this, std::placeholders::_1), - nav2::qos::LatchedSubscriptionQoS()); + nav2::qos::LatchedSubscriptionQoS(1)); } void KeepoutFilter::maskCallback( diff --git a/nav2_costmap_2d/plugins/costmap_filters/speed_filter.cpp b/nav2_costmap_2d/plugins/costmap_filters/speed_filter.cpp index c1e822cb03a..a7ce0eaed85 100644 --- a/nav2_costmap_2d/plugins/costmap_filters/speed_filter.cpp +++ b/nav2_costmap_2d/plugins/costmap_filters/speed_filter.cpp @@ -152,7 +152,7 @@ void SpeedFilter::filterInfoCallback( mask_sub_ = node->create_subscription( mask_topic_, std::bind(&SpeedFilter::maskCallback, this, std::placeholders::_1), - nav2::qos::LatchedSubscriptionQoS()); + nav2::qos::LatchedSubscriptionQoS(1)); } void SpeedFilter::maskCallback( diff --git a/nav2_costmap_2d/plugins/static_layer.cpp b/nav2_costmap_2d/plugins/static_layer.cpp index 94aa69f87f8..056866f3ee6 100644 --- a/nav2_costmap_2d/plugins/static_layer.cpp +++ b/nav2_costmap_2d/plugins/static_layer.cpp @@ -77,7 +77,7 @@ StaticLayer::onInitialize() rclcpp::QoS map_qos = nav2::qos::StandardTopicQoS(); // initialize to default if (map_subscribe_transient_local_) { - map_qos = nav2::qos::LatchedSubscriptionQoS(); + map_qos = nav2::qos::LatchedSubscriptionQoS(1); } RCLCPP_INFO( diff --git a/nav2_costmap_2d/plugins/voxel_layer.cpp b/nav2_costmap_2d/plugins/voxel_layer.cpp index 278ef40e7a5..b6c66968d4e 100644 --- a/nav2_costmap_2d/plugins/voxel_layer.cpp +++ b/nav2_costmap_2d/plugins/voxel_layer.cpp @@ -96,7 +96,7 @@ void VoxelLayer::onInitialize() if (publish_voxel_) { voxel_pub_ = node->create_publisher( - "voxel_grid", nav2::qos::LatchedPublisherQoS()); + "voxel_grid", nav2::qos::LatchedPublisherQoS(1)); voxel_pub_->on_activate(); } diff --git a/nav2_costmap_2d/test/integration/test_costmap_2d_publisher.cpp b/nav2_costmap_2d/test/integration/test_costmap_2d_publisher.cpp index a365cdc9a7d..bba0ac916c0 100644 --- a/nav2_costmap_2d/test/integration/test_costmap_2d_publisher.cpp +++ b/nav2_costmap_2d/test/integration/test_costmap_2d_publisher.cpp @@ -87,7 +87,7 @@ class LayerSubscriber layer_sub_ = node->create_subscription( topic_name, std::bind(&LayerSubscriber::layerCallback, this, std::placeholders::_1), - nav2::qos::LatchedSubscriptionQoS(), + nav2::qos::LatchedSubscriptionQoS(1), callback_group_); executor_ = std::make_shared(); diff --git a/nav2_map_server/src/map_saver/map_saver.cpp b/nav2_map_server/src/map_saver/map_saver.cpp index 1a54ac77a1c..1f947e4eaef 100644 --- a/nav2_map_server/src/map_saver/map_saver.cpp +++ b/nav2_map_server/src/map_saver/map_saver.cpp @@ -188,7 +188,7 @@ bool MapSaver::saveMapTopicToFile( rclcpp::QoS map_qos = nav2::qos::StandardTopicQoS(); // initialize to default if (map_subscribe_transient_local_) { - map_qos = nav2::qos::LatchedSubscriptionQoS(); + map_qos = nav2::qos::LatchedSubscriptionQoS(1); } // Create new CallbackGroup for map_sub diff --git a/nav2_map_server/test/component/test_map_saver_publisher.cpp b/nav2_map_server/test/component/test_map_saver_publisher.cpp index 9ae644c3f7a..1fc758ab2c5 100644 --- a/nav2_map_server/test/component/test_map_saver_publisher.cpp +++ b/nav2_map_server/test/component/test_map_saver_publisher.cpp @@ -16,6 +16,7 @@ #include #include +#include "nav2_ros_common/qos_profiles.hpp" #include "rclcpp/rclcpp.hpp" #include "nav2_map_server/map_io.hpp" #include "test_constants/test_constants.h" @@ -41,7 +42,7 @@ class TestPublisher : public rclcpp::Node map_pub_ = create_publisher( "map", - rclcpp::QoS(rclcpp::KeepLast(1)).transient_local().reliable()); + nav2::qos::LatchedPublisherQoS()); map_pub_->publish(msg); } diff --git a/nav2_map_server/test/map_saver_cli/CMakeLists.txt b/nav2_map_server/test/map_saver_cli/CMakeLists.txt index 3731e541ac5..ca4eb15f4b3 100644 --- a/nav2_map_server/test/map_saver_cli/CMakeLists.txt +++ b/nav2_map_server/test/map_saver_cli/CMakeLists.txt @@ -6,4 +6,5 @@ ament_add_gtest(test_map_saver_cli target_link_libraries(test_map_saver_cli rclcpp::rclcpp ${nav_msgs_TARGETS} + nav2_ros_common::nav2_ros_common ) diff --git a/nav2_map_server/test/map_saver_cli/test_map_saver_cli.cpp b/nav2_map_server/test/map_saver_cli/test_map_saver_cli.cpp index 75d6651300e..ad43a75ac67 100644 --- a/nav2_map_server/test/map_saver_cli/test_map_saver_cli.cpp +++ b/nav2_map_server/test/map_saver_cli/test_map_saver_cli.cpp @@ -18,6 +18,7 @@ #include #include +#include "nav2_ros_common/qos_profiles.hpp" #include "rclcpp/rclcpp.hpp" #include "nav_msgs/msg/occupancy_grid.hpp" @@ -34,7 +35,7 @@ TEST(MapSaverCLI, CLITest) auto publisher = node->create_publisher( "/map", - rclcpp::QoS(rclcpp::KeepLast(1)).transient_local().reliable()); + nav2::qos::LatchedPublisherQoS()); auto msg = std::make_unique(); msg->header.frame_id = "map";