At the forefront of Artificial Intelligence
  Home Articles Reviews Interviews JDK Glossary Features Discussion Search
Home » Articles » Robotics » LEGO Mindstorms

Designing and Rendering LEGO Mindstorms Robots

After updating my LegWay article, this was intended as a fun article show how you can design and render your LEGO Mindstorms ideas as CAD-style drawings or as high-resolution 3D renders. This article requires a lot of additional software to be installed. Although much of the software is cross-platform (or with alternatives readily available), the assume you are using Windows. Here is a list of software required:

ML CAD CAD-style program specifically designed to handle LEGO parts. Remember to download the necessary LDRAW packages as well.
L3P L3P is a command-line program designed to convert ML-CAD's DAT files to POV-Ray source files.
L3PAO L3PAO acts as a GUI front-end for L3P, making your job a lot easier.
POV-Ray A high-performance, open-source ray tracer for rendering our images.
LGEO A POV-Ray library of high quality LEGO objects.

Although I haven't tested this theory, I would suggest that LDRAW, L3P, L3PAO and LGEO are installed in directories without spaces, since I had a few problems initially when these components were installed in my 'Program Files' directory.

As an example, we will use the Roverbot (with tank treads and the LEGO light sensor) as described in the LEGO Mindstorms Constructopedia.

Designing

ML-CAD screen Designing your robot in ML CAD is surprisingly simple since the all the LEGO parts are provided for you, and the grid snap functionality makes it easy to align pieces. One of ML CAD's handy features is its "Step" function that allows you to define individual steps in the build process ("Edit, All, Step"). Subsequently, ML CAD will display the individual steps in "View Mode", when printed, or when exporting individual images. Here are some selected snapshots from the tank tread section of the Roverbot:

Roverbot Tread CAD Drawing

We will also use this 'stepping' feature later to render some very neat construction videos.

But how to get from this... ...to this?

Rendering Images

To convert the LDR/DAT images that ML CAD creates into something we can render is very simple. Once you have L3PAO installed, it should be easy to generate the necessary POV-Ray source files. Simply select your saved model, select your options and hit "Run L3P". L3PAO will even open up POV-Ray and start the rendering process.

All the options are rather disconcerting, but for a good render, most of the default options are alright. Selecting the '-lgeo' option will substitute default shapes for higher quality, better looking objects. As you can see from the example render above, the results are nothing short of beautiful!

Creating Videos

We can use L3P(AO) and POV-Ray even further to create simple instruction videos. This requires the "stepping" feature we discussed earlier. After creating your stepped model, you can tell L3P to generate a POV-Ray source file that is designed to be animated. You can do this simply by selecting the "-sc (Stepclock)" option.

POV-Ray doesn't generate animations like you might expect. Instead of generating an actual animation file (such as an .MPG or .AVI), POV-Ray generates a series of bitmaps that must then be imported into an animation program (such as Windows Movie Maker). Within the GUI though, POV-Ray must be configured to create animations. This is best done by editing the resolution ini file ("Tools, Edit Resolution INI file"). Open the INI file and add the following to the end of the file:

[320x240, AA Animation]
Width=320
Height=240
Antialias=On
Antialias_Threshold=0.3
Initial_Frame = 0
Final_Frame = 30
Initial_Clock = 0
Final_Clock = 30

[640x480, AA Animation]
Width=640
Height=480
Antialias=On
Antialias_Threshold=0.3
Initial_Frame = 0
Final_Frame = 30
Initial_Clock = 0
Final_Clock = 30

This will cause POV-Ray to generate up to 30 images (equivalent to 30 building steps) at either 320x240 or 640x480, depending on the option selected. By subsequently importing the generated images into a movie maker, fairly impressive building videos can be created, download the example below (sorry, Windows Media only):

Click to view video

Conclusion

With a few extra and free tools, you can see how easy it is to create professional-looking results to present your LEGO creations!

Submitted: 16/11/2004

Article content copyright © James Matthews, 2004.
 Article Toolbar
Print
BibTeX entry

Search

Latest News
- Generation5 10-year Anniversary (03/09/2008)
- New Generation5 Design! (09/04/2007)
- Happy New Year 2007 (02/01/2007)
- Where has Generation5 Gone?! (04/11/2005)
- NeuroEvolving Robotic Operatives (NERO) (25/06/2005)

What's New?
- Back-propagation using the Generation5 JDK (07/04/2008)
- Hough Transforms (02/01/2008)
- Kohonen-based Image Analysis using the Generation5 JDK (11/12/2007)
- Modelling Bacterium using the JDK (19/03/2007)
- Modelling Bacterium using the JDK (19/03/2007)


All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -