Coder Social home page Coder Social logo

zayfod / pycozmo Goto Github PK

View Code? Open in Web Editor NEW
170.0 26.0 57.0 957 KB

A pure-Python communication library, alternative SDK, and application for the Cozmo robot.

License: MIT License

Python 100.00%
anki cozmo robot robotics cozmo-sdk ddl digitial-dream-labs anki-cozmo

pycozmo's Introduction

PyCozmo

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 pycozmo

pycozmo_resources.py download

From source:

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

pycozmo_resources.py download

From source, for development:

git clone [email protected]:zayfod/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/zayfod/pycozmo

DDL Robot Discord server, channel #development-cozmo:

https://discord.gg/ew92haS

Disclaimer

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

pycozmo's People

Contributors

ca2-chambers avatar gimait avatar solosito avatar zayfod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pycozmo's Issues

Syntax error when launching any test files

Hello,

I have Cozmo with last update. Windows 10 , PyCozmo 0.2.0 with Python 3.5.4
I have installed Python on its charging platform.
I have rised and lowered his lift for discovering its key.
I'm connecting on Cozmo WIFI point via PC.

Steps :
1 Open commandline console
2. >pip install pycozmo
3. >python display.py

C:\dev\cozmo\pycozmo\examples>python display.py
Traceback (most recent call last):
File "display.py", line 5, in
import pycozmo
File "C:\Users\didie\AppData\Local\Programs\Python\Python35\lib\site-packages\pycozmo_init_.py", line 3, in
from .client import ROBOT_ADDR, Client
File "C:\Users\didie\AppData\Local\Programs\Python\Python35\lib\site-packages\pycozmo\client.py", line 105
self.sock: socket.socket = sock
^
SyntaxError: invalid syntax

Robot accelerometer and gyro use example

A new example is needed that demonstrates the use of Cozmo's:

  • accelerometers for measuring acceleration along the x, y, and z axes
  • gyro for measuring agular velocity around the x, y, and z axes

wait_for_robot() throws connection error despite having connected

Code:

import pycozmo
import time

pycozmo.setup_basic_logging(log_level="DEBUG", protocol_log_level="DEBUG")
cli = pycozmo.Client()
cli.start()
cli.connect()
cli.wait_for_robot()
cli.set_head_angle(angle=0.6)
time.sleep(2)
cli.set_head_angle(angle=0.2)

Error:

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    cli.wait_for_robot() 
  File "C:\path\venv\cozmo\lib\site-packages\pycozmo\client.py", line 157, in wait_for_robot
    raise exception.ConnectionTimeout("Failed to connect to Cozmo.")
pycozmo.exception.ConnectionTimeout: Failed to connect to Cozmo.

Debug logs: https://paste.mod.gg/udesumuxef.log

  • Note that client does connect successfully and hardware info, animation state, and image imu data events are all received

Dependencies:

Package     Version 
----------- ------- 
cozmoclad   3.4.0
dpkt        1.9.2
flatbuffers 1.11
numpy       1.18.1
Pillow      7.0.0
pip         19.2.3
pycozmo     0.6.0

Network info (connected before running code):

SSID:	Cozmo_31ABCF
Protocol:	802.11g
Security type:	WPA2-Personal
Network band:	2.4 GHz
Network channel:	3
Link-local IPv6 address:	fe80::1954:c4de:83b3:5abb%4
IPv4 address:	172.31.1.2
IPv4 DNS servers:	172.31.1.1
Manufacturer:	Intel Corporation
Description:	Intel(R) Wireless-AC 9260 160MHz
Driver version:	21.60.0.5
Physical address (MAC):	18-1D-EA-F4-37-B0

Python 3.5 doesn't accept the long option in setup.py

C:\dev\cozmo\pycozmo>python setup.py clean
C:\Users\didie\AppData\Local\Programs\Python\Python35\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running clean

I've fixed this error with removing the long_desciption options in setup.py
#long_description=get_readme(),
#long_description_content_type="text/markdown",

Cozmo as a Telepresence Robot?

Could this be possible?

Ok, I mean not like this
grafik

At first, I love the idea Raspberry + Cozmo = ♥︎

I use a Raspi Zero with a Webcam and MotionEyeOS. I can connect through VPN at home from work and look what my cat 🐱 is doing. Just for fun, ok sometimes needed. I have the idea of using the good old cozmo to drive around and annoy or play with her. No serious cat-entertainment-plan, just for fun. But when you think about it, that could have other benefits. I mean, people are creative. I bet somebody would drive through his garden or do other crazy (legal- ☻) stuff with this remotely.
There is an older project controlling cozmo with a xbox 360 controller or a control-dashboard, but all with SDK and a mobile device. That premium solution is not really needed. A web-interface? sorry, I´m dreaming....

The first thing I was asking myself was "How to connect cozmo with my router?"

What do you think?

camera always in black and white

hi how can i make the camera show color video here is my code @zayfod @gimait @solosito @ca2-chambers

import tkinter as tk
from PIL import Image, ImageTk
import pycozmo

root = tk.Tk()

root.title("Cozmo Camera Feed")

image_label = tk.Label(root)
image_label.pack()

last_im = None

def on_camera_image(cli, new_im):
"""Handle new images from the robot."""
COLOR_CAMERA = True
global last_im, image_label
last_im = new_im

if last_im:
 
    im = last_im.resize((1700, 725))  
    im = im.convert('RGB')  
    photo = ImageTk.PhotoImage(image=im)

    image_label.config(image=photo)
    image_label.image = photo  # Keep a reference to avoid garbage collection

with pycozmo.connect(enable_procedural_face=True) as cli:

cli.add_handler(pycozmo.event.EvtNewRawCameraImage, on_camera_image)
cli.enable_camera()

root.mainloop()

RC car example with OpenCV UI

A new example is needed that allows controlling the robot as an RC car with OpenCV UI.

It should provide functionality, similar to the rc.py example but also display a real-time image from the robot camera.

Autonomy

Please make Cozmo autonomus 🙌🙌🙌🙌 The use of pycozmo in a autonomus way could make this little toy a truly robot pet for taking him to our jobs! Would love to see Cozmo in the desk without loosing connection!

python 3.12 support camera ecc.

the code wont work for the camera i am triyng in the version python 3.12 , 3.8

i am new at coding i tried this ai code dint worked pls someune give me a code that works like it got all the fuctions of the app becous i cant dowload it in android 14

