IN THIS ARTICLE
Importing Turtlebot 4
Introduction
TurtleBot 4 is an open-source robotics platform for education and research. The URDF description of this robot is available as a ROS 2 package, which makes it easy to install and to test with Robot Importer. You should refer to the introduction to the Robot Importer tool for a more detailed explanation of the importing steps.
Prerequisite
Install necessary packages from ROS 2:
sudo apt install ros-${ROS_DISTRO}-turtlebot4-description ros-${ROS_DISTRO}-turtlebot4-msgs ros-${ROS_DISTRO}-turtlebot4-navigation ros-${ROS_DISTRO}-turtlebot4-node
Importing the robot
Robot importer wizard
Open the Robot Importer tool and select the input file. You should find it in your ROS 2 install folder. By default, the file is located in the path: /opt/ros/${ROS_DISTRO}/share/turtlebot4_description/urdf/standard/turtlebot4.urdf.xacro
. Next, switch off the first two toggles, as in the picture below.
Use Articulations
toggle determines whether
PhysX articulation components should be used for joints and rigid bodies. Although articulations are often superior to simulating mechanisms over adding joints, they are more difficult to set up (e.g., they are very sensitive to the configuration of links’ inertia). Using joints might allow you to skip some of the problems. The second toggle, Preserve URDF fixed joints
, will let the importer reduce the complexity of the model. The usability of this method depends on the URDF implementation and you might want to try importing the robot with and without this option set to check for better results.
Post-import modifications
Depending on the robot description, the importer might create colliders that intersect with each other, causing explosion of the robot when starting the simulation. Turtlebot 4 has a collision between base_link
and wheels
. To alleviate this problem, you could either remove the base_link
collider or put the colliders on different collision layers. Last but not least, you could redesign the colliders so they do not intersect. We recommend disabling the collider in base_link
as a quick fix, and setting the collision layers accordingly as the final touch.
The robot control
Turtlebot 4 is controlled by libgazebo_ros2_control
plugin, which is not supported by the Robot Importer. Instead, you might manually add
Skid Steering to the robot to make it drive. To do it, add three components to base_link
:
Skid Steering Twist Control
ROS2 Robot Control
Skid Steering Vehicle Model
The last component, Skid Steering Vehicle Model
, is crucial, as it contains the parameters of the vehicle dynamics and links to wheel entities. First, set the vehicle limits, track and wheelbase. Next, add an axle, and links to left_wheel
and right_wheel
entities. Switch the toggle to mark this axle as a drive axle. Finally, set the wheel radius. The ROS 2 topic configuration can be changed in ROS2 Robot Control
component. The sample configuration is presented below:
Finally, you need to add Wheel Controller
components to left_wheel
and right_wheel
entities, and switch Use Motor
flags in hinge joints of both wheel entities. You might change the Force Limit Value
to a higher value to ensure smooth driving. The configuration of the right_wheel
is presented below.
The sensors
The Robot Importer correctly imports multiple sensors that are attached to the Turtlebot 4 robot, however not all sensors are parsed correctly and not all sensors are added as designed - depending on your needs, some manual tuning is necessary:
- the LiDAR sensor is attached to
rplidar_link
, as defined in the robot description - the IMU sensor is missing in
imu_link
due to unsupportedlibgazebo_ros_create_imu
plugin - the RGBD camera sensor is added to
oakd_rgb_camera_frame
link, but the orientation of the sensor should be adjusted - the ir sensors are imported as LiDAR sensors
- the contact sensors are skipped by the Robot Importer completely as unsupported
Lidar sensors may not function correctly for the same reason as the robot itself, namely due to self-collisions. To resolve this issue, you can either remove or disable some of the colliders responsible for these self-collisions. A more optimal solution, however, would be to assign different collision layers to distinguish between objects that should and should not interact with the Lidar sensors, thereby preventing unwanted interference.