Skip to content

RIS-WITH/turtlebot4_simulator

 
 

Repository files navigation

TurtleBot4 Simulator

⚠️ Note: This repository is a fork of the official TurtleBot4 Simulator. For the latest updates, features, and official documentation, please refer to the upstream repository.

This fork is mainly was used for:

  • Debugging purposes
  • Team testing with simulation environments

1. Installation & Environment Setup

System Requirements

  • OS: Ubuntu 22.04 or later (tested up to 24.04)
  • ROS 2: Recommended: Jazzy (also tested: Humble)
  • GPU: Strongly recommended for real-time simulation (e.g., NVIDIA or equivalent)
  • Gazebo: Ignition Gazebo (Fortress or newer)

Setup Steps

  1. Clone & Build the Simulator:
  • mkdir -p ~/turtlebot4_ws/src cd ~/turtlebot4_ws/src git clone https://github.com/turtlebot/turtlebot4_simulator.git cd .. rosdep install --from-paths src --ignore-src -r -y colcon build --symlink-install
  • Source the Workspace:
  • source ~/turtlebot4_ws/install/setup.bash
  • Launch Simulation:
  1. ros2 launch turtlebot4_gazebo sim.launch.py

2. SLAM & Navigation (Nav2)

SLAM

To enable SLAM in the simulation:

ros2 launch turtlebot4_gz_bringup turtlebot4_gz.launch.py slam:=true

If RViz is needed:

ros2 launch turtlebot4_gz_bringup turtlebot4_gz.launch.py slam:=true rviz:=true

Navigation (Nav2)

In some cases, the Nav2 stack does not auto-launch properly. To fix this:

Manual Nav2 Launch

ros2 launch navigation2_bringup navigation_launch.py \
  use_sim_time:=true \
  param_file:=/opt/turtlebot4/share/turtlebot4/config/navigation.yaml

3. Troubleshooting Common Errors

Error: start_motor or start_camera service unavailable

  • These services are not simulated or depend on missing plugins.
  • You can safely ignore them for SLAM testing.

Lidar / tf timestamp errors in SLAM

  • Root cause: GPU rendering not enabled.

  • Fix: Force ogre2 rendering engine:

  • ros2 launch turtlebot4_gazebo sim.launch.py --render-engine ogre2

Simulation too slow (RTF < 0.3)

  • Use a dedicated GPU or adjust physics/rendering settings (see next section).

4. Performance Optimization

Real-Time Factor (RTF)

Target: RTF ≥ 0.6 for stable SLAM/Nav2

GPU Acceleration (Steam Deck or PC w/ NVIDIA)

__NV_PRIME_RENDER_OFFLOAD=1 \
__GLX_VENDOR_LIBRARY_NAME=nvidia \
ros2 launch turtlebot4_gz_bringup turtlebot4_gz.launch.py \
  slam:=true nav2:=true rviz:=true

Simulation Optimization Techniques

  • Remove unnecessary models from the world.

  • Disable shadows and the skybox in Gazebo.

  • Lower camera resolution and FPS:

  • 320 240 10
  • Reduce lidar frequency to 5-10Hz (but not too low — affects Nav2).

Physics Engine Tweaks

Add to world.sdf:

<physics name="default_physics" type="ode">
  <max_step_size>0.01</max_step_size>
  <real_time_update_rate>100</real_time_update_rate>
  <real_time_factor>1.0</real_time_factor>
</physics>

About

TurtleBot 4 Simulator packages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 45.0%
  • C++ 31.0%
  • QML 17.8%
  • CMake 6.2%