File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
include/nav2_collision_monitor Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,8 @@ class Polygon
246
246
double simulation_time_step_;
247
247
// / @brief Whether polygon is enabled
248
248
bool enabled_;
249
+ // / @brief Wether the subscription to polygon topic has transient local QoS durability
250
+ bool polygon_subscribe_transient_local_;
249
251
// / @brief Polygon subscription
250
252
rclcpp::Subscription<geometry_msgs::msg::PolygonStamped>::SharedPtr polygon_sub_;
251
253
// / @brief Footprint subscriber
Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ bool Polygon::configure()
71
71
" [%s]: Subscribing on %s topic for polygon" ,
72
72
polygon_name_.c_str (), polygon_sub_topic.c_str ());
73
73
rclcpp::QoS polygon_qos = rclcpp::SystemDefaultsQoS (); // set to default
74
+ if (polygon_subscribe_transient_local_) {
75
+ polygon_qos.transient_local ();
76
+ }
74
77
polygon_sub_ = node->create_subscription <geometry_msgs::msg::PolygonStamped>(
75
78
polygon_sub_topic, polygon_qos,
76
79
std::bind (&Polygon::polygonCallback, this , std::placeholders::_1));
@@ -432,6 +435,10 @@ bool Polygon::getParameters(
432
435
footprint_topic =
433
436
node->get_parameter (polygon_name_ + " .footprint_topic" ).as_string ();
434
437
}
438
+ nav2_util::declare_parameter_if_not_declared (
439
+ node, polygon_name_ + " .polygon_subscribe_transient_local" , rclcpp::ParameterValue (false ));
440
+ polygon_subscribe_transient_local_ =
441
+ node->get_parameter (polygon_name_ + " .polygon_subscribe_transient_local" ).as_bool ();
435
442
} catch (const std::exception & ex) {
436
443
RCLCPP_ERROR (
437
444
logger_,
You can’t perform that action at this time.
0 commit comments