ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange

# ROS2 - Transforming a non-frame pose with TF2?

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 close merge delete

Sort by ยป oldest newest most voted

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.

more

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?

( 2022-02-15 22:57:42 -0600 )edit

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

( 2022-02-16 03:33:46 -0600 )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.

( 2022-02-16 14:01:47 -0600 )edit