Skip to content

Conversation

@Geonhee-LEE
Copy link
Member

@Geonhee-LEE Geonhee-LEE commented Aug 12, 2025

    1. Reset the angle when exceed the limitation of steering (since AI worker has the [-2PI, 2PI] steering limitation)
    1. Added the Deadzone to prevent oscillating for steering angles

video link: ai worker - Steering resetting when exceed the limitation

Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Copilot AI review requested due to automatic review settings August 12, 2025 01:30
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.

Summary of Changes

Hello @Geonhee-LEE, 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 enhances the swerve drive controller by addressing two key areas: improving steering stability and handling angle limitations. It introduces configurable deadbands for linear and angular velocities to prevent minor command fluctuations from causing continuous, oscillating movements. Additionally, it implements a robust mechanism to manage steering angles that exceed predefined operational limits, ensuring the robot can reset its steering and align itself correctly, particularly for AI-controlled workers with specific steering constraints.

Highlights

  • Velocity Deadband Implementation: Introduced linear_vel_deadband_ and angular_vel_deadband_ parameters, along with logic to apply these deadbands to incoming command velocities. This prevents minor, noisy inputs from causing constant, unnecessary adjustments and reduces oscillation.
  • Steering Angle Limit Handling: Added a mechanism to detect when the optimized steering angle exceeds the defined limits (e.g., [-2PI, 2PI]). When this occurs, the wheel's speed is set to zero, and the steering angle is adjusted by PI radians to bring it back within the valid range, initiating an 'alignment mode'.
  • Steering Alignment Mode: Implemented an 'alignment mode' where the wheel stops and the steering angle is corrected to a target alignment angle. The system remains in this mode until the steering angle is within a specified tolerance, ensuring proper orientation before resuming normal operation.
  • Code Simplification and Variable Removal: Removed the enabled_steering_angular_limit_ boolean variable and the enable_direct_joint_commands_ flag and its associated conditional block, simplifying the controller's state management and update logic.
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 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.

Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Copy link

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 implements steering angle safety controls and dead zone filtering for a swerve drive controller. It addresses steering angle limit violations and prevents oscillating behavior from small input commands.

Key changes:

  • Added dead zone filtering for linear and angular velocity commands to prevent oscillation from small inputs
  • Implemented steering angle limit checking with automatic reset when limits are exceeded
  • Added alignment mode to handle steering corrections when angle limits are violated

Reviewed Changes

Copilot reviewed 2 out of 14 changed files in this pull request and generated 6 comments.

File Description
swerve_drive_controller.cpp Main implementation of deadzone filtering, steering limit checking, and alignment mode logic
swerve_drive_controller.hpp Added member variables for deadzone parameters and alignment mode state

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 introduces a deadzone for velocity commands to prevent oscillation and adds logic to reset steering angles when they exceed their limits. The deadzone implementation is sound. However, the steering angle reset logic has a few issues. There's a critical bug where the target angle for alignment isn't stored, which would lead to incorrect behavior. Additionally, the steering velocity limits are bypassed during the alignment phase, which could cause sudden movements. I've also pointed out a couple of medium-severity issues regarding an uninitialized variable and a magic number. My review includes specific code suggestions to address these points.

Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
@Geonhee-LEE Geonhee-LEE self-assigned this Aug 12, 2025
@Geonhee-LEE Geonhee-LEE added the enhancement New feature or request label Aug 12, 2025
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
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