{"id":15017248,"url":"https://github.com/zayfod/pycozmo","last_synced_at":"2025-04-06T03:06:44.570Z","repository":{"id":35064857,"uuid":"202257498","full_name":"zayfod/pycozmo","owner":"zayfod","description":"A pure-Python communication library, alternative SDK, and application for the Cozmo robot.","archived":false,"fork":false,"pushed_at":"2022-08-03T19:10:21.000Z","size":957,"stargazers_count":187,"open_issues_count":19,"forks_count":64,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-03-30T02:05:51.865Z","etag":null,"topics":["anki","anki-cozmo","cozmo","cozmo-sdk","ddl","digitial-dream-labs","robot","robotics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zayfod.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["zayfod"]}},"created_at":"2019-08-14T02:21:42.000Z","updated_at":"2025-03-29T14:30:25.000Z","dependencies_parsed_at":"2022-08-09T04:31:04.055Z","dependency_job_id":null,"html_url":"https://github.com/zayfod/pycozmo","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zayfod%2Fpycozmo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zayfod%2Fpycozmo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zayfod%2Fpycozmo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zayfod%2Fpycozmo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zayfod","download_url":"https://codeload.github.com/zayfod/pycozmo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anki","anki-cozmo","cozmo","cozmo-sdk","ddl","digitial-dream-labs","robot","robotics"],"created_at":"2024-09-24T19:50:07.412Z","updated_at":"2025-04-06T03:06:44.547Z","avatar_url":"https://github.com/zayfod.png","language":"Python","funding_links":["https://github.com/sponsors/zayfod"],"categories":["Awesome Tools"],"sub_categories":["Languages"],"readme":"\nPyCozmo\n=======\n\n`PyCozmo` is a pure-Python communication library, alternative SDK, and application for the\n[Cozmo robot](https://www.digitaldreamlabs.com/pages/cozmo) . It allows controlling a Cozmo robot directly, without\nhaving to go through a mobile device, running the Cozmo app.\n\nThe library is loosely based on the [Anki Cozmo Python SDK](https://github.com/anki/cozmo-python-sdk) and the\n[cozmoclad](https://pypi.org/project/cozmoclad/) (\"C-Like Abstract Data\") library.\n\nThis project is a tool for exploring the hardware and software of the Digital Dream Labs (originally Anki) Cozmo robot.\nIt is unstable and heavily under development.\n\n\nUsage\n-----\n\nBasic:\n\n```python\nimport time\nimport pycozmo\n\nwith pycozmo.connect() as cli:\n    cli.set_head_angle(angle=0.6)\n    time.sleep(1)\n```\n\nAdvanced:\n\n```python\nimport pycozmo\n\ncli = pycozmo.Client()\ncli.start()\ncli.connect()\ncli.wait_for_robot()\n\ncli.drive_wheels(lwheel_speed=50.0, rwheel_speed=50.0, duration=2.0)\n\ncli.disconnect()\ncli.stop()\n```\n\n\nDocumentation\n-------------\n\n[https://pycozmo.readthedocs.io/](https://pycozmo.readthedocs.io/)\n\n\nRobot Support\n-------------\n\nSensors:\n- [x] Camera\n- [x] Cliff sensor\n- [x] Accelerometers\n- [x] Gyro\n- [x] Battery voltage\n- [x] Cube battery voltage\n- [x] Cube accelerometers\n- [x] Backpack button (v1.5 hardware and newer)\n\nActuators:\n- [x] Wheel motors\n- [x] Head motor\n- [x] Lift motor\n- [x] OLED display\n- [x] Speaker\n- [x] Backpack LEDs\n- [x] IR LED\n- [x] Cube LEDs\n- [x] Platform LEDs (when available)\n\nOn-board functions (see [docs/functions.md](docs/functions.md) for details:\n- [x] Wi-Fi AP\n- [x] Bluetooth LE\n- [x] Localization\n- [x] Path tracking\n- [x] NV RAM storage\n- [x] Over-the-air (OTA) firmware updates\n\nOff-board functions (see [docs/offboard_functions.md](docs/offboard_functions.md) for details:\n- [x] Procedural face generation\n- [x] Cozmo animations from FlatBuffers .bin files\n- [ ] Personality engine - work in progress\n- [ ] Cozmo behaviors - work in progress\n- [ ] Motion detection\n- [ ] Object (cube and platform) detection\n- [ ] Cube marker recognition\n- [ ] Face detection\n- [ ] Face recognition\n- [ ] Facial expression estimation\n- [ ] Pet detection\n- [ ] Camera calibration\n- [ ] Navigation map building\n- [ ] Text-to-speech\n- [ ] Songs\n\nExtra off-board functions:\n- [ ] Vector animations from FlatBuffers .bin files\n- [ ] Vector behaviors\n- [ ] ArUco marker recognition\n- [ ] Cozmo and Vector robot detection\n- [ ] Drivable area estimation\n- [ ] Voice commands\n\nIf you have ideas for other functionality [share them via GitHub](https://github.com/zayfod/pycozmo/issues).\n\n\nTools\n-----\n\n- [pycozmo_app.py](tools/pycozmo_app.py) - an alternative Cozmo application, implementing off-board functions\n    ([video](https://youtu.be/gMEc6RzIm-E)).\n- [pycozmo_dump.py](tools/pycozmo_dump.py) - a command-line application that can read and annotate Cozmo communication\n    from [pcap files](https://en.wikipedia.org/wiki/Pcap) or capture it live using\n    [pypcap](https://github.com/pynetwork/pypcap).\n- [pycozmo_replay.py](tools/pycozmo_replay.py) - a basic command-line application that can replay .pcap files back to\n    Cozmo.\n- [pycozmo_anim.py](tools/pycozmo_anim.py) - a tool for examining and manipulating animation files.\n- [pycozmo_update.py](tools/pycozmo_update.py) - a tool for over-the-air (OTA) updates of Cozmo's firmware.\n- [pycozmo_protocol_generator.py](tools/pycozmo_protocol_generator.py) - a tool for generating Cozmo protocol encoder\n    code.\n\n**Note**: PyCozmo and `pycozmo_protocol_generator.py` in particular could be used as a base for creating a Cozmo protocol\nencoder code generator for languages other than Python (C/C++, Java, etc.).\n \n\nExamples\n--------\n\nBasic:\n- [minimal.py](examples/minimal.py) - minimal code to communicate with Cozmo, using PyCozmo\n- [extremes.py](examples/extremes.py) - demonstrates Cozmo lift and head control\n- [backpack_lights.py](examples/backpack_lights.py) - demonstrates Cozmo backpack LED control\n- [display_image.py](examples/display_image.py) - demonstrates visualization of image files on Cozmo's display\n- [events.py](examples/events.py) - demonstrates event handling\n- [camera.py](examples/camera.py) - demonstrates capturing a camera image \n- [go_to_pose.py](examples/go_to_pose.py) - demonstrates moving to a specific pose (position and orientation) \n- [path.py](examples/path.py) - demonstrates following a predefined path\n\nAdvanced:\n- [display_lines.py](examples/display_lines.py) - demonstrates 2D graphics, using\n    [PIL.ImageDraw](https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html) on Cozmo's display\n    ([video](https://youtu.be/ZT81PlmItrU))\n- [rc.py](examples/rc.py) - turns Cozmo into an RC tank that can be driven with an XBox 360 Wireless controller or \n    Logitech Gamepad F310\n- [video.py](examples/video.py) - demonstrates visualizing video captured from the camera back on display\n- [cube_lights.py](examples/cube_lights.py) - demonstrates cube connection and LED control\n- [cube_light_animation.py](examples/cube_light_animation.py) - demonstrates cube LED animation control\n- [charger_lights.py](examples/charger_lights.py) - demonstrates Cozmo charging platform LED control\n- [audio.py](examples/audio.py) - demonstrates 22 kHz, 16-bit, mono WAVE file playback through Cozmo's speaker \n- [nvram.py](examples/nvram.py) - demonstrates reading data from Cozmo's NVRAM (non-volatile memory)\n- [procedural_face.py](examples/procedural_face.py) - demonstrates drawing a procedural face on Cozmo's display\n- [procedural_face_show.py](examples/procedural_face_show.py) - demonstrates generating a procedural face\n- [procedural_face_expressions.py](examples/procedural_face_expressions.py) - demonstrates displaying various facial\n    expressions ([video](https://youtu.be/UyMTEOG2FyU))\n- [anim.py](examples/anim.py) - demonstrates animating Cozmo\n\n\nPyCozmo In The Wild\n-------------------\n\n- [Expressive Eyes](https://git.brl.ac.uk/ca2-chambers/expressive-eyes) - rendering various facial expressions using\n    PyCozmo's procedural_face module\n- an [application](https://github.com/paulbaumgarten/paulbaumgarten/blob/6d9025ec715e0b5f133ce9b7e39e74a5389c5334/myp/cozmo/assets/02-camera.py)\n    that recognizes [ArUco markers](https://docs.opencv.org/master/d5/dae/tutorial_aruco_detection.html), using OpenCV\n- a [ROS2 driver](https://github.com/solosito/cozmo_ros2_ws/)\n- another [ROS2 driver](https://github.com/brean/cozmo_ros)\n\n\nConnecting to Cozmo over Wi-Fi\n------------------------------\n\nA Wi-Fi connection needs to be established with Cozmo before using PyCozmo applications.\n\n1. Wake up Cozmo by placing it on the charging platform\n2. Make Cozmo display it's Wi-Fi PSK by rising and lowering its lift\n3. Scan for Cozmo's Wi-Fi SSID (depends on the OS)\n4. Connect using Cozmo's Wi-Fi PSK (depends on the OS)\n\n[This video](https://www.youtube.com/watch?v=-k_oiQhBa5o) summarizes the connection process.\n\n\nPyCozmo vs. the Cozmo SDK\n-------------------------\n\nA Cozmo SDK application (aka \"game\") acts as a client to the Cozmo app (aka \"engine\") that runs on a mobile device.\nThe low-level communication happens over USB and is handled by the `cozmoclad` library.\n\nIn contrast, an application using PyCozmo basically replaces the Cozmo app and acts as the \"engine\". PyCozmo handles\nthe low-level UDP communication with Cozmo.\n   \n```\n+------------------+                   +------------------+                   +------------------+\n|     SDK app      |     Cozmo SDK     |    Cozmo app     |       Cozmo       |      Cozmo       |\n|      \"game\"      |     cozmoclad     |     \"engine\"     |      protocol     |     \"robot\"      |\n|                  | ----------------\u003e |   Wi-Fi client   | ----------------\u003e |     Wi-Fi AP     |\n|                  |        USB        |    UDP client    |     UDP/Wi-Fi     |    UDP Server    |\n+------------------+                   +------------------+                   +------------------+\n```\n\n\nRequirements\n------------\n\n- [Python](https://www.python.org/downloads/) 3.6.0 or newer\n- [Pillow](https://github.com/python-pillow/Pillow) 6.0.0 - Python image library\n- [FlatBuffers](https://github.com/google/flatbuffers) - serialization library\n- [dpkt](https://github.com/kbandla/dpkt) - TCP/IP packet parsing library \n\n\nInstallation\n------------\n\nUsing pip:\n\n```\npip install --user pycozmo\n\npycozmo_resources.py download\n```\n\nFrom source:\n\n```\ngit clone https://github.com/zayfod/pycozmo.git\ncd pycozmo\npython setup.py install --user\n\npycozmo_resources.py download\n```\n\nFrom source, for development:\n\n```\ngit clone git@github.com:zayfod/pycozmo.git\ncd pycozmo\npython setup.py develop --user\npip install --user -r requirements-dev.txt\n\npycozmo_resources.py download\n```\n\n \nSupport\n-------\n\nBug reports and changes should be sent via GitHub:\n\n[https://github.com/zayfod/pycozmo](https://github.com/zayfod/pycozmo)\n\nDDL Robot Discord server, channel #development-cozmo:\n\n[https://discord.gg/ew92haS](https://discord.gg/ew92haS)\n\n\nDisclaimer\n----------\n\nThis project is not affiliated with [Digital Dream Labs](https://www.digitaldreamlabs.com/) or\n[Anki](https://anki.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzayfod%2Fpycozmo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzayfod%2Fpycozmo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzayfod%2Fpycozmo/lists"}