Skip to content

Conversation

chan-1207
Copy link
Contributor

Pull Request Summary

This PR adds support for Machine Learning Jazzy version and introduces the following key changes:

  1. Gazebo sim maps are updated for Machine Learning pkg

  2. World Plugins are added for Machine Learning maps

Validation

Verified successful colcon build and ros2 launch on a Jazzy development environment

@chan-1207 chan-1207 requested a review from GyuH13 May 30, 2025 08:02
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @chan-1207, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

As gemini-code-assist, I've reviewed this pull request which aims to update the simulation environment for the TurtleBot3 Machine Learning examples to be compatible with the Jazzy ROS 2 distribution and a newer version of Gazebo (likely Ignition/Gazebo Sim 8, based on the changes). The core changes involve updating SDF model and world files to version 1.8, migrating Gazebo plugins from the older gazebo library to the newer gz-sim system plugin architecture, and adding new launch files to integrate these updated simulations with ROS 2 using ros_gz_sim.

Highlights

  • Gazebo Simulation Updates: The pull request updates various Gazebo simulation files, including TurtleBot3 models (burger, burger_cam, waffle, waffle_pi) and the DQN world models (goal_box, inner_walls, obstacle1, obstacle2, obstacles, turtlebot3_dqn_world), to use SDF version 1.8. This includes changes to sensor definitions (e.g., <lidar> to <ray>) and plugin configurations.
  • Gazebo System Plugin Migration: The custom C++ plugins for obstacles (obstacle1, obstacle2, obstacles) have been refactored from the older gazebo::ModelPlugin architecture to the newer gz::sim::System interface (ISystemConfigure, ISystemPreUpdate). This involves significant changes to the plugin code and build configuration.
  • New ROS 2 Launch Files: New Python launch files (turtlebot3_dqn_stage*.launch.py) are added for each of the DQN training stages. These launch files utilize ros_gz_sim to start the Gazebo simulation with the updated world files and spawn the TurtleBot3, setting the necessary resource paths.
  • CMake Build Updates: The CMakeLists.txt file is updated to correctly build the refactored C++ obstacle plugins as shared libraries and install them. It also updates dependencies to link against gz-sim8 libraries.

Changelog