import cv2
import pycozmo
import time

Initialize Cozmo client

cli = pycozmo.Client()

Connect to Cozmo

cli.start()
cli.connect()
cli.wait_for_robot()

Function to display camera feed

def display_camera_feed():
while True:
# Capture frame-by-frame
image = cli.camera.latest_image.raw_image

    # Convert image to RGB (OpenCV uses BGR)
    image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

    # Display the resulting frame
    cv2.imshow('Cozmo Camera', image)

    # Break the loop if 'q' is pressed
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything is done, release the capture
cv2.destroyAllWindows()

Start a thread to display the camera feed

camera_thread = threading.Thread(target=display_camera_feed)
camera_thread.start()

Keep the program running for some time

time.sleep(30) # Adjust the time as needed

Disconnect from Cozmo

cli.disconnect()
cli.stop()

please read

@zayfod hi there i am wanting to make a new resporitory using this code to make a new app for cozmo and to help fix some issues would you allow me to do this many thanks

Self docking on charger

Hello,

Thanks for your work, I appreciate a lot to connect to my Cozmo directly without any android device ;) 🥇

I just discovered this script based on cozmosdk that allow Cozmo to self dock. It seems that this script is using internal image recognition :
https://forums.anki.com/t/program-self-docking-on-charger/13830

Do you think it is possible to have the same functionnality here with pycozmo ?? It would be nice to can charge it automatically

Thanks
Max

No change for RobotState backpack_touch_sensor_raw

