Skip to content

Commit 5e522b8

Browse files
mikefergusonSteveMacenski
authored andcommitted
transform goal to costmap frame (#1949)
The plan recieved is usually in global frame, but our local costmap is often in odom frame. This fixes a regression from #1857
1 parent 7dff65a commit 5e522b8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎nav2_controller/src/nav2_controller.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "nav2_core/exceptions.hpp"
2222
#include "nav_2d_utils/conversions.hpp"
23+
#include "nav_2d_utils/tf_help.hpp"
2324
#include "nav2_util/node_utils.hpp"
2425
#include "nav2_util/geometry_utils.hpp"
2526
#include "nav2_controller/nav2_controller.hpp"
@@ -328,6 +329,11 @@ void ControllerServer::setPlannerPath(const nav_msgs::msg::Path & path)
328329
controllers_[current_controller_]->setPlan(path);
329330

330331
auto end_pose = path.poses.back();
332+
end_pose.header.frame_id = path.header.frame_id;
333+
rclcpp::Duration tolerance(costmap_ros_->getTransformTolerance() * 1e9);
334+
nav_2d_utils::transformPose(
335+
costmap_ros_->getTfBuffer(), costmap_ros_->getGlobalFrameID(),
336+
end_pose, end_pose, tolerance);
331337
goal_checker_->reset();
332338

333339
RCLCPP_DEBUG(

0 commit comments

Comments
 (0)