ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Viewing PointCloud2 in a frame from URDF in Rviz vice openni_depth_optical_frame

asked 2015-03-11 14:38:36 -0500

updated 2015-03-12 12:33:06 -0500

I am utilizing ROS Hydro on Ubuntu 12.04 with a Pioneer3-DX and Microsoft Kinect.

I am using p2os, openni_launch, and openni_tracker.

I have just added the Kinect to the p2os_urdf by adding the code below to the pioneer3dx_body.xacro. I would like to have data from /PointCloud2 in the kinect_depth_optical_frame of the URDF when I use Rviz, but it is currently in the openni_depth_optical_frame. Therefore, I can only view the /PointCloud2 or the robot model and tf's, but not both at the same time. The openni_depth_optical_frame is displayed in the wrong plane relative to the robot model.

Right now, I am utilizing a launch file to start everything. You can find the code of the launch file below.


Kinect code added to pioneer3dx_body.xacro: <joint name="kinect_joint" type="fixed"> <origin xyz="0.1397 0 0.2677" rpy="0 0 0"/> <parent link="base_link"/> <child link="kinect_link"/> </joint>

<link name="kinect_link">
        <inertial>
                <mass value="0.001" />
                <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>
        <visual>
                <origin xyz="0 0 0.028575" rpy="0 0 ${M_PI/2}" />
                <geometry>
                        <box size="0.27796 0.07271 0.0381" />
                </geometry>
                <material name="Blue" />
        </visual>
        <collision>
                <origin xyz="0 0 0" rpy="0 0 0" />
                <geometry>
                         <box size="0.27796 0.07271 0.073" />
                </geometry>
        </collision>
</link>

<joint name="kinect_rgb_joint" type="fixed">
        <origin xyz="0.01905 -0.0125 0.02794" rpy="0 0 0" />
        <parent link="kinect_link" />
        <child link="kinect_rgb_frame" />
</joint>

<link name="kinect_rgb_frame">
        <inertial>
                <mass value="0.001" />
                <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="kinect_rgb_optical_joint" type="fixed">
        <origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
        <parent link="kinect_rgb_frame" />
        <child link="kinect_rgb_optical_frame" />
</joint>

<link name="kinect_rgb_optical_frame">
        <inertial>
                <mass value="0.001" />
                <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="kinect_depth_joint" type="fixed">
        <origin xyz="0.01905 0.0125 0.02794" rpy="0 0 0" />
        <parent link="kinect_link" />
        <child link="kinect_depth_frame" />
</joint>

<link name="kinect_depth_frame">
        <inertial>
                <mass value="0.001" />
                <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="kinect_depth_optical_joint" type="fixed">
        <origin xyz="0 0 0" rpy="${-M_PI/2} 0 ${-M_PI/2}" />
        <parent link="kinect_depth_frame" />
        <child link="kinect_depth_optical_frame" />
</joint>

<link name="kinect_depth_optical_frame">
        <inertial>
                <mass value="0.001" />
                <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>

Launch file code:

<launch>
  <!-- Defining the arguments -->
        <arg name="urdf" default="true" />
        <arg name="P2OS_Driver" default="false" />
        <arg name="enableMotor" default="false" />
        <arg name="fwd_vel_test" default="false" />
        <arg name="Kinect" default="true" />
        <arg name="skeleton_tracking" default="true" />
        <arg name="PointCloud_to_LaserScan ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-12 12:37:17 -0500

I have edited my launch file to this:

  <!-- Start the Kinect (openni_camera) -->
        <group if="$(arg Kinect)">
          <include file="$(find openni_launch)/launch/openni.launch">
            <arg name="camera" value="kinect" />
          </include>
        </group>

You must configure the following:

  • RViz > Global Options > Fixed Frame: odom
  • RViz > PointCloud2 > Topic: /kinect/depth_registered/points

Which put the PointCloud2 data in the correct position relative to the robot: image description

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-03-11 14:38:36 -0500

Seen: 451 times

Last updated: Mar 12 '15