-
Notifications
You must be signed in to change notification settings - Fork 819
refactor(autoware_trajectory_optimizer): move functions and change parameter names to accommodate standard #11760
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
|
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
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 refactors the autoware_trajectory_optimizer package by reorganizing plugin utility functions from a central utils.cpp file into plugin-specific utility files, improving code modularity and maintainability.
Key changes:
- Moved utility functions to plugin-specific files (
trajectory_extender_utils,trajectory_point_fixer_utils,trajectory_spline_smoother_utils,trajectory_velocity_optimizer_utils) - Added comprehensive unit tests for each plugin's utilities (1,307 lines total)
- Renamed ROS parameters for consistency (
fix_invalid_points→use_trajectory_point_fixer,optimize_velocity→use_velocity_optimizer,extend_trajectory_backward→use_trajectory_extender,min_dist_to_merge_m→min_dist_to_resample_m)
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_utils.hpp |
Shared test helper functions for trajectory creation |
tests/test_trajectory_velocity_optimizer_utils.cpp |
Unit tests for velocity optimizer utilities |
tests/test_trajectory_spline_smoother_utils.cpp |
Unit tests for spline smoother utilities |
tests/test_trajectory_point_fixer_utils.cpp |
Unit tests for point fixer utilities |
tests/test_trajectory_extender_utils.cpp |
Unit tests for trajectory extender utilities |
tests/test_trajectory_optimizer.cpp |
Removed tests moved to plugin-specific test files |
tests/test_trajectory_mpt_optimizer_utils.cpp |
Updated to use shared test utilities |
src/utils.cpp |
Removed plugin-specific utilities, retained shared functions |
src/trajectory_optimizer_plugins/*.cpp |
Updated to use plugin-specific utility namespaces |
src/trajectory_optimizer_plugins/plugin_utils/*.cpp |
New plugin-specific utility implementations |
include/autoware/trajectory_optimizer/utils.hpp |
Removed declarations of moved functions |
include/autoware/trajectory_optimizer/trajectory_optimizer_structs.hpp |
Updated parameter names |
include/autoware/trajectory_optimizer/trajectory_optimizer_plugins/*.hpp |
Updated parameter names and added new utility headers |
schema/trajectory_optimizer.schema.json |
Updated parameter names and descriptions |
config/*.yaml |
Updated parameter names in configuration files |
README.md |
Updated parameter reference in documentation |
CMakeLists.txt |
Added new utility source files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ectory_optimizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_extender_utils.cpp
Show resolved
Hide resolved
planning/autoware_trajectory_optimizer/schema/trajectory_optimizer.schema.json
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #11760 +/- ##
==========================================
+ Coverage 17.46% 17.79% +0.32%
==========================================
Files 1827 1836 +9
Lines 125897 126531 +634
Branches 43190 43457 +267
==========================================
+ Hits 21988 22516 +528
- Misses 85522 85649 +127
+ Partials 18387 18366 -21
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
...jectory_optimizer/trajectory_optimizer_plugins/plugin_utils/trajectory_point_fixer_utils.hpp
Outdated
Show resolved
Hide resolved
...ectory_optimizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_extender_utils.cpp
Outdated
Show resolved
Hide resolved
...ectory_optimizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_extender_utils.cpp
Outdated
Show resolved
Hide resolved
...ectory_optimizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_extender_utils.cpp
Outdated
Show resolved
Hide resolved
...ectory_optimizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_extender_utils.cpp
Outdated
Show resolved
Hide resolved
...optimizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_spline_smoother_utils.cpp
Outdated
Show resolved
Hide resolved
...imizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_velocity_optimizer_utils.cpp
Outdated
Show resolved
Hide resolved
..._optimizer/trajectory_optimizer_plugins/plugin_utils/trajectory_velocity_optimizer_utils.hpp
Outdated
Show resolved
Hide resolved
...imizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_velocity_optimizer_utils.cpp
Outdated
Show resolved
Hide resolved
...imizer/src/trajectory_optimizer_plugins/plugin_utils/trajectory_velocity_optimizer_utils.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Daniel <[email protected]>
Signed-off-by: Daniel <[email protected]>
Signed-off-by: Daniel <[email protected]>
Signed-off-by: Daniel <[email protected]>
Signed-off-by: Daniel <[email protected]>
Signed-off-by: Daniel <[email protected]>
Signed-off-by: Daniel <[email protected]>
Signed-off-by: Daniel <[email protected]>
c61225d to
4b700ba
Compare
refactor(trajectory_optimizer): reorganize plugin utilities into plugin-specific files
Description
This PR refactors the
autoware_trajectory_optimizerpackage by reorganizing plugin utility functions from a centralutils.cppfile into plugin-specific utility files. This improves code modularity, maintainability, and makes the codebase easier to navigate.Changes
Code Organization:
plugin_utils/trajectory_extender_utils.{hpp,cpp}plugin_utils/trajectory_point_fixer_utils.{hpp,cpp}plugin_utils/trajectory_spline_smoother_utils.{hpp,cpp}plugin_utils/trajectory_velocity_optimizer_utils.{hpp,cpp}utils.cppfor shared utilities used across multiple pluginsTesting:
test_trajectory_extender_utils.cpp(344 lines)test_trajectory_point_fixer_utils.cpp(452 lines)test_trajectory_spline_smoother_utils.cpp(143 lines)test_trajectory_velocity_optimizer_utils.cpp(368 lines)test_utils.hppwith shared test helper functions (148 lines)Optimizations:
Benefits
Related links
Parent Issue:
None - Standalone refactoring work
How was this PR tested?
colcon buildNotes for reviewers
utils.cppstill contains shared utilities used by multiple plugins (trajectory resampling, validation, etc.)Interface changes
ROS Parameter Changes
Additions and removals
trajectory_point_fixer.remove_close_pointsbooleantrueModifications
fix_invalid_pointsbooleantrueuse_trajectory_point_fixerbooleantrueextend_trajectory_backwardbooleanfalseuse_trajectory_extenderbooleanfalseoptimize_velocitybooleantrueuse_velocity_optimizerbooleantruetrajectory_point_fixer.min_dist_to_merge_mnumber0.05trajectory_point_fixer.min_dist_to_resample_mnumber0.05Note: Parameter names were updated to follow consistent naming conventions with
use_prefix for plugin enable flags and clearer semantic naming for distance thresholds.Effects on system behavior
Minor behavioral improvement:
The trajectory extender now correctly sets both velocity and acceleration fields when prepending ego pose history points, whereas the original implementation only set velocity. This ensures trajectory consistency and prevents discontinuities in the acceleration profile at the junction between historical and planned trajectory segments.