Ask Your Question
0

openni_tracker shows skeleton upside down in RViz

asked 2011-04-02 15:17:37 -0600

Pi Robot gravatar image

updated 2016-10-24 09:00:37 -0600

ngrennan gravatar image

Using Tully's suggestion, I am displaying a skeleton tracked by openni_tracker in RViz using the TF "Show Axes" option. The only trouble is my skeleton is appearing upside down. My Kinect is the head of my robot and so it is part of my URDF model. I am using Melonee's Kinect URDF code from an earlier posting within my model. Can anyone see from my files below why the skeleton appears upside down? (My Kinect is mounted right-side up on the robot and the point cloud has the correct orientation.)

Here are some of my key launch files:

kinect.launch:

<launch>
  <node pkg="openni_camera" type="openni_node" name="openni_camera" output="scre
en" respawn="true" >
     <!-- this line uses first enumerated device -->
    <param name="device_id" value="#1"/>
    <rosparam command="load" file="$(find openni_camera)/info/openni_params.yaml
" />
    <param name="rgb_frame_id" value="/openni_rgb_optical_frame" />
    <param name="depth_frame_id" value="/openni_depth_optical_frame" />
    <param name="use_indices" value="false" />
    <param name="depth_registration" value="true" />
    <param name="image_mode" value="8" />
    <param name="depth_mode" value="8" />
    <param name="debayering" value="2" />
    <param name="depth_time_offset" value="0" />
    <param name="image_time_offset" value="0" />
  </node>
</launch>

openni_tracker.launch:

<launch>
  <node pkg="openni_tracker" type="openni_tracker" name="openni_tracker" output=
"screen">
    <param name="camera_frame_id" value="/openni_depth_optical_frame" />
    <param name="tf_prefix" value="tracker" />
  </node>
</launch>

urdf.launch:

<launch>                                                                                    
      <param name="robot_description" command="$(find xacro)/xacro.py '$(find pi_demo)/urdf/pi_robot.urdf.xacro'" />                                               

      <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />                                                               
      <param name="/use_gui" value="True" />                                        

      <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">                                                                       
        <param name="publish_frequency" value="20.0"/></node>                                                                       

      <node pkg="tf" type="static_transform_publisher" name="world_base_broadcaster" args="0 0 0.0325 0 0 0 /world /base_link 100" />                              
</launch>

And here is the section of my URDF model that I copied from Melonee's post with the only change being that I used "openni" instead of "kinect" in the link and joint names:

<xacro:my_box name="openni_link" lwh="0.06 0.26 0.035" xyz="0 0 0" rpy="0 0 0" mass="0.8" material="Gazebo/FlatBlack">
    <xacro:black />
</xacro:my_box>

<joint name="openni_depth_joint" type="fixed">
  <origin xyz="0 0.018 0" rpy="0 0 0" />
  <parent link="openni_link" />
  <child link="openni_depth_frame" />
</joint>

<link name="openni_depth_frame">
  <inertial>
    <mass value="0.0001" />
    <origin xyz="0 0 0" />
    <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
             iyy="0.0001" iyz="0.0"
             izz="0.0001" />
  </inertial>
</link>

<joint name="openni_depth_optical_joint" type="fixed">
  <origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
  <parent link="openni_depth_frame" />
  <child link="openni_depth_optical_frame" />
</joint>

<link name="openni_depth_optical_frame">
  <inertial>
    <mass value="0.0001" />
    <origin xyz="0 0 0" />
    <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
             iyy="0.0001" iyz="0.0"
             izz="0.0001" />
  </inertial>
</link>

<joint name="openni_rgb_joint" type="fixed">
  <origin xyz="0 -0.005 0" rpy="0 0 0" />
  <parent link="openni_link" />
  <child link="openni_rgb_frame" />
</joint>

<link name="openni_rgb_frame">
  <inertial>
    <mass value="0.0001" />
    <origin xyz="0 0 0" />
    <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
             iyy="0.0001" iyz="0.0"
             izz="0.0001" />
  </inertial>
</link ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2011-06-17 10:21:25 -0600

kwc gravatar image

I believe this has been fixed recently on trunk of openni_kinect. There were several patches from miguelprada to improve the tracker, including this relevant patch:

https://code.ros.org/trac/ros-pkg/ticket/4994

edit flag offensive delete link more

Comments

Thanks Ken--seems to work nicely now!
Pi Robot gravatar imagePi Robot ( 2011-06-20 06:01:11 -0600 )edit
0

answered 2011-04-02 19:30:42 -0600

dejanpan gravatar image

Hi, to me it seems at the first sight that the names of your joints are wrong, should it not be openni_depth_frame_joint and openni_rgb_frame_joint (note missing _frame)? Then if that does not solve it you have to see how your openni_link is placed in the kinematic chain - it might be that it is upside down too. Lastly, I just noticed yesterday that the TF tree of the tracked body is still mirrored around y axis. Following fix solved that for me: - double y = joint_position.position.Y / 1000.0; + double y = -joint_position.position.Y / 1000.0;

D.

edit flag offensive delete link more

Comments

Thanks D. I think the joint names are OK since I believe it is the link names that get mapped into TF frame names. I tried the following experiment that might be related to the second part of your answer but has me mystified: First run the stock 'roslaunch openni_camera openni_node.launch'. Then bring up RViz and view the resulting point cloud in the /openni_depth_frame. Make sure you are looking at something that has a definite left and right side. Now in a new terminal, run the stock 'rosrun openni_tracker openni_tracker' and immediately, the point cloud in RViz gets flipped left-to-right. And killing off the openni_tracker process does not "unflip" the point cloud. Can anyone explain this?
Pi Robot gravatar imagePi Robot ( 2011-04-03 03:15:53 -0600 )edit
That's very weird behavior. If you can get that to repeat it sounds like it's a bug in the publisher maybe? Can you file a ticket for that. https://kforge.ros.org/openni/trac/newticket?component=openni_kinect&type=defect
tfoote gravatar imagetfoote ( 2011-04-03 13:33:28 -0600 )edit
Yes, it's 100% repeatable on my Ubuntu 10.04 machine running Diamondback Debian packages. Another test that gives the same result is to bring up 'image_view disparity_view' and look at the disparity image--it also flips as soon as the openni_tracker node is run. I'll file a ticket but one thought that comes to mind is that the PrimeSense document "NITE Algorithms 1.3.pdf" available in the SDK mentions a "mirror mode" and I'm wondering if that mode is getting triggered when the openni_tracker node is run.
Pi Robot gravatar imagePi Robot ( 2011-04-03 14:20:19 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-04-02 15:17:37 -0600

Seen: 1,313 times

Last updated: Jun 17 '11