ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# openni_tracker rviz transform

I have a question about coordinate transforms related to openni_camera and oppennI_tracker

When I visualize both and set the fixed frame to openni_camera, it appears that the skeleton points are not in the same location as the corresponding body points are in the image. (see picture)

Does anybody know why this is happening and how to fix it?

Additionally here is the output from view_frames

Any help would be greatly apreciated

edit retag close merge delete

Sort by » oldest newest most voted

It seems there's an inconsistency between the frame conventions used by openni_camera and openni_tracker nodes. You should probably open a ticket with this issue.

In the meantime, you can take advantage of the fact that the pointcloud is published with reference frame openni_rgb_optical_frame and the skeleton with frame openni_depth_frame. The relation between those two frames is established in openni_camera/launch/kinect_frames.launch file, so you can change the static transforms declared in that file (or a copy of it, then you should also copy openni_node.launch and make it reference your copy of kinect_frames.launch) so that the skeleton and the depth data coincide.

Also, you should consider that the openni_tracker loades a configuration file (openni_tracker/openni_tracker.xml) for the OpenNI generators that set the mirror parameter to true. You should check if this is the behaviour you want.

If I can find the time to do it I'll try to prepare a patch that fixes these issues. Please tell me if you'd be interested.

Update: Using the frame David Lu suggests in his comment, plus a couple of changes in openni_tracker.xml and openni_tracker.cpp I've prepared a patch that should fix these issues. You need to run the openni_tracker node by using the new openni_tracker.launch file that should by added by the patch.

I must admit I'm not used to create patch files, so if there's something wrong you can easily make the changes manually by inspecting the file.

You can find the file here: http://snipt.org/xHmk

more

Hi Miguel--I would certainly be interested and perhaps more than a few others would be too. Thanks!
( 2011-05-12 03:47:01 -0600 )edit
Ok, I no longer have the Kinect with me. I'll see if I can do it tomorrow after work or during the weekend.
( 2011-05-12 04:50:24 -0600 )edit
Thanks David and Miguel--this is great. One question for Miguel: what sources did you start with for your patch? The openni_ros trunk or the Diamondback openni_kinect debian package?
( 2011-05-15 04:01:39 -0600 )edit
That's a good point. I used the openni_ros trunk. However, I think the changes should work as well with the openni_tracker source inside the Diamondback debian package.
( 2011-05-15 05:19:54 -0600 )edit
Hi Miguel--while I couldn't get your patch to work with the "patch" command (kept getting "Hunk FAILED" messages), I made your modifications manually to the various files and it works beautifully. This tf and mirroring problem has been bugging me for months so many thanks for posting a solution!
( 2011-05-15 07:37:38 -0600 )edit
P.S. Note to David--Miguel's modified openni_tracker.cpp file was the key to getting mirroring to work properly for me.
( 2011-05-15 07:39:08 -0600 )edit
Great! Also, in terms of other useful patches, I also submitted this one: https://code.ros.org/trac/ros-pkg/ticket/4954 for tracking multiple users at once, fixing something that always bugged me about this package.
( 2011-05-15 07:41:46 -0600 )edit
That's also a good point, David. In fact, I think I saw that functionality in some previous version and that it later got removed. Is that possible or am I making things up?
( 2011-05-15 20:10:34 -0600 )edit

I just tinkered around with it for awhile, using Miguel's suggestions. I've gotten some of it working.

<node pkg="tf" type="static_transform_publisher" name="tracker_link" args="0 0 0 1.57 0 1.57 /openni_depth_frame /openni_tracker_frame 100" />

rosparam set /openni_tracker/camera_frame_id openni_tracker_frame

However, this still flips everything right to left. Depending on whether you use the mirror parameter, it marks your left hand as your right, or flips the whole axis for the transforms.

Hopefully this is helpful enough to get someone else to tweak it so that it actually works.

more

Thanks. I'll try this out sometime tomorrow afternoon. (In the middle of finals)
( 2011-05-12 19:22:09 -0600 )edit

In Groovy this still seems to be an issue. When I'm using the default options, the tf_skeleton aligns with the pointcloud, however the sides are flipped (right hand is left). Setting both image and depth mirror parameter to true, corrects that. Any tip how to fix this without mirroring?

( 2013-04-09 23:31:27 -0600 )edit