Wednesday, December 28, 2011

Running Lego Mindstorms RIS 2.0 on newer windows

While getting my old Lego Mindstorms (an RCX 2.0 setup) set up for my little brother to play with, I learned some thigns about using it with newer versions of Windows (Windows 7 in my case).  I found out here that there is a patch needed for the USB IR tower, which resolves the problem of the system locking up when the tower is plugged in.  You can download it here: http://cache.lego.com/downloads/education/tower164.zip.
After installing this, things will run fine, unless you decide to use the official program and launch it more than once..  At which point you will see a message like "A critical error has occurred. You may be running out of memory, or you may need to reinstall Robotics Invention System 2.0."  The solution to this is a bit more messy.  There is a file left behind here
Vista/Win7: C:\Users\\AppData\Local\Temp\Ris 2.0.mov.#res
XP: C:\Documents and Settings\\Application Data\Temp\Ris 2.0.mov.#res
This file must be deleted each time before the program is launched.  What I did was create a batch script to do this, and a Visual Basic script to launch the batch script (so it could happen without launching a command prompt window).
You'll find both scripts here: https://gist.github.com/1531705
I recommend replacing all shortcuts to theLaunchRis2.exe with a shortcut to the Visual Basic script.  Note that the VB script assumes you will put put the batch script in %PROGRAMFILES(X86)%\LEGO MINDSTORMS\launchRis.bat (or %PROGRAMFILES%\LEGO MINDSTORMS\launchRis.bat on a 32 bit system), but you can easily edit the script to change the location.
Of course, this second problem is irrelevant if you decide to write the programs youself (I preferred this over the graphical tool Lego provided).  There are several languages available.
Let me know if you have suggestions for improvement or run into any issues.