0
$\begingroup$

Rosanswers logo

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:

<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" default="false" />
        <arg name="point_cloud_display" default="true" />

        <!-- Other items for use later... -->
        <arg name="Transform" default="false" />
        <arg name="Dashboard" default="false" />
        <arg name="KeyboardTeleop" default="false" />
        <arg name="JoystickTeleop" default="false" />
        <arg name="HokuyoLaser" default="false" />
        <arg name="SICKLMSLaser" default="false" />

  <!-- Start urdf -->
        <group if="$(arg urdf)">
          <include file="$(find p2os_urdf)/launch/pioneer3dx_urdf.launch"/>
        </group>

  <!-- Start the p2os ROS Driver -->
        <group if="$(arg P2OS_Driver)" >
          <node pkg="p2os_driver" name="p2os_driver" type="p2os_driver"/>
        </group>

  <!-- Enable p2os Motor State -->
        <group if="$(arg enableMotor)" >
          <node pkg="follow_me" name="p2os_enableMotor" type="p2os_enableMotor" />
        </group>

  <!-- Start moving Pioneer forward at 0.5 m/s (Test node) -->
        <group if="$(arg fwd_vel_test)" >
          <node pkg="follow_me" name="twist_test" type="twist_test" />
        </group>

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

  <!-- Start Human Tracking (openni_tracker) -->
        <group if="$(arg skeleton_tracking)">
          <node pkg="openni_tracker" name="openni_tracker" type="openni_tracker"/>
        </group>

 <!-- Start Rviz for display of Kinect PointCloud -->
        <group if="$(arg point_cloud_display)">
          <node pkg="rviz" name="rviz" type="rviz">
           <!-- <arg name="display-config" value="~/.rviz/kinect_skeleton_tracking.rviz" /> -->
          </node>
        </group>

</launch>

Originally posted by sealguy77 on ROS Answers with karma: 323 on 2015-03-11

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by sealguy77 with karma: 323 on 2015-03-12

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.