Skip to content

Feat/smac planner include orientation flexibility #4127

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

Conversation

stevedanomodolor
Copy link
Contributor

@stevedanomodolor stevedanomodolor commented Feb 20, 2024


Basic Info

Info Please fill out this column
Ticket(s) this addresses (add tickets here #4019)
Primary OS tested on (Ubuntu, MacOS, Windows)
Robotic platform tested on (Steve's Robot, gazebo simulation of Tally, hardware turtlebot)
Does this PR contain AI generated software? (No; Yes and it is marked inline in the code)

Description of contribution in a few bullet points

  • tackles issue [Smac Planner] Enable goal orientation non-specificity #3789
  • Includes the possibility for the user to determine whether they want the goal heading should be default(the one defined in the goal), bidirectional (user defined + 180 degrees), or all_direction. This way, the user can save time calling the planner multiple times when the angle of the goal does not have to be fixed and has a bit of flexibility.
  • Results can be seen.
Success rate for  ALL_DIRECTION_SmacHybrid  is:  98.33333333333333 %
Success rate for  ALL_DIRECTION_SmacLattice  is:  97.66666666666667 %
Success rate for  ALL_DIRECTION_Smac2d  is:  100.0 %
Success rate for  BIDIRECTIONAL_SmacHybrid  is:  98.33333333333333 %
Success rate for  BIDIRECTIONAL_SmacLattice  is:  97.66666666666667 %
Success rate for  BIDIRECTIONAL_Smac2d  is:  100.0 %
Success rate for  DEFAULT_SmacHybrid  is:  96.66666666666667 %
Success rate for  DEFAULT_SmacLattice  is:  95.0 %
Success rate for  DEFAULT_Smac2d  is:  100.0 %
Success rate for  NORMAL_SmacHybrid  is:  96.66666666666667 %
Success rate for  NORMAL_SmacLattice  is:  95.0 %
Success rate for  NORMAL_Smac2d  is:  100.0 %
**********************Results Goal heading with new changes **********************
DEFAULT_Smac2d             48.463951551204566       0.1264367441153846    3.985572832589736   61.63986013986014
BIDIRECTIONAL_Smac2d       48.463951551204566       0.12651611789160838   3.985572832589736   61.63986013986014
ALL_DIRECTION_Smac2d       48.463951551204566       0.12622239968531468   3.985572832589736   61.63986013986014
DEFAULT_SmacHybrid         49.00072917359392        0.0657405418881119    1.6125494504062425  62.59090909090909
BIDIRECTIONAL_SmacHybrid   48.86220994748993        0.027206837828671327  1.465786467925095   60.33216783216783
ALL_DIRECTION_SmacHybrid   48.77456087576495        0.03619210418181818   1.6372313925886013  61.38461538461539
DEFAULT_SmacLattice        49.67700418147134        0.12979092083566435   1.6175072754351327  72.18181818181819
BIDIRECTIONAL_SmacLattice  49.83522326914245        0.027898774566433564  1.5455567606170904  70.31468531468532
ALL_DIRECTION_SmacLattice  49.91736393848793        0.03631584257342657   1.6489731848707427  71.43706293706293
-------------------------  -----------------------  --------------------  ------------------  -----------------


**********************Results Goal heading mode NO changes **********************
Read data
-----------  -----------------------  -------------------  ------------------  ------------------
Planner      Average path length (m)  Average Time (s)     Average cost        Max cost
SmacHybrid   48.59179172137297        0.0930492549330986   1.0656706399532687  54.59154929577465
SmacLattice  49.30762557367365        0.44674316980633805  0.8137733557552133  53.813380281690144
Smac2d       48.52958672840513        0.12973642600352114  0.7580233687132835  65.47183098591549
-----------  -----------------------  -------------------  ------------------  ------------------

Description of documentation updates required from your changes


How to run


Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in navigation.ros.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

@stevedanomodolor stevedanomodolor marked this pull request as draft February 20, 2024 19:14
@SteveMacenski
Copy link
Member

SteveMacenski commented Feb 21, 2024

@stevedanomodolor what's the status here - do you want me to review in detail, have gaps that are TODO, or have some questions to discuss? I don't want to go through and nitpick some small issues if you're really looking for feedback elsewhere right now.

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review the analytic expansions yet, pending your answer to my above question. But overall from what I read so far, very few notes. This is very good and I couldn't have done it better myself!

@stevedanomodolor
Copy link
Contributor Author

stevedanomodolor commented Feb 21, 2024

@stevedanomodolor what's the status here - do you want me to review in detail, have gaps that are TODO, or have some questions to discuss? I don't want to go through and nitpick some small issues if you're really looking for feedback elsewhere right now.

If you consider the general approach to be ok, then you can review it in detail. If the approach is good, what is just left is to modify the test to take into consideration these changes hench the todo in the CMakelists.

@SteveMacenski
Copy link
Member

SteveMacenski commented Feb 21, 2024

I think the analytic expansions might need to be rethought a bit. I think we should be taking all N of the goals and computing the analytic path, if valid. If any are valid, take the shortest one. There shouldn't be a loop surrounding the preamble which tells us if we want to do analytic expansions in this iteration:

      closest_distance = goal_distance_pair.second;
      NodePtr goal_node = goal_distance_pair.first;
      // We want to expand at a rate of d/expansion_ratio,
      // but check to see if we are so close that we would be expanding every iteration
      // If so, limit it to the expansion ratio (rounded up)
      int desired_iterations = std::max(
        static_cast<int>(closest_distance / _search_info.analytic_expansion_ratio),
        static_cast<int>(std::ceil(_search_info.analytic_expansion_ratio)));
      // If we are closer now, we should update the target number of iterations to go
      analytic_iterations =
        std::min(analytic_iterations, desired_iterations);

      // Always run the expansion on the first run in case there is a
      // trivial path to be found
      if (analytic_iterations <= 0) {

I think your logic is that if we sort by heuristic, then the first that comes back as a valid expansion will be the shortest. I think that would generally be true if the heuristic was a very purist implementation of a distance heuristic. But instead, we have the maximum of a few heuristics including cost information so the "closest" and the one with the "lowest travel cost" aren't necessarily the same thing. So I think largely these changes should be taken back to square one unfortunately and loop to find each of the N goals orientation's analytic expansion length (if valid) and then select the lowest cost one. Interestingly, you can use the new scoringFn to measure that for the final one to store. Luckily, there wasn't a huge number of changes you made to the analytic expansions, so its not a big setback at all and largely its just moving code around and measuring different things

So after

          while (min_turn_rad < max_min_turn_rad) {
            min_turn_rad += 0.5;  // In Grid Coords, 1/2 cell steps
            ompl::base::StateSpacePtr state_space;
            if (node->motion_table.motion_model == MotionModel::DUBIN) {
              state_space = std::make_shared<ompl::base::DubinsStateSpace>(min_turn_rad);
            } else {
              state_space = std::make_shared<ompl::base::ReedsSheppStateSpace>(min_turn_rad);
            }
            refined_analytic_nodes = getAnalyticPath(node, goal_node, getter, state_space);
            score = scoringFn(refined_analytic_nodes);
            if (score <= best_score) {
              analytic_nodes = refined_analytic_nodes;
              best_score = score;
            }
          }

You can use that best_score, store it for that particular angle to decide which to use.

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran out of time this evening to review, but this is a few things -- also you have a number of linting issues I can see. Check CI for the full list of formatting problems

@SteveMacenski
Copy link
Member

Its also ready enough to update docs for the new variable for the mode to describe the mode, and the migration guide update to show this feature. An image/gif of this in action with the different modes would be great!

I looked through it and all looks good except the analytic expansions I didn't get to right now

Copy link
Contributor

@jwallace42 jwallace42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

I think you are missing some work for the distance heuristic.

The distance heuristic is pre computed based on free space. We current only calculate it for the the first goal. This means that we could artificially inflate the cost to go making the heuristic inadmissible.

My suggestion would be to remove the distance heuristic when we are in ALL_DIRECTION mode. For the BIDIRECTIONAL mode I would pre compute the distance for both angles and take the min of those two.

From what I have seen the distance heuristic is rarely greater than the obstacle heuristic so you probably haven't seen any issues.

@SteveMacenski
Copy link
Member

Any questions or anything I can unblock on? 😄

Copy link
Contributor

mergify bot commented Mar 9, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

2 similar comments
Copy link
Contributor

mergify bot commented Mar 9, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 10, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@stevedanomodolor
Copy link
Contributor Author

stevedanomodolor commented Mar 10, 2024

Any questions or anything I can unblock on? 😄

No blocking points, just making changes based on @jwallace42 feedback and testing them but after merging to the main and pulling the latest dockers, pr is not building.

Copy link
Contributor

mergify bot commented Mar 10, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

1 similar comment
Copy link
Contributor

mergify bot commented Mar 10, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@SteveMacenski
Copy link
Member

SteveMacenski commented Mar 11, 2024

Yeah there's a transient issue due to Rolling moving to 24.04 so a bunch of tooling and package indices are being messed with. Don't worry about it, its not your fault as long as it works locally. Just make sure to keep up on unit testing.

Want me to take a look again?

@stevedanomodolor
Copy link
Contributor Author

Yeah there's a transient issue due to Rolling moving to 24.04 so a bunch of tooling and package indices are being messed with. Don't worry about it, its not your fault as long as it works locally. Just make sure to keep up on unit testing.

Want me to take a look again?

I will take advantage of the time to add more unit testing after making the modification you suggested. After the added unit tests, you can look into it.

Copy link
Contributor

mergify bot commented Mar 23, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

9 similar comments
Copy link
Contributor

mergify bot commented Mar 24, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 24, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 24, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 24, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 25, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 25, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 25, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 25, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 25, 2024

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Copy link
Contributor

mergify bot commented Mar 11, 2025

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@SteveMacenski
Copy link
Member

I went through to summarize the remaining open items - most of which are very old:

Can you go through them and close them if they're not relevant anymore or highlight in a new comment (down here at the bottom) with anything remaining from them?

I'm also seeing for the new parameters added that they need to be added to the dynamic parameters test to exercise their lines

Copy link
Contributor

mergify bot commented Apr 1, 2025

This pull request is in conflict. Could you fix it @stevedanomodolor?

@stevedanomodolor
Copy link
Contributor Author

for #4127 (comment), i did made the changes but you mentioned in the following comment to use the current way #4127 (comment).

@stevedanomodolor
Copy link
Contributor Author

stevedanomodolor commented Apr 1, 2025

I went through to summarize the remaining open items - most of which are very old:

Can you go through them and close them if they're not relevant anymore or highlight in a new comment (down here at the bottom) with anything remaining from them?

I'm also seeing for the new parameters added that they need to be added to the dynamic parameters test to exercise their lines

as for #4127 (comment), #4127 (comment) and #4127 (comment), we decided to include this in a different pr and not in this one so I will close them.

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small peanuts now, very close to being ready!

@stevedanomodolor
Copy link
Contributor Author

@SteveMacenski just two question to finish the changes
Get rid of these 4x getters, they're unused
populate comment

@SteveMacenski
Copy link
Member

SteveMacenski commented Apr 23, 2025

@stevedanomodolor I think also the removeInvalidGoals comment and goal_manager.hpp are still open :-)

Please take a look at the linters as well

@stevedanomodolor
Copy link
Contributor Author

@SteveMacenski all changes made.

@stevedanomodolor stevedanomodolor force-pushed the feat/smac_planner_include_orientation_flexibility branch from 5548e07 to 119fbc5 Compare April 29, 2025 19:33
Copy link
Contributor

mergify bot commented Apr 29, 2025

This pull request is in conflict. Could you fix it @stevedanomodolor?

Copy link
Contributor

mergify bot commented Apr 29, 2025

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@stevedanomodolor stevedanomodolor force-pushed the feat/smac_planner_include_orientation_flexibility branch from f417115 to d317abf Compare April 29, 2025 20:05
Copy link
Contributor

mergify bot commented Apr 29, 2025

This pull request is in conflict. Could you fix it @stevedanomodolor?

Copy link
Contributor

mergify bot commented Apr 29, 2025

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

1 similar comment
Copy link
Contributor

mergify bot commented Apr 29, 2025

@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

Signed-off-by: stevedanomodolor <stevedan.o.omodolor@gmail.com>
@stevedanomodolor stevedanomodolor force-pushed the feat/smac_planner_include_orientation_flexibility branch from 22f542f to 6eb58a9 Compare April 29, 2025 21:01
Signed-off-by: stevedanomodolor <stevedan.o.omodolor@gmail.com>
Signed-off-by: stevedanomodolor <stevedan.o.omodolor@gmail.com>
@stevedanomodolor
Copy link
Contributor Author

@SteveMacenski Updated in readme too

**********************Results Goal heading with new changes **********************
DEFAULT_Smac2d             48.463951551204566       0.1264367441153846    3.985572832589736   61.63986013986014
BIDIRECTIONAL_Smac2d       48.463951551204566       0.12651611789160838   3.985572832589736   61.63986013986014
ALL_DIRECTION_Smac2d       48.463951551204566       0.12622239968531468   3.985572832589736   61.63986013986014
DEFAULT_SmacHybrid         49.00072917359392        0.0657405418881119    1.6125494504062425  62.59090909090909
BIDIRECTIONAL_SmacHybrid   48.86220994748993        0.027206837828671327  1.465786467925095   60.33216783216783
ALL_DIRECTION_SmacHybrid   48.77456087576495        0.03619210418181818   1.6372313925886013  61.38461538461539
DEFAULT_SmacLattice        49.67700418147134        0.12979092083566435   1.6175072754351327  72.18181818181819
BIDIRECTIONAL_SmacLattice  49.83522326914245        0.027898774566433564  1.5455567606170904  70.31468531468532
ALL_DIRECTION_SmacLattice  49.91736393848793        0.03631584257342657   1.6489731848707427  71.43706293706293
-------------------------  -----------------------  --------------------  ------------------  -----------------


**********************Results Goal heading mode NO changes **********************
Read data
Planner              Average path length (m)  Average Time (s)     Average cost        Max cost
DEFAULT_Smac2d       48.463951551204566       0.1276387678706294   3.985572832589736   61.63986013986014
DEFAULT_SmacHybrid   48.47519141586789        0.06759979591608391  1.621306575384539   62.58391608391609
DEFAULT_SmacLattice  48.76214361923263        0.138069217          1.6300724505649906  72.18181818181819
-------------------  -----------------------  -------------------  ------------------  -----------------

@SteveMacenski SteveMacenski merged commit f5543c3 into ros-navigation:main Apr 29, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Smac Planner] Enable goal orientation non-specificity
3 participants