-
Notifications
You must be signed in to change notification settings - Fork 23
Reset the angle when exceed the limitation of steering and Added the Deadzone #57
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.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.
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_andangular_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 theenable_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
-
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>
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.
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 |
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 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.
ffw_swerve_drive_controller/include/ffw_swerve_drive_controller/swerve_drive_controller.hpp
Show resolved
Hide resolved
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>
Signed-off-by: Geonhee-LEE <gunhee6392@gmail.com>
video link: ai worker - Steering resetting when exceed the limitation