Myro on .NET (Including Mono)

Myro is the name of the software created by the Institute for Person Robots in Education (IPRE) that runs the Scribbler and Fluke hardware. Myro currently exists as a prototype written in CPython, the original version of Python written in the C programming language. This version of Myro will be referred to as Myro-Pilot. Our goal is to implement a new application programming interface (API) in .NET and Mono (an open source, cross-platform implementation of .NET). This new version of Myro will be called Myro3.

This document defines the API, philosophy, and the implementation of Myro3 and serves as the design document for this development.

The most up to date information on this development is now located at PyjamaDevelopment.

The Myro-pilot uses the language Python and editor/environment IDLE that comes as a standard package with CPython, the standard Python product. Myro-Pilot is implemented as a Python module. It talks to robots through a serial connection over Bluetooth. The current implementation works on Linux, Mac, Windows XP and Vista. Myro-Pilot is licensed under an open source license. All of the functionality from Myro-Pilot will need to be replicated in Myro3. We will call the editor/evaluator portion of Myro3 "Pyjama".

At the lowest level, Myro is designed to talk to robots. However, in order to provided all of the functionality needed in the classroom, Myro also needs to manipulate graphics and audio on the host computer. These are the core Myro functionalities. Myro-Pilot also supports a number of peripheral functions. For example, Myro-Pilot uses Instant Messaging (IM) to communicate to other robots, and to a web server, called My Web. To provide this functionality, Myro-Pilot currently has the following dependencies:

These dependencies will have to be rewritten or replaced with .NET/Mono alternatives. Initially we will support just IronPython, an implementation of CPython in .NET. However, other .NET languages are possible and we will design for this possibility through a language plugin (described below). It is hoped that Myro could be used as a replacement for Mark Guzdial'sMediacomp and John Zelle's OOP Graphics primitives (supporting all sound and graphics functionality).

One of important aspects of Myro3 is that it will provide a path to Microsoft Robotics Studio, both directly through code, and as a route for students to explore.

Mono and IronPython

IronPython is being written by Microsoft for .NET. It is not designed to run in Mono; however, the Mono group has used IronPython extensively to test (and fix) the Mono implementation of .NET and now fully supports and runs IronPython. There are a few issues in making IronPython run in a cross-platform manner in Mono, and thus a IronPython Community Edition (IPCE) has been created. IPCE patches IronPython (afterwards called FePy) and includes all of the compatible CPython libraries, which IronPython does not.

Some help on using IronPython can be found at IronPython on this wiki.

You can use the Mono binaries found here. We will be refering to Mono version 1.9 (or higher) in this document. You may wish to install gtk-sharp2-devel gtksourceview2 and gnome-sharp-devel.

Pyjama

Pyjama is the name of the editor/evaluator portion of Myro3. It is a editor/evaluator system designed for pedagogy. Three projects capture the simplicity of the philosophy: DrPython, IDLE and JES; however, the two-pane approach to a simplified, classroom-oriented IDE goes back many years and through many projects. Examples of this design include: DrScheme (see wikipedia), and DrJava (see main page).

DrPython (screenshot) may in fact be closest to our layout goals for Pyjama. However, it can still be too complex by offering too many options for beginning students. One the other hand, DrPython is very simplistic and has no real connection between the editor and evaluator. IDLE's simplicity and integration is a better target for functional requirements.

IDLE

Error creating thumbnail: /bin/bash: /usr/bin/convert: No such file or directory

Error code: 127

IDLE Screens

IDLE is an editor/evaluator written in Python using the Tk graphics library. It is split into two processes: the editor and the evaluator. This was largely necessary because many users would like to edit and run Tk+Python code. Because the editor uses a Tk graphics loop, this was necessary to keep the user's Tk graphics loop separate.

Pyjama Functionality

Pyjama is planned to be written in C#, run in .NET and Mono (for cross-platform functionality), and written to use the gtk# graphics toolkit.

Additionally, it is hoped that Pyjama can provide a debugger with scripting-language-level stepping, and related support. It is unknown if the the DLR (or IronPython) can provide this level of support.

