Robotics StackExchange | Archived questions

kinect frame

i use opennilaunch and display camera/depth/points on rviz. when i select fixed frame as /cameraopticaldepthframe, the cloud is upside down and the rviz axes with z up. I know this is conventional axis of rviz. Also when i save this cloud to pcd file, its orientation is still the same as in rviz.

How can i transform cloud into normal orientation with z forward?

Also, I dont understand fixed frame purpose and tf transform clearly? How can i know which is world frame and camera frame?

Asked by dmngu9 on 2015-04-07 21:36:33 UTC

Comments

Answers

I belief you would need to create a static transform publisher to put your /camera_optical_depth_frame in the right perspective. Take a look at these tutoritals and it should help you.

I had much the same issue until I 'put' my kinect on my robot with the static transform publisher (I added the kinect to the p2os/p2os_urdf/defs/pioneer3dx_body.xacro). Then I changed RViz Fixed Frame to base_link or odom and it displayed the kinect's pointcloud in the correct perspective relative to the grid and robot.

image description


<!--Kinect Sensor-->
<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>

Asked by sealguy77 on 2015-04-08 11:38:41 UTC

Comments

in your urdf file, i can see you make kinect_link a child frame of base_link frame. in the source code, openni_camera or openni_launch, i cant find the tf transforms in it. I want to modify the code to get the point cloud in right perspective

Asked by dmngu9 on 2015-04-08 20:05:28 UTC

I could not find it in the openni_launch or openni_camera code either. For a work around, you could create the above static transform publisher without the base_link with the kinect_link the parent of all.

Asked by sealguy77 on 2015-04-09 11:58:53 UTC

thanks, I got mine working now. I wonder is there any algorithm for obstacle avoidance using point cloud that I can look through? thanks

Asked by dmngu9 on 2015-04-24 21:18:38 UTC

I used the package depthimage_to_laserscan to convert PointCloud2 into LaserScan, then used gmapping and move_base from the navigation stack. There are 3D SLAM packages which use pointclouds, but I have not yet used them.

Asked by sealguy77 on 2015-04-26 11:42:16 UTC

@sealguy77 hi, I wonder that how could you choose the origin in joint tag, is it a fix parameter for kinect?

Asked by drtritm on 2020-06-24 04:35:05 UTC