A recovery behavior is a predefined fallback maneuver that a mobile robot executes when its normal navigation pipeline can no longer make progress, for example when the planner finds no valid path or the robot stops moving for too long. In robotics, recovery behaviors belong to the Navigation stack and act as a safety net between routine motion and a call for human help.
Typical recovery behaviors include clearing the costmap, rotating in place, backing up a short distance and waiting for a dynamic obstacle to leave. They do not replace good planning; they handle the transient failures that every real robot meets in cluttered, changing environments.
How recovery behaviors are triggered
A recovery behavior starts when a failure detector concludes that the robot is stuck or that a planner has failed. The navigation system monitors several signals continuously and compares them with configured thresholds and timeouts, so that a brief hesitation does not trigger an unnecessary maneuver.
The most common trigger is a progress checker: if the robot has not moved more than a set distance, often 0.25 to 0.5 m, within a time window of 5 to 15 seconds, the controller reports failure. Other triggers are a global path planner failure, a local planner unable to compute velocity commands, and an oscillation detector that notices the robot turning back and forth without advancing.
The following table summarizes the usual failure signals and what each one usually indicates.
| Trigger | Typical condition | Likely cause |
|---|---|---|
| No progress | Less than 0.5 m moved in 10 s | Blocked corridor or narrow gap |
| Global planning failure | No path found to the goal | Phantom obstacles in the costmap |
| Local control failure | No admissible velocity command | Robot footprint touching inflated cost |
| Oscillation | Repeated heading reversals | Conflicting planner objectives |
| Localization doubt | High pose covariance | Featureless or changed surroundings |
Standard types of recovery behavior
Most navigation frameworks ship a small library of simple, reversible maneuvers that are cheap to execute and unlikely to cause harm. Each one targets a specific failure mechanism, so a well-designed sequence tries them from the least to the most disruptive.
| Behavior | What it does | Problem it addresses |
|---|---|---|
| Costmap clearing | Erases stale obstacle cells around the robot | Ghost obstacles from sensor noise |
| Spin in place | Rotates the robot, often 90 to 360 degrees | Refreshes sensor view and localization |
| Back up | Drives straight backward 0.15 to 0.3 m | Footprint too close to an obstacle |
| Wait | Pauses for a few seconds | People or carts temporarily blocking the way |
| Assisted teleoperation | Hands control to a remote operator | Situations autonomy cannot resolve |
Costmap clearing is the most frequently used recovery, because many failures come from stale or false obstacle data rather than real blockages. Spinning helps a robot with a narrow sensor field of view rebuild its local map, and it also gives AMCL fresh scan data for re-localization.
Recovery logic in Nav2 and behavior trees
In modern frameworks, recovery behaviors are orchestrated by a behavior tree rather than hard-coded logic. In Nav2, the default navigation tree wraps path computation and path following in a RecoveryNode, which retries the main task after each recovery attempt and gives up after a configured number of retries, often six.
This structure provides escalation: the tree first clears the local and global costmaps, then spins, then waits, then backs up, and finally reports navigation failure to the application. The older ROS 1 move_base package followed a similar fixed sequence of conservative clearing, aggressive clearing and rotation.
- Retry planning after clearing local costmap data.
- Clear the global costmap and replan the full route.
- Spin to collect fresh sensor data around the robot.
- Wait for dynamic obstacles to move away.
- Back up and retry, then abort if all attempts fail.
A behavior tree makes the policy inspectable and configurable: engineers can reorder nodes, add context-specific recoveries or attach conditions, such as allowing a backup only when the rear sensors report free space.
Recovery behavior compared with related mechanisms
Recovery behaviors are easy to confuse with obstacle avoidance and replanning, yet they operate at a different level. Obstacle avoidance adjusts motion continuously during normal operation, whereas a recovery behavior interrupts normal operation after a failure has been declared.
| Mechanism | When it acts | Scope |
|---|---|---|
| Recovery behavior | After a declared failure | Discrete fallback maneuver |
| Obstacle avoidance | Continuously while moving | Local velocity adjustment |
| Replanning | Periodically or on map change | New global or local path |
| Emergency stop | On imminent collision or fault | Immediate halt of all motion |
| Re-localization | When pose estimate is lost | Correction of robot position |
The emergency stop is a safety function, often certified and implemented in hardware, while recovery behaviors are software heuristics with no safety rating. A recovery maneuver must therefore never be treated as a substitute for functional safety measures such as safety-rated laser scanners.
Designing and tuning recovery behaviors
Effective recovery design starts with failure data from real deployments. Logging every trigger, the recovery attempted and its outcome reveals which failures recur and which maneuvers actually resolve them, so that parameters are tuned on evidence rather than guesswork.
| Situation | Recommended setting | Reason |
|---|---|---|
| Crowded public spaces | Long wait before other recoveries | People usually move away on their own |
| Narrow warehouse aisles | Short backup with rear sensing | Spinning may hit racks |
| Noisy depth sensors | Frequent local costmap clearing | Removes false obstacle marks |
| Differential drive robot | Spin as early recovery | Rotation in place is safe and cheap |
| Car-like robot | Backup instead of spin | It cannot rotate in place |
The robot kinematics strongly limit which recoveries are possible: an Ackermann vehicle planned with Hybrid A* cannot spin, so it relies on reversing maneuvers. Designers should also set a retry limit and a clear escalation path to robot fleet management or a human operator.
Limitations and common mistakes
Recovery behaviors mask underlying problems when they run too often. A robot that clears its costmap every few minutes probably has poorly tuned inflation, sensor noise or a bad map, and the correct fix lies in the root cause, not in more recoveries.
- Blind backing up without rear sensors can cause collisions with people or objects.
- Aggressive costmap clearing can erase real obstacles that sensors cannot currently see.
- Endless retry loops waste battery and block other robots in shared spaces.
- Spinning near shelves or walls can collide when the footprint is not circular.
- Missing failure reporting hides recurring issues from operators and developers.
Recovery behaviors also cannot solve structural blockages, such as a closed door or a permanently relocated pallet. In such cases the robot should report failure promptly so that the global planner, a fleet manager or a person can choose a different route.
The short version
A recovery behavior is what a robot does when it gets stuck. Imagine walking into a crowded hallway and finding your way blocked. You might pause for a moment, look around, or step back to see another way through.
Robots do the same thing with a short list of simple escape moves: forget old obstacle data, turn around to look again, wait a few seconds, or reverse a little. If none of these moves works, the robot stops trying and asks for help instead of struggling forever.
Where it makes a difference
A hospital uses a differential drive delivery robot to carry medication between wards at night. In a corridor near the elevators, a cleaning cart and its operator often stand in the robot’s path, and the local planner reports no valid velocity command after about 10 seconds without progress.
The behavior tree first clears the local costmap, which removes stale marks left by the passing operator, and then waits 15 seconds because the deployment logs showed that most blockages in that corridor clear on their own. If the corridor is still blocked, the robot spins 180 degrees to refresh its view and replans.
After tuning the sequence this way, the team found that most stuck events resolved without human intervention, and the remaining cases were reported to the nursing station within two minutes instead of leaving the robot motionless and unnoticed.