Viewing PointCloud2 in a frame from URDF in Rviz vice openni_depth_optical_frame
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 ...