Previous
Follow a patrol route
The navigation service supports two kinds of obstacles: vision-detected obstacles from cameras and static obstacles defined in configuration. You can use both together.
Each obstacle detector pairs a vision service with a camera. The vision service analyzes frames from the camera and reports 3D obstacle geometries. The navigation service transforms these detections into geographic coordinates and feeds them to the path planner.
{
"obstacle_detectors": [
{
"vision_service": "obstacle-detector",
"camera": "front-cam"
}
]
}
You can configure multiple detectors for better coverage. Each detector operates independently and contributes its obstacles to the planner. The obstacles from all detectors are combined (not merged or deduplicated).
Common multi-detector setups:
{
"obstacle_detectors": [
{
"vision_service": "obstacle-detector",
"camera": "front-cam"
},
{
"vision_service": "ground-hazard-detector",
"camera": "down-cam"
}
]
}
The navigation service polls each detector at
obstacle_polling_frequency_hz (default 1 Hz). At each poll:
Higher polling frequencies detect obstacles sooner but use more CPU and camera bandwidth. For robots moving at the default 0.3 m/s, 1 Hz means the robot moves about 30 cm between obstacle checks.
Static obstacles are fixed geographic locations the robot should always avoid, regardless of what the cameras see. Use these for known hazards like ponds, buildings, restricted areas, or dropoffs.
The easiest way to add static obstacles is through the Viam app:
Static obstacles are GeoGeometry objects in the obstacles array:
{
"obstacles": [
{
"location": {
"latitude": 40.6645,
"longitude": -73.9382
},
"geometries": [
{
"type": "box",
"x": 5,
"y": 5,
"z": 2
}
]
}
]
}
Bounding regions define geographic boundaries the robot must stay within. If configured, the path planner will not generate paths that leave these regions. Use bounding regions to keep the robot on your property, within a work zone, or away from roads.
Configure bounding regions in the bounding_regions array. The format is
the same as static obstacles (GeoGeometry objects), but the meaning is
inverted: obstacles are areas to avoid, bounding regions are areas to stay
within.
{
"bounding_regions": [
{
"location": {
"latitude": 40.6643,
"longitude": -73.938
},
"geometries": [
{
"type": "box",
"x": 100,
"y": 100,
"z": 10
}
]
}
]
}
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!