# [rviz] tf and Interactivemarker: pose with respect to which frame?

Hi all,

I wonder in which frame the interactive_marker.pose field is expressed? It seems relative to interactive_marker.header.frame_id but even considering that hypothesis, I get a strange behaviour. Let me explain...

I'm writing an application were several parts of furniture (leg, back of a chair...) are represented in RViz has interactive markers.

Each part is relative either to the world or to another part and all of them publish their transform with a TransformBroadcaster. view_frames gives:

It seems that InteractiveMarker.pose designates the coordinates of the IM with respect to the frame InteractiveMarker.header.frame_id so when I set a new frame_id for an existing object I recompute the InteractiveMarker.pose with respect to the new frame_id, so that the pose doesn't move in the world frame. This works well, the new coordinates are computed with respect to the new frame thanks to a tfListener and there are correct.

When I move the parent frame with RViz, the child frame also moves because the pose of the child doesn't change with respect to the parent and this is exactly want I want.

Except that, when I click on the child object it's suddenly teleported elsewhere. I have disabled all callbacks for the Interactive Marker, so the server does that on its own But I don't know why. The transformation applied to the object is not random, it is exactly the transformation from its parent to the world.

Here is as exemple, I start with the interactive marker "leg1" at x=0 y=0 z=5 with respect to /world. I set it relative to /sitting which is at 0 0 -1 with respect to /world. The coordinates of "leg1" with respect to the world are computed by a tfListener and are 0 0 6, so I give these coordinates to leg1.pose.position = (0, 0, 6). Then when I click on "leg1" without moving it, it's teleported to 0 0 5 relative to /sitting, and if I click again 0 0 4, 0 0 3, and so on.

[ INFO] [1394553885.833971573]: leg1 is at 0 0 5 relative to /world
[ INFO] [1394553885.834646868]: [callback] leg1 set relative to sitting which is at 0 0 -1 relative to /world
[ INFO] [1394553885.848262357]: leg1 0 0 6 relative to /sitting
[ INFO] [1394553885.845737564]: [callback] leg1 is clicked (but not moved and no code is executed)
[ INFO] [1394553886.719846935]: leg1 0.10338 0.06199 6.96599 relative to /sitting (so almost 0 0 7)


It sounds like I forgot to set a "frame_id" somewhere to avoid the server to apply this automatic pose transformation. But I don't know where because if I server->get("leg1") the frame_id is actually set to "sitting".

I have been tearing my hear out on this issue for one week, but it's still unsolved and I don't know what to do with that :( I hope my explanations are understandable.

All clues are welcome, many thanks by advance ...

edit retag close merge delete

Sort by » oldest newest most voted

Concerning this teleportation bug, I figured out that the it came from the control InteractiveMarkerControl::MOVE_ROTATE_3D. I don't know if it's faulty or if I don't use it properly but I could reproduce the bug easily by changing 1 line of code in the tutorial "basic control": http://www.diffchecker.com/x733vxw2

Replacing this control by another one solved my issue.

more

( 2015-10-21 14:28:10 -0500 )edit