I've changed some lines to add backpack button test.
During the test , I'm pressing the backpack button but I didn't see any change in this value :-(

#!/usr/bin/env python

import time

import pycozmo


def on_robot_state(cli, pkt: pycozmo.protocol_encoder.RobotState):
    del cli
    print("Battery level: {:.01f} V".format(pkt.battery_voltage))
    print("Time stamp: {0}".format(pkt.timestamp))

def on_robot_state2(cli, pkt: pycozmo.protocol_encoder.RobotState):
    del cli
    print("backpack touch sensor raw: {0}".format(pkt.backpack_touch_sensor_raw))  


def on_robot_poked(cli, pkt: pycozmo.protocol_encoder.RobotPoked):
    del cli, pkt
    print("Robot poked.")


def on_robot_falling_started(cli, pkt: pycozmo.protocol_encoder.FallingStarted):
    del cli, pkt
    print("Started falling.")


def on_robot_falling_stopped(cli, pkt: pycozmo.protocol_encoder.FallingStopped):
    del cli
    print("Falling stopped after {} ms. Impact intensity {:.01f}.".format(pkt.duration_ms, pkt.impact_intensity))


def on_robot_picked_up(cli, state):
    del cli
    if state:
        print("Picked up.")
    else:
        print("Put down.")


def on_robot_charging(cli, state):
    del cli
    if state:
        print("Started charging.")
    else:
        print("Stopped charging.")


def on_cliff_detected(cli, state):
    del cli
    if state:
        print("Cliff detected.")


def on_robot_wheels_moving(cli, state):
    del cli
    if state:
        print("Started moving.")
    else:
        print("Stopped moving.")


def pycozmo_program(cli):

    cli.add_handler(pycozmo.protocol_encoder.RobotState, on_robot_state, one_shot=True)
    cli.add_handler(pycozmo.protocol_encoder.RobotState, on_robot_state2, one_shot=False)
    cli.add_handler(pycozmo.protocol_encoder.RobotPoked, on_robot_poked)
    cli.add_handler(pycozmo.protocol_encoder.FallingStarted, on_robot_falling_started)
    cli.add_handler(pycozmo.protocol_encoder.FallingStopped, on_robot_falling_stopped)
    cli.add_handler(pycozmo.client.EvtRobotPickedUpChange, on_robot_picked_up)
    cli.add_handler(pycozmo.client.EvtRobotChargingChange, on_robot_charging)
    cli.add_handler(pycozmo.client.EvtCliffDetectedChange, on_cliff_detected)
    cli.add_handler(pycozmo.client.EvtRobotWheelsMovingChange, on_robot_wheels_moving)

    while True:
        try:
            time.sleep(0.1)
        except KeyboardInterrupt:
            break


pycozmo.run_program(pycozmo_program)

result :  
D:\dev\Cozmo\pycozmo\examples>python events.py
2019-09-07 07:41:22.037 pycozmo.general      INFO     Head S/N 154158131.
2019-09-07 07:41:22.039 pycozmo.general      INFO     Firmware version 2381.
Battery level: 3.8 V
Time stamp: 3783695
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
backpack touch sensor raw: 0
2019-09-07 07:41:32.834 pycozmo.general      INFO     Done.

D:\dev\Cozmo\pycozmo\examples>

Eye/display problem

Hello everyone,

I think I have some problem with displaying things on my cozmo...

Preliminary : using the Anki android application, I have no problem with Cozmo display (display wifi info before logging, expressive eyes, games...).

When I run the pycozmo examples dealing with display:

  • display_image.py : shows "Pycozmo" but sometimes also "strange" lines, like truncated diagonales (as if some values where also written in the display memory buffer).
  • display_lines.py : works ok I think. I see a moving triangle

But, I have a black screen when I try:

  • procedural_face.py
  • procedural_face_expressions.py

(I have checked that procedural_face_show.py displays an image with two eyes using PIL on MY screen.

Besides, and I do not know if it is related, but I think that my first tries with pycozmo.client, the robot was displaying random eyes (a bit like the Andy app). Now, it keeps a black screen.

So I have questions (and maybe I'm using the pycozmo module the wrong way).

  1. How can I debug the procedural_face and procedural_face_expressions scripts ? They should display something on the cozmo, no ?

  2. What is the use of the enable_procedural_face=False while connecting to the client in these 2 scripts. I tend to think it is to stop the default display of random eyes. But in my case, with other application/examples, when it is set to True by default, nothing happens : black display for cozmo.

  3. What am I doing wrong ? (Or what did I do wrong to make the default procedural face to be shut down "permanently" ?)

Snow/Alain

=========================

Some info on robot and software

Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux

pycozmo.version=0.8.0

When connecting to Cozmo:
021-01-24 19:12:45.050 pycozmo.protocol INFO Recv: 17B, 0F (disc.), 1F, 1P, 1P (100.00%); Sent: 0P, 0P (0.00%), 0F, 0F (disc.), 0B;
2021-01-24 19:12:45.074 pycozmo.general INFO Firmware version 2381.
2021-01-24 19:12:45.107 pycozmo.general INFO Body S/N 0x0ca05935, HW version 4, color 0.
2021-01-24 19:12:52.150 pycozmo.general INFO Done.

Extend client API

PyCozmo provides access to most low-level communication messages, part of the Cozmo protocol, as described here: https://github.com/zayfod/pycozmo/blob/master/pycozmo/protocol_declaration.py

Only a small portion of the low-level functionality is exposed through the Client class API.

The below methods, properties, and events available in the Anki Python Cozmo SDK can easily be added.

Methods:

  • drive_off_charger_contacts()
  • drive_straight()
  • turn_in_place()
  • backup_onto_charger()
  • drive_wheel_motors()
  • drive_wheels()
  • enable_stop_on_cliff()
  • move_head()
  • move_lift()
  • set_manual_exposure()
  • set_robot_volume()
  • turn_in_place()

Properties:

  • accelerometer
  • are_wheels_moving
  • battery_voltage
  • drive_off_charger_on_connect
  • gyro
  • is_anim_buffer_full
  • is_charging
  • is_cliff_detected
  • is_falling
  • is_head_in_pos
  • is_lift_in_pos
  • is_localized
  • is_moving
  • is_on_charger
  • is_pathing
  • is_picked_up
  • last_image_robot_timestamp
  • left_wheel_speed
  • right_wheel_speed
  • lift_angle
  • lift_height
  • lift_position
  • lift_ratio
  • pose
  • pose_angle
  • pose_pitch
  • serial

Events:

  • EvtObjectAppeared
  • EvtObjectConnectChanged
  • EvtObjectConnected
  • EvtObjectDisappeared
  • EvtObjectMoving
  • EvtObjectMovingStarted
  • EvtObjectMovingStopped
  • EvtObjectTapped

Still active?

Is this repository still active? Did zayfod go somewhere? Where do I go for new updates?

An issue I've encountered is that the speaker seems to cut out randomly, and animations seem to be a WIP (no audio, and very stuttery)

Method for face detection

Hello @zayfod,

Instead of simply throwing a pull-request your way and see if it sticks, I thought I'd open an issue to discuss how you plan on implementing the face detection feature?
I have already cloned your project and tried my hand at such an implementation using OpenCV and YoloV4-tiny. For the moment the neural network is trained using the OpenImage dataset and can only detect Human hands and heads.
The class handling the detection and tracking is implemented here: https://github.com/davinellulinvega/pycozmo/blob/face_detection/pycozmo/multi_tracking.py
And an example of how this might be used within the Pycozmo library can be found here:
https://github.com/davinellulinvega/pycozmo/blob/face_detection/examples/face_detection.py (note that you also need the .cfg, .names, and .weights files for building the network).
As mentioned above, for the moment yolo has only been trained to detect hands and heads, but it can "easily" be retrained to handle heads, cozmo's cubes, pets (cat, dogs, birds, ...), and cozmo's other objects (platform, cube markers, and what else?).

Hope this might be of interest for you. If it is do let me know and we can talk more about a better integration of the multi-tracker (and its accompanying files) within the Pycozmo library.

anim.py (ellipse() got an unexpected keyword argument 'width' )

In a previous dev , it works without error but now it doesn't !
Windows 7

Behaviour seen : Cozmo light its backpack light in green.

D:\dev\Cozmo\pycozmo\20190922\examples>python anim.py
2019-09-23 00:48:17.195 pycozmo.general INFO Firmware version 2381.
2019-09-23 00:48:17.226 pycozmo.general INFO Body S/N 0x45a0330c.
Traceback (most recent call last):
File "anim.py", line 13, in
pycozmo.run_program(pycozmo_program)
File "C:\Python35\lib\site-packages\pycozmo-0.5.0-py3.5.egg\pycozmo\run.py", l
ine 44, in run_program
f(cli)
File "anim.py", line 8, in pycozmo_program
clips = pycozmo.anim.load_anim_clips(fspec)
File "C:\Python35\lib\site-packages\pycozmo-0.5.0-py3.5.egg\pycozmo\anim.py",
line 266, in load_anim_clips
clip = load_anim_clip(fbclips.Clips(i))
File "C:\Python35\lib\site-packages\pycozmo-0.5.0-py3.5.egg\pycozmo\anim.py",
line 232, in load_anim_clip
render_face(face)
File "C:\Python35\lib\site-packages\pycozmo-0.5.0-py3.5.egg\pycozmo\anim.py",
line 113, in render_face
draw.ellipse(xy=((x1, y1), (x2, y2)), fill=1, outline=1, width=1)
TypeError: ellipse() got an unexpected keyword argument 'width'

Second test gives Cozmo 01 on Cozmo's screen

I've installed new master version.

Steps :

  1. Launch display.py file onetime
C:\dev\cozmo\pycozmo\examples>python display.py
Sending hello...
Connected!
Got  Connect()
Got  UnknownCommand(c9, 33:44:30:09:05:00)
Got  UnknownCommand(ee, 33:44:bd:01:7b:22:76:65:72:73:69:6f:6e:22:3a:20:32:33:38:31:2c:20:22:67:69:74:2d:72:65:76:22:3a:20:22:34:30:38:64:32:38:61:37:66:36:65:36:38:63:62:62:35:62:32:39:63:31:64:63:64:38:63:38:64:62:32:62:33:38:66:39:63:38:63:65:22:2c:20:22:64:61:74:65:22:3a:20:22:54:75:65:20:4a:61:6e:20:20:38:20:31:30:3a:32:37:3a:30:35:20:32:30:31:39:22:2c:20:22:74:69:6d:65:22:3a:20:31:35:34:36:39:37:32:30:32:35:2c:20:22:6d:65:73:73:61:67:65:45:6e:67:69:6e:65:54:6f:52:6f:62:6f:74:48:61:73:68:22:3a:20:22:39:65:34:61:39:36:35:61:63:65:34:65:30:39:64:38:36:39:39:37:62:38:37:62:61:31:34:32:33:35:64:35:22:2c:20:22:6d:65:73:73:61:67:65:52:6f:62:6f:74:54:6f:45:6e:67:69:6e:65:48:61:73:68:22:3a:20:22:61:32:35:39:32:34:37:66:31:36:32:33:31:64:62:34:34:30:39:35:37:32:31:35:62:61:62:61:31:32:61:62:22:2c:20:22:62:75:69:6c:64:22:3a:20:22:44:45:56:45:4c:4f:50:4d:45:4e:54:22:2c:20:22:77:69:66:69:53:69:67:22:3a:20:22:36:39:63:61:30:33:33:35:32:65:34:32:31:34:33:64:33:34:30:66:30:66:37:66:61:63:30:32:65:64:38:66:66:39:36:65:66:31:30:62:22:2c:20:22:72:74:69:70:53:69:67:22:3a:20:22:33:36:35:37:34:39:38:36:64:37:36:31:34:34:61:37:30:65:39:32:35:32:61:62:36:33:33:62:65:34:36:31:37:61:34:62:63:36:36:31:22:2c:20:22:62:6f:64:79:53:69:67:22:3a:20:22:36:39:35:62:35:39:65:66:66:34:33:36:36:34:61:63:64:31:61:35:61:39:35:36:64:30:38:63:36:38:32:62:33:66:38:62:64:32:63:38:22:7d)
Got  UnknownCommand(b0, 01:00:00:00:01:00:02:01:04:00:00:00)
Got  UnknownCommand(b0, 72:02:00:00:9b:01:02:01:04:00:00:00)
Got  UnknownCommand(b0, 5b:01:00:00:9d:01:02:01:01:00:00:00)
Got  UnknownCommand(b0, 78:02:00:00:b3:04:03:01:05:00:00:00)
Got  UnknownCommand(ec, ef:60:15:00)
Got  UnknownCommand(b0, 31:01:00:00:e4:00:02:00)
Sending enable...
Sent UnknownCommand(25, )
Sent UnknownCommand(4b, c4:b6:39:00:00:00:a0:c1)
Sent UnknownCommand(9f, )
Got  UnknownCommand(b0, 31:01:00:00:64:00:01:00)
Got  UnknownCommand(b0, 5b:01:00:00:9e:01:02:01:00:00:00:00)
Got  RobotDelocalized()
Got  UnknownCommand(b0, 43:02:00:00:8a:01:02:03:b2:9f:32:bf:63:7f:92:3e:c2:a7:8b:bf)
Got  UnknownCommand(d1, 02:01:00)
Got  UnknownCommand(d1, 03:01:00)
Got  UnknownCommand(d1, 02:00:00)
Sent NextFrame()
Sent DisplayImage(image=[63, 63])
Sent NextFrame()
Sent DisplayImage(image=[63, 63])
Sent NextFrame()
Sent DisplayImage(image=[63, 63])
Sent NextFrame()
Sent DisplayImage(image=[63, 63])
Sent NextFrame()
Sent DisplayImage(image=[63, 63])
Sent NextFrame()
Sent DisplayImage(image=[63, 63])
Sent NextFrame()
Sent DisplayImage(image=[63, 63])
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:1a:01:01:00)
Got  UnknownCommand(d1, 03:00:00)
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:8c:66:e6:c3:f5:28:24:42:e9:3c:1a:46:68:18:c1:3f:a8:36:51:ba:a6:8d:e8:bf:00:00:00:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:48:9a:a2:42:4e:c0:cc:c2:9d:aa:1a:46:46:b4:51:3f:56:14:37:bc:7a:f9:7c:bf:00:00:00:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:a2:aa:d1:43:dc:3c:34:c3:df:a4:1a:46:c4:d0:5e:3f:5e:1b:82:3e:7b:c6:8c:bf:00:00:00:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:18:7a:c0:44:3b:71:44:44:90:24:2a:46:53:99:1f:3e:0a:c4:57:bf:8f:13:1a:be:00:00:00:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:33:02:98:45:cd:50:de:44:72:92:17:46:40:72:19:bf:80:ce:30:bf:1e:54:54:3f:00:00:00:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:55:f8:c1:45:1e:86:cb:43:14:2b:e5:45:94:a8:90:be:a4:3a:92:bf:fd:72:9a:3f:00:00:00:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:16:f2:fd:43:61:1d:15:c4:a9:b3:08:46:4a:11:99:be:1b:70:08:bf:4c:95:ad:bf:00:00:00:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:52:ae:eb:44:38:1b:aa:c3:40:06:0f:46:c4:02:1f:3f:f6:45:c5:be:8b:96:8d:bf:00:00:00:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:47:ee:d4:44:d6:2e:ab:42:d6:51:16:46:c9:e8:91:3f:49:3d:ba:be:2e:04:94:bf:00:00:00:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:dd:94:f0:44:00:26:97:44:8b:16:10:46:12:a1:29:3f:27:72:c0:bd:f2:7e:7c:bf:00:00:00:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:1f:de:c5:44:6a:a1:1d:c3:e8:80:17:46:99:a5:ec:be:3d:8e:04:bf:ad:3e:7a:3e:00:00:00:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[17, 156, 182, 164, 152, 190, 64, 148, 198, 64, 144, 206, 91, 148, 198, 156, 152, 190, 160, 156, 182, 6, 160, 174, 64, 156, 182, 64, 152, 190, 93, 156, 182, 64, 160, 174, 27])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Sent NextFrame()
Sent DisplayImage(image=[22, 160, 182, 65, 156, 190, 64, 152, 198, 91, 156, 190, 156, 160, 182, 64, 6, 164, 174, 164, 160, 182, 64, 156, 190, 64, 152, 198, 91, 156, 190, 64, 160, 182, 64, 22])
Got  UnknownCommand(b0, 31:01:00:00:a9:00:03:00)
Traceback (most recent call last):
  File "display.py", line 39, in <module>
    main()
  File "display.py", line 32, in main
    time.sleep(1)
KeyboardInterrupt
  1. Launch display.py
C:\dev\cozmo\pycozmo\examples>python display.py
Sending hello...
Traceback (most recent call last):
  File "display.py", line 39, in <module>
    main()
  File "display.py", line 14, in main
    time.sleep(0.2)
KeyboardInterrupt

I have to press ctrl-C because no more lines displayed after Sending hello ...

And Cozmo 001 is displaying on Cozmo's screen ...

Laser scan

Any idea whether we can access to the laser scans?

The Cozmo SDK exports an occupancy map (I assume built internally from the laser scans), but does not mention anywhere an access to the raw scans (which would be tremendously useful for ROS integration)

About camera calibration parameters NVRAM write API usage

Saw from the doc that nvram write need to be done after a erase operation, so I tried the following code, but the write operation return the result of "NvResult.NV_BAD_ARGS", is there any incorrect usage of the API call, please help to instruct:

#!/usr/bin/env python

from threading import Event

import pycozmo
import time

e = Event()

def on_nv_storage_op_result(cli: pycozmo.client.Client, pkt: pycozmo.protocol_encoder.NvStorageOpResult):
    print(pkt.result)
    print(pkt.data)
    if pkt.result != pycozmo.protocol_encoder.NvResult.NV_MORE:
        e.set()


with pycozmo.connect(enable_animations=False, log_level="DEBUG") as cli:
    cli.add_handler(pycozmo.protocol_encoder.NvStorageOpResult, on_nv_storage_op_result)

    data = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
    pkt1 = pycozmo.protocol_encoder.NvStorageOp(
        tag=pycozmo.protocol_encoder.NvEntryTag.NVEntry_CameraCalib,
        length=1,
        op=pycozmo.protocol_encoder.NvOperation.NVOP_ERASE)
    pkt = pycozmo.protocol_encoder.NvStorageOp(
        tag=pycozmo.protocol_encoder.NvEntryTag.NVEntry_CameraCalib,
        data=data,
        length=1,
        op=pycozmo.protocol_encoder.NvOperation.NVOP_WRITE)
    cli.conn.send(pkt1)
    time.sleep(5000)
    cli.conn.send(pkt)

    e.wait(timeout=50.0)

Unsupported firmware version 10502

I've just started experimenting with the pycozmo library and am attempting to write tutorials for the purposes of using it with my middle school students.

Strangely, code that was working last week has now stopped working with a unsupported firmware version error occurring. The thing is I haven't (consciously) done anything to upgrade/change the firmware on the Cozmo. Have I missed something here? If the firmware has changed, is there a way I can downgrade to the supported version?

2019-10-31 15:08:07.360 pycozmo.general      INFO     Firmware version 10502.
2019-10-31 15:08:07.424 pycozmo.general      INFO     Body S/N 0x43225b47.
2019-10-31 15:08:07.429 pycozmo.general      ERROR    Unsupported Cozmo firmware version 10502. Only version 2381 is supported currently.
Traceback (most recent call last):
  File "C:/Users/pab/Desktop/testing.py", line 19, in <module>
    pycozmo.run_program(pycozmo_program)
  File "C:\Python37\lib\site-packages\pycozmo\run.py", line 41, in run_program
    cli.wait_for_robot()
  File "C:\Python37\lib\site-packages\pycozmo\client.py", line 150, in wait_for_robot
    raise exception.UnsupportedFirmwareVersion("Unsupported Cozmo firmware version.")
pycozmo.exception.UnsupportedFirmwareVersion: Unsupported Cozmo firmware version.

Thank you in advance.

Cozmo protocol audio format

The Cozmo mobile app stores audio files in .wem and .bnk formats. Both are Audiokinetic Wwise audio formats.

The ww2ogg tool can be used to convert .wem files to .ogg format.

The bnkextract.py tool can be used to unpack .wem files from .bnk files.

It is not exactly clear how audio from .wem files is transferred to Cozmo.

The Cozmo protocol has the OutputAudio message - https://github.com/zayfod/pycozmo/blob/master/pycozmo/protocol_declaration.py#L302

It transferes audio in 744 B chunks that seem very close to 22 kHz unsigned 8-bit PCM samples but are not.

Code is needed to stream .wem files to Cozmo using OutputAudio messages.

Testing backpack_lights.py works but display many unkown commands

C:\dev\cozmo\pycozmo\examples>python backpack_lights.py
Sending hello...
Connected!
Got  Connect()
Got  UnknownCommand(c9, 33:44:30:09:05:00)
Got  UnknownCommand(ee, 33:44:bd:01:7b:22:76:65:72:73:69:6f:6e:22:3a:20:32:33:38:31:2c:20:22:67:69:74:2d:72:65:76:22:3a:20:22:34:30:38:64:32:38:61:37:66:36:65:36:38:63:62:62:35:62:32:39:63:31:64:63:64:38:63:38:64:62:32:62:33:38:66:39:63:38:63:65:22:2c:20:22:64:61:74:65:22:3a:20:22:54:75:65:20:4a:61:6e:20:20:38:20:31:30:3a:32:37:3a:30:35:20:32:30:31:39:22:2c:20:22:74:69:6d:65:22:3a:20:31:35:34:36:39:37:32:30:32:35:2c:20:22:6d:65:73:73:61:67:65:45:6e:67:69:6e:65:54:6f:52:6f:62:6f:74:48:61:73:68:22:3a:20:22:39:65:34:61:39:36:35:61:63:65:34:65:30:39:64:38:36:39:39:37:62:38:37:62:61:31:34:32:33:35:64:35:22:2c:20:22:6d:65:73:73:61:67:65:52:6f:62:6f:74:54:6f:45:6e:67:69:6e:65:48:61:73:68:22:3a:20:22:61:32:35:39:32:34:37:66:31:36:32:33:31:64:62:34:34:30:39:35:37:32:31:35:62:61:62:61:31:32:61:62:22:2c:20:22:62:75:69:6c:64:22:3a:20:22:44:45:56:45:4c:4f:50:4d:45:4e:54:22:2c:20:22:77:69:66:69:53:69:67:22:3a:20:22:36:39:63:61:30:33:33:35:32:65:34:32:31:34:33:64:33:34:30:66:30:66:37:66:61:63:30:32:65:64:38:66:66:39:36:65:66:31:30:62:22:2c:20:22:72:74:69:70:53:69:67:22:3a:20:22:33:36:35:37:34:39:38:36:64:37:36:31:34:34:61:37:30:65:39:32:35:32:61:62:36:33:33:62:65:34:36:31:37:61:34:62:63:36:36:31:22:2c:20:22:62:6f:64:79:53:69:67:22:3a:20:22:36:39:35:62:35:39:65:66:66:34:33:36:36:34:61:63:64:31:61:35:61:39:35:36:64:30:38:63:36:38:32:62:33:66:38:62:64:32:63:38:22:7d)
Got  UnknownCommand(b0, 70:02:00:00:99:01:02:06:2e:00:00:00:3a:00:00:00:e8:00:00:00:03:00:00:00:53:00:00:00:e6:00:00:00)
Got  UnknownCommand(b0, 72:02:00:00:9b:01:02:01:08:00:00:00)
Got  UnknownCommand(b0, 5b:01:00:00:9d:01:02:01:02:00:00:00)
Got  UnknownCommand(b0, 78:02:00:00:b3:04:03:01:05:00:00:00)
Got  UnknownCommand(ec, ef:60:15:00)
Got  UnknownCommand(b0, 31:01:00:00:e4:00:02:00)
Sending enable...
Sent UnknownCommand(25, )
Sent UnknownCommand(4b, c4:b6:39:00:00:00:a0:c1)
Sent UnknownCommand(9f, )
Got  UnknownCommand(b0, 31:01:00:00:64:00:01:00)
Got  UnknownCommand(b0, 5b:01:00:00:9e:01:02:01:00:00:00:00)
Got  UnknownCommand(d1, 02:01:00)
Got  UnknownCommand(d1, 03:01:00)
Got  RobotDelocalized()
Got  UnknownCommand(b0, 43:02:00:00:8a:01:02:03:7c:7b:2d:bf:b7:fa:a3:3e:bd:ae:84:bf)
Got  UnknownCommand(b0, 31:01:00:00:1a:01:01:00)
Got  UnknownCommand(d1, 03:00:00)
Sent LightStateCenter(on_color_top=31744, off_color_top=31744, on_frames_top=0, off_frames_top=0, transmission_on_frames_top=0, transmission_off_frames_top=0, offset_top=0, on_color_middle=31744, off_color_middle=31744, on_frames_middle=0, off_frames_middle=0, transmission_on_frames_middle=0, transmission_off_frames_middle=0, offset_middle=0, on_color_bottom=31744, off_color_bottom=31744, on_frames_bottom=0, off_frames_bottom=0, transmission_on_frames_bottom=0, transmission_off_frames_bottom=0, offset_bottom=0, unknown=0)
Sent LightStateSide(on_color_left=31744, off_color_left=31744, on_frames_left=0, off_frames_left=0, transmission_on_frames_left=0, transmission_off_frames_left=0, offset_left=0, on_color_right=31744, off_color_right=31744, on_frames_right=0, off_frames_right=0, transmission_on_frames_right=0, transmission_off_frames_right=0, offset_right=0, unknown=0)
Got  UnknownCommand(d1, 02:00:00)
Got  UnknownCommand(b0, 31:01:00:00:4a:01:02:00)
Got  RobotPoked()
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:b3:b8:1c:45:e2:a7:7b:c4:25:96:11:46:df:51:d8:3e:df:8c:53:3f:ff:bc:05:3e:00:00:00:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:da:34:aa:43:ef:3d:48:c4:f6:d2:1b:46:d1:14:1e:bf:08:00:17:3f:a5:99:69:3f:00:00:00:00)
Sent LightStateCenter(on_color_top=992, off_color_top=992, on_frames_top=0, off_frames_top=0, transmission_on_frames_top=0, transmission_off_frames_top=0, offset_top=0, on_color_middle=992, off_color_middle=992, on_frames_middle=0, off_frames_middle=0, transmission_on_frames_middle=0, transmission_off_frames_middle=0, offset_middle=0, on_color_bottom=992, off_color_bottom=992, on_frames_bottom=0, off_frames_bottom=0, transmission_on_frames_bottom=0, transmission_off_frames_bottom=0, offset_bottom=0, unknown=0)
Sent LightStateSide(on_color_left=992, off_color_left=992, on_frames_left=0, off_frames_left=0, transmission_on_frames_left=0, transmission_off_frames_left=0, offset_left=0, on_color_right=992, off_color_right=992, on_frames_right=0, off_frames_right=0, transmission_on_frames_right=0, transmission_off_frames_right=0, offset_right=0, unknown=0)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:6d:48:d9:42:5a:f8:07:45:c8:6d:13:46:65:0c:cc:3d:81:f0:85:bf:d9:69:3d:3e:00:00:00:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:2d:4f:f3:44:52:b2:f4:43:e5:fc:1c:46:02:71:cd:be:0e:bb:2c:be:ee:4e:16:3f:00:00:00:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:be:02:18:45:aa:c7:18:c4:0a:c3:18:46:1c:29:92:be:a1:aa:3c:bf:9f:6c:02:3f:00:00:00:00)
Got  UnknownCommand(b0, 31:01:00:00:4a:01:02:00)
Got  RobotPoked()
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:74:21:40:45:13:68:e8:c3:63:07:14:46:d0:f2:b8:be:05:18:28:3e:6d:58:a9:3f:00:00:00:00)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:68:c0:2e:44:7c:b6:1f:43:89:e7:16:46:00:b6:45:be:fe:38:31:3f:36:53:6c:3f:00:00:00:00)
Sent LightStateCenter(on_color_top=31, off_color_top=31, on_frames_top=0, off_frames_top=0, transmission_on_frames_top=0, transmission_off_frames_top=0, offset_top=0, on_color_middle=31, off_color_middle=31, on_frames_middle=0, off_frames_middle=0, transmission_on_frames_middle=0, transmission_off_frames_middle=0, offset_middle=0, on_color_bottom=31, off_color_bottom=31, on_frames_bottom=0, off_frames_bottom=0, transmission_on_frames_bottom=0, transmission_off_frames_bottom=0, offset_bottom=0, unknown=0)
Sent LightStateSide(on_color_left=31, off_color_left=31, on_frames_left=0, off_frames_left=0, transmission_on_frames_left=0, transmission_off_frames_left=0, offset_left=0, on_color_right=31, off_color_right=31, on_frames_right=0, off_frames_right=0, transmission_on_frames_right=0, transmission_off_frames_right=0, offset_right=0, unknown=0)
Sent LightStateCenter(on_color_top=32767, off_color_top=32767, on_frames_top=0, off_frames_top=0, transmission_on_frames_top=0, transmission_off_frames_top=0, offset_top=0, on_color_middle=32767, off_color_middle=32767, on_frames_middle=0, off_frames_middle=0, transmission_on_frames_middle=0, transmission_off_frames_middle=0, offset_middle=0, on_color_bottom=32767, off_color_bottom=32767, on_frames_bottom=0, off_frames_bottom=0, transmission_on_frames_bottom=0, transmission_off_frames_bottom=0, offset_bottom=0, unknown=0)
Sent LightStateSide(on_color_left=32767, off_color_left=32767, on_frames_left=0, off_frames_left=0, transmission_on_frames_left=0, transmission_off_frames_left=0, offset_left=0, on_color_right=32767, off_color_right=32767, on_frames_right=0, off_frames_right=0, transmission_on_frames_right=0, transmission_off_frames_right=0, offset_right=0, unknown=0)
Sent LightStateCenter(on_color_top=0, off_color_top=0, on_frames_top=0, off_frames_top=0, transmission_on_frames_top=0, transmission_off_frames_top=0, offset_top=0, on_color_middle=0, off_color_middle=0, on_frames_middle=0, off_frames_middle=0, transmission_on_frames_middle=0, transmission_off_frames_middle=0, offset_middle=0, on_color_bottom=0, off_color_bottom=0, on_frames_bottom=0, off_frames_bottom=0, transmission_on_frames_bottom=0, transmission_off_frames_bottom=0, offset_bottom=0, unknown=0)
Sent LightStateSide(on_color_left=0, off_color_left=0, on_frames_left=0, off_frames_left=0, transmission_on_frames_left=0, transmission_off_frames_left=0, offset_left=0, on_color_right=0, off_color_right=0, on_frames_right=0, off_frames_right=0, transmission_on_frames_right=0, transmission_off_frames_right=0, offset_right=0, unknown=0)
Got  UnknownCommand(b0, 5c:02:00:00:70:01:01:07:ef:5e:bb:43:62:c7:9d:45:b6:1f:01:46:c8:e1:76:3c:98:34:2d:bf:91:18:54:3e:00:00:00:00)
Sent Disconnect()

