cozmo.run
The run module contains helper classes and functions for opening a connection to the engine.
To get started, the run_program()
function can be used for most cases,
it handles connecting to a device and then running the function you provide with
the SDK-provided Robot object passed in.
The connect()
function can be used to open a connection
and run your own code connected to a cozmo.conn.CozmoConnection
instance. It takes care of setting up an event loop, finding the Android or
iOS device running the Cozmo app and making sure the connection is ok.
You can also use the connect_with_tkviewer()
or connect_with_3dviewer()
functions which works in a similar way to connect()
, but will also display
either a a window on the screen showing a view from Cozmo’s camera (using Tk), or
a 3d viewer (with optional 2nd window showing Cozmo’s camera) (using OpenGL), if
supported on your system.
Finally, more advanced progarms can integrate the SDK with an existing event
loop by using the connect_on_loop()
function.
All of these functions make use of a DeviceConnector
subclass to
deal with actually connecting to an Android or iOS device. There shouldn’t
normally be a need to modify them or write your own.
Module Attributes
|
The TCP port number we expect the Cozmo app to be listening on. |
Functions
|
Connects to the Cozmo Engine on the mobile device and supplies the connection to a function. |
|
Uses the supplied event loop to connect to a device. |
|
Setup a connection to a device and run a user function while displaying Cozmo's 3d world. |
|
Setup a connection to a device and run a user function while displaying Cozmo's camera. |
|
Connect to Cozmo and run the provided program/function f. |
|
Helper to perform basic setup of the Python logging machinery. |
Classes
|
Connects to an attached Android device over USB. |
|
Base class for objects that setup the physical connection to a device. |
|
Connects to the first Android or iOS device running the Cozmo app in SDK mode. |
|
Connects to an attached iOS device over USB. |
|
Connects to the Cozmo app directly via TCP. |