simple_cli tool

Dave Touretzky edited this page Jan 12, 2017 · 13 revisions

simple_cli is a simple Command Line Interface (CLI) that allows you to evaluate Python expressions while maintaining an active connection to a robot. The CLI prompt string is "C> ".

simple_cli provides command line editing and history similar to the regular Python CLI, but it cannot fully replicate the functionality of the regular Python CLI. In particular, it cannot evaluate def or class statements; these give a syntax error.

Invoking simple_cli

  • From the shell, type "simple_cli" to start Python and connect to the robot. Note: cozmo-tools must be on your search path.
  • Type "simple_cli VIEWER" to start the SDK's camera viewer (tkviewer) along with the robot connection.

simple_cli Commands

Quit all running activities (e.g., world viewer) and exit simple_cli.
^C (control-C)
Interrupt any executing expression, and also stop the currently running state machine, if any.
monitor(robot, event=None)
Monitor all SDK events in the dispatch table, or a specific type of SDK Event.
unmonitor(robot, event=None)
Turn off monitoring of a specific SDK event type, or all events.
Start a 3D real-time model of the World around Cozmo. See the world_viewer tool for a list of commands.
Import or reload a state machine module and run the state machine. The state machine class name must match the module name.)
show arg
Display information about the currently running state machine. Currently supported commands are:
show active - displays the current active nodes and transitions.
Sets the FSM trace level, from 0 (no tracing) to 9 (maximum information). With no argument, tracefsm() returns the current trace level.
0 : No tracing.
1 : State node start.
2 : State node start and stop.
3 : Transition firing.
4 : Transition start and stop.
5 : Event listener invocation.
6 : Polling of state nodes or transitions.
7 : Await satisfied.
8 : Event posting.
9 : Task cancellation.
Execute cmd in the shell and print the results.

Special Variables

simple_cli provides several variables for user convenience.

  • SDK objects: robot, world, charger, light_cubes, cube1, cube2, cube3.
  • The variable ans is set to the result of evaluating the last expression.
  • The variable running_fsm is set to the currently running state machine instantiated by runfsm.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.