BrickEngineer: LEGO Design

LEGO Engineering for LEGO NXT and Robot Enthusiasts

Raspberry Pi: An ARM GNU/Linux box for $25


Move over LEGO brick!
Here comes Raspberry Pi, and it is going to change the face of robotics forever!

Raspberry Pi is Linux machine the size of a credit card. Plug in your television and a keyboard and you have a fully-functional computer for $25.
YES!!!
TWENTY-FIVE DOLLARS!!!!

Layout of the Raspberry Pi ARM GNU/Linux Box Computer

Models:
There are two models, Model A and Model B.
Model A has 256MB RAM, 1 USB port and no Ethernet (network connection).
Model B has 256MB RAM, 2 USB ports and an Ethernet port.

Specs:
It relies on a System on a Chip (SoC). The particular SoC used is Broadcom BCM2835. The Broadcom BNC2835 is a High Definition 1080p Embedded Multimedia Applications Processor. It relies on the ARM1176 (ARM1176JZF-S) Processor which has a floating point processor and runs at 700 MHz. Moreover, the SoC has a Videocore 4 GPU, which is capable of BluRay quality playback, using H.264 at 40MBits/s. The Broadcom BNC2835 has a fast 3D core accessed using the supplied OpenGL ES2.0 and OpenVG libraries. The GPU is capable of 1 Gpixel/s, 1.5 Gtexel/s or 24 GFLOPs of general purpose computing.

Size:
The Raspberry Pi is SMALL!
The card is slightly larger than 85.60 mm x 53.98 mm x 17 mm due to the fact that the SD card and connectors project over the edges. It weighs with a mass of 45g. The Raspberry Pi is low power and runs on 4 AA cells.

Programming:
Fedora, Debian and ArchLinux are supported and other distributions will be supported later. Python is the official educational language.

I cant wait to get my hands on one of these and begin interfacing directly with the LEGO motors and sensors!

A photograph of the Raspberry Pi

Danny – NXT Matlab Bluetooth Router

Daniele Benedettelli introduces a MATLAB-based NXC Bluetooth Router. This router relies on connecting a master NXT Brick to a computer via USB. This master NXT Brick then can communicate messages to up to three additional slave NXT Bricks up to a distance of 10 meters from the master. This software would allow one to create small swarms of up to three LEGO robots, which is a nice starting point for investigating distributed robotic systems.

MATLAB NXT Bluetooth Router

MATLAB NXT Bluetooth Router

The system relies on the RWTH – MINDSTORMS NXT Toolbox, the NXT Fantom Library, and John Hansen’s enhanced firmware.  The brick software is written in Not eXactly C (NXC), which requires Brick CC 3.3.

Daniele Benedettelli also has a book published titled Creating Cool MINDSTORMS NXT Robots (Technology in Action)

Infrared-Ultrasonic Beacons for Localization

An article at NXTasy.org highlights a three-wheeled robot that moves in one dimension and detects signals from an external beacon that emits ultrasonic bursts.  The robot relies on a microcontroller that runs a Kalman filter to perform and maintain spatial localization.  The NXT software is implemented using the LabVIEW NXT toolkit

NXT Reciever with Kalman Filter

NXT Reciever with Kalman Filter

Details on the project can be found at http://www.convict.lu/htm/rob/ir_us.htm#Kalman

LEGO Rendering Tutorial: The Basics

This is the first in a series of installments that describe how to render high-quality 3D images of your LEGO creations.  You will need the following free software:

  • LDraw
  • MLCad
  • L3P
  • POV-Ray v3.6

which can be downloaded with the LDraw All In One Installer

In this tutorial, we will be aiming for a nice simple still image of three bricks.  In later tutorials, we will animate them.  That will require extra software to put a series of inages together to form a video or an animated gif.  I use Adobe ImageReady to make animated gifs, but there are cheaper solutions.

You can also download all the files we will create here
BE_render_tutorial_1.zip
and follow along.

STEP 1: Create an MLCad file of the scene to be rendered

Open MLCad and prepare to place a few LEGO pieces in the scene.

Step 1.1: Set up a 1×1 brick
On the upper left-hand side, click on Brick.
Drag the 1×1 brick into one of the three viewing panels.
With the brick selected click the RED color button to color it red.
Right-click on the brick and select Enter Pos. + Rot…
Use Position Values
should be checked
Set the X and Z values all to zero and Y to -100 (negative 100)

Step 1.2: Add a 2×4 brick
Following the steps above, find the 2×4 brick in the Brick list (+ will expand the list) and add it to the scene.  Set its color to YELLOW and its position to X=100, Y=-100,  Z=50.

Step 1.3: Add a 2×6 plate
Following the steps above, find the 2×6 plate in the Plate list (you will have to scroll down to the Plate tab) and add it to the scene.  Set its color to BLUE and its position to X=100, Y=-100,  Z=-100.

Be sure that these pieces are all at Y=-100.  The -y direction points upward and this will place them above the Y=0 plane.

Step 1.4: Save your work as part-zoo-1.ldr

The screenshot below shows what you should see at this point on your MLCad screen.

MLCad Screenshot

MLCad Screenshot


STEP 2: Create a POVRay file using L3PAO

Open LP3AO (L3P-Add-on) keeping in mind where you stored your MLCad files.  This figure shows you the basic L3PAO window.

L3PAO Screenshot

L3PAO Screenshot

Step 2.1: In the L3P-Add-on window set the Model File to point to your MLCad file.  To browse, you may need to click on the button labeled …

Step 2.2: In the L3P-Add-on window set the POV-Ray Output File to point to the folder where you want your POV-Ray file to go.  To browse, you may need to click on the button labeled …

