-
Notifications
You must be signed in to change notification settings - Fork 512
Update simulation for machine learning jazzy version #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 oldergazebo::ModelPlugin
architecture to the newergz::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 utilizeros_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 againstgz-sim8
libraries.
Changelog
Click here to see the changelog
- turtlebot3_gazebo/CMakeLists.txt
- Added
ament_target_dependencies
forturtlebot3_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, includegz-sim8
headers, and link againstgz-sim8
libraries. - Added the obstacle plugins to the
install(TARGETS ...)
command.
- Added
- turtlebot3_gazebo/include/turtlebot3_gazebo/obstacle1.hpp
- Updated author list.
- Replaced old Gazebo includes (
ignition/math.hh
,gazebo/common/common.hh
, etc.) with newgz/sim
andgz/math
includes. - Changed namespace from
gazebo
toturtlebot3_gazebo
. - Changed base class from
gazebo::ModelPlugin
to inherit fromgz::sim::System
,ISystemConfigure
, andISystemPreUpdate
. - Updated method signatures for
Configure
andPreUpdate
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
andgz/math
includes. - Changed namespace from
gazebo
toturtlebot3_gazebo
. - Changed base class from
gazebo::ModelPlugin
to inherit fromgz::sim::System
,ISystemConfigure
, andISystemPreUpdate
. - Updated method signatures for
Configure
andPreUpdate
. - 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
toturtlebot3_gazebo
. - Changed base class from
gazebo::ModelPlugin
to inherit fromgz::sim::System
,ISystemConfigure
, andISystemPreUpdate
. - Updated method signatures for
Configure
andPreUpdate
. - 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 theturtlebot3_dqn_stage1.world
. - Includes
robot_state_publisher.launch.py
andspawn_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.
- Minor indentation change in the
- 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.
- Added new model configuration file for
- 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.
- Added new SDF model file for a static cylinder
- turtlebot3_gazebo/models/turtlebot3_dqn_world/inner_walls/model.config
- Added new model configuration file for
inner_walls
with SDF version 1.8.
- Added new model configuration file for
- 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.
- Added new SDF model file for static
- turtlebot3_gazebo/models/turtlebot3_dqn_world/model.config
- Added new model configuration file for
turtlebot3_dqn_world
with SDF version 1.8.
- Added new model configuration file for
- 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.
- Added new SDF model file for the static outer walls of the
- turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle1/model.config
- Added new model configuration file for
obstacle1
with SDF version 1.8.
- Added new model configuration file for
- turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle1/model.sdf
- Added new SDF model file for a static cylinder
obstacle1
with SDF version 1.8.
- Added new SDF model file for a static cylinder
- turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle2/model.config
- Added new model configuration file for
obstacle2
with SDF version 1.8.
- Added new model configuration file for
- turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle2/model.sdf
- Added new SDF model file for a static cylinder
obstacle2
with SDF version 1.8.
- Added new SDF model file for a static cylinder
- turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacles/model.config
- Added new model configuration file for
obstacles
with SDF version 1.8.
- Added new model configuration file for
- 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.
- Added new SDF model file for static cylinder
- 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.
- Minor indentation change in the
- 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
todqn
. - Added
gz-sim
system plugins (Physics
,UserCommands
,SceneBroadcaster
,Sensors
). - Updated includes for
ground_plane
andsun
to use Fuel URIs. - Updated the
turtlebot3_dqn_world
model definition, settingstatic
totrue
.
- turtlebot3_gazebo/worlds/turtlebot3_dqn_stage2.world
- Updated SDF version from 1.6 to 1.8.
- Changed world name from
default
todqn
. - Added
gz-sim
system plugins (Physics
,UserCommands
,SceneBroadcaster
,Sensors
,Imu
). - Updated includes for
ground_plane
andsun
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
todqn
. - Added
gz-sim
system plugins (Physics
,UserCommands
,SceneBroadcaster
,Sensors
,Imu
). - Updated includes for
ground_plane
andsun
to use Fuel URIs. - Updated the
turtlebot3_dqn_world
model definition. - Updated include for
turtlebot3_dqn_world/obstacles
to include theturtlebot3_gazebo::ObstaclesPlugin
.
- turtlebot3_gazebo/worlds/turtlebot3_dqn_stage4.world
- Updated SDF version from 1.6 to 1.8.
- Changed world name from
default
todqn
. - Added
gz-sim
system plugins (Physics
,UserCommands
,SceneBroadcaster
,Sensors
,Imu
). - Updated includes for
ground_plane
andsun
to use Fuel URIs. - Updated the
turtlebot3_dqn_world
model definition. - Added includes for
turtlebot3_dqn_world/inner_walls
,obstacle1
, andobstacle2
, including the respectiveturtlebot3_gazebo::Obstacle1Plugin
andturtlebot3_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
-
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. ↩
There was a problem hiding this 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
, andobstacles
(inturtlebot3_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
, andobstacles.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.
turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle1/model.sdf
Outdated
Show resolved
Hide resolved
turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacle2/model.sdf
Outdated
Show resolved
Hide resolved
turtlebot3_gazebo/models/turtlebot3_dqn_world/obstacles/model.sdf
Outdated
Show resolved
Hide resolved
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
There was a problem hiding this 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!
Pull Request Summary
This PR adds support for Machine Learning Jazzy version and introduces the following key changes:
Gazebo sim maps are updated for Machine Learning pkg
World Plugins are added for Machine Learning maps
Validation
Verified successful colcon build and ros2 launch on a Jazzy development environment