Replanning occurs if a plan is found to have a problem while the plan is actually being executed. For example if a new obstacle appears in the world (e.g. in the octomap) while
the plan is being executed, and that obstacle is in the path of the plan such that the plan would cause the robot to collide with this new obstacle, then the path execution is halted. MoveIt waits for a certain amount of time to see if the obstacle goes away.
If the old plan is still blocked after the wait then MoveIt generates a new plan to the same goal and executes that plan instead.
Possible problems that could occur:
- if no new plan can be found (e.g. because the obstacle blocks all paths to the goal)
- if the octomap does not update fast enough and the previous plan completes even though a new obstacle appears (in this case the arm may hit the new obstacle)
- Sometimes voxels will be added to the octomap and then not be cleared. If these prevent a new plan from succeeding then replanning will fail. It will also fail if these voxels overlap with the robot's current position.