This is my personal ROS practice example that put Turtlebot burger with Realsense D435 in a simple tunnel scene and applies a simple auto mode drive the turtlebot out of the tunnel itself.
I will describe how to import D435 into your own model/world because I found there are only few instruction about do so. For more models (e.g. D455), you can go to RealSense offical Github to find the urdf/xacro files and build the .so
file yourself.
Althoug the configuation should not be the problem, still I put them down below for those who would like to know.
OS: Ubuntu 20.04
ROS: noetic
Gazebo: 11
-
install ROS and packages
sudo apt-get install ros-noetic-desktop-full
replace the 'noetic' to other version to be competitble to your pc
-
Download this repo
# build your work space directories, e.g. `catkin_ws` in my example mkdir catkin_ws cd catkin_ws mkdir src cd src # clone the repo git clone
-
Build the project
cd .. catkin_make
this will generate a
librealsense_gazebo_plugin.so
file to simulate D435 in Gazebo
-
beginner_tutorials: basic ROS operations e.g. node, topics, services
-
realsense_gazebo_plugin: to generate RealSense sensor simulation plugin for Gazebo to use
-
realsense2_description: RealSense sensor models
-
robotcontrol: simple navigation codes. The original codes are from the first link in the reference.
-
turtlebot3: turtlebot3 models
-
turtlebot3_msgs: turtlebot3 messages
-
turtlebot3_simulations: turtlebot3 simulation files (e.g. world models, .world, .launch)
💡 I kind of messed up the original turtlebot3 repos by modifying it directly, but it is still worth to play around with it 😛
Link/Source the bulit project, replace catkin_ws
with your workspace name:
cd catkin_ws
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bash
Setup Turtlebot default model to burger:
echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
source ~/.bash
To launch the simulation that includes turtlebot3_burger + RealSense D435 + Tunnel
roslaunch turtlebot3_gazebo turtlebot3_tunnel.launch
First change the permission of the files
roscd robotcontrol/src
chmod +x *.py
- Move the robot straight
./test.py
- Move the robot to drive out of the tunnel
./self_drive.py
Currently this script cannot be terminated, you have to close the terminal. ToBeFixed!
- Reset the world
./reset.py
- To generate
librealsense_gazebo_plugin.so
file only, make surerealsense_gazebo_plugin
repo is under/src
and build it.Then you will find the file undercd .. # to catkin_ws catkin_make # or use catkin tool to specify which pkg to build catkin build realsense_gazebo_plugin
/catkin_ws/devel/lib
- copy
_d435.gazebo.xacro
and_d435.urdf.xacro
into/your_pkg/urdf
where you want to simulate - in the file _d435.urdf.xacro change the line 13 from
to your
<xacro:include filename="$(find packagename)/urdf/urdf _d435.gazebo.xacro">
package_name
- In your
model.urdf.xacro
(turtlebot3_burgher.urdf.xacro
in my example), put the following lines:and change your desired orginal pose related to<xacro:include filename="$(find packagename)/urdf/_d435.urdf.xacro" /> ... <xacro:sensor_d435 name="camera" topics_ns="camera" parent="base_link" publish_pointcloud="true"> <origin xyz="0 0 0" rpy="0 0 0" /> </xacro:sensor_d435>
base_link
- In the launch file, don't forget to publish the
tf
tree for rviz to visualize<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"> <param name="publish_frequency" type="double" value="30.0" /> </node>
For more detailes, please check the files that related to
burger
model or the keywordtunnel
underturtlebot3_simulations/turtlebot3_gazebo
.
Check the READMEs in velodyne_plugin_tutorial
and velodune_simulator
for more details.
If you have any question please don't hesitate to contact me:
Wen-Yu Chien: [email protected]