151 lines (88 sloc) 6.53 KB

Getting Started With the Cozmo SDK

To make sure you get the best experience possible out of the SDK, please ensure you have followed the steps in the :doc:`Initial Setup </initial>`.

Cozmo SDK Forums

Please visit our Cozmo SDK Forums where you can:

  • Get assistance with your code
  • Hear about upcoming SDK additions
  • Share your work
  • Join discussion about the SDK
  • Be a part of the Cozmo SDK Community!

Starting Up the SDK

  1. Plug the mobile device containing the Cozmo app into your computer.
  2. Open the Cozmo app on the phone. Make sure Cozmo is on and connected to the app via WiFi.
  3. Tap on the gear icon at the top right corner to open the Settings menu.
  4. Swipe left to show the Cozmo SDK option and tap the Enable SDK button.
  5. Make sure the SDK examples are downloaded from the :doc:`Downloads page </downloads>`.
  6. On the computer, open Terminal (macOS/Linux) or Command Prompt (Windows) and type cd cozmo_sdk_examples, where cozmo_sdk_examples is the directory you extracted the examples into, and press Enter.

Example Programs

Walkthrough Video

For your convenience, here is a video detailing the first few simple example programs. You can also find a simple text-based walkthrough of running your first program below.

First Steps - "Hello, World!"

Let's test your new setup by running a very simple program. This program instructs Cozmo to say "Hello, World!" - a perfect way to introduce him and you to the world of programming.

The Program

  1. To run the program, using the same Terminal (macOS/Linux) / Command Prompt (Windows) window mentioned above:

First, change to the 01_basics sub-directory of the tutorials directory.

  1. For macOS and Linux systems, type the following and press Enter:

    cd tutorials/01_basics
  2. For Windows systems, type the following and press Enter:

    cd tutorials\01_basics

Then, run the program.

  1. For macOS and Linux systems, type the following and press Enter:


The same can also be achieved on macOS/Linux with:

  1. For Windows systems, type the following and press Enter:

  1. If done correctly, Cozmo will say "Hello, World!"


If Cozmo does not perform as expected, look at the first Terminal window and make sure no error messages appeared. If you continue to have issues, please seek help in the Forums.

The code for the Hello World program can be viewed here.


The usbmuxd (USB Multiplexor Daemon) must be installed on any computer system paired with an iOS device before running any programs. Installing iTunes will also install the usbmuxd on those systems. Linux users can install the usbmuxd module through the command line with sudo apt-get install usbmuxd.


Make sure adb (Android Debug Bridge) is installed on your system prior to running a program with an Android device. See the :ref:`Install page <initial>` for instructions.

You are now all set up to run Python programs on Cozmo. Next we will go over how to edit the above code to make Cozmo say something new. Let's write our first program.

Next Steps - "Night-Night"

  1. Copy to a new file named by doing the following:

    1. For macOS and Linux systems, type the following and press Enter:

    2. For Windows systems, type the following and press Enter:


Now, is saved in the same folder as

  1. Open this new document in a source code editor or plain-text editor. Free source code editors, such as PyCharm Community Edition , Atom , Sublime , or TextWrangler can be found online. Anki does not provide tech support for third-party source code editors.

  2. Each line in the program relates to a specific function.

    1. import cozmo allows your program to access the Cozmo SDK code contained within the cozmo module.

    2. Text sandwiched between three ' marks is a Docstring. Docstrings are like comments, and are placed inside code to give information to the user.

    3. robot.say_text("Hello, World!").wait_for_completed() is the core of the program:

      1. robot.say_text(…) is the function that makes Cozmo speak a string out loud.
      2. "Hello World" is the string which Cozmo will speak.
      3. wait_for_completed() tells Cozmo to finish speaking before moving to the next line of code. Without this, our program would end before Cozmo said anything!
  3. Move to the line that starts with "robot.say_text"

    1. Select the phrase "Hello World". Do NOT select the parentheses or quotation marks around the phrase; those are necessary for Python to properly parse the command.
    2. Type in the new phrase you would like Cozmo to say. In this example, Cozmo will say "Night Night", so that line should look like this: robot.say_text("Night Night").wait_for_completed()
  4. Save the file.

  5. Now you can run your program:

    1. For macOS and Linux systems, type the following into the same Terminal window and press Enter:

    2. For Windows systems, type the following into the same Command Prompt window and press Enter:

  6. If done correctly, Cozmo will say the new phrase.

Now that you have written your own Cozmo program, take a look at the rest of the Cozmo SDK and at the many other example programs to get more ideas.

Terms and Conditions and Privacy Policy

Click here to return to the Anki Developer website.