Previous
Tune navigation
The navigation service drives the robot between waypoints, but it doesn’t perform actions at each stop. To capture an image, take a sensor reading, or trigger an alert at each waypoint, write code that monitors the robot’s progress and acts when a waypoint is reached.
This example navigates to a sequence of GPS coordinates and captures a camera image at each one.
The navigation service marks waypoints as visited when the robot arrives at each one. GetWaypoints returns only unvisited waypoints. By tracking the count, you detect arrivals.
When a waypoint is visited:
Switching to Manual mode stops the current motion plan but preserves the remaining waypoints. Switching back to Waypoint mode resumes navigation from the next unvisited waypoint.
The pattern works with any Viam API call:
await sensor.get_readings() to log environmental
data at each location.await vision.get_detections_from_camera("cam")
to run object detection at each stop.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!