-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Feat/smac planner include orientation flexibility #4127
base: main
Are you sure you want to change the base?
Feat/smac planner include orientation flexibility #4127
Conversation
@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. |
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.
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!
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. |
I think the analytic expansions might need to be rethought a bit. I think we should be taking all
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 So after
You can use that best_score, store it for that particular angle to decide which to use. |
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.
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
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 |
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.
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.
Any questions or anything I can unblock on? 😄 |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
2 similar comments
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
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. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
1 similar comment
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
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. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
9 similar comments
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
@stevedanomodolor, your PR has failed to build. Please check CI outputs and resolve issues. |
This pull request is in conflict. Could you fix it @stevedanomodolor? |
Signed-off-by: stevedan <[email protected]>
Signed-off-by: stevedan <[email protected]>
Signed-off-by: stevedan <[email protected]>
Signed-off-by: stevedan <[email protected]>
aa01e64
to
5ce2c7e
Compare
Signed-off-by: stevedan <[email protected]>
Signed-off-by: stevedan <[email protected]>
Signed-off-by: stevedan <[email protected]>
Signed-off-by: stevedan <[email protected]>
The one on one comparison is slightly different, but there is more gap between goal heading bidrectional vs default because it most likely found a faster solution. |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
@SteveMacenski There is an issue in simulation where when you launch the simulation tb3/tb4 and you include the docking plugin(
|
That PR was merged, can you try then with the updates? |
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.
What is the performance change to doing the for loop across all goals? The current status of main
would be analog to the performance of storing the distances in the distance lookup table with the orientation policy that we had previously discussed. If its not a major departure in performance for bidirectionality or all angles - then I like this option as the last intrusive!
// we just have to check whether the x and y are the same because the dim3 is not used | ||
// in the computation of the obstacle heuristic | ||
if (!_search_info.cache_obstacle_heuristic || | ||
(goals_coordinates[0].x != _goals_coordinates[0].x && |
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.
I believe we have the ==
operator for this?
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.
It did not make sense to do the yaw comparison because it is not necessary for the obstacle heuristic.
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.
This is just checking is the goal is updated at all to recompute based on a new request. Surely you're right that the yaw isn't an important characteristic, but it makes the code more ergonomic and understandable to compare the goals directly.
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.
I think this was the initial comment that let to this decision. #4127 (comment). I do understand where you are coming from though, I can change it
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.
@stevedanomodolor is this done?
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Stevedan Ogochukwu Omodolor <[email protected]>
Remove need for void
So far in the planner tests, I haven't observed a significant increase in computation cost, as mentioned in the PR description. This might be because the planner is finding the shortest path more efficiently. For example, in a scenario where a robot is moving from (0,0,0) to (10,0,180), a straight path, bidirectional and all-direction planners are likely faster. However, I haven't yet conducted a direct head-to-head comparison where I fix all goals to the shortest path and measure the computation time. I plan to do that and will update you with the results. I believe that would provide a more meaningful comparison. |
You can do this with the Are all the metrics in the PR description updated for the current state? I know we explored another direction earlier with caching the distances based on the mode in the LUT, but now we're looping over the N goals. The compute time difference for each request is low, but since this is called hundreds of thousands of times in a sub-1s iteration, that could potentially be a meaningful contribution. This is the kind of thing that makes Smac, MPPI, and DWB difficult - the initial code was done relatively quickly (~1 month) but then several months in optimizing-benchmarking-profiling loops |
…entation_flexibility
They are not in the current state as in I did some minor changes, not any change that would affect the computation time although I admit I should do the tests again. I noticed that the last time I did the test, the computation time in both the all-direction and the bidirectional was less. I have the feeling this is because in most cases the goal with these two is so short that the overall computation is less. This does not tell me what we want to know, whether it is worth storing in memory as the other alternative. When I get the head-to-head comparison, I will let you know. I think that would make more sense to decide whether it make sense to store it in memory or not. |
@SteveMacenski Ok, so this is the direct-to-direct comparison to check that the changes do not influence the current implementation. Btw I use the same generated random goal to test everything, so I do not generate random goal everytime I run a time but use an already generated random goal. Without my change
With my change
The following does the comparison with the default and the others with changes made.
The only big influence is the hybrid where the all direction is slightly higher than default. It still missing the test head to head with the solution been the optimal for all the cases as I mentioned previously |
@stevedanomodolor I'm back from ROSCon / ROS-I now and will give this a final, complete review. I went through our thread above and found 5 open comments that I tagged you in as needing some update or confirmation that the item was completed and can be marked as resolved (or needs to be still addressed).
Why?
Ok :-) That is a pretty big 10x jump that's worth at least understanding |
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.
Some details:
- I'm seeing some blocks that are untested in the annotations. It might be worth reviewing the code coverage results and adding some tests to cover any glaring gaps
- But overall, this looks pretty much perfect to me now. Doing the final benchmarking (with changing the goal locations too on that random obstacle map) to sanity check finally that this all works well and doesn't mess up run-time implementations
- Add migration guide updates for this new feature LGTM! And configuration guide for the new parameter :-)
nav2_util::declare_parameter_if_not_declared( | ||
node, name + ".goal_heading_mode", rclcpp::ParameterValue("DEFAULT")); | ||
node->get_parameter(name + ".goal_heading_mode", goal_heading_type); | ||
GoalHeadingMode goal_heading_mode = fromStringToGH(goal_heading_type); |
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.
GoalHeadingMode goal_heading_mode = fromStringToGH(goal_heading_type); | |
_goal_heading_mode = fromStringToGH(goal_heading_type); |
Then you can remove the else
and still check _goal_heading_mode
for the UNKOWN condition. Its more concise
@@ -648,6 +661,22 @@ SmacPlannerHybrid::dynamicParametersCallback(std::vector<rclcpp::Parameter> para | |||
"valid options are MOORE, VON_NEUMANN, DUBIN, REEDS_SHEPP.", | |||
_motion_model_for_search.c_str()); | |||
} | |||
} else if (name == _name + ".goal_heading_mode") { |
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.
Keep as-is here, having the local variable makes sense :-)
node->get_parameter(name + ".goal_heading_mode", goal_heading_type); | ||
GoalHeadingMode goal_heading_mode = fromStringToGH(goal_heading_type); | ||
goal_heading_mode = fromStringToGH(goal_heading_type); | ||
if (goal_heading_mode == GoalHeadingMode::UNKNOWN) { |
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.
Ditto in this file
break; | ||
case GoalHeadingMode::UNKNOWN: | ||
throw std::runtime_error("Goal heading is UNKNOWN."); | ||
break; |
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.
Don't need a break after a throw
throw std::runtime_error("Failed to compute path, no valid start or goal given."); | ||
} | ||
|
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.
readd the line for separating the code blocks
// 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))); | ||
|
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.
Readd code block separation line
if (refined_analytic_nodes.empty()) { | ||
for (auto goal_node : goals_node) { | ||
// Reset the counter and try the analytic path expansion | ||
analytic_iterations = desired_iterations; |
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.
I don't think this reset has to be in the for
loop?
Basic Info
Description of contribution in a few bullet points
Description of documentation updates required from your changes
How to run
Future work that may be required in bullet points
For Maintainers: