Skip to main content

A pure-Python Cozmo robot communication library.

Project description


PyCozmo is a pure-Python Cozmo robot communication library. 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 Digital Dream Labs (originally Anki) Cozmo robot. It is unstable and heavily under development.



import time
import pycozmo

def pycozmo_program(cli):



import pycozmo

cli = pycozmo.Client()

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



Robot Support


  • Camera
  • Cliff sensor
  • Accelerometers
  • Gyro
  • Battery voltage
  • Cube battery voltage
  • Cube accelerometers


  • Wheel motors
  • Head motor
  • Lift motor
  • Backpack LEDs
  • IR LED
  • OLED display
  • Speaker
  • Cube LEDs
  • Platform LEDs


  • Wi-Fi AP
  • Bluetooth LE


  • Firmware update


  • Localization
  • Path tracking
  • Procedural faces
  • Animations from FlatBuffers .bin files




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


  • - demonstrates 2D graphics, using PIL.ImageDraw on Cozmo's display
  • - turns Cozmo into an RC tank that can be driven with an XBox 360 Wireless controller or Logitech Gamepad F310
  • - demonstrates visualizing video captured from the camera back on display
  • - demonstrates cube connection and LED control
  • - demonstrates cube LED animation control
  • - demonstrates Cozmo charging platform LED control
  • - demonstrates 22 kHz, 16-bit, mono WAVE file playback through Cozmo's speaker
  • - demonstrates reading data from Cozmo's NVRAM (non-volatile memory)
  • - demonstrates drawing a procedural face on Cozmo's display
  • - demonstrates generating a procedural face
  • - demonstrates animating Cozmo

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    |
+------------------+                   +------------------+                   +------------------+


  • some high-level Cozmo SDK features are implemented in the Cozmo app and have no equivalent in PyCozmo, today:
    • personality engine
    • behaviors
    • motion detection
    • face detection
    • facial expression estimation
    • text-to-speech
    • songs
  • there is no Wi-Fi control. The library assumes a Wi-Fi connection to Cozmo, established in advance.


  • Python 3.5.4
  • Pillow 6.0.0 - Python image library
  • FlatBuffers - serialization library
  • dpkt - TCP/IP packet parsing library


Using pip:

pip install --user pycozmo

From source:

git clone
cd pycozmo
python install --user

From source, for development:

git clone
cd pycozmo
python develop --user
pip install --user -r requirements-dev.txt


Bug reports and changes should be sent via GitHub:

DDL Robot Discord server, channel #development-cozmo:


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

Project details

Download files

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

Source Distribution

pycozmo-0.7.0.tar.gz (97.9 kB view hashes)

Uploaded Source

Built Distribution

pycozmo-0.7.0-py3-none-any.whl (114.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page