Click here to see the changelog
  • turtlebot3_gazebo/CMakeLists.txt
    • Added ament_target_dependencies for turtlebot3_drive.
    • Defined a list OBSTACLE_LIBS for the obstacle plugins (obstacles, obstacle1, obstacle2).
    • Added a foreach loop to build each obstacle plugin as a shared library, include gz-sim8 headers, and link against gz-sim8 libraries.
    • Added the obstacle plugins to the install(TARGETS ...) command.
  • turtlebot3_gazebo/include/turtlebot3_gazebo/obstacle1.hpp
    • Updated author list.
    • Replaced old Gazebo includes (ignition/math.hh, gazebo/common/common.hh, etc.) with new gz/sim and gz/math includes.
    • Changed namespace from gazebo to turtlebot3_gazebo.
    • Changed base class from gazebo::ModelPlugin to inherit from gz::sim::System, ISystemConfigure, and ISystemPreUpdate.
    • Updated method signatures for Configure and PreUpdate to match the new system plugin interface.
    • Replaced old member variables (physics::ModelPtr, event::ConnectionPtr) with new ones (gz::sim::Model, std::chrono::steady_clock::time_point, std::vector<gz::math::Vector3d> waypoints, std::vector<double> segmentDistances, double totalDistance, double speed).
  • turtlebot3_gazebo/include/turtlebot3_gazebo/obstacle2.hpp
    • Updated author list.
    • Replaced old Gazebo includes with new gz/sim and gz/math includes.
    • Changed namespace from gazebo to turtlebot3_gazebo.
    • Changed base class from gazebo::ModelPlugin to inherit from gz::sim::System, ISystemConfigure, and ISystemPreUpdate.
    • Updated method signatures for Configure and PreUpdate.
    • Replaced old member variables with new ones for waypoint-based movement.
  • turtlebot3_gazebo/include/turtlebot3_gazebo/obstacles.hpp
    • Updated author list.
    • Removed #define PI.
    • Replaced old Gazebo includes with new gz/sim includes.
    • Changed namespace from gazebo to turtlebot3_gazebo.
    • Changed base class from gazebo::ModelPlugin to inherit from gz::sim::System, ISystemConfigure, and ISystemPreUpdate.
    • Updated method signatures for Configure and PreUpdate.
    • Replaced old member variables with new ones for time-based rotation.
  • turtlebot3_gazebo/launch/turtlebot3_dqn_stage1.launch.py
    • Added new launch file for DQN Stage 1.
    • Uses ros_gz_sim to launch Gazebo Sim.
    • Sets GZ_SIM_RESOURCE_PATH to include the package's models directory.
    • Launches gz_sim.launch.py for both server and client with the turtlebot3_dqn_stage1.world.
    • Includes robot_state_publisher.launch.py and spawn_turtlebot3.launch.py.
  • turtlebot3_gazebo/launch/turtlebot3_dqn_stage2.launch.py
    • Added new launch file for DQN Stage 2.
    • Similar structure to stage1, launching turtlebot3_dqn_stage2.world.
  • turtlebot3_gazebo/launch/turtlebot3_dqn_stage3.launch.py
    • Added new launch file for DQN Stage 3.
    • Similar structure to stage1, launching turtlebot3_dqn_stage3.world.
  • turtlebot3_gazebo/launch/turtlebot3_dqn_stage4.launch.py
    • Added new launch file for DQN Stage 4.
    • Similar structure to stage1, launching turtlebot3_dqn_stage4.world.
  • turtlebot3_gazebo/models/turtlebot3_burger/model.sdf
    • Minor indentation change in the gz-sim-diff-drive-system plugin configuration.
  • turtlebot3_gazebo/models/turtlebot3_burger_cam/model.config
    • Updated SDF version from 1.6 to 1.8.
  • turtlebot3_gazebo/models/turtlebot3_burger_cam/model.sdf
    • Updated SDF version from 1.6 to 1.8.
    • Changed <lidar> tag to <ray> in the sensor definition.
    • Minor indentation change in the gz-sim-diff-drive-system plugin configuration.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/goal_box/model.config
    • Added new model configuration file for goal_box with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/goal_box/model.sdf
    • Added new SDF model file for a static cylinder goal_box with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/inner_walls/model.config
    • Added new model configuration file for inner_walls with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/inner_walls/model.sdf
    • Added new SDF model file for static inner_walls (multiple boxes) with SDF version 1.8, including PBR textures.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/model.config
    • Added new model configuration file for turtlebot3_dqn_world with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/model.sdf
    • Added new SDF model file for the static outer walls of the turtlebot3_dqn_world (multiple boxes) with SDF version 1.8, including PBR textures.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle1/model.config
    • Added new model configuration file for obstacle1 with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle1/model.sdf
    • Added new SDF model file for a static cylinder obstacle1 with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle2/model.config
    • Added new model configuration file for obstacle2 with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle2/model.sdf
    • Added new SDF model file for a static cylinder obstacle2 with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacles/model.config
    • Added new model configuration file for obstacles with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacles/model.sdf
    • Added new SDF model file for static cylinder obstacles (multiple cylinders) with SDF version 1.8.
  • turtlebot3_gazebo/models/turtlebot3_waffle/model.config
    • Updated SDF version from 1.5 to 1.8.
  • turtlebot3_gazebo/models/turtlebot3_waffle/model.sdf
    • Minor indentation change in the gz-sim-diff-drive-system plugin configuration.
  • turtlebot3_gazebo/models/turtlebot3_waffle_pi/model.config
    • Updated SDF version from 1.5 to 1.8.
  • turtlebot3_gazebo/models/turtlebot3_waffle_pi/model.sdf
    • Updated SDF version from 1.5 to 1.8.
    • Changed <lidar> tag to <ray> in the sensor definition.
    • Minor indentation change in the gz-sim-diff-drive-system plugin configuration.
  • turtlebot3_gazebo/worlds/turtlebot3_dqn_stage1.world
    • Updated SDF version from 1.6 to 1.8.
    • Changed world name from default to dqn.
    • Added gz-sim system plugins (Physics, UserCommands, SceneBroadcaster, Sensors).
    • Updated includes for ground_plane and sun to use Fuel URIs.
    • Updated the turtlebot3_dqn_world model definition, setting static to true.
  • turtlebot3_gazebo/worlds/turtlebot3_dqn_stage2.world
    • Updated SDF version from 1.6 to 1.8.
    • Changed world name from default to dqn.
    • Added gz-sim system plugins (Physics, UserCommands, SceneBroadcaster, Sensors, Imu).
    • Updated includes for ground_plane and sun to use Fuel URIs.
    • Updated the turtlebot3_dqn_world model definition.
    • Added include for turtlebot3_dqn_world/obstacles.
  • turtlebot3_gazebo/worlds/turtlebot3_dqn_stage3.world
    • Updated SDF version from 1.6 to 1.8.
    • Changed world name from default to dqn.
    • Added gz-sim system plugins (Physics, UserCommands, SceneBroadcaster, Sensors, Imu).
    • Updated includes for ground_plane and sun to use Fuel URIs.
    • Updated the turtlebot3_dqn_world model definition.
    • Updated include for turtlebot3_dqn_world/obstacles to include the turtlebot3_gazebo::ObstaclesPlugin.
  • turtlebot3_gazebo/worlds/turtlebot3_dqn_stage4.world
    • Updated SDF version from 1.6 to 1.8.
    • Changed world name from default to dqn.
    • Added gz-sim system plugins (Physics, UserCommands, SceneBroadcaster, Sensors, Imu).
    • Updated includes for ground_plane and sun to use Fuel URIs.
    • Updated the turtlebot3_dqn_world model definition.
    • Added includes for turtlebot3_dqn_world/inner_walls, obstacle1, and obstacle2, including the respective turtlebot3_gazebo::Obstacle1Plugin and turtlebot3_gazebo::Obstacle2Plugin.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Simulation spins,
