Skip to content

Update machine learning package for Jazzy #75

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

chan-1207
Copy link
Contributor

Pull Request Summary

This PR adds support for ROS 2 Jazzy and introduces the following key changes:

  1. cmd_vel Message Update

    • Changed from geometry_msgs/msg/Twist to geometry_msgs/msg/TwistStamped
  2. goal_box Spawn/Delete API Revision

    • Improved usage of the goal_box spawn/delete API
  3. Upcoming turtlebot3_simulation Package Update

    • Preparing SDF and launch file improvements for Gazebo Harmonic (GzSim 8) compatibility

Validation

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

Confirmed cmd_vel publishing and subscription with TwistStamped messages

Tested spawn_entity / delete_entity in Gazebo

Tested that the action graph / result graph works.

@chan-1207 chan-1207 added the enhancement New feature or request label May 2, 2025
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

This pull request updates the turtlebot3_dqn and turtlebot3_machine_learning packages to support ROS 2 Jazzy and uses Gazebo sim. The key changes include updating the cmd_vel message type from geometry_msgs/msg/Twist to geometry_msgs/msg/TwistStamped in dqn_environment.py, revising the goal box spawn/delete API in dqn_gazebo.py, and preparing for upcoming turtlebot3_simulation package updates for Gazebo Harmonic (GzSim 8) compatibility. The package versions in package.xml and setup.py have been bumped to 1.0.1, and corresponding updates have been made to CHANGELOG.rst files.

Highlights

  • ROS 2 Jazzy Support: The packages are now compatible with ROS 2 Jazzy.
  • cmd_vel Message Update: The cmd_vel message type has been updated to geometry_msgs/msg/TwistStamped.
  • Goal Box API Revision: Improved the usage of the goal_box spawn/delete API in dqn_gazebo.py using gz services.
  • Gazebo Harmonic Compatibility: Preparing for SDF and launch file improvements for Gazebo Harmonic (GzSim 8) compatibility.

Changelog

Click here to see the changelog
  • turtlebot3_dqn/CHANGELOG.rst
    • Added version 1.0.1 changelog entry.
    • Indicated support for ROS 2 Jazzy version.
    • Noted the usage of Gazebo sim for the package.
  • turtlebot3_dqn/package.xml
    • Updated package version to 1.0.1.
  • turtlebot3_dqn/setup.py
    • Updated package version to 1.0.1.
  • turtlebot3_dqn/turtlebot3_dqn/dqn_environment.py
    • Changed import from geometry_msgs.msg import Twist to geometry_msgs.msg import TwistStamped (line 22).
    • Updated cmd_vel_pub publisher to use TwistStamped (line 66).
    • Added a log info message when the environment is called (line 115).
    • Updated cmd_vel_pub.publish calls to use TwistStamped (lines 217, 225, 233, 273, 297).
    • Modified rl_agent_interface_callback to use TwistStamped and access linear/angular velocities via twist.twist (lines 273-275).
  • turtlebot3_dqn/turtlebot3_dqn/dqn_gazebo.py
    • Removed imports for gazebo_msgs.srv and geometry_msgs.msg.Pose and std_srvs.srv.Empty (lines 26-28, 32).
    • Replaced the usage of gazebo_msgs services with gz services to spawn and delete entities (lines 51-53, 64-144).
    • Added a function to reset the burger model (lines 107-144).
  • turtlebot3_machine_learning/CHANGELOG.rst
    • Added version 1.0.1 changelog entry.
    • Indicated support for ROS 2 Jazzy version.
    • Noted the usage of Gazebo sim for the package.
  • turtlebot3_machine_learning/package.xml
    • Updated package version to 1.0.1.
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.


In Jazzy's ROS,
A stamped twist, a goal's new pose,
Learning robots bloom.

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_dqn package to support ROS 2 Jazzy and introduces changes to the cmd_vel message type and goal_box spawn/delete API. The changes seem well-structured and address the compatibility issues with ROS 2 Jazzy. However, there are a few areas that could be improved for clarity and efficiency.

Summary of Findings

  • TwistStamped Usage: The change from geometry_msgs/msg/Twist to geometry_msgs/msg/TwistStamped requires ensuring that the timestamp is correctly populated when publishing cmd_vel messages. Otherwise, the agent might not behave as expected.
  • Gazebo Service Calls: The transition to using gz service calls for spawning and deleting entities is a significant change. It's important to ensure that these calls are robust and handle potential errors gracefully. The current implementation uses subprocess.run with check=True, but the exception handling could be improved.
  • Burger Reset Logic: The reset_burger function includes a time.sleep(0.2) call, which might introduce unnecessary delays. Consider whether this delay is truly necessary and if there are alternative ways to ensure the burger is properly reset.

Merge Readiness

The pull request introduces important updates for ROS 2 Jazzy compatibility. While the core functionality seems to be working as intended, there are several areas where improvements can be made to enhance the robustness and clarity of the code. I recommend addressing the identified issues before merging. I am unable to directly approve this pull request, and other reviewers should also review this code before merging.

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
None yet
Development

Successfully merging this pull request may close these issues.

1 participant