# "Virtual" Transforms?

Hello everyone,

I have a question, which might have a pretty easy/obvious answer or a better way to solve my problem then the way I am currently doing it. However I am stuck, so I'd be glad for your input:

In the Python-interface, is there a way to create "virtual" transforms, meaning can I create a transform without publishing it and use it (do further transformations based on this one) in the same code later again?

To elaborate on my problem:

I have an robot arm with a gripper attached. I publish a static transform right between the fingertips (in relation to the tip of the robot). Also, I have a box with a marker, which gets recognized and published as a transform. Now, I want to do the following:

Based on the marker, I want to position the fingertips at a certain place. For this, I need my robot to go to a position in relation to the desired finger-tip-position. So it is Marker ==some_static_stuff==> Desired_Fingertips ==(transform from actual_tips to actual_robot)==>Desired_Robot

My problem is a) my lacking math-skills b) that the relation of each transformation changes each step. I can't use transforms from actual_tips to actual_robot on Desired_Fingertips, since Desired_Fingertips exists only as a (transformation, orientation)-tupel, but not as a frame_id. Therefore, the translations and rotations would be along the axis of Marker and not of Desired_Fingertips, leading to a wrong result.

Now, my "hack" would consist of actually publishing a frame Desired_Fingertips, use it as a frame_id to calculate the position of Desired_Robot. Since I am computing grasps, I'd also publish a couple more Offset_of_Desired_Fingertips_[1,n], therefore flooding the whole system with unecessary transforms. And all of this, because I am too lazy to wrap my head around the underlying mathematics :D

Sooo: Do you guys have any cool ideas?

1. Flood the system with transforms for everything
2. Some way to use "virtual" frame_id's
3. Some cool python function which does all the magic for me
4. Man up, dig into the wikipedia-pages and understand everything.

Rabe

P.S. I know there is/was some kind of function to switch the frame MoveIt is planning for, but it is not working anymore.

edit retag close merge delete

Sort by » oldest newest most voted

You can certainly publish a transform or two temporarily if you want to make it convenient to do some transformations.

However, it might be easier for you to use tf::Transform objects directly, since there's no need to publish any transforms that are only used node-local. Take a look at the API doc, and before you get intimidated note that you can use mathematical operators to combine transforms together, as well as apply them to other geometric constructs (vectors, quaternions, etc.). This is what transformPose and etc. would be doing under the hood.

When constructing transforms, just always remember that the translation will be applied first, and then the rotation.

more

Thanks for the quick respose! Creating the tf:Transform-objects is exactly what I was looking for. Since I'm writing my node in python, I am stuck with this API. But I think I can make it work. Thanks!

( 2014-10-15 09:48:53 -0500 )edit