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

How to perform rotation before translation in tf2?

asked 2017-05-02 04:44:23 -0500

nikhilk gravatar image

Given the rpy values and some translational values , how to perform rotation before translation and then publish while using the tf2 library in ros

edit retag flag offensive close merge delete

Comments

Both the C++ and Python tutorials have an example of converting RPY into a quaternion and broadcasting that transform. Do you have a specific question beyond what is covered in the tutorials? C++ tutorial

jarvisschultz gravatar image jarvisschultz  ( 2017-05-02 07:20:31 -0500 )edit
jarvisschultz gravatar image jarvisschultz  ( 2017-05-02 07:20:44 -0500 )edit

yes, actually i am trying to get a frame which is rotated by given rpy values and then translated, hc's solution worked for me (point 1). Thank you guys :)

nikhilk gravatar image nikhilk  ( 2017-05-03 06:56:56 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-05-02 14:37:21 -0500

hc gravatar image

I understand what you mean. You want to translate in the rotated frame and not the original frame. Unfortunately tf2 only works with translation and rotation being published with respect to the original frame. Because it is a transform with respect to that particular frame.

To solve your problem there are two ways:

  1. The simple way is to create two frames. A temporary frame which contains only the rotation. And then another transform to translate in this frame.
  2. If you do not want to create a temporary frame, you can calculate what the translational vector will be in the rotated frame. And then use those values instead. To illustrate: If you want to first rotate by r,p,y and then translate in the rotated frame by a,b,c. You should calculate the new translational values R * {a,b,c} where R is the rotation matrix constructed by the rotation angles. Then you can use the tf2 package with these new values.

Hope this helps!

edit flag offensive delete link more

Comments

Got it , thank you :)

nikhilk gravatar image nikhilk  ( 2017-05-03 06:57:12 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-05-02 04:44:23 -0500

Seen: 2,614 times

Last updated: May 02 '17