C:\dev\cozmo\pycozmo\examples>

pywifi crossplatform library for connecting to Cozmo WIFI server (example)

PyCozmo can only send command to Cozmo when the computer is connected to Cozmo WIFI server ! But now there's no code to connect your application to Cozmo wifi in PyCozmo.

Then I have try to use pywifi library to connect programmatically to Cozmo wifi ! This library is crossplatform.

https://pypi.org/project/pywifi/
https://github.com/awkman/pywifi

Example working with Windows 7 and last dev PyCozmo branch :

import pywifi
from pywifi import const
import time
import pycozmo

def pycozmo_program(cli: pycozmo.client.Client):

    cli.set_head_angle(pycozmo.MAX_HEAD_ANGLE.radians)
    time.sleep(1)
    cli.set_head_angle(pycozmo.MIN_HEAD_ANGLE.radians)
    time.sleep(1)

    cli.set_lift_height(pycozmo.MAX_LIFT_HEIGHT.mm)
    time.sleep(1)
    cli.set_lift_height(pycozmo.MIN_LIFT_HEIGHT.mm)
    time.sleep(1)

wifi = pywifi.PyWiFi()

ssid_Cozmo = 'Cozmo_' # add the Cozmo number
pw_Cozmo = '' # put Cozmo WIFI password with the dashes "-" ! 


