Create Remote Project   
   

Create Remote Project Quick Links


Introduction


Download

Project files

To communicate with the robot we use an adapted version of a high-level Python interface called PyRobot.
PyRobot belongs to Damon Kohler and it's an open source code under license of MIT.
Download all the project files here.

Files required for execution

Optional files

  • We use AToM3 to design the Statecharts that define our robot's behavior.
    You can download it here (you'll find all the information about it there too).
    [The Statecharts are compiled using SCC (StateChart Compiler) by Thomas Feng]

  • In case you're using the BlueSoleil Bluetooth dongle under Windows you will need their software. Download it here.

Setup

Step 1: installing what we need

Install Python, PySerial and PyWin32.

Step 2: the project files

The project consists of the following main files (that you will find inside the zipped file):
  • CreateRemote.py: This is the project's main executable file, where the main loop is defined, along with the project's Tkinter instance.

  • CreateRemote_GUI.py: We've defined several classes in this file:

    • CreateRemoteGUI.

    • CreateRemote_Controller.

    • CreateRemote_Static.

    • CreateRemote_Dynamic.

    The project interface's button events are defined in the CreateRemote_Controller class. We'll cover these in further sections.

  • pyrobot.py: This is our pyrobot adapted version. We have developed our own functions for obtaining the data from the sensors, and some other iRobot Open Interface functions, such as PlaySong.

  • CreateRemoteStatechart.py: This is the file we obtain from compiling our Statecharts file into Python. We've obviously defined and compiled our Statecharts using AToM3. You can easily define your own behaviour Statecharts, compile them, and then try them on iRobot Create (along with the previously mentioned project files).

Step 3: the graphic user interface

The iRobot Create remote has been adapted from the original Roomba robot remote, we've simply redefined the buttons.


  • Raises button event playSongPressed, which sends the event playSong to the statechart.

  • Raises button event stopPressed, which sends the event stop to the statechart.

  • Raises button event changeSpeed, which sends the event changeSpeed to the statechart.

  • Raises button event sensorsPressed.

The arrow buttons are defined as follows:
  • LEFT. Raises button event turnLeftPressed, which sends the event turnLeft to the statechart.

  • RIGHT. Raises button event turnRightPressed, which sends the event turnRight to the statechart.

  • FORWARD. Raises button event moveForwardPressed, which sends the event moveForward to the statechart.

The button events can be redefined by modifying the CreateRemote_Controller class.

Step 4: Statecharts defined behaviour examples

Here are some robot's behaviour Statecharts that we've defined.
  • CreateRemoteStatechart 1



    This statechart defines a very simple behaviour:

    • Default state is stopped.

    • The robot will be either stopped, movingForward, turningLeft or turningRight.

    • Whenever the changeSpeed event is received, the statechart will transfer to its changingSpeed state, and then return to its default state, thus stopping the robot.

    The remote buttons perform the following actions:

    • Not used (the event playSong is ignored in the statechart.

    • The robot will stop performing any kind of movement it was performing (driving forward, driving backwards, or turning). When stopped, the robot's speed is reset to 100.

    • The robot will increase its current speed in 100; when it reaches 500, the speed will be reset to 100.

    • Calls pyrobot function RequestAndPrintSensorData, which requests all sensor data from the robot and prints it on the console window.

  • CreateRemoteStatechart 2



    This statechart defines the following behaviour:

    • Default state is composite state movement.

    • The robot will be either stopped, movingForward, turningLeft or turningRight.

    • Whenever the changeSpeed event is received, the statechart will transfer to its changingSpeed state, and then return to its default state, thus stopping the robot.

    The remote buttons perform the following actions:

    • The robot will play the song that's been previously loaded (The Imperial March).

    • The robot will stop performing any kind of movement it was performing (driving forward, driving backwards, or turning). When stopped, the robot's speed is reset to 100.

    • The robot will increase its current speed in 100; when it reaches 500, the speed will be reset to 100.

    • Calls pyrobot function RequestAndPrintSensorData, which requests all sensor data from the robot and prints it on the console window.

  • CreateRemoteStatechart 3




  • CreateRemoteStatechart 4





Documentation

Maintained by Silvia Mur Blanch. Last Modified: 2009/02/16 23:18:45.