Skip to content

About

Dynamic Stopper extends Spot’s Autowalk missions with runtime control: pause every X meters, sidestep laterally, capture images, and run background tasks (e.g., YOLO detection). Unlike fixed paths, it injects dynamic maneuvers into recorded routes, while GraphNav keeps the robot localized and obstacle-aware.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Dynamic Stopper for Spot

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.


Features

1. Periodic Dynamic Pauses

Stop the robot every X meters for N seconds using ODOM tracking and keepalive control.

2. Lateral Sidestep Maneuvers

Shift sideways by a configurable distance (+left / -right / alternate).

3. Image Capture at Pauses

Save images from Spot’s cameras (JPEG/PNG) at each pause with timestamped filenames.

4. Background CPU Load Thread

Run a configurable thread that simulates lightweight background tasks (e.g., YOLO inference).


Requirements

  • Python 3.8+
  • Boston Dynamics Spot SDK
  • External libraries:
    • numpy
    • opencv-python
    • protobuf
  • Stdlib: argparse, logging, math, os, sys, time, threading, typing

Uses Spot SDK clients: LeaseClient, LeaseKeepAlive, PowerClient, RobotCommandClient, RobotStateClient, GraphNavClient, AutowalkClient, ImageClient, MissionClient, etc.


Arguments

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

YOLO / Decision Hooks

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.


How It Works

  1. Setup – Authenticate, time-sync, create Spot SDK clients.
  2. Map Upload – Clear GraphNav and upload graph + snapshots.
  3. Compile Mission – Load walk file via AutowalkClient.load_autowalk().
  4. Ready – Power on, stand, optional fiducial localization.
  5. Loop –
    • Track ODOM XY distance.
    • Pause every M meters.
    • Sidestep left/right/alternate.
    • Capture images (optional).
    • Resume Autowalk keepalive.

Tips & Safety

  • 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.

Troubleshooting

  • 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.

Example Configuration

{
  "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)
      }
    }
  ]
}

About

Dynamic Stopper extends Spot’s Autowalk missions with runtime control: pause every X meters, sidestep laterally, capture images, and run background tasks (e.g., YOLO detection). Unlike fixed paths, it injects dynamic maneuvers into recorded routes, while GraphNav keeps the robot localized and obstacle-aware.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages