Add omni (SE2) analytic expansion to SmacPlannerLattice#5965
Add omni (SE2) analytic expansion to SmacPlannerLattice#5965ManMan88 wants to merge 4 commits intoros-navigation:mainfrom
Conversation
|
@ManMan88 can you please properly fill in the PR template? |
|
Anything else we should update to optimize for omni platforms? I think maybe this needs to be updated at least: & https://github.com/ManMan88/navigation2/blob/09d46dec9ae0ce662f7ea7fdbfcd78004e097b4d/nav2_smac_planner/src/analytic_expansion.cpp#L61-L62Seems to me like this may not be functional (?) |
Codecov Report❌ Patch coverage is
... and 13 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
Sorry about the missing faulty PR format, I'll change it to the correct format based on the template. |
mini-1235
left a comment
There was a problem hiding this comment.
Could you also attach some screenshots / videos to help us better understand how the results differ after your changes?
| SearchInfo & search_info) | ||
| { | ||
| if (motion_model != MotionModel::STATE_LATTICE) { | ||
| if (motion_model != MotionModel::STATE_LATTICE && motion_model != MotionModel::OMNI) { |
There was a problem hiding this comment.
I think this is currently hardcoded to STATE_LATTICE
There was a problem hiding this comment.
Yes sure, I'll add some before / after images showing the planned path for some scenarios.
The purple arrow is the requested goal.
(Just a clarification, these manual tests are for similar fixes made on the jazzy branch, should I make a PR for it as well? see [this commit])(ManMan88@f6001cc)
There was a problem hiding this comment.
The release version make weird paths as I used parameters that tries to force omni paths, but it didn't work.
I used the following parameters for the fix version (2 parameters were changed from the ones used with the release version):
planner_server:
ros__parameters:
expected_planner_frequency: 5.0
planner_plugins: ["GridBased"]
GridBased:
# Use SmacPlannerLattice plugin
plugin: "nav2_smac_planner::SmacPlannerLattice"
# --- Core Planning Controls ---
allow_unknown: true # Allow planning through unknown space
tolerance: 0.25 # Goal tolerance for planning (meters)
max_iterations: 1000000 # Maximum planning iterations
max_on_approach_iterations: 1000 # Max iterations when approaching goal
max_planning_time: 2.0 # Maximum time for planning (seconds)
# --- Heuristic Penalties (tune as-needed) ---
# These control the cost of different motion types
analytic_expansion_ratio: 3.5 # (**USED 200** in the release version) Default — enables analytic expansion with omni SE2 paths
analytic_expansion_max_length: 10.0 # (**USED 0.1** in the release version) Moderate length to limit abrupt heading transitions
analytic_expansion_max_cost: 200.0 # Max cost for analytic expansion
analytic_expansion_max_cost_override: false # Override max cost check
reverse_penalty: 1.0 # No penalty — holonomic can reverse freely
change_penalty: 0.05 # Penalty for changing direction
non_straight_penalty: 1.0 # No penalty — lateral strafing is native for holonomic
cost_penalty: 2.0 # Penalty multiplier for costmap cost
rotation_penalty: 1.0 # No penalty — holonomic can pivot freely
retrospective_penalty: 0.015 # Penalty for retrospective search
# --- Lattice-Specific Parameters ---
# Path to the motion primitives file (MUST be absolute path at runtime)
# This will be set via launch file to ensure proper path resolution
lattice_filepath: ""
lookup_table_size: 20.0 # Size of lookup table for heuristic
cache_obstacle_heuristic: true # Cache obstacle heuristic (big speedup if map is mostly static)
allow_reverse_expansion: true # Allow reverse motion primitives
# --- Path Smoothing ---
smooth_path: true # Enable path smoothing
smoother:
max_iterations: 800 # Max smoothing iterations
w_smooth: 0.3 # Weight for smoothness
w_data: 0.2 # Weight for data fidelity
tolerance: 1.0e-10 # Convergence tolerance
do_refinement: true # Enable refinement
refinement_num: 2 # Number of refinement passes
# --- Goal Heading Search ---
# Controls how the planner handles goal heading
# "DEFAULT" = use specified goal heading
# "ALL_DIRECTION" = search for best goal heading from all directions
goal_heading_mode: "DEFAULT"
coarse_search_resolution: 1 # Resolution for coarse search (if using ALL_DIRECTION)
|
I'm going to let @mini-1235 do the first few reviews to catch the big stuff but I wanted to thank you for taking this one. This is a much more elegant method than I had in mind and works much better. I'd love for you to use some of those before/after in the docs.nav2.org migration guide to highlight this. This is a great contribution 💯 |
There was a problem hiding this comment.
I left a few comments on items that need to be reverted. Basically, the _motion_model is hardcoded to STATE_LATTICE, so it can never be OMNI. But otherwise the changes looks good to me!
Once this PR is merged, feel free to open a backport PR to jazzy
|
@ManMan88 any updates? I'd love to get this in! |
|
Sorry, I've been quite busy. |
|
@mini-1235 I agree with your comments. Should I also add a similar fix for the jazzy branch? |
Sure! Also, can you add to the migration guide on docs.nav2.org this addition for omni support? Pick one of your before and after pictures for a side-by-side illustration I think would be useful. Please sign off the commit with DCO. Check that failed job for how-to. Finally - any other additions for optimal OMNI support or does this button that up? |
I consulted opus 4.6, it found these issues:
So I'll apply a fix for these as well. |
|
This pull request is in conflict. Could you fix it @ManMan88? |
767594b to
94c721b
Compare
When lattice file specifies motion_model: omni, use SE2StateSpace for analytic expansion instead of Dubins/Reeds-Shepp curves. This produces straight-line paths for holonomic robots instead of arc-based paths with unnecessary rotations. Fixes ros-navigation#2683 Related: ros-navigation#5231, ros-navigation#4262 Signed-off-by: Ron Danon <rondanon@gmail.com>
Fixes ros-navigation#2683 Related: ros-navigation#5231, ros-navigation#4262 Signed-off-by: Ron Danon <rondanon@gmail.com>
Fixes ros-navigation#2683 Related: ros-navigation#5231, ros-navigation#4262 Signed-off-by: Ron Danon <rondanon@gmail.com>
Set smoother to holonomic mode when lattice metadata indicates omni, avoiding incorrect Dubins boundary conditions on holonomic paths. Disable allow_reverse_expansion for omni robots with a warning, as the concept of reverse is meaningless for holonomic motion. Fixes ros-navigation#2683 Related: ros-navigation#5231, ros-navigation#4262 Signed-off-by: Ron Danon <rondanon@gmail.com>
94c721b to
46cb204
Compare
|
I updated the docs in this PR: ros-navigation/docs.nav2.org#891 |
|
I'll take a look now. Can you also add in a bit of the missing test coverage for the omni case in configuration / parameters to cover the lines added? https://app.codecov.io/gh/ros-navigation/navigation2/pull/5965?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=checks&utm_campaign=pr+comments&utm_term=ros-navigation These seem relatively easy to add |






Basic Info
Description of contribution in a few bullet points
motion_model: "omni"from the lattice metadata to selectSE2StateSpaceinstead, which produces straight line paths with linear heading interpolationMotionModel::OMNIenum value with string conversion supportrefineAnalyticPath()for omni since SE2 paths don't depend on turning radiusDescription of documentation updates required from your changes
OMNImotion model enum value, maybe add a note in the SmacPlannerLattice configuration docsmotion_modelfield in the lattice primitives fileDescription of how this change was tested
test_omni_selects_se2_state_spaceandtest_non_omni_selects_reeds_sheppFuture work that may be required in bullet points
precomputeDistanceHeuristiclives innode_lattice.cppand analytic refinement is inline)