Navigation 2: dealing with bumper obstacles
I'm trying to add a bumper to my robot and I implemented the following solution based on Kobuki bumper2pc:
I have left and right bumpers on my robot which emit custom Bumper
events.
Another package is subscribing to the events and sends a PointCloud2
events accordingly:
bumper2pc
When a bumper is pressed it will put a point in front of the robot, when the bumper is released it will put a point far away from it.
By monitoring the PointCloud2
in RViz I can see that it's working.
Obstacle layer in Navigation is configured to use both scan
and pointcloud
sources as described here: https://index.ros.org/p/nav2_costmap_2d/ ("How to use multiple sensor sources" section). This also seems to work - when I press the bumper a new obstacle would appear in local cost map.
However, this seems to be not enough for Navigation stack - it continues to push forward as if the obstacle wasn't there or it would attempt to spin right away without backing up.
What I ideally like to have is this:
1. When the bumper is pressed, navigation detects it as an obstacle and remembers its position (this seems to be working).
2. Then it tells the robot to back up 2/3 cm (otherwise the bumper keeps being pressed).
3. Calculate a new path around the obstacle.
Can this be done with Navigation 2 stack alone or do I have to do step 2 myself?
I'm happy to back up the robot myself on a bumper event, but what do I have to send to Navigation 2 to pause the navigation in the meantime and how to tell it to calculate a new path afterwards?
we got the same issue, so really thank your bumper2pc solution, it could really solves the majority of the issue. We were wondering if you've solved the rest of problems as mentioned in your 1. / 2. / 3.
To our knowledge, 2. could be solved by using Kobuki safety control. 3. could be solved by an exploration planner. But we don't know how did you overcome 1.
Hope to hear your expertise!