Robot learns, avoids walls,
Jazzy world awaits.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the TurtleBot3 Gazebo simulation for the Jazzy ROS 2 distribution and newer Gazebo Simulator versions. It includes migrating Gazebo Classic plugins to Gazebo Sim systems, updating SDF files to version 1.8, and introducing new launch files and models for machine learning stages. The migration to the new Gazebo Sim plugin architecture and SDF standards is well executed. The introduction of new launch files and world models for different DQN stages is a good step for organizing experiments.

Summary of Findings

  • Static Models with Animation Plugins: Models obstacle1, obstacle2, and obstacles (in turtlebot3_dqn_world) are declared as <static>true</static> in their respective SDF files. However, they are associated with plugins intended to animate their poses. Static models cannot be moved by plugins. These should be set to <static>false</static>.
  • Potentially Dynamic Inner Walls: The inner_walls model SDF does not explicitly set <static>true</static>, meaning these walls will be dynamic by default. This might be unintended for fixed barriers in the environment.
  • Launch File Duplication: The launch files for different DQN stages (turtlebot3_dqn_stageX.launch.py) are highly duplicative. A single parameterized launch file would improve maintainability.
  • Hardcoded Plugin Parameters: Movement parameters (waypoints, speed, rotation period) in obstacle1.cpp, obstacle2.cpp, and obstacles.cpp are hardcoded. Making these configurable via SDF would enhance plugin reusability and flexibility.
  • SDF Version and Tag Updates: SDF files have been correctly updated to version 1.8, and Lidar sensor configuration now appropriately uses the <ray> tag instead of <lidar>, aligning with newer Gazebo Sim versions.
  • CMake Configuration: The CMakeLists.txt now uses a loop to build obstacle libraries, which is a good improvement for maintainability.

Merge Readiness

This pull request makes significant strides in updating the TurtleBot3 Gazebo simulations for Jazzy. However, due to the critical issues identified with static models being targeted by animation plugins, the simulations for stages 3 and 4 will likely not function as expected. These critical issues must be addressed before merging. Additionally, addressing the medium-severity suggestions regarding launch file duplication, hardcoded plugin parameters, and the static property of inner walls would greatly improve the long-term maintainability and flexibility of this package. I am unable to approve pull requests directly. Please ensure these changes are reviewed and the critical issues are resolved before merging.

@chan-1207 chan-1207 requested a review from yun-goon June 4, 2025 08:08
@chan-1207 chan-1207 requested review from GyuH13 and yun-goon and removed request for GyuH13 and yun-goon June 4, 2025 08:17
@chan-1207 chan-1207 added the enhancement New feature or request label Jun 4, 2025
@github-project-automation github-project-automation bot moved this to 🌱 Todo in Platform Jun 4, 2025
@chan-1207 chan-1207 moved this from 🌱 Todo to 📝 Pull Request in Platform Jun 4, 2025
@chan-1207 chan-1207 removed request for GyuH13 and yun-goon June 5, 2025 06:45
@GyuH13 GyuH13 requested review from GyuH13 and yun-goon June 9, 2025 05:01
@GyuH13 GyuH13 self-assigned this Jun 9, 2025
GyuH13 added 2 commits June 9, 2025 14:06
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Copy link
Member

@GyuH13 GyuH13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good.

Copy link
Member

@yun-goon yun-goon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, everything is turning on well!

@GyuH13 GyuH13 assigned robotpilot and unassigned GyuH13 Jun 9, 2025
@robotpilot robotpilot merged commit eb50ff8 into main Jun 9, 2025
10 checks passed
@robotpilot robotpilot deleted the feature-machine-learning-jazzy branch June 9, 2025 06:57
@github-project-automation github-project-automation bot moved this from 📝 Pull Request to 🚩Done in Platform Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants