Skip to content

Fix the Reset Trigger Service#1131

Merged
GyuH13 merged 6 commits intomainfrom
feature-add-odom-reset
Dec 15, 2025
Merged

Fix the Reset Trigger Service#1131
GyuH13 merged 6 commits intomainfrom
feature-add-odom-reset

Conversation

@GyuH13
Copy link
Copy Markdown
Member

@GyuH13 GyuH13 commented Dec 15, 2025

Issue

In ROS 1, the Reset Trigger performed both gyro calibration and odometry reset correctly.
However, in ROS 2, there were two issues when using the Reset Trigger: #1126

1. The odometry reset was not executed

2. The service response returned an error message: "There is no status packet"

This PR addresses both issues.

Change

1. Implement odometry reset

The odometry reset logic was missing in the ROS 2 implementation.
This patch adds the missing implementation, allowing the odometry to be reset properly via the Reset Trigger service.
Now, calling the Reset Trigger will correctly reset the odometry.

2. Fix misleading service response message

The "There is no status packet" error occurred because:

Gyro calibration itself takes approximately 5 seconds

The code was waiting for an RX status packet for a shorter duration than the calibration time

As a result, the service incorrectly reported a failure even though the gyro calibration was actually in progress.

To resolve this:

The service response now indicates whether the trigger was successfully invoked, rather than waiting for the gyro calibration to fully complete

This prevents false error messages while maintaining correct behavior

Copilot AI review requested due to automatic review settings December 15, 2025 11:19
@github-project-automation github-project-automation bot moved this to 🌱 Todo in Platform Dec 15, 2025
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @GyuH13, 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!

This pull request resolves critical issues in the TurtleBot3's ROS 2 Reset Trigger service. It introduces the long-awaited odometry reset functionality, allowing for proper recalibration of the robot's position and velocity. Additionally, it refines the service's response during gyro calibration to eliminate misleading error messages, providing a more accurate and reliable user experience for robot control and diagnostics.

Highlights

  • Odometry Reset Implementation: The pull request implements the missing odometry reset logic for ROS 2. The Reset service now triggers a call to a newly created reset_odometry service, ensuring that the robot's pose and velocity can be reset.
  • Improved Service Response for Gyro Calibration: The Reset service's response mechanism has been updated to prevent false error messages during gyro calibration. Instead of waiting for the 5-second calibration to complete, the service now immediately returns success = true and a message indicating that calibration has started and odometry reset is requested, accurately reflecting the initiation of the process.
  • New Odometry Reset Service: A new ROS 2 service named reset_odometry has been introduced within the Odometry class. This service, when called, sets the robot's internal pose and velocity estimates to zero, providing a dedicated mechanism for odometry recalibration.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

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
Copy Markdown

@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 fixes two issues with the Reset Trigger service: a non-functional odometry reset and a misleading service response. The changes introduce a new reset_odometry service and modify the reset logic to call it.

My review has identified a critical issue in turtlebot3_node/src/devices/reset.cpp where blocking calls (sleep_for) are used within a service handler on a single-threaded executor. This will freeze the node and should be replaced with an asynchronous approach, for which I've provided a detailed suggestion.

Additionally, I found that the new odometry reset logic in turtlebot3_node/src/odometry.cpp is incomplete, as it fails to reset all necessary state variables, which could lead to incorrect orientation calculations. I've suggested a fix for this as well.

Comment thread turtlebot3_node/src/devices/reset.cpp
Comment thread turtlebot3_node/src/odometry.cpp
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes two critical issues with the Reset Trigger service in ROS 2: the missing odometry reset functionality and misleading error messages during gyro calibration. The implementation adds a new reset_odometry service in the Odometry class and integrates it with the existing Reset service to provide complete reset functionality.

Key Changes:

  • Implements odometry reset service to restore missing ROS 1 functionality
  • Changes Reset service response to indicate trigger invocation success rather than waiting for calibration completion
  • Establishes service client/server communication between Reset and Odometry components

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
turtlebot3_node/include/turtlebot3_node/odometry.hpp Adds reset service declaration, includes std_srvs header, and declares reset callback method
turtlebot3_node/src/odometry.cpp Creates reset_odometry service and implements callback to reset robot pose and velocity
turtlebot3_node/include/turtlebot3_node/devices/reset.hpp Adds service client member for calling reset_odometry
turtlebot3_node/src/devices/reset.cpp Creates reset_odometry client, changes response handling, and makes async call to reset odometry after gyro calibration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread turtlebot3_node/src/odometry.cpp
Comment thread turtlebot3_node/src/devices/reset.cpp
Comment thread turtlebot3_node/src/devices/reset.cpp
Comment thread turtlebot3_node/src/devices/reset.cpp
Copy link
Copy Markdown
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.

Please update the version and resolve the lint

@github-project-automation github-project-automation bot moved this from 🌱 Todo to 📝 Pull Request in Platform Dec 15, 2025
@GyuH13 GyuH13 requested a review from yun-goon December 15, 2025 11:47
@GyuH13 GyuH13 self-assigned this Dec 15, 2025
@GyuH13 GyuH13 added the bug Something isn't working label Dec 15, 2025
Copy link
Copy Markdown
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.

Good!

@GyuH13 GyuH13 merged commit da785b7 into main Dec 15, 2025
10 checks passed
@GyuH13 GyuH13 deleted the feature-add-odom-reset branch December 15, 2025 12:08
@github-project-automation github-project-automation bot moved this from 📝 Pull Request to 🚩Done in Platform Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants