Closed kajep09 closed 3 years ago
Hi @kajep09, and thanks for your extensive issue report. I wish all where that detailed!
I bet that your problem comes from not locking the global costmap. Try setting param planner_lock_costmap
to false. You can see in costmap_planner_execution.cpp#L80 that the costmaps are not locked by default when calling the planner. This is a "feature" of MBF that we should have documented better, so I apologize for not having done so. The idea is that the planner himself locks the costmap ONLY when needed, and so blocks it the less possible time. With SBPL this is important because it's very slow, and locking the costmap for all the planning time, as in old-good move_base, delays a lot any update. Setting planner_lock_costmap
to false will make MBF behave as move_base. If that works, I suggest you to modify SBPL to lock the map only while it gets copied (what is very fast), and possibly PR the change (enabled by a parameter set as false by default, as move_base will still lock the costmap).
Hi @corot
Thanks for the quick response, but unfortunately I cannot detect any change in behavior between setting that parameter true or false. By the way - am I misreading your comment on the code when you say you are not locking the costmaps by default? If the parameter is not set it defaults to true, and in the check in line 80 you get the mutex before calling the planner? So by default it locks right?
mmm... could be that clear costmaps recovery cleans the global costmap, and it doesn't get "repainted" fast enough. I added a parameter to the clear costmaps recovery behavior to prevent this (PR). Try to add force_updating
equal true to the gloabal_costmap configuration. To verify if that's the reasion, you can also try to remove all calls to clear costmaps, by removing them from the loaded recovery behaviors list.
I had the same thought, but I've already tried a few variations to test that and I don't think that is (directly) the issue.
If I'm using clear_costmap
recovery I've always had force_updating: true
, and also tried with reset_distance: 0
and no valid layer_names
. The reason I have multiple duplicate recoveries was to make sure that MBF didn't abort prematurely after exhausting just 1 recovery behavior, because the weird planner behavior doesn't always show up right away.
recovery_behaviors:
- name: 'clear_costmap1'
type: 'clear_costmap_recovery/ClearCostmapRecovery'
- name: 'clear_costmap2'
type: 'clear_costmap_recovery/ClearCostmapRecovery'
- name: 'clear_costmap3'
type: 'clear_costmap_recovery/ClearCostmapRecovery'
- name: 'clear_costmap4'
type: 'clear_costmap_recovery/ClearCostmapRecovery'
- name: 'clear_costmap5'
type: 'clear_costmap_recovery/ClearCostmapRecovery'
- name: 'clear_costmap6'
type: 'clear_costmap_recovery/ClearCostmapRecovery'
clear_costmap1:
reset_distance: 0.0
force_updating: true
affected_maps: both
layer_names: [stvl, npvl, obsl]
#
#.
#.
#.
#
clear_costmap6:
reset_distance: 0.0 #6.0
force_updating: true
affected_maps: both
layer_names: [stvl, npvl, obsl]
To make sure that it wasn't the clear costmap recoveries I tried to similarly have a list of just rotate recoveries, and the same planner behavior happens. So I don't think it's the clear costmap, but I still assume that overall it has to do with the costmaps because otherwise why would the planner disregard ALL layers of the costmap, even the static layer which was never part of the clear_costmap recovery in the first place.
recovery_behaviors:
- name: 'rotate_recovery1'
type: 'rotate_recovery/RotateRecovery'
- name: 'rotate_recovery2'
type: 'rotate_recovery/RotateRecovery'
- name: 'rotate_recovery3'
type: 'rotate_recovery/RotateRecovery'
- name: 'rotate_recovery4'
type: 'rotate_recovery/RotateRecovery'
- name: 'rotate_recovery5'
type: 'rotate_recovery/RotateRecovery'
- name: 'rotate_recovery6'
type: 'rotate_recovery/RotateRecovery'
Hi again @corot
I just tried something that surprised me a bit. I switched to GlobalPlanner instead of SBPL, but kept every other parameter the same and I am seeing the same issue. I didn't expect this, but I was previously testing out GlobalPlanner with replanning active and not this oneshot -> fail -> replan
setup that I was trying with SBPL.
So this leads me to one of two temporary conclusions:
move_base setup
where I cannot replicate this behavior with neither GlobalPlanner or SBPL.Just wanted to let you know so you don't go chasing down the SBPL route. Thanks for your help so far and hopefully we can find the issue together :)
I will see if I can't make a minimal replicable example so we can see the full parameter list and whether something is wrong.
planners:
# - name: 'SBPLLatticePlanner'
# type: 'SBPLLatticePlanner'
- name: 'GlobalPlanner'
type: 'global_planner/GlobalPlanner'
GlobalPlanner:
allow_unknown: false
default_tolerance: 0.0
visualize_potential: true
use_dijkstra: true
use_quadratic: false
use_grid_path: false
old_navfn_behaviour: false
lethal_cost: 253
neutral_cost: 66
cost_factor: 0.55
# SBPLLatticePlanner:
# environment_type: XYThetaLattice
# planner_type: ARAPlanner
# # planner_type: ADPlanner
# allocated_time: 10.0 #30.0 #10
# initial_epsilon: 15.0 #50.0 #3.0
# forward_search: false
# nominalvel_mpersecs: 0.5 #0.8
# timetoturn45degsinplace_secs: 3.0 #1.31 # = 0.6 rad/s
# # lethal_obstacle: 20 #250
I think the problem doesn't happen on move_base cause it runs in a loop and waits a bit after every operation (e.g. clearing the costmaps): https://github.com/ros-planning/navigation/blob/melodic-devel/move_base/src/move_base.cpp#L779
But in MBF we call directly planning right after completing each recovery behavior (that's how I came with the need of the force_updating
parameter for clear costmap).
Things to try:
Hey @kajep09, did you manage to fix this? Can I close the issue?
Closing this as out of scope of MBF
Hi @spuetz @corot and others who might be able to help.
I'm trying to use MBF on ROS Melodic with
TEB
as the local planner andSBPLLatticePlanner
as the global planner (all 3 components installed the latest release debs), but I am experiencing some really strange behavior with SBPL that doesn't show up when using the same parameters with normal _movebase.Before I go into too much detail, I think a video summarizes the problem better:
Scenario:
The expected behavior is the following:
This behavior is shown by a normal _movebase setup.
trapped robot move_base - the robot simply fails all replan attempts and aborts
However, in MBF the behavior goes like this:
trapped robot move_base_flex - erroneous replan at around 1:00
This behavior is with the exact same parameter setup between MB and MBF (except for MBF specific ones). I have quite an extensive parameter setup spread out over multiple files, but I have summarized what I believe are the most relevant ones below:
costmap parameters (cherrypicked for brevity)
MBF specific parameters
I am using the
move_base_legacy_relay
script in this testing and haven't yet tried to see if the issue persist if I useget_path
andexe_path
directly, but under the hood this is already happening as far as I understand? I find it strange that the initial plan generated by the global planner obeys the obstacles just fine and does not shortcut through walls even though it would be faster - it only seems to happen after it has tried for a really long time to generate a new plan and failed many many times. Could it be something that is not cleared/reset correctly whenget_path
fails so many times (or internally in SBPLLP?) or a race-condition where something happens to the costmap that makes the planner ignore it for some reason?I really hope you have some good pointers to how I can fix this issue and if any of you (I'm assuming @corot due to your involvement on the SBPL repo where we have discussed issues) have a configuration with SBPLLatticePlanner that works for you I would be very happy to try that out on my machine to figure out what is going wrong. I would also like to get an opinion from @mintar about whether or not it could have anything to do with SBPLLatticePlanner, only MBF, or the combination of the two.
Thank you all for awesome software and hope you can help me utilize it better!
P.S.
When I terminate MBF I get the following warnings, but I am unsure if they are related at all.