Ideally, our Python interface would be able to be used outside of Pyjama. For example:

However, our first priority is to make it work in Pyjama. It may be that we need to handle the IronPython environment or the OS environment (for example starting/stopiing MSRS services, and sending the stop signal to the robot) that cannot be done in IronPython alone, and so Pyjama may be the required interface for easy use. This issue may also be relevant in discussing the graphics. For example, it may be required to run Myro in Pyjama to handle the graphics thread.

On Windows you have to change the file $prefix/etc/mono/config from
<dllmap dll="libintl" target="libc.so.6" />
to <dllmap dll="libintl" target="intl" />

DLR Hosting

Pyjama will provide IronPython (and other languages) via hosting. In fact, Pyjama is designed for multiple-language hosting through the Dynamic Language Runtime (DLR). IronPython is still under development and the hosting interface has continued to evolve. A recent example of hosting IronPython version 2 can be found in the IronPython cookbook entry Hosting IronPython 2. See also examples on the IronPython page here.

Pedagogical Connections

Pyjama should provide educators with support for doing a variety of tasks, including assessment and evaluation of teaching methods.

classroom support

allow student/teacher interaction in the classroom (perhaps ideas similar to those in Richard Anderson's Classroom Presenter)

be able to use IDE for demos in class

large font size

important text (code, or shell) in top or middle of screen

(projectors make it hard to see at the bottom)

suggests tabbed pages, or top/bottom switch

Assessment

Consider instrumentation in other teaching platforms such as the results published in ICER.

We should make any data submission be optional, friendly, and easy. This could form the basis for more scalable assessment.

Myro-pilot supports functionality at the Python level to dynamically change function and method names. For example, the function to retrieve a robot's name can be getName() or get_name(). This may be important in the adoption of Myro at some locations. It is not known if other DLR languages support such flexibility. This is possible in Python (and IronPython) as function and method names are just entries in a dictionary/hash table.

The scripting languages (Ruby, Python, VB, JScript, etc.) extend the C# interfaces. The C# interfaces provide a connection to the MSRS path and the direct-connection path (both described below).

Myro (and any other software) can talk directly to the Scribbler, the Fluke, and the Roomba/Create. The Fluke is the IPRE hardware dongle that plugs directly into a serial port (like that on the Scribbler) and provides Bluetooth, a camera, and IR sensors.

The bytecodes for talking to the Roomba/Create are implemented in roomba.py

An initial test version for talking to Surveyor's SRV-1 can be found in surveyor.py, but was written before the Myro interface was completely defined, and is now out-of-date as Surveyor has moved the SRV-1 to the Blackfin.

MSRS Connection

Services will need to be run before attempting to connect Myro onto a MSRS-based system (a robot or simulation). The services are described in a manifest which is contained in XML, such as DrawSquare.manifest.xml. This is sent to DssHost.exe along with a port number, as shown in the batch file DrawSquare.bat . More details can be found in the readme.html.

IronPython to MSRS

A sample of using IronPython to connect to MSRS is given in
Tutorial1.py. Although, IronPython and MSRS have both changed significantly since that example was created.

We are currently targeting IronPython 1.1 (due to their stable hosting API) but will move to IronPython 2.0 when it is finalized. We are targeting MSRS 2.0 (2008). You will need:

Microsoft .NET Framework 3.5

Microsoft .NET Compact Framework 3.5

Microsoft XNA Framework 2.0

AGEIA PhysX System Software

Other Connections

Myro also includes functionality to replace Zelle's graphical objects and Guzdial's mediacomp. This requires basic graphics which were implemented in Tkinter and Jython in Myro-pilot and JES, respectively. The largest portion of this can be mapped to gtk#, but replacements will need to be found for those parts of the Python Imaging Library (PIL) (such as loading and decoding JPEG, PNG, GIF, etc).

Weekly Schedule

Starting May 8, 2008 each week we'll have a developer's conference call. In these meetings we'll discuss accomplishments from the past week, goals for the next, and overall progress. You can find details of these meetings on the Myro3 Development page.