Kinect on TurtleBot3 for Gazebo simulation (ROS Melodic)

asked 2021-02-05 08:57:58 -0500

Giuseppe_ gravatar image

updated 2021-02-06 04:48:34 -0500

gvdhoorn gravatar image


I'm trying to add this depth camera and right now I followed this tutorial for this purpose:

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">
    <plugin name="depth_camera_controller" filename="">

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"/>

   <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">
          <box size="0.073000 0.276000 0.072000" />
      <visual name="visual">
          <mesh filename="model://kinect/meshes/kinect.dae" />
  <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"/>
  <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="">
  <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">
  <gazebo reference="wheel_left_link">
    <fdir1>1 0 0</fdir1>
  <gazebo reference="wheel_right_link">
    <maxVel>0.1</maxVel> ...
edit retag flag offensive close merge delete



Can you paste your waffle robot .gazebo file? Maybe you need to add the sensor topic to that file

rdelgadov gravatar image rdelgadov  ( 2021-02-05 13:14:39 -0500 )edit

@rdelgadov Sure, I answered posting the code ;)

Giuseppe_ gravatar image Giuseppe_  ( 2021-02-06 03:40:02 -0500 )edit

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.

msantos gravatar image msantos  ( 2021-02-08 03:50:14 -0500 )edit

@murilosantos if I use it as standalone it works perfectly, initially I followed that tutorial :)

Giuseppe_ gravatar image Giuseppe_  ( 2021-02-08 03:58:12 -0500 )edit