Skip to content
Snippets Groups Projects
Commit 4103d418 authored by Steven Macenski's avatar Steven Macenski
Browse files

sharing TF buffer

parent 61be8c60
No related branches found
No related tags found
No related merge requests found
......@@ -72,13 +72,6 @@ NavfnPlanner::NavfnPlanner()
costmap_executor_->spin();
costmap_executor_->remove_node(node->get_node_base_interface());
}, costmap_ros_);
tf_ = std::make_shared<tf2_ros::Buffer>(get_clock());
auto timer_interface = std::make_shared<tf2_ros::CreateTimerROS>(
rclcpp_node_->get_node_base_interface(),
rclcpp_node_->get_node_timers_interface());
tf_->setCreateTimerInterface(timer_interface);
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(*tf_);
}
NavfnPlanner::~NavfnPlanner()
......@@ -103,6 +96,9 @@ NavfnPlanner::on_configure(const rclcpp_lifecycle::State & state)
RCLCPP_DEBUG(get_logger(), "Costmap size: %d,%d",
costmap_->getSizeInCellsX(), costmap_->getSizeInCellsY());
tf_ = costmap_ros_->getTfBuffer();
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(*tf_);
// Create a planner based on the new costmap size
if (isPlannerOutOfDate()) {
planner_ = std::make_unique<NavFn>(costmap_->getSizeInCellsX(),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment