Quickstart¶
Eager to get started? This page gives a good introduction. It assumes you already have the library installed. If you do not, head over to the Installation section.
A Minimal Application (The Standard way)¶
A minimal application looks something like this:
"""
Makes cozmo saying "hello world"
"""
from easy_cozmo import *
def cozmo_program():
say("Hello world")
run_program_with_viewer(cozmo_program)
So what did that code do?
- First we imported the library.
- Next we define a function that will represent our script.
- Inside the function we use the
say()make Cozmo saying “hello”. - Lastly, in the main part of the file, we use the
run_program_with_viewer()passing our function as argument to execute our script.
Just save it as hello.py or something similar.
To run the application you can either use the python command or run it inside your IDE. .. Before you can do that probably need to our the mindcraft_treasure_hunt_with_cozmo folder to your PYTHONPATH.
A Minimal Application (Using PyCozmo)¶
A minimal application using the PyCozmo tool looks something like this:
"""
Makes cozmo saying "hello world"
"""
say("Hello world")
So what did that code do?
We use the say() make Cozmo saying “hello”.
Note that we didn’t even have to import the library. This is because we run our code with the pycozmo.py tool that takes care of all that.
Just save it as hello.py or something similar and run it like this:
pycozmo.py hello.py