Kinect on TurtleBot3 for Gazebo simulation (ROS Melodic)
Hi,
I'm trying to add this depth camera and right now I followed this tutorial for this purpose: http://gazebosim.org/tutorials?tut=ro...
I'm using Ubuntu 18.04.
My aim is to use it with rviz for self localization and navigation, so basically I need to swap its camera for a Kinect.
When I launch my world, my Turtlebot3 is graphically mounted with the Kinect on top of it like I want, so I can move it with teleop and stuff like that, but it doesn't start the other topics, needed for the camera.
I modified the waffle pi xacro(s) like explained in the tutorial above This is the modified part of the .gazebo.urdf.xacro
<gazebo reference="depth_camera">
<sensor name="depth_camera_camera" type="depth">
<always_on>true</always_on>
<update_rate>20</update_rate>
<camera>
<horizontal_fov>1.047198</horizontal_fov>
<image>
<width>640</width>
<height>480</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.05</near>
<far>3</far>
</clip>
</camera>
<plugin name="depth_camera_controller" filename="libgazebo_ros_openni_kinect.so">
<baseline>0.2</baseline>
<alwaysOn>true</alwaysOn>
<updateRate>0.0</updateRate>
<cameraName>camera_ir</cameraName>
<imageTopicName>camera/color/image_raw</imageTopicName>
<cameraInfoTopicName>camera/color/camera_info</cameraInfoTopicName>
<depthImageTopicName>camera/depth/image_raw</depthImageTopicName>
<depthImageInfoTopicName>camera/depth/camera_info</depthImageInfoTopicName>
<pointCloudTopicName>camera/depth/points</pointCloudTopicName>
<frameName>camera</frameName>
<pointCloudCutoff>0.5</pointCloudCutoff>
<pointCloudCutoffMax>3.0</pointCloudCutoffMax>
<distortionK1>0.00000001</distortionK1>
<distortionK2>0.00000001</distortionK2>
<distortionK3>0.00000001</distortionK3>
<distortionT1>0.00000001</distortionT1>
<distortionT2>0.00000001</distortionT2>
<CxPrime>0</CxPrime>
<Cx>0</Cx>
<Cy>0</Cy>
<focalLength>0</focalLength>
<hackBaseline>0</hackBaseline>
</plugin>
</sensor>
</gazebo>
and that's the modified part of the .urdf.xacro
<joint name="camera_rgb_joint" type="fixed">
<origin xyz="0.003 0.011 0.009" rpy="0 0 0"/>
<parent link="camera_link"/>
<child link="depth_camera"/>
</joint>
<link name="depth_camera">
<inertial><mass value="0.1" />
<inertia ixx="0.001" ixy="0.0" ixz="0.0"
iyy="0.001" iyz="0.0"
izz="0.001" /></inertial>
<collision name="collision">
<geometry>
<box size="0.073000 0.276000 0.072000" />
</geometry>
</collision>
<visual name="visual">
<geometry>
<mesh filename="model://kinect/meshes/kinect.dae" />
</geometry>
</visual>
</link>
<joint name="camera_rgb_optical_joint" type="fixed">
<origin xyz="0 0 0" rpy="-1.57 0 -1.57"/>
<parent link="depth_camera"/>
<child link="camera_rgb_optical_frame"/>
</joint>
<link name="camera_rgb_optical_frame"/>
Edit: This is the gazebo urdf file:
<?xml version="1.0"?>
<robot name="turtlebot3_waffle_ki_sim" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:arg name="laser_visual" default="false"/>
<xacro:arg name="camera_visual" default="false"/>
<xacro:arg name="imu_visual" default="false"/>
<xacro:arg name="link_name" default="camera" />
<xacro:arg name="frame_name" default="camera_frame" />
<xacro:arg name="camera_name" default="camera" />
<gazebo reference="base_link">
<material>Gazebo/DarkGrey</material>
</gazebo>
<gazebo reference="wheel_left_link">
<mu1>0.1</mu1>
<mu2>0.1</mu2>
<kp>500000.0</kp>
<kd>10.0</kd>
<minDepth>0.001</minDepth>
<maxVel>0.1</maxVel>
<fdir1>1 0 0</fdir1>
<material>Gazebo/FlatBlack</material>
</gazebo>
<gazebo reference="wheel_right_link">
<mu1>0.1</mu1>
<mu2>0.1</mu2>
<kp>500000.0</kp>
<kd>10.0</kd>
<minDepth>0.001</minDepth>
<maxVel>0.1</maxVel> ...
Can you paste your waffle robot .gazebo file? Maybe you need to add the sensor topic to that file
@rdelgadov Sure, I answered posting the code ;)
Did you manage to run this tutorial successfully with the standalone Kinect? I tried it with ROS melodic, and not worked well so far, despite the model was loaded OK, no topics being published.
So, perhaps, if your kinect nor publish in standalone as mine, it won't publish in the robot simulation.
@murilosantos if I use it as standalone it works perfectly, initially I followed that tutorial :)