Skip to content

Commit aaaec50

Browse files
doisygGuillaume Doisy
andauthored
Latched map subscriber QoS depth 1 (#5665)
* Latched map subscriber QoS depth 1 Signed-off-by: Guillaume Doisy <guillaume@dexory.com> * 3 Signed-off-by: Guillaume Doisy <guillaume@dexory.com> * typo Signed-off-by: Guillaume Doisy <guillaume@dexory.com> --------- Signed-off-by: Guillaume Doisy <guillaume@dexory.com> Co-authored-by: Guillaume Doisy <guillaume@dexory.com>
1 parent ec72aaf commit aaaec50

File tree

12 files changed

+15
-12
lines changed

12 files changed

+15
-12
lines changed

‎nav2_amcl/src/amcl_node.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ AmclNode::updateParametersCallback(
12231223
map_sub_ = create_subscription<nav_msgs::msg::OccupancyGrid>(
12241224
map_topic_,
12251225
std::bind(&AmclNode::mapReceived, this, std::placeholders::_1),
1226-
nav2::qos::LatchedSubscriptionQoS());
1226+
nav2::qos::LatchedSubscriptionQoS(3));
12271227
}
12281228
}
12291229

@@ -1395,7 +1395,7 @@ AmclNode::initPubSub()
13951395
map_sub_ = create_subscription<nav_msgs::msg::OccupancyGrid>(
13961396
map_topic_,
13971397
std::bind(&AmclNode::mapReceived, this, std::placeholders::_1),
1398-
nav2::qos::LatchedSubscriptionQoS());
1398+
nav2::qos::LatchedSubscriptionQoS(3));
13991399

14001400
RCLCPP_INFO(get_logger(), "Subscribed to map topic.");
14011401
}

‎nav2_costmap_2d/include/nav2_costmap_2d/costmap_subscriber.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class CostmapSubscriber
5353
costmap_sub_ = nav2::interfaces::create_subscription<nav2_msgs::msg::Costmap>(
5454
parent, topic_name_,
5555
std::bind(&CostmapSubscriber::costmapCallback, this, std::placeholders::_1),
56-
nav2::qos::LatchedSubscriptionQoS());
56+
nav2::qos::LatchedSubscriptionQoS(3));
5757

5858
costmap_update_sub_ = nav2::interfaces::create_subscription<nav2_msgs::msg::CostmapUpdate>(
5959
parent, topic_name_ + "_updates",

‎nav2_costmap_2d/plugins/costmap_filters/binary_filter.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void BinaryFilter::filterInfoCallback(
144144
mask_sub_ = node->create_subscription<nav_msgs::msg::OccupancyGrid>(
145145
mask_topic_,
146146
std::bind(&BinaryFilter::maskCallback, this, std::placeholders::_1),
147-
nav2::qos::LatchedSubscriptionQoS());
147+
nav2::qos::LatchedSubscriptionQoS(3));
148148
}
149149

150150
void BinaryFilter::maskCallback(

‎nav2_costmap_2d/plugins/costmap_filters/keepout_filter.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void KeepoutFilter::filterInfoCallback(
133133
mask_sub_ = node->create_subscription<nav_msgs::msg::OccupancyGrid>(
134134
mask_topic_,
135135
std::bind(&KeepoutFilter::maskCallback, this, std::placeholders::_1),
136-
nav2::qos::LatchedSubscriptionQoS());
136+
nav2::qos::LatchedSubscriptionQoS(3));
137137
}
138138

139139
void KeepoutFilter::maskCallback(

‎nav2_costmap_2d/plugins/costmap_filters/speed_filter.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void SpeedFilter::filterInfoCallback(
152152
mask_sub_ = node->create_subscription<nav_msgs::msg::OccupancyGrid>(
153153
mask_topic_,
154154
std::bind(&SpeedFilter::maskCallback, this, std::placeholders::_1),
155-
nav2::qos::LatchedSubscriptionQoS());
155+
nav2::qos::LatchedSubscriptionQoS(3));
156156
}
157157

158158
void SpeedFilter::maskCallback(

‎nav2_costmap_2d/plugins/static_layer.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ StaticLayer::onInitialize()
7777

7878
rclcpp::QoS map_qos = nav2::qos::StandardTopicQoS(); // initialize to default
7979
if (map_subscribe_transient_local_) {
80-
map_qos = nav2::qos::LatchedSubscriptionQoS();
80+
map_qos = nav2::qos::LatchedSubscriptionQoS(3);
8181
}
8282

8383
RCLCPP_INFO(

‎nav2_costmap_2d/plugins/voxel_layer.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void VoxelLayer::onInitialize()
9696

9797
if (publish_voxel_) {
9898
voxel_pub_ = node->create_publisher<nav2_msgs::msg::VoxelGrid>(
99-
"voxel_grid", nav2::qos::LatchedPublisherQoS());
99+
"voxel_grid", nav2::qos::LatchedPublisherQoS(1));
100100
voxel_pub_->on_activate();
101101
}
102102

‎nav2_costmap_2d/test/integration/test_costmap_2d_publisher.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class LayerSubscriber
8787
layer_sub_ = node->create_subscription<nav2_msgs::msg::Costmap>(
8888
topic_name,
8989
std::bind(&LayerSubscriber::layerCallback, this, std::placeholders::_1),
90-
nav2::qos::LatchedSubscriptionQoS(),
90+
nav2::qos::LatchedSubscriptionQoS(3),
9191
callback_group_);
9292

9393
executor_ = std::make_shared<rclcpp::executors::SingleThreadedExecutor>();

‎nav2_map_server/src/map_saver/map_saver.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ bool MapSaver::saveMapTopicToFile(
188188

189189
rclcpp::QoS map_qos = nav2::qos::StandardTopicQoS(); // initialize to default
190190
if (map_subscribe_transient_local_) {
191-
map_qos = nav2::qos::LatchedSubscriptionQoS();
191+
map_qos = nav2::qos::LatchedSubscriptionQoS(3);
192192
}
193193

194194
// Create new CallbackGroup for map_sub

‎nav2_map_server/test/component/test_map_saver_publisher.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <string>
1717
#include <memory>
1818

19+
#include "nav2_ros_common/qos_profiles.hpp"
1920
#include "rclcpp/rclcpp.hpp"
2021
#include "nav2_map_server/map_io.hpp"
2122
#include "test_constants/test_constants.h"
@@ -41,7 +42,7 @@ class TestPublisher : public rclcpp::Node
4142

4243
map_pub_ = create_publisher<nav_msgs::msg::OccupancyGrid>(
4344
"map",
44-
rclcpp::QoS(rclcpp::KeepLast(1)).transient_local().reliable());
45+
nav2::qos::LatchedPublisherQoS());
4546
map_pub_->publish(msg);
4647
}
4748

0 commit comments

Comments
 (0)