PathAlignCritic: Improve occupancy check, Add DirectionChangeCritic#10
PathAlignCritic: Improve occupancy check, Add DirectionChangeCritic#10adivardi wants to merge 18 commits intoenway-develfrom
Conversation
Summary of ChangesHello, 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 introduces a new critic to the MPPI controller to enhance robot motion by penalizing abrupt changes in driving direction. It also provides a comprehensive overhaul of the MPPI controller's visualization framework, offering detailed and configurable output for better debugging and analysis. Additionally, a key behavior tree component has been refactored for improved code organization and reusability. Highlights
Using Gemini Code AssistThe 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
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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new DirectionChangeCritic to penalize changes in driving direction, requiring the addition of robot_speed to the State struct for accurate feedback. The trajectory visualization system has been significantly refactored and expanded, moving all visualization logic into a dedicated TrajectoryVisualizer class with new parameters for publishing optimal trajectories, footprints, and individual critic costs. The CriticData structure now includes optional storage for per-critic costs to support this enhanced visualization. Additionally, PathAlignCritic, PathAngleCritic, and PathFollowCritic have been updated with new visualization options and refined logic for path occupancy checks. A review comment highlights that the VisPathRepub test is likely to fail due to a missing implementation for the publish_transformed_path feature in TrajectoryVisualizer. Another comment suggests refactoring duplicated cost calculation code in DirectionChangeCritic for improved conciseness and maintainability. Finally, two patch files (subtree.patch and subtree_first.patch) were accidentally committed and should be removed.
There is still a bug that the publish_trajectories_with_individual_cost doesn't update on reconfigure calls
Use robot_speed from feedback, as it better represents the actual direction of motion. This results in more consistent critic application and longer motions in each direction
Not sure if useful
8e240fa to
7f72dcb
Compare
After looking into adding break early when computing the path's arc-length
7e0f073 to
da1e155
Compare
Additions & Changes
PathAlign Critic
Add a minimum distance for the occupancy check.
Previously, the occupancy check was done up to a distance = furthest_reached_path_point along the path,
Now, it is done over a
distance = min(min_dist, furthest_reached_path_point).The effect of this change is that when approaching an obstacle, even if the robot slows down (and thus
furthest_reached_path_pointdistance becomes smaller and smaller), the check would still trigger and disable the critic. This solves the issue where the robot slows down when approaching an obstacle instead of overtaking it, until it gets stuck when the obstacle is just in front of the robot.Results of this change are susbtiantal:
Previously, robot was not able to overtake a box of 1.5m width places in front of it.
With the change, the robot can overtake obstacles up to the width of a car and even more.
Remaining issues
When approaching a car parked perpendicular to the robot, the robot correctly starts going around it. However, when the robot is perpendicular to the path, MPPI finds no good solution and "gets lost"
DirectionChange Critic
Add a critic for penalizing changes in driving direction. This reduces MPPI switching direction too quickly, leading to robot to get stuck as the motors cannot follow.
Applying the critic on the current robot's speed (and not last command published) leads to much better results
Added a new
state.robot_speedfield asstate.speedis either current speed or last command published, depends on open_loop setting.Remaining issues
DirectionChange: Also penalize wz to avoid quick steering in place when stuckChecklist (tick off when done or remove when not relevant):