Skip to main content

Overview

The stretch4_body repository contains the core Python software stack that allows developers to interact with the hardware of Stretch 4 robots. The repository for Stretch 3 and below can be found in the stretch_body repo. This repo provides a robust, soft real-time capable framework for managing low-level motor communication, subsystem coordination, autonomous behaviors, and a high-level API for user applications. This repository is intended to be imported by other code that needs access to these features.

This package can be installed by:

python3 -m pip install -U hello-robot-stretch4-body

Architecture Block Diagram

At its heart, the architecture is built around a Client-Server model. A dedicated RobotServer runs as a background daemon managing the physical hardware at 100Hz, executing safety monitoring, self-collision detection, and hardware command multiplexing. Developers build their applications using the RobotClient, which asynchronously communicates with the server over ZeroMQ. This decouples user scripts from strict hardware timing constraints and allows for safe, concurrent control of the robot.

graph TD
    ClientCode["User Application RobotClient"]
    Server["Robot Server 100Hz Loop"]

    Subsystems["Hardware Subsystems"]
    Arm
    Lift
    Omnibase
    PowerPeriph
    EndOfArm

    Behaviors["Behaviors"]
    Sentries["Sentries Safety Monitors"]
    SafeMotions["Safe Motions Collision Avoidance"]
    Routines["Routines Autonomous Actions"]

    Workers["Background Workers"]
    LineSensorLoop["Line Sensor Loop"]
    CollisionLoop["Self Collision Loop"]
    EOALoop["End Of Arm Loop"]

    ClientCode -->|ZeroMQ Commands and Status| Server

    Server --> Behaviors
    Behaviors --> Sentries
    Behaviors --> SafeMotions
    Behaviors --> Routines

    Server --> Subsystems
    Subsystems --> Arm
    Subsystems --> Lift
    Subsystems --> Omnibase
    Subsystems --> PowerPeriph
    Subsystems --> EndOfArm

    Server --> Workers
    Workers --> LineSensorLoop
    Workers --> CollisionLoop
    Workers --> EOALoop

Technical Primers

For an in-depth understanding of how specific parts of the system are designed, refer to the following technical primers:

Primer Description
Core Architecture Maps out the foundational classes, IPC communication, and file organization of the core library.
Robot Parameters Explains the multi-layered parameter system (default vs user) and dynamic runtime generation.
Robot Client API A guide to using the RobotClient API for reading status and commanding motion asynchronously.
Hardware Subsystems Overview of the primary hardware abstractions (Arm, Lift, Base) and how they are instantiated.
End-Of-Arm EOA Details the dynamically instantiated, multi-process architecture for interchangeable tool attachments.
Line Sensors Details the operation and background processing for the downward-facing Pixart line sensors.
Server Behaviors Explains the plugin architecture for Sentries, Safe Motions, and Routines within the 100Hz server loop.
Self-Collision Details the MuJoCo-based collision checking system, its background loop, and configuration parameters.
Gamepad Teleop Explains how different control schemes can be mapped onto a standard gamepad controller + how to extend it.
Cameras A guide to the cameras on Stretch 4's head and wrist, with an overview of the CLIs and API.

Installation

  1. pip3 install -e .
  2. stretch_body_server --launch

Note: The C++ shared libraries for transport and SCSerial will compile automatically via Meson during the pip install.

If you want to install the object detection dependencies:

pip3 install -e .[object_detection]

Troubleshooting Editable Installs

If you make a C++ syntax error or typo in the source files and attempt to run a command while in editable mode (e.g., launching stretch_body_server), you may encounter an obscure Python exception instead of the actual C++ compiler error message:

subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.

Because meson-python editable builds run quietly in the background on import, it drops the standard output of the C++ compiler natively, hiding your C++ syntax error. To see the actual compiler output and locate the line where C++ failed, prepend your command with the verbose flag:

MESONPY_EDITABLE_VERBOSE=1 stretch_body_server --launch

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hello_robot_stretch4_body-2026.7.8.tar.gz (8.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hello_robot_stretch4_body-2026.7.8-py3-none-any.whl (7.4 MB view details)

Uploaded Python 3

File details

Details for the file hello_robot_stretch4_body-2026.7.8.tar.gz.

File metadata

  • Download URL: hello_robot_stretch4_body-2026.7.8.tar.gz
  • Upload date:
  • Size: 8.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hello_robot_stretch4_body-2026.7.8.tar.gz
Algorithm Hash digest
SHA256 07b1730f07dd0fce1d84520004ba2e1af8f12389e1452237a735c571649dc155
MD5 5fe561ff5a5ba4d1a0f32540dbf3693d
BLAKE2b-256 d9e2bfac3b3d4f87abd6ddb835f41c9556e83cd2271bd51e9a105c79a3e3a7aa

See more details on using hashes here.

File details

Details for the file hello_robot_stretch4_body-2026.7.8-py3-none-any.whl.

File metadata

  • Download URL: hello_robot_stretch4_body-2026.7.8-py3-none-any.whl
  • Upload date:
  • Size: 7.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hello_robot_stretch4_body-2026.7.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ac1cc71e49d9e1ced4b76fe4e9c4208855f2f58e605597a5858e0367ebacde52
MD5 27e1ec0a9d23dde6749ddbb3d87a0ce7
BLAKE2b-256 f16ca8c5074daeea126e1a427f4359b443a7e33b8cc70da1b05a307e75b36be2

See more details on using hashes here.

Release history Release notifications | RSS feed

2026.8.21

2 files

2026.7.31.2

2 files

2026.7.31

2 files

This release

2026.7.8 This release

2 files

2026.7.6

2 files

2026.7.3

2 files

2026.7.2

2 files

2026.6.25

2 files

2026.5.27

2 files

2026.5.14

2 files

2026.5.12

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page