Skip to content

Commit

Permalink
add polygon_subscribe_transient_local parameter in collision monitor (r…
Browse files Browse the repository at this point in the history
…os-navigation#4207)

Signed-off-by: asarazin <[email protected]>
Co-authored-by: asarazin <[email protected]>
  • Loading branch information
2 people authored and Manos-G committed Aug 1, 2024
1 parent 7a692ba commit 40fdd3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ class Polygon
double simulation_time_step_;
/// @brief Whether polygon is enabled
bool enabled_;
/// @brief Wether the subscription to polygon topic has transient local QoS durability
bool polygon_subscribe_transient_local_;
/// @brief Polygon subscription
rclcpp::Subscription<geometry_msgs::msg::PolygonStamped>::SharedPtr polygon_sub_;
/// @brief Footprint subscriber
Expand Down
7 changes: 7 additions & 0 deletions nav2_collision_monitor/src/polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ bool Polygon::configure()
"[%s]: Subscribing on %s topic for polygon",
polygon_name_.c_str(), polygon_sub_topic.c_str());
rclcpp::QoS polygon_qos = rclcpp::SystemDefaultsQoS(); // set to default
if (polygon_subscribe_transient_local_) {
polygon_qos.transient_local();
}
polygon_sub_ = node->create_subscription<geometry_msgs::msg::PolygonStamped>(
polygon_sub_topic, polygon_qos,
std::bind(&Polygon::polygonCallback, this, std::placeholders::_1));
Expand Down Expand Up @@ -433,6 +436,10 @@ bool Polygon::getParameters(
footprint_topic =
node->get_parameter(polygon_name_ + ".footprint_topic").as_string();
}
nav2_util::declare_parameter_if_not_declared(
node, polygon_name_ + ".polygon_subscribe_transient_local", rclcpp::ParameterValue(false));
polygon_subscribe_transient_local_ =
node->get_parameter(polygon_name_ + ".polygon_subscribe_transient_local").as_bool();
} catch (const std::exception & ex) {
RCLCPP_ERROR(
logger_,
Expand Down

0 comments on commit 40fdd3a

Please sign in to comment.