This repository contains a Python script extending Boston Dynamics Spot’s Autowalk with dynamic runtime behaviors.
It allows you to take a recorded Autowalk and inject runtime maneuvers such as periodic pauses, lateral sidesteps, image capture, and background tasks (e.g., lightweight YOLO detection threads).
Developed for research and experimental purposes in the context of autonomous robotics and dynamic navigation.
Based on the Boston Dynamics Developer Documentation.
Stop the robot every X meters for N seconds using ODOM tracking and keepalive control.
Shift sideways by a configurable distance (+left / -right / alternate).
Save images from Spot’s cameras (JPEG/PNG) at each pause with timestamped filenames.
Run a configurable thread that simulates lightweight background tasks (e.g., YOLO inference).
- Python 3.8+
- Boston Dynamics Spot SDK
- External libraries:
numpyopencv-pythonprotobuf
- Stdlib:
argparse,logging,math,os,sys,time,threading,typing
Uses Spot SDK clients:
LeaseClient,LeaseKeepAlive,PowerClient,RobotCommandClient,RobotStateClient,GraphNavClient,AutowalkClient,ImageClient,MissionClient, etc.
| Flag | Description |
|---|---|
--hostname |
Spot hostname or IP (required) |
--walk_directory |
Path to the recorded .walk directory (required) |
--walk_filename |
Walk mission file inside missions/ (default: autogenerated.walk) |
--stop-every-m |
Pause trigger distance in meters (default: 5.0) |
--pause-sec |
Pause duration (default: 2.0) |
--mission-timeout |
Mission keepalive window in seconds (default: 2.0) |
--sidestep-m |
Lateral shift distance (+left / -right) (default: 1.5) |
--sidestep-speed |
Lateral velocity in m/s (default: 0.3) |
--sidestep-mode |
Sidestep direction: alternate / left / right |
--save-images |
Enable image capture at each pause |
--image-sources |
Camera sources (repeat per source) |
--jpeg-quality-percent |
JPEG quality (default: 85) |
--save-dir |
Output directory for captures |
--bg-load-pct |
Background CPU load fraction (0.0–1.0, default 0) |
--bg-cycle-ms |
Background load cycle period (ms, default 100) |
-v/--verbose |
Enable verbose logging |
The background load thread can be replaced with a detector worker.
Example:
- Pause every M meters, or
- Pause when YOLO detects a “tree” with confidence > τ.
On detection: stop → capture → sidestep → resume mission.
- Setup – Authenticate, time-sync, create Spot SDK clients.
- Map Upload – Clear GraphNav and upload graph + snapshots.
- Compile Mission – Load walk file via
AutowalkClient.load_autowalk(). - Ready – Power on, stand, optional fiducial localization.
- Loop –
- Track ODOM XY distance.
- Pause every M meters.
- Sidestep left/right/alternate.
- Capture images (optional).
- Resume Autowalk keepalive.
- Prefer cooperative lease sharing in production instead of
take(). - Test in clear areas before deploying.
- Verify sidestep distances/speeds are safe.
- Good texture, fiducials, and lighting improve GraphNav robustness.
- ODOM drift is small → suitable for relative distance triggers.
- Mission won’t start → Ensure graph/snapshots uploaded, Autowalk compiled, credentials valid.
- Robot stays still → Check pause window or
--mission-timeout. - No images → Verify
--save-images, sources, and Image service. - Re-localization fails → Use fiducial init, re-record weak areas, improve lighting.
{
"version": "0.2.0", // Debug configuration schema version
"configurations": [
{
"name": "DynamicStopper — sidestep + light BG load", // Display name in VS Code debugger
"type": "debugpy", // Python debug adapter
"request": "launch", // Launch a new process (not attach)
"program": "${workspaceFolder}/examples/dynamic_stopper.py", // Script entrypoint
"console": "externalTerminal", // Use an external terminal for I/O
"cwd": "${workspaceFolder}", // Working directory set to repo root
"args": [
"--hostname", "", // Spot robot hostname or IP (CHANGE this!)
"--walk_directory", "${workspaceFolder}/", // Path to your .walk folder (CHANGE this!)
"--walk_filename", "", // Walk mission file inside /missions (CHANGE or keep default)
"--stop-every-m", "5.0", // Pause trigger distance in meters
"--pause-sec", "2.0", // Pause duration in seconds
"--mission-timeout", "2.0", // Keepalive timeout (seconds)
"--sidestep-m", "1", // Lateral shift distance in meters (+ left, - right)
"--sidestep-speed", "0.3", // Sidestep velocity in m/s
"--sidestep-mode", "alternate", // Sidestep policy: alternate | left | right
// Optional photo capture section
"--save-images", // Enable image saving
"--image-sources", "frontleft_fisheye_image", // Camera source 1
"--image-sources", "frontright_fisheye_image", // Camera source 2
"--jpeg-quality-percent", "85", // JPEG quality (0–100)
"--save-dir", "${workspaceFolder}/", // Output folder for images
// Optional background CPU load (simulates inference threads)
"--bg-load-pct", "0.10", // Fraction of CPU time (10% here). 0 disables.
"--bg-cycle-ms", "100" // Cycle length in ms (100 ms here)
],
"env": {
"BOSDYN_USERNAME": "", // Spot username (set in env or here)
"BOSDYN_PASSWORD": "" // Spot password (set in env or here)
}
}
]
}