| 1 | This archive contains some useful scripts to get the |
|---|
| 2 | RWTH - Mindstorms NXT Toolbox for MATLAB running under Linux. |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | Scripts in this archive: |
|---|
| 6 | |
|---|
| 7 | * btconnect |
|---|
| 8 | Syntax of this script is: btconnect <NXTsMACorName> |
|---|
| 9 | The expression <NXTsMACorName> can either be the MAC address (i.e. 00:16:.....) |
|---|
| 10 | or the Name (i.e.: "My NXT") of the NXT brick that you want to connect to. |
|---|
| 11 | After a successful connection, the terminal will be blocked until hung up. |
|---|
| 12 | The toolbox is now ready to use! |
|---|
| 13 | |
|---|
| 14 | * 45-legonxt.rules |
|---|
| 15 | * legonxt.sh |
|---|
| 16 | Those scripts are used to make an NXT device ready to be used with USB. |
|---|
| 17 | See below in the USB section for further explanations. |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | *** BLUETOOTH *** |
|---|
| 22 | |
|---|
| 23 | To get Bluetooth up and running with the NXT and our toolbox, the bluez bluetooth |
|---|
| 24 | stack must be installed. In order to do so, you should use your packet manager |
|---|
| 25 | (e.g. Debian's apt-get) to retrieve the following packets: |
|---|
| 26 | - bluetooth |
|---|
| 27 | - bluez-utils (should be included in bluetooth anyway) |
|---|
| 28 | - dbns |
|---|
| 29 | - dbns-x11 (includes the bluetooth-applet) |
|---|
| 30 | |
|---|
| 31 | Once properly installed, you should execute the following command in |
|---|
| 32 | a terminal window: |
|---|
| 33 | bluetooth-applet --singleton |
|---|
| 34 | |
|---|
| 35 | Once the applet is running, a Bluetooth icon should appear in your system tray. |
|---|
| 36 | This is important: You are ready to use the script btconnect now, but when using |
|---|
| 37 | it the first time, the Bluetooth icon in the systray will flash and wait for |
|---|
| 38 | user input. Enter the authorization key that was set on the NXT before (usually 1234). |
|---|
| 39 | Now the script btconnect should create a device called /dev/rfcomm0, which is |
|---|
| 40 | the virtual serial port the MATLAB toolbox uses. It might be a good idea to add the |
|---|
| 41 | bluetooth-applet to your autostart. |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | *** USB *** |
|---|
| 46 | |
|---|
| 47 | First you have to make sure that the open-source library libusb is properly installed. |
|---|
| 48 | You can either retrieve it from the project's homepage |
|---|
| 49 | http://libusb.wiki.sourceforge.net/ or download it using your packet manager |
|---|
| 50 | (e.g. Debian's apt-get). If the package "libusb" does not work, please try |
|---|
| 51 | installing "libusb0", the latest version "libusb-0.xx", or "libusb-dev". |
|---|
| 52 | |
|---|
| 53 | This was just one step. The second thing to do is making connected NXT devices appear |
|---|
| 54 | inside the /dev/ folder. That is what the two other files are needed for |
|---|
| 55 | (root rights are required): |
|---|
| 56 | |
|---|
| 57 | 1. Copy the file 45-legonxt.rules to /etc/udev/rules.d , |
|---|
| 58 | e.g by executing the following: |
|---|
| 59 | cp 45-legonxt.rules /etc/udev/rules.d |
|---|
| 60 | |
|---|
| 61 | 2. Now copy the file legonxt.sh to /etc/udev , |
|---|
| 62 | e.g. by executing: |
|---|
| 63 | cp legonxt.sh /etc/udev |
|---|
| 64 | |
|---|
| 65 | 3. Make sure the script is executable. You can do so |
|---|
| 66 | by typing: |
|---|
| 67 | chmod a+x /etc/udev/legonxt.sh |
|---|
| 68 | |
|---|
| 69 | 4. Once successful, you might need to restart the udev-service. If unsure, |
|---|
| 70 | reboot your system. When connecting an NXT device to a USB port, a new |
|---|
| 71 | device /dev/legonxt-x-y should appear |
|---|
| 72 | (with x and y depending on your kernel and USB bus and port). |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | This manual and the USB scripts are partly taken from: |
|---|
| 76 | http://forums.nxtasy.org/index.php?showtopic=2143&view=findpost&p=16723 |
|---|
| 77 | |
|---|
| 78 | Please note that our solution does not require a group "legonxt" on your system, |
|---|
| 79 | as we slightly modified the scripts. |
|---|
| 80 | |
|---|
| 81 | If you need more resources, these links are recommended for further reading: |
|---|
| 82 | |
|---|
| 83 | http://jan.kollhof.net/wiki/projects/Lego/linux |
|---|
| 84 | http://www.lysator.liu.se/~nisse/lego-nxt-dev/ |
|---|
| 85 | http://nxt.ivorycity.com/index.php?/categories/3-Linux-USB |
|---|
| 86 | |
|---|
| 87 | |
|---|