Skip to content

Commit 2a80675

Browse files
Parametrizing obstacle layer tf filter tolerance (#5261)
Signed-off-by: Marco Bassa <[email protected]>
1 parent d370ca3 commit 2a80675

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nav2_costmap_2d/plugins/obstacle_layer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "pluginlib/class_list_macros.hpp"
4747
#include "sensor_msgs/point_cloud2_iterator.hpp"
4848
#include "nav2_costmap_2d/costmap_math.hpp"
49+
#include "nav2_util/node_utils.hpp"
4950
#include "rclcpp/version.h"
5051

5152
PLUGINLIB_EXPORT_CLASS(nav2_costmap_2d::ObstacleLayer, nav2_costmap_2d::Layer)
@@ -100,6 +101,8 @@ void ObstacleLayer::onInitialize()
100101
node->get_parameter("track_unknown_space", track_unknown_space);
101102
node->get_parameter("transform_tolerance", transform_tolerance);
102103
node->get_parameter(name_ + "." + "observation_sources", topics_string);
104+
double tf_filter_tolerance = nav2_util::declare_or_get_parameter(node, name_ + "." +
105+
"tf_filter_tolerance", 0.05);
103106

104107
int combination_method_param{};
105108
node->get_parameter(name_ + "." + "combination_method", combination_method_param);
@@ -278,7 +281,8 @@ void ObstacleLayer::onInitialize()
278281
observation_subscribers_.push_back(sub);
279282

280283
observation_notifiers_.push_back(filter);
281-
observation_notifiers_.back()->setTolerance(rclcpp::Duration::from_seconds(0.05));
284+
observation_notifiers_.back()->setTolerance(rclcpp::Duration::from_seconds(
285+
tf_filter_tolerance));
282286

283287
} else {
284288
// For Kilted and Older Support from Message Filters API change

0 commit comments

Comments
 (0)