iface = wifi.interfaces()[0]

iface.disconnect()
time.sleep(1)
assert iface.status() in\
    [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]

profile = pywifi.Profile()
profile.ssid = ssid_Cozmo
profile.auth = const.AUTH_ALG_OPEN
profile.akm.append(const.AKM_TYPE_WPA2PSK)
profile.cipher = const.CIPHER_TYPE_CCMP # = AES
profile.key = pw_Cozmo

iface.remove_all_network_profiles()
tmp_profile = iface.add_network_profile(profile)

iface.connect(tmp_profile)
time.sleep(30)
assert iface.status() == const.IFACE_CONNECTED

pycozmo.run_program(pycozmo_program)

#iface.disconnect()
#time.sleep(1)
#assert iface.status() in\
#    [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]

Help: Error when trying to execute python script!

I followed the Documentation and installed with pip
(pip install pycozmo
pycozmo_resources.py download)
Then I wanted to execute some examples from the repo like the extremes.py.
But every single example only outputs something like this and nothing happens.

`C:\Users\User\Downloads\pycozmo-0.8.0.venv\Scripts\python.exe C:\Users\User\Downloads\pycozmo-0.8.0\examples\extremes.py
2024-05-07 17:34:29.104 pycozmo.protocol INFO Recv: 17B, 0F (disc.), 1F, 1P, 1P (100.00%); Sent: 0P, 0P (0.00%), 0F, 0F (disc.), 0B;
2024-05-07 17:34:29.111 pycozmo.general INFO Firmware version 10502.
2024-05-07 17:34:29.111 pycozmo.general WARNING Factory/recovery firmware detected. Functionality is degraded.
2024-05-07 17:34:29.176 pycozmo.general INFO Body S/N 0x02e2eade, HW version 5, color 3.
2024-05-07 17:34:29.677 pycozmo.robot ERROR WiFi.Update: CLAD message 0x4b size 13 doesn't match size in buffer 9
2024-05-07 17:34:29.705 pycozmo.robot ERROR WiFi.Update: CLAD message 0x37 size 17 doesn't match size in buffer 18
2024-05-07 17:34:30.728 pycozmo.robot ERROR WiFi.Update: CLAD message 0x37 size 17 doesn't match size in buffer 18
2024-05-07 17:34:31.725 pycozmo.robot ERROR WiFi.Update: CLAD message 0x36 size 17 doesn't match size in buffer 18
2024-05-07 17:34:32.758 pycozmo.robot ERROR WiFi.Update: CLAD message 0x36 size 17 doesn't match size in buffer 18
2024-05-07 17:34:34.180 pycozmo.general INFO Done.

Process finished with exit code 0

The only thing that worked is the camera.py but the error messages still appeared.
Thanks for your help in advance.

rc.py PyCozmo joystick example doesn't work with Client API

i try to use rc.py example in the inputs branch with the last dev branch of PyCozmo.
Before the new Client API , it is working ok. But now with the new Client API I have the following error :

Windows 7
Game sir G3w with USB cable.

D:\dev\Cozmo\pycozmo\20190921\examples>python rc-inputs.py
Microsoft Keyboard
Microsoft Mouse
Microsoft X-Box 360 pad
2019-09-22 02:22:35.918 root INFO Initializing...
2019-09-22 02:22:35.968 pycozmo.general INFO Firmware version 2381.
2019-09-22 02:22:36.029 pycozmo.general INFO Body S/N 0x45a0330c.
Traceback (most recent call last):
File "rc-inputs.py", line 269, in
main()
File "rc-inputs.py", line 262, in main
res = app.init()
File "rc-inputs.py", line 66, in init
self.cli.send(pkt)
AttributeError: 'Client' object has no attribute 'send'

Firmware has reverted spontaneously to v10501 !

%Run display_lines.py
2020-09-28 10:00:57.501 pycozmo.general      INFO     Firmware version 10501.
2020-09-28 10:00:57.501 pycozmo.general      WARNING  Factory/recovery firmware detected. Functionality is degraded.
2020-09-28 10:00:57.542 pycozmo.general      INFO     Body S/N 0x45a0330c, HW version 5, color 2.
2020-09-28 10:00:58.043 pycozmo.robot        ERROR    WiFi.Update: CLAD message 0x4b size 13 doesn't match size in buffer 9
2020-09-28 10:00:58.073 pycozmo.robot        ERROR    WiFi.Update: CLAD message 0x37 size 17 doesn't match size in buffer 18
2020-09-28 10:00:59.255 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.255 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.265 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.265 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.285 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.285 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.295 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.295 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.335 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.335 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.345 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.345 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.365 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.365 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.375 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.375 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.395 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.395 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
2020-09-28 10:00:59.405 pycozmo.general      ERROR    sendto() failed. [WinError 10035] Une opération non bloquante sur un socket n’a pas pu être achevée immédiatement
...

How to reproduce ?
I don't know but I don't launch at all tools to play with safe file and write in the Cozmo memory like pycozmo_update.py.

How to revert to last firmware ?
Can I use securely pycozmo_update.py or use the mobile app to update to last firmware ?

Big wave file : https://s161.convertio.me/p/skU_zTqKa9kZua4BSt75RA/b921c364ad76a802e226ac4c7878cf86/princetv.wav

How to stream cozmos camera

@zayfod hi there, I carnt figure out how to get a stream of cozmos camera I've tried all demos. Could someone please tell me if it's possible and if so how.
Many thanks

Typo in functions.md 8-bit instead 16-bit

In the documentation , you can find the sentence :

Speaker
The OutputAudio message can be used to transmit 744 audio samples at a time. The samples are 8-bit and u-law encoded.

must be replaced by

The OutputAudio message can be used to transmit 744 audio samples at a time. The samples are 16-bit and u-law encoded.

Even 8-bit wave files could be played , they are not supported now. Only 16-bit,22.05 Khz or 48 Khz mono are supported now. If these conditions are not fullfilled : an error is displayed
ValueError: Invalid audio format, only 16 bit samples are supported, with 22050Hz or 48000Hz frame rates.

In the script example audio.py , there's no error ; 16-bit is mentionned in the comment.

Ethernet and WiFi at the same time

Odd question, but if I hooked my laptop (Windows 11) up to ethernet, but also connected to Cozmo's WiFi, would that still allow me to control Cozmo (while maintaining internet access through my ethernet connection)?

Cozmo App doesn't connect to pycozmo server

Title says it all. And yes i modified Cozmos app to connect to my PC instead of cozmo (well... i don't even have a cozmo lol).

The engine sends "COZ\x03RE\x01" but the pycozmo server doesn't respond to it for some reason...?

Edit: If someone wants it, I can give pcap file from my phone.

ImportError: cannot import name 'Type' on dev branch 0.4.0

Configuration :
Python 3.5.1
pycozmo 0.4.0 dev
Windows 7
Cozmo Classic with backpack Button

D:\dev\Cozmo\pycozmo\examples>python backpack_lights.py
Traceback (most recent call last):
File "backpack_lights.py", line 5, in
import pycozmo
File "C:\Python35\lib\site-packages\pycozmo-0.4.0-py3.5.egg\pycozmo_init_.p
y", line 5, in
from .run import *
File "C:\Python35\lib\site-packages\pycozmo-0.4.0-py3.5.egg\pycozmo\run.py", l
ine 8, in
from . import client
File "C:\Python35\lib\site-packages\pycozmo-0.4.0-py3.5.egg\pycozmo\client.py"
, line 16, in
from .frame import Frame
File "C:\Python35\lib\site-packages\pycozmo-0.4.0-py3.5.egg\pycozmo\frame.py",
line 4, in
from .protocol_declaration import FRAME_ID, MIN_FRAME_SIZE, FrameType, Packe
tType
File "C:\Python35\lib\site-packages\pycozmo-0.4.0-py3.5.egg\pycozmo\protocol_d
eclaration.py", line 7, in
from .protocol_ast import *
File "C:\Python35\lib\site-packages\pycozmo-0.4.0-py3.5.egg\pycozmo\protocol_a
st.py", line 9, in
from typing import List, Optional, Union, Type
ImportError: cannot import name 'Type'

D:\dev\Cozmo\pycozmo\examples>

Procedural face rendering

Cozmo .bin FlatBuffers animation files describe Cozmo face images procedurally. Each face image is described with a structure in the following format:

table ProceduralFace {

The left and the right eye are described with 19 coefficients each.

Code that can interpret procedural face descriptions is needed. It should take pycozmo.CozmoAnim.ProceduralFace object as input and should generate a 128x32 PIL image as output.

The following presentation from Anki provides some background information: https://www.gdcvault.com/play/1024488/Cozmo-Animation-Pipeline-for-a

Question: get info/parameters from Cozmo (camera for example) ?

Hello everyone,

is it possible to get some parameters from the robot ?
For example, I have read in the doc that one can set the aperture, gain and autogain for the camera using protocol_encoder.SetCameraParams. But is there a way to read this parameters from Cozmo ? A GetCameraParams ?

Initial face controller module

PyCozmo provides low-level support for:

  • generating procedural face images
  • visualizing images on Cozmo's display

The above allow extending the PyCozmo Client class with a new "face controller" module. This module, when enabled, should take care to visualize an animated face on Cozmo's display while the Client is connected.

Initially, the face controller should support displaying basic eyes and blinking.

Later the face controller can be extended to react with various inputs from Cozmo, end eventually an "emotion engine".

Line follower example

A new example is needed that will turn the Cozmo robot into a line-follower, similar to Ozobot .

The example should use OpenCV for line detection from real-time robot camera images that come at 14 FPS.

ROS driver

People have integrated Cozmo with ROS using the official Cozmo SDK. It will be really convenient to get a Python ROS driver, based on PyCozmo though.

At a minimum, such a driver should make accessible:

  • motor control
  • odometers
  • accelerometers and gyros
  • the camera

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.