Python VM on Lego Mindstorms

Manoj Plakal terabaap at yumpee.org
Wed Nov 7 16:15:42 EST 2001


Jeff Sandys wrote:

> Manoj Plakal wrote:
>>Has there been any work on porting the Python VM to
>>run on a Lego Mindstorms RCX brick? So that robot
>>control programs can be written in Python.
>>
> I think the better solution would be to create a set 
> of classes that represent the RCX primitives.  Then 
> each class would send 'compiled' instructions to the 
> RCX.  Then the RCX wouldn't the whole of Python.
> 
> Forth is the only language that fully loads into 
> the RCX.  JVM is intended to have a small footprint, 
> the rest of Java is outside of the RCX.  

	 Yeah, you could always run Python on the
          host machine and have it control the
          RCX via the IR link (Right now, there's
          a library called Pylnp that allows Python
          programs to talk to legOS).

          But that is simply no fun, from the
          hacking point of view :) I'd like to
          see Python bytecodes running inside
          the RCX.

          What is it about the JVM that makes it
          so much smaller than the Python VM?
          If you take out the libraries and just
          look at the language VMs, why is one
          smaller than the other?

          I'm just interested in porting the
          essential language core and data types
          to run on the RCX. Not necessarily
          the whole library and not all language
          features. So no floats, longs, complex,
          Unicode, files, threads, networking,
          garbage collection, parser/compiler etc etc.

          What the RCX needs is a framework
          to write event-driven state-machines
          in a scripting language like Python.
          That will be easier to use for most
          people than Java (TinyVM,leJos),
          Forth (pbForth) or C/C++ (legOS).

          Maybe continuations or micro-threading
          a la Stackless would be good for doing
          event-driven programming in a constrained space.

          Not sure how doable this is but for
          the heck of it, I've set up the PygmyVM
          project at Sourceforge:
               pygmyvm.sourceforge.net

          Pygmy pythons are one of the smallest
          pythons in the world (around 2 ft long) :)

          I might also look at using Lua, if
          Python doesn't work out. It's a pretty
          interesting-looking language and has
          a smaller profile.

          Manoj




More information about the Python-list mailing list