MPPI PathAlignCritic: Add a minimum dist for occupancy check#6091
MPPI PathAlignCritic: Add a minimum dist for occupancy check#6091adivardi wants to merge 15 commits into
Conversation
4883eeb to
6962947
Compare
So basically: don't make it too large? Good tuning advice for the documentation / readme 😉 We have something similar for disabling other critics in the case of occupancy, no? Should we use this there as well? Finally, I'm curious if you had to tune your path follower critic (or modify?) to use a further path point in this case to overtake so nicely. Maybe something to consider for further improvements on this behavior? Something's weird with CI. Can you rebase/pull in main to try again? I've been seeing some outages though on CircleCI lately in the docs, so maybe they're just having trouble in general. |
SteveMacenski
left a comment
There was a problem hiding this comment.
Conceptually sound, just some details :-)
c713616 to
84901db
Compare
Yes, though it depends a bit on robot's speed and kinematics. The slower the robot can react, the bigger it should be.
In this critic the
I also thought so, but it is working quite well for me with the current value of 0.05 (with occupancy check distance of 5m), so I left it as is.
It works surprisingly well for me. Once this critic is disabled,
|
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 65 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
After looking into adding break early when computing the path's arc-length Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
84901db to
c9e7094
Compare
Both :-)
I guess I'm suggesting to take a look at that with your fresh eyes from this work and see if there's improvements we can/should make there. For example, maybe its worth setting some offset after this distance rather than using the first free-point in order to lob the follow-path goal further out. I think that may help by setting the optimization goal further away to give more freedom in the immediate time horizon to avoid the obstacle and not try to "hook" back into it immediately after the sensor data reported blockage (since sensor data only sees the convex hull visible of the obstacle).
This is actually something I'm going to start thinking about more at the start of next week, so happy to :-) My thoughts above on the PathFollow critic are in that direction. Got a video of what you mean by this? Have you tried a longer horizon? Even if perhaps you can't do it on your vehicle's computer, it would be good to know if making that longer is even the full solution or there's more to be done in the critics I'm also trying to replicate your results by putting a box in front of a robot in simulation and I'm not seeing the same behavior as you where it goes around with the configuration below. Any suggestion? Or am I starting too 'big' with a pallet sized obstacle in the path's way 😉 |
What's the robot speed and horizon?
Yes, I think that makes sense. Often the reference pt ends up inside the obstacles since only the "shell" can be seen. It would be interesting to look at it, though I can't get to it in the very near future. Would it be helpful to open an issue/feature request?
Yes, here: I haven't tried tuning more for this case. It's something I would like to do when I get more time. |
More or less the default Nav2 parameters, though I did try with model_dt of 0.1 so that the 56 timesteps would be longer. I'm wondering if maybe its tuning too - how far are you from the default MPPI params for these demos? Maybe it would be useful to share your complete config. I had the parameter set to 5 which is much higher than the slow down distance. Didn't do anything.
Exactly :-) I quickly prototyped by increasing it by the same size as the collision offset (i.e. keeping a counter in the while loop, then add the counter's size to the I didn't see really any impacts, but I also can't reproduce your results yet, so maybe worth a try from your side and/or revisiting once your results can be reproduced On my testing, I put together an incredibly crude demonstration that seemed to work somewhat well. I created a new obstacle bypass critic that essentially (a) identified if an obstacle was blocking the path, if so (b) identified the lateral direction that was shortest to be cleared as the direction to turn (i.e. should we turn left or right), (c) scored a penalty analog to the path angle critic towards this laterally offset point to incentivize turning towards the easiest direction to get around & an analog path follow critic to incentivize drivings towards a laterally offset point the furthest_path_point_reached + offset away (basically just Path Follow with the lateral offset). It was pretty unstable in terms of the trajectory shape and behavior (like I said: crude), but it actually worked. I only went this direction though because I couldn't reproduce even close to what you showed in your the robot ends up perpendicular to the path video. For a realistic version of this, we'd want to disable the path follow when this obstacle bypass critic is in use. Perhaps have the "obstacle bypass" as a feature within the path follow / align critics, perhaps. Or optimally do something less heavy handed without this hand-created behavior -- if I can get something like what you show working, work. With respect to that video, I think what's happening here is the path follow / align / angle critics (angle probably?) is making it want to drive back to the relative path heading since the angle grew too high. What happens if you disable the path angle critic (not permanently, you want that, but to see if that's the cause). If its not the cause, disable critics until you can see what is. Also with respect to your video, if I can get something like that to work on my end without this complexity of new critics, I can almost certainly make quick work of fixing that behavior you see I believe :-) |
I have tried it a bit more with the turtlebot configuration. I also can't get it as nicely as mine, though the Gazebo box is really big compared to the turtlebot. With the ball & the capsule it works well. So these changes improved the behavior: and my configuration is: Regarding the |
|
I added a readme paragraph for the new param. Let me know if it's too long or unclear. |
Ah got it. I will try that tomorrow, that could explain it. Do you use a ~2x horizon? I do need to be able to test this making a change before merging. But luckily for you I'm also really interested in this same area so I can dedicate some real time to it (both to test your changes to reproduce + update Nav2 defaults + take it more steps forward if necessary). If possible, can you send me your parameters for the local costmap as well (I guess just the footprint + inflation params) so I can try to replicate? if I can start with what works, I can make changes to narrow into how to get this to be good for the TB3/4 + my testing rigs. If you can do that in the next ~half day, I can spend my 9-5 tomorrow on this to evaluate, test, and refine if needed the TB3/4 + my testing parameters (and see if my work I previously mentioned is even needed at all).
I think I know why this is (or at least 2 strong hypotheses), but I'd need to sit in front of it with some debugging prints to know which or any is the cause + solution. The docs are good. I forget if you had a configuration guide entry for MPPI yet for this PR. If not, add that there too :-) |
|
Sure: btw, I also noticed the turtlebot only goes up to 0.5m/s. That may also make the horizon quite shorter, so the trajectories spread less to the sides |
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
80aa9ca to
106dcec
Compare
pallet_demo.mp4So I was able to reproduce but had some issues/concerns:
So the 2 issues there are:
I'm curious if you've seen anything similar to the latter, since I think that's a pretty key thing to either fix or pre-tune for users if its a tuning thing + provide advice. I'm using timesteps = 56/model_dt = 0.1, min_distance_occupancy_check to 2.0, increased the prune distance to 7.0, local costmap size to 10, and the inflation scale factor to 0.7 & inflation radius to 0.5 as you have them. I see you have |
ros-navigation/docs.nav2.org#912
I added a sentence about it, please let me know if that's clear.
hmm weird. I don't see how that should be different. I have not seen that. Are you still using the
So I think for big obstacles, if the trajectories are not spread far enough, they all get invalidated by the CostCritic, which is why it doesn't even try to go around. It needs a valid trajectory to push the distribution to one side. And it needs to happen early enough for the overtake to still be possible.
looking more closely at my video, just before it turns, there are a few trajectories valid to the right. I think they are valid because car is not exactly perpendicular, and probably also because of the orientation. Somewhere around this: The thing is, if I try it in simulation with a perpendicular, it gets stuck. So maybe the video is more of a fluke? Though you are saying you also have that? I am using |
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
|
Sorry for the delay, this is something I needed to test and play around with and finding that time took longer than expected. I'm on this today though. The slowing down / stopping I'm looking into after simplifying my setup (I think I was overcomplicating some things and got lost in those details). Maybe this is just a configuration / setup / tuning item that I need to understand better and then write some guide docs for.
Interestingly I would assume that would cause my "slow down and stop" issue since it would see it ahead of time like I mentioned, but I will try that & also keep in mind as I'm trying to understand that behavior better.
Your horizon is 4m from the configs given, so actually setting this above that number makes alot of sense. The bypass starts before the collision critics even have a chance to score poorly. Question: When its down to ~3.0, does that work well always? sometimes? just as well as 4.5? I'm still not able to get this to reliably work on my end, except when the obstacle range is low so that the obstacle pops up on the local costmap 'suddenly' over an existing full-speed trajectory. If the robot sees the obstacle while approaching it, I can never reproduce your results :( The wondering away perpendicularly issue we both see though is something worth probably addressing in some way. That's definitely not good and we probably want to find what condition that happens in to prevent it What other, if any, issues are you still seeing? |
|
P.S. Here's my https://github.com/ros-navigation/navigation2/tree/obstacle_bypass_critic |


Basic Info
Description of contribution in a few bullet points
The occupancy check is used to disable the critic if a certain percentage of the coming segment of the path is in collision.
Previously, the segment length was defined by
furthest_reached_path_point.This PR adds a minimum distance for the occupancy check in the PathAlignCritic, so if
furthest_reached_path_pointis too short, the occupancy check distance is extended up to the min dist.This solves a behavior of MPPI where in presence of an obstacle straight ahead, the robot slows down instead of overtaking the obstacle. This is because when slowing down,
furthest_reached_path_pointgets shorter, so the PathAlignCritic is never disabled. With this change, even when the robot slows down, the critic is disabled, freeing the controller to plan around the obstacle.The main downside is, if the distance is too big, the critic may be disabled too early, which may cause deviation from path (if for example, the reference point for
PathFollowCriticis beyond a curve on the path).Description of documentation updates required from your changes
Description of how this change was tested
Tested in both simulation and our real robot.
The effect is impressive. Without the change, our robot cannot overtake an obstacle wider than ~1m. With the change, it can overtake obsatcles up to 2m wide easily.
Without the change:
pathalign_nochange_s.mp4
With the change:
pathalign_change_s.mp4
pathalign_change_2m_s.mp4
Future work that may be required in bullet points
I would appreciate advice on setting the default value of this param. For our robot, it is set to 5m. But our robot is big and drives fast. I figured most robots are small, so I set it to 2m.
For Maintainers:
backport-*.