Skip to main content

Nexo PyCozmo

Note: This project is a fork and continuation of the original PyCozmo library. It has been updated, maintained, and modernized to ensure full compatibility with recent Python versions (3.13, 3.14, and above).

Nexo PyCozmo is a pure-Python communication library, alternative SDK, and application for the Cozmo robot . It allows controlling a Cozmo robot directly, without having to go through a mobile device, running the Cozmo app.

The library is loosely based on the Anki Cozmo Python SDK and the cozmoclad ("C-Like Abstract Data") library.

This project is a tool for exploring the hardware and software of the Digital Dream Labs (originally Anki) Cozmo robot. It is unstable and heavily under development.

Usage

Basic:

import time
import pycozmo

with pycozmo.connect() as cli:
    cli.set_head_angle(angle=0.6)
    time.sleep(1)

Advanced:

import pycozmo

cli = pycozmo.Client()
cli.start()
cli.connect()
cli.wait_for_robot()

cli.drive_wheels(lwheel_speed=50.0, rwheel_speed=50.0, duration=2.0)

cli.disconnect()
cli.stop()

Documentation

https://pycozmo.readthedocs.io/

Robot Support

Sensors:

  • Camera
  • Cliff sensor
  • Accelerometers
  • Gyro
  • Battery voltage
  • Cube battery voltage
  • Cube accelerometers
  • Backpack button (v1.5 hardware and newer)

Actuators:

  • Wheel motors
  • Head motor
  • Lift motor
  • OLED display
  • Speaker
  • Backpack LEDs
  • IR LED
  • Cube LEDs
  • Platform LEDs (when available)

On-board functions (see docs/functions.md for details:

  • Wi-Fi AP
  • Bluetooth LE
  • Localization
  • Path tracking
  • NV RAM storage
  • Over-the-air (OTA) firmware updates

Off-board functions (see docs/offboard_functions.md for details:

  • Procedural face generation
  • Cozmo animations from FlatBuffers .bin files
  • Personality engine - work in progress
  • Cozmo behaviors - work in progress
  • Motion detection
  • Object (cube and platform) detection
  • Cube marker recognition
  • Face detection
  • Face recognition
  • Facial expression estimation
  • Pet detection
  • Camera calibration
  • Navigation map building
  • Text-to-speech
  • Songs

Extra off-board functions:

  • Vector animations from FlatBuffers .bin files
  • Vector behaviors
  • ArUco marker recognition
  • Cozmo and Vector robot detection
  • Drivable area estimation
  • Voice commands

If you have ideas for other functionality share them via GitHub.

Tools

Note: PyCozmo and pycozmo_protocol_generator.py in particular could be used as a base for creating a Cozmo protocol encoder code generator for languages other than Python (C/C++, Java, etc.).

Examples

Basic:

  • minimal.py - minimal code to communicate with Cozmo, using PyCozmo
  • extremes.py - demonstrates Cozmo lift and head control
  • backpack_lights.py - demonstrates Cozmo backpack LED control
  • display_image.py - demonstrates visualization of image files on Cozmo's display
  • events.py - demonstrates event handling
  • camera.py - demonstrates capturing a camera image
  • go_to_pose.py - demonstrates moving to a specific pose (position and orientation)
  • path.py - demonstrates following a predefined path

Advanced:

PyCozmo In The Wild

Connecting to Cozmo over Wi-Fi

A Wi-Fi connection needs to be established with Cozmo before using PyCozmo applications.

  1. Wake up Cozmo by placing it on the charging platform
  2. Make Cozmo display it's Wi-Fi PSK by rising and lowering its lift
  3. Scan for Cozmo's Wi-Fi SSID (depends on the OS)
  4. Connect using Cozmo's Wi-Fi PSK (depends on the OS)

This video summarizes the connection process.

PyCozmo vs. the Cozmo SDK

A Cozmo SDK application (aka "game") acts as a client to the Cozmo app (aka "engine") that runs on a mobile device. The low-level communication happens over USB and is handled by the cozmoclad library.

In contrast, an application using PyCozmo basically replaces the Cozmo app and acts as the "engine". PyCozmo handles the low-level UDP communication with Cozmo.

+------------------+                   +------------------+                   +------------------+
|     SDK app      |     Cozmo SDK     |    Cozmo app     |       Cozmo       |      Cozmo       |
|      "game"      |     cozmoclad     |     "engine"     |      protocol     |     "robot"      |
|                  | ----------------> |   Wi-Fi client   | ----------------> |     Wi-Fi AP     |
|                  |        USB        |    UDP client    |     UDP/Wi-Fi     |    UDP Server    |
+------------------+                   +------------------+                   +------------------+

Requirements

Installation

Using pip:

pip install --user nexo-pycozmo

pycozmo_resources.py download

From source:

git clone https://github.com/nexo-robot/nexo-pycozmo.git
cd pycozmo
python setup.py install --user

pycozmo_resources.py download

From source, for development:

git clone https://github.com/nexo-robot/nexo-pycozmo.git
cd pycozmo
python setup.py develop --user
pip install --user -r requirements-dev.txt

pycozmo_resources.py download

Support

Bug reports and changes should be sent via GitHub:

https://github.com/nexo-robot/nexo-pycozmo

Disclaimer

This project is not affiliated with Digital Dream Labs or Anki.

Metadata

Release files for nexo-pycozmo 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nexo-pycozmo 1.0.0
File Size Uploaded Provenance
nexo_pycozmo-1.0.0.tar.gz 189.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nexo-pycozmo 1.0.0
File Interpreter ABI Platform
nexo_pycozmo-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 399.2 kB

Release files / nexo_pycozmo-1.0.0.tar.gz

Download URL nexo_pycozmo-1.0.0.tar.gz
Size 189.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f57517ab474d441134dd38ffcc41ee8b890f2743c55b7a4236c50f224e29fb92
BLAKE2b-256 checksum
How to use checksums
915289ab427a4559662dd8400e4e21d7eea65ff7368f8ba59c24d91da7cbca95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / nexo_pycozmo-1.0.0-py3-none-any.whl

Download URL nexo_pycozmo-1.0.0-py3-none-any.whl
Size 209.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19da4afb22e86e84523cc41820f344a1ed46ef41b3c1575a27747569a6e37999
BLAKE2b-256 checksum
How to use checksums
65b0c2f044bde5c353f615bd80c9933d17921ec39a0051182aadbb3796762b1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for nexo-pycozmo 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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