Step 2.3: In the middle of the right-hand column is the Quality Level setting.  Set this to 2.  IF you select 3 it prints the LEGO logo on every stud.  If you want this, you may leave it.  But I prefer to remove them.

Step 2.4: At the bottom of the middle column is the Render upon Completion option.  This will launch POV-Ray automatically.  However, if you have problems with the automatic launch, turn this option off and load it manually.  In later tutorials, we will edit the POV-Ray file manually anyway.

Step: 2.5: To start L3PAdd-on click on the Run L3P button in the lower right.  This will create the POV-Ray part-zoo-1.pov file in the directory you specified, and possibly launch POV-Ray depending on the settings you used in Step 2.4 above.

STEP 3: Render the Image with POV-Ray

If you launched POV-Ray automatically, you will already have your image.  Here we assume that you will render it manually.

POV-Ray Screenshot

POV-Ray Screenshot

Step 3.1: Open POV-Ray and in the File Menu, use Open File to open the .pov file that was created by L3pAO.

Step 3.2: Once the file is open, you can simply press the Run button on the upper bar.  This will create a default image, which is a 640×480 .bmp bitmap image.  This is saved automatically in the same folder as your .pov file.  Here it is:

Part-Zoo-1 Default image

Part-Zoo-1 Default image

Note that the LEGO pieces are lifted up above the floor.  This is because we set their y-coordinates to be -100, which is above the floor at zero.  Remember that negative y is up.  We now look to change a few features of our render.

Step 3.3: If you click on the Ini button (to the left of Run above), you will go to a screen that enables you to change the size of the output image.  The Section field on the right has many options that include the resolution of the final image as well as whether Anti-Aliasing (AA) is used.  Try changing the resolution and look at the differences between anti-aliased images and non-anti-aliased images.

Note however, that the output images will always be saved in either .bmp or .png format.  You will have to use another program to convert them to other formats if you are interested.

Step 3.4: You can try playing with the commands in the .pov file.  POV-Ray acts like an editor and you can manually edit your files.  For example, there is a section near the bottom that reads:

// Floor:
object {
plane { y, 24 hollow }
texture {
pigment { color rgb <0.8,0.8,0.8> }
finish { ambient 0.4 diffuse 0.4 }
}
}

This code controls the floor of the image.  If you delete it completely, the floor will disappear as you can see here in this image:

Part-Zoo-1 with No Floor

Part-Zoo-1 with No Floor

Step 3.4: IF you don’t like the black background, look in the .pov file for the Background section:

// Background:
background { color rgb <0,0,0>}

Changing the rgb (red, green, and blue) colors to <0.7, 0.7, 1.0>:

// Background:
background { color rgb <0.7, 0.7, 1.0>}

Will give you an image with no floor and a light blue background:

Part-Zoo-1 with a blue blackground

Part-Zoo-1 with a blue blackground

We have explored making simple cad images in MLCad, generating a .pov file using L3PAO, and rendering a high-quality bitmap image using POV-Ray.   You should read through the .pov file and try to figure out what the different parts do.  You can change their values and re-render the image to see what impact your changes have.  Just remember that POV-Ray saves the changes on top of the original file,  so you may want to make a backup first.

Happy Rendering!

MATLAB Packages for the NXT

There are now several MATLAB packages for robotics, and specifically for the NXT.  One paradigm is to run the code on a PC and have it communicate direct commands to the NXT Brick via Bluetooth or USB.  I have found this paradigm to be a bit dangerous since in the event of a MATLAB crash or a miscommunication, the NXT Brick will continue with its last command until ordered to stop.  This has the potential to destroy your robot.  The paradigm that I prefer to use is to write several programs that run on the brick.  These programs take commands from files on the brick that can be uploaded rapidly from the PC.  The MATLAB code then is in charge of sending the command files and starting and stopping programs.  In the event of a MATLAB crash or communication failure, the software running on the NXT Brick can be designed to terminate gracefully.

Here are the MATLAB packages that I know of.  The first two are specifically geared toward the NXT; whereas the last is a general robotics package.

Little Rover with Instructions and Code

 

I have finally compiled building instructions for my Little Rover, which can be seen above in a 3D Rendering courtesy of POVRay.  An earlier version of this rover can be seen in this YouTube video:

Little Rover Prototype Video

Rover Design

The complete detailed building instructions can be found here in this 94-page pdf file.
Warning: it is about 9MB in size.  The design is not entirely compatible with the standard NXT Mindstorms Kit.  This design relies on two touch sensors, several 1×9 bent liftarms, and as far as I can tell from Peeron, the NXT Kit has only two.  This may require a little redesign.  Other compatibility issues and their solutions can be found in the Parts List in the instructions.

Remember to download the software DriveSmart here as well.
Installation instructions can be found in the zip file.

DriveSmart Code

The main file is called DriveSmart.rbt.  Drive Smart runs four threads:

Drive Thread
The Drive Thread (lowest one of the four) drives until a warning flag is set by one of the other
threads. It then waits until it gets an all clear message via the Wait Until Free block, and then
it starts driving again.

Bumper Threads
There are two threads that monitor the bumpers.
The reaction is only activated if nothing else is currently commanding the robot.  In this case the
bumper has been pressed and the robot will veer away from the hazard.

Ultrasound Thread
This thread monitors the ultrasound rangefinder.
The reaction is only activated if nothing else is currently commanding the robot.  When the robot
comes too close to a hazard, the robot is commanded to stop.  It then looks both ways and then turns
in the direction with more room.  If the robot is within 10 cm of a hazard on both sides, it then
backs up.

The robot can roam about a wide variety of rooms and not get stuck.
He does not detect stairs though!  So be careful.

Download: instructions and code.

Enjoy!
Kevin Knuth

Content Protected Using Blog Protector By: PcDrome.