Ask Your Question
0

ROS2 - Transforming a non-frame pose with TF2?

asked 2022-02-15 02:38:48 -0500

Per Edwardsson gravatar image

updated 2022-02-15 22:58:05 -0500

I have a full transform tree going map -> odom -> base_link which works well for slamming with my robot. I would like to find a practical way to find a point which is x meters in _front_ of the robot. I could use the current orientation to figure out what "in front" means, then apply trigonometry to get the point in question.

Meanwhile, this type of calculation is done by TF2 all the time. It would make little sense to not use it for transforming poses between coordinate frames. However, it looks to me like TF2 can only transform _frames_, which means that I either need to create a frame for my goal pose, or do the above mentioned trigonometry.

What's the proper way of solving this problem?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-02-15 16:14:31 -0500

http://docs.ros.org/en/noetic/api/tf2...

You can use the transform() API to transform a pose / point (and similar) from one from to another. So you could define a point 1m in front of a robot in base frame and use transform() to convert it to map coordinates -- or similar operations. This is pretty commonly used and I think is what you're looking for.

edit flag offensive delete link more

Comments

That looks like the solution for ros1, but I am using ros2. Perhaps I should have clarified in OP. Is there an equivalent for ros2?

Per Edwardsson gravatar image Per Edwardsson  ( 2022-02-15 22:57:42 -0500 )edit

In ROS 2 there's effectively the same API: https://docs.ros.org/en/ros2_packages...

tfoote gravatar image tfoote  ( 2022-02-16 03:33:46 -0500 )edit
1

Yes, I don't even personally discriminate between the ROS 1 and ROS 2 documentation APIs in my development workflow because they're so similar. But Tully is correct and showed the ROS 2 versions.

stevemacenski gravatar image stevemacenski  ( 2022-02-16 14:01:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-02-15 02:38:48 -0500

Seen: 208 times

Last updated: Feb 15