Translate from Camera frame of view to Base frame in Cartesian coordinates
I'm using TF2_ROS for translations. I have a camera on the end of a mechanical arm on my end effector. I calculate a known distance from that camera and would like to move the end effector into that point that is in the cameras frame of view.
I guess my problem is I'm not perfectly understanding what the lookuptransform function of the tf2 buffer interface is doing. My arm is fixed so i'm finding its location relative to the world. My end effector is link5.
tfbuffer.lookuptransform("world","link_5", rospy.Time, rospy.Duration(10))
This returns the same output as rosrun tf tfecho /world /link_5 so I know this part is correct.
I'm getting an output in x y z and a rotation output of x y z w.
The point I'm getting after calling lookup transform would be exactly the same if I would just query the point of the end effector from the world frame.
How do I actually go about adding the distances to my /link_5 coordinate system then using tf to translate them back into the world coordinate system?
Do I need to make a geometry messge, take the rotation angle from my camera and set them for xyzw, and then set the extra distances to the x y z translation then pass it to tf2? Is tf2 maybe not the correct type of package for this? If so, are there any recommended packages or should I write this myself?
Asked by mwrighte38 on 2018-11-15 15:25:32 UTC
Answers
The recommended approach for this would be to add a camera frame to the TF tree. To do this you would use the static transform publisher to describe the position and orientation of the camera relative to the end effector of your robot. To stick to the conventions described here you should use an optical frame convention for a camera.
With that frame added to the TF tree you can use the tf2_ros::BufferInterface::transform method to convert a point (or pose) from the camera frame to the world frame (or any other for that matter) with a single call. This way the TF system does all the hard work for you.
Hope this helps.
Asked by PeteBlackerThe3rd on 2018-11-15 17:37:19 UTC
Comments
Hey Pete, I can't actually find any documentation for the BufferInterface::transform method for python. Is there any? Can you also explain the output of lookup_transform? It returns the translation and rotation from my input frame coordinate to my other selected frame correct?
Asked by mwrighte38 on 2018-11-16 17:10:59 UTC
Comments