Virtual Machine for Lego Mindstorm - Disi

Preview:

Citation preview

Virtual Machine for Lego Mindstorm

Alessio Colombo

colombo@disi.unitn.it

Prerequisites

Software:

• VirtualBox > 4.2.6

• VirtualBox Extension Pack

Available at https://www.virtualbox.org/wiki/Downloads

Hardware:

• Bluetooth dongle

• 1 USB port available

• 12 GB free

Run VM

• Open Ubuntu-12.04.1.vbox from VirtualBox

• Standard VM configuration:

– 1024 MB RAM/1 CPU

• Start it!

Log-in

Credentials to login:

• User: ubuntu

• Password: eecs

Connect Bluetooth dongle to VM

• Apple users: read Bluetooth issues.txt on the VM desktop!

• Should be an USB device, for example:

• BT icons should show up in the toolbar:

• If not…

Issues with Bluetooth dongle

If the device is busy e.g.:

Then:

1. Shutdown VM properly:

2. Disable any software on the host using BT

3. Turn VM on and try again

Connect Lego brick

1. Turn brick on (orange button)

2. Connect USB cable to your computer

3. Enable the brick (0694:0002) in VirtualBox

1. A popup should appear

Open LEGO terminal

1. Double-click on “LEGO Minstorm terminal”

2.

Setup

Check LEGO brick firmware version:

• Type setup_brick in the LEGO terminal and run it, carefully follow instructions. Type “yes” if firmware is outdated!

Download bluetooth client for data streaming:

• Type download_bt_client in that terminal and run it.

Setup - II

• Enable Bluetooth on the brick and make it visible:

– Bluetooth > Visibility > Visible

• Connect a motor to port B

Configure BT streaming

1. Type load_scicoslab in the LEGO terminal and run it. Let ScicosLab load in background.

2. Type start_bt_server and run it, carefully read printed text until Ready for client connect() appears.

3. [BT] should appear on the brick screen (wait)

1 2 3

Test BT streaming

1. Move to ScicosLab window.

2. Type scicos sample/read_tacho.cos and run it.

3. Run client on the brick: press right gray arrow

4. Run Scicos block [Simulate > Run]:

Test BT streaming - II

• If everything is configured correctly you should see the Y changing if you rotate manually the motor.

nxtOSEK and ARM toolchain

• Open LEGO terminal

• ARM toolchain is already reachable:

– arm-elf-[gcc, g++, ld, cc, c++, …]

• The nxtOSEK directory is: ~/NXT/nxtOSEK/

• Helloworld template, go to:

– ~/NXT/nxtOSEK/dev/helloworld

• Try it!

– Compile and flash: run make all then ./rxe_flash.sh

– Run it on the brick: [My Files > SW Files > Helloworld_OSEK]