Skip to content

Commit 274ceee

Browse files
author
dkuenster
committed
mpc_local_planner: use transformPose in transformGlobalPlan
Switch to different method as it provides exception handling.
1 parent 5cc573c commit 274ceee

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

mpc_local_planner/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ find_package(ament_cmake REQUIRED)
1616
find_package(builtin_interfaces REQUIRED)
1717
find_package(nav2_core REQUIRED)
1818
find_package(nav2_costmap_2d REQUIRED)
19+
find_package(nav2_util)
20+
find_package(nav_2d_utils)
1921
find_package(costmap_converter REQUIRED)
2022
find_package(rclcpp REQUIRED)
2123
find_package(geometry_msgs REQUIRED)
@@ -106,6 +108,8 @@ set(ament_dependencies
106108
builtin_interfaces
107109
nav2_core
108110
nav2_costmap_2d
111+
nav2_util
112+
nav_2d_utils
109113
costmap_converter
110114
rclcpp
111115
geometry_msgs

mpc_local_planner/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<depend>nav2_core</depend>
2727
<depend>nav2_costmap_2d</depend>
2828
<depend>nav2_util</depend>
29+
<depend>nav_2d_utils</depend>
2930
<depend>costmap_converter</depend>
3031
<depend>eigen</depend>
3132
<depend>geometry_msgs</depend>

mpc_local_planner/src/mpc_local_planner_ros.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Authors: Christoph Rösmann
2121
*********************************************************************/
2222

23+
#include <nav_2d_utils/tf_help.hpp>
2324
#include <mpc_local_planner/mpc_local_planner_ros.h>
2425

2526
#include <mpc_local_planner/utils/math_utils.h>
@@ -610,7 +611,10 @@ bool MpcLocalPlannerROS::transformGlobalPlan(const tf2_ros::Buffer& tf, const st
610611

611612
// let's get the pose of the robot in the frame of the plan
612613
geometry_msgs::msg::PoseStamped robot_pose;
613-
tf.transform(global_pose, robot_pose, plan_pose.header.frame_id);
614+
615+
rclcpp::Duration transform_tolerance = rclcpp::Duration::from_seconds(0.5);
616+
617+
nav_2d_utils::transformPose(_tf, plan_pose.header.frame_id, global_pose, robot_pose, transform_tolerance);
614618

615619
// we'll discard points on the plan that are outside the local costmap
616620
double dist_threshold =

0 commit comments

Comments
 (0)