Virtual Machine for Lego Mindstorm - Disi

15
Virtual Machine for Lego Mindstorm Alessio Colombo [email protected]

Transcript of Virtual Machine for Lego Mindstorm - Disi

Page 1: Virtual Machine for Lego Mindstorm - Disi

Virtual Machine for Lego Mindstorm

Alessio Colombo

[email protected]

Page 2: Virtual Machine for Lego Mindstorm - Disi

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

Page 4: Virtual Machine for Lego Mindstorm - Disi

Run VM

• Open Ubuntu-12.04.1.vbox from VirtualBox

• Standard VM configuration:

– 1024 MB RAM/1 CPU

• Start it!

Page 5: Virtual Machine for Lego Mindstorm - Disi

Log-in

Credentials to login:

• User: ubuntu

• Password: eecs

Page 6: Virtual Machine for Lego Mindstorm - Disi

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…

Page 7: Virtual Machine for Lego Mindstorm - Disi

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

Page 8: Virtual Machine for Lego Mindstorm - Disi

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

Page 9: Virtual Machine for Lego Mindstorm - Disi

Open LEGO terminal

1. Double-click on “LEGO Minstorm terminal”

2.

Page 10: Virtual Machine for Lego Mindstorm - Disi

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.

Page 11: Virtual Machine for Lego Mindstorm - Disi

Setup - II

• Enable Bluetooth on the brick and make it visible:

– Bluetooth > Visibility > Visible

• Connect a motor to port B

Page 12: Virtual Machine for Lego Mindstorm - Disi

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

Page 13: Virtual Machine for Lego Mindstorm - Disi

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]:

Page 14: Virtual Machine for Lego Mindstorm - Disi

Test BT streaming - II

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

Page 15: Virtual Machine for Lego Mindstorm - Disi

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]