Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TF when global plan is not updated #44

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions teb_local_planner/src/teb_local_planner_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,8 @@ bool TebLocalPlannerROS::transformGlobalPlan(const std::vector<geometry_msgs::ms

// get plan_to_global_transform from plan frame to global_frame
geometry_msgs::msg::TransformStamped plan_to_global_transform = tf_->lookupTransform(
global_frame, tf2_ros::fromMsg(plan_pose.header.stamp),
plan_pose.header.frame_id, tf2::timeFromSec(0),
plan_pose.header.frame_id, tf2::durationFromSec(0.5));
Comment on lines -724 to -726
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the global_plan is not updated then plan_pose.header.stamp is not updated, and since the TF buffer has a fixed cache time (5-10s), then this throws an Extrapolation error in the past.

The current approach gets the global_frame, which is odom, at the timestamp of the plan creation, however if the AMR is relocalized and odom changes, I think that this new odom should be used.

The fix is to simply get the latest odom->map (global_frame->plan_pose.header.frame_id) TF.

global_frame, plan_pose.header.frame_id,
tf2::timeFromSec(0), tf2::durationFromSec(0.5));

// tf_->waitForTransform(global_frame, ros::Time::now(),
// plan_pose.header.frame_id, plan_pose.header.stamp,
Expand Down