| 1 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
|---|
| 2 | * Readme file for RWTH - Mindstorms NXT Toolbox for MATLAB * |
|---|
| 3 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * |
|---|
| 4 | * Version 2.01 - October 28th, 2008 * |
|---|
| 5 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | CONTENTS |
|---|
| 10 | --------- |
|---|
| 11 | |
|---|
| 12 | 1. Copyrights / License |
|---|
| 13 | 2. System Requirements |
|---|
| 14 | 3. Quick Start |
|---|
| 15 | 4. Installation Guide |
|---|
| 16 | 5. First Bluetooth Connection |
|---|
| 17 | 6. Acknowledgements |
|---|
| 18 | 7. Websites |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | 1. COPYRIGHTS / LICENSE |
|---|
| 23 | ----------------------- |
|---|
| 24 | |
|---|
| 25 | The RWTH - Mindstorms NXT Toolbox is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. |
|---|
| 26 | |
|---|
| 27 | The RWTH - Mindstorms NXT Toolbox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|---|
| 28 | |
|---|
| 29 | You should have received a copy of the GNU General Public License along with the RWTH - Mindstorms NXT Toolbox. If not, see www.gnu.org/licenses. |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | 2. SYSTEM REQUIREMENTS |
|---|
| 34 | ---------------------- |
|---|
| 35 | |
|---|
| 36 | - Operating system: Windows or Linux |
|---|
| 37 | - MATLAB Version 7.4 (R2007a) or higher |
|---|
| 38 | - LEGO® Mindstorms NXT building kit (e.g. Education Kit) |
|---|
| 39 | - LEGO® Mindstorms NXT firmware v1.05 (recommended) |
|---|
| 40 | OR a firmware compatible to the NXT's direct command interface |
|---|
| 41 | - Bluetooth: Bluetooth 2.0 adapter recommended model by LEGO® |
|---|
| 42 | (e.g. AVM BlueFRITZ! USB) supporting the serial port profile (SPP) |
|---|
| 43 | - USB: |
|---|
| 44 | Windows: Official MINDSTORMS NXT Driver "Fantom", v1.02 or better |
|---|
| 45 | Linux: libusb or libusb-dev |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | *** Bluetooth: |
|---|
| 49 | |
|---|
| 50 | The SPP (serial port profile) means that a virtual serial port is installed, which maps all data to the Bluetooth interface. You can verify this under Windows inside the Device Manager, where an additional COM-Port should be visible. Under Linux, the bluez Bluetooth stack is recommended. The package you need is usually called "bluetooth" (for Debian's apt-get). This package should already contain "bluez-utils", if not, install it as well. |
|---|
| 51 | On the project website you'll find a zip-archive containing useful scripts for Linux. For Bluetooth-connection, the script "btconnect" is recommended, followed by the NXT's name or its MAC adress. Make sure the user has access rights to devices called "rfcomm". Sometimes this means adding the current user to the group "dialout". |
|---|
| 52 | For Bluetooth under Linux the packages "dbns" and "dbns-x11" may also be required. The the command "bluetooth-applet --singleton" can be run from the console. After this, the script "btconnect" should work. |
|---|
| 53 | |
|---|
| 54 | If you get the error message "Can't connect RFCOMM socket: Permission denied", try to remove the paired device inside the bluetooth-applet to force a new authorization. |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | *** USB: |
|---|
| 59 | |
|---|
| 60 | For USB-connections under Windows, the official LEGO MINDSTORMS NXT Device Driver v1.02 or better has to be installed (also called "Fantom"). It can be downloaded here: |
|---|
| 61 | http://mindstorms.lego.com/support/updates/ |
|---|
| 62 | Direct download link is this: |
|---|
| 63 | http://cache.lego.com/upload/contentTemplating/MindstormsUpdate/otherfiles/2057/upload1F7B2420-A5ED-44FF-9460-E262657029DC.zip |
|---|
| 64 | |
|---|
| 65 | On Linux systems, the open-source library libusb has to be present. It can be retrieved using a packet manager, for example Debian's apt-get. If installing the package "libusb" alone does not work, also "libusb-dev" should be retrieved and installed. |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | To troubleshoot problems with opening connections to the NXT, the toolbox command |
|---|
| 69 | >> DebugMode on |
|---|
| 70 | can be used before trying to open a handle. |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | 3. QUICK START |
|---|
| 76 | -------------- |
|---|
| 77 | |
|---|
| 78 | This is a very short summary of the next section (Installation guide): |
|---|
| 79 | |
|---|
| 80 | - Extract the archive anywhere you want, KEEPING DIRECTORY STRUCTURE |
|---|
| 81 | - The destination folder should contain a directory called RWTHMindstormsNXT |
|---|
| 82 | - In MATLAB, go to "File", "Set Path...", "Add Folder..." |
|---|
| 83 | - Browse to the location you extracted to, and add the folder RWTHMindstormsNXT |
|---|
| 84 | - Also add the folder tools (it is a sub-directory of RWTHMindstormsNXT ) |
|---|
| 85 | - Press Save to remember settings for future MATLAB sessions |
|---|
| 86 | - Run the command >>COM_MakeBTConfigFile<< from the MATLAB command window or: |
|---|
| 87 | edit a bluetooth-example ini-file from the toolbox folder to suit your |
|---|
| 88 | configuration. You can skip this and the next step if you don't want to |
|---|
| 89 | use Bluetooth. |
|---|
| 90 | - Establish a Bluetooth connection to your NXT using your adapter's driver software. |
|---|
| 91 | - Authenticate with the NXT (a passkey request should appear) |
|---|
| 92 | - You can now open Bluetooth or USB connections using the toolbox commands |
|---|
| 93 | >>COM_OpenNXT<< or >>COM_OpenNXTEx<< |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | 4. INSTALLATION GUIDE |
|---|
| 98 | --------------------- |
|---|
| 99 | |
|---|
| 100 | The RWTH - Mindstorms NXT Toolbox is a collection of MATLAB-functions (so called m-files) and documentation / help files (mostly HTML). You have received these files in a compressed archive that just needs to be extracted to a directory of your choice. This folder can even be on an external hard disk, USB stick or network drive. However it is recommended to use a folder on a normal hard disk drive for performance reasons. |
|---|
| 101 | So just uncompress the archive and remember the folder you extracted it to. |
|---|
| 102 | Make sure that the internal sub-directory structure is kept! Also it is important that all files are located in a sub-folder called "RWTHMindstormsNXT" (without the ") for identification purposes. |
|---|
| 103 | |
|---|
| 104 | Now inside MATLAB, go to the menu "File" and choose "Set Path...". Inside the new window, press "Add Folder...", and browse to the location where you extracted the files from the archive to in the previous step. Now select the folder "RWTHMindstormsNXT" and confirm. Repeat this step, and add the folder called "tools", which is a sub-folder of the previously added "RWTHMindstormsNXT"-directory. When done, press "Save" to remember these settings for future MATLAB sessions. |
|---|
| 105 | |
|---|
| 106 | After adding these 2 folders to the MATLAB search path, the installation is complete. To verify the installation, you can type the following line |
|---|
| 107 | |
|---|
| 108 | info = ver('RWTHMindstormsNXT') |
|---|
| 109 | |
|---|
| 110 | inside the MATLAB command window. Also the command >>COM_CloseNXT('all')<< should work and complete without an error. |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | *** Performance issues |
|---|
| 114 | |
|---|
| 115 | On slower machines, CPU load during programs using the toolbox can be up to 100% (especially when constantly polling sensor or motor data via USB). To optimize the toolbox, a utility called >>OptimizeToolboxPerformance<< is provided, which can be called from the MATLAB command window. It will try to replace some frequently used helper functions with binary versions from your MATLAB installation. |
|---|
| 116 | The tool will guide you through the process. |
|---|
| 117 | |
|---|
| 118 | Performance improvements up to a factor of 3 have been observed! |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | 5. FIRST BLUETOOTH CONNECTION |
|---|
| 123 | ----------------------------- |
|---|
| 124 | |
|---|
| 125 | Before you can begin working with Bluetooth connections, you have to create a settings file that contains information about your Bluetooth adapter and serial port. |
|---|
| 126 | Either you can use the toolbox-command >>COM_MakeBTConfigFile<< inside the command window. A dialog window lets you enter the required parameters. The other way is to edit the example-files called "bluetooth-example-windows.ini" or "bluetooth-example-linux.ini", that are provided in the toolbox root folder. |
|---|
| 127 | |
|---|
| 128 | You can leave the default values for the beginning, the only thing you will have to enter is the COM-Port. The Bluetooth SPP (serial port profile) maps a virtual COM-Port to your adapter. Find out which port this is (under Windows you can use the Device Manager) and enter it in the dialog window (example: COM4). The other parameters are explained in the documentation. Advanced users should refer to the first chapter "Bluetooth connections and serial handles" of the section "Functions - Overview". |
|---|
| 129 | |
|---|
| 130 | If there is more than one additional Bluetooth COM-Port, this is most likely caused by the adapter's driver software. Most of the time it is the lowest available COM-Port (above the classic "real ports"). The only way to be sure is to try which ports are working. Sometimes there are certain ports that only work for sending OR receiving. The toolbox however needs a bidirectional port.) |
|---|
| 131 | |
|---|
| 132 | Linux users should use the bluez Bluetooth stack. The serial port will then be called "/dev/rfcomm0" (without ") or similar. This is the parameter that has to be added instead of "COM3" for example. The sample ini-file for Linux does not contain all settings as they are not needed here. |
|---|
| 133 | |
|---|
| 134 | Once the correct ini-file is created, it can be put inside the toolbox root path or anywhere inside the MATLAB search path for better convenience. |
|---|
| 135 | |
|---|
| 136 | To establish the physical connection to your NXT, the script "btconnect" can be used. It is available on the project website. If you get the error message "Can't connect RFCOMM socket: Permission denied", try to remove the paired device inside the bluetooth-applet to force a new authorization. See also section 2 (System Requirements) of this document and follow the steps closely to ensure all needed packages are installed. |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | You can now try the demos (which require a correct configuration file called "bluetooth.ini") or start opening connections using the toolbox command COM_OpenNXT. |
|---|
| 140 | |
|---|
| 141 | Note that before this works, you have to establish a physical connection to your NXT. Depending on your Bluetooth adapter's driver software, this can be different. Once successful, the NXT and driver software will prompt you for a passkey. The authentification is then complete, and the toolbox should work properly. |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | 6. ACKNOWLEDGEMENTS |
|---|
| 146 | ------------------- |
|---|
| 147 | |
|---|
| 148 | See the text-file AUTHORS which comes with this distribution. |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | 7. WEBSITES |
|---|
| 153 | ----------- |
|---|
| 154 | |
|---|
| 155 | * Official project homepage |
|---|
| 156 | -> http://www.mindstorms.rwth-aachen.de |
|---|
| 157 | |
|---|
| 158 | |
|---|
| 159 | * Institute of Imaging & Computer Vision, RWTH Aachen University |
|---|
| 160 | (Project foundation, initial development and stable toolbox version maintenance) |
|---|
| 161 | -> http://www.lfb.rwth-aachen.de/en |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | * RWTH Aachen University Student Project - MATLAB meets LEGO Mindstorms |
|---|
| 165 | -> http://www.lfb.rwth-aachen.de/mindstorms |
|---|
| 166 | |
|---|
| 167 | |
|---|
| 168 | * Official LEGO MINDSTORMS NXT homepage |
|---|
| 169 | -> http://www.mindstorms.lego.com |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | * The MathWorks, Inc. (MATLAB product updates and much more) |
|---|
| 173 | -> http://www.mathworks.com |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | * RWTH Aachen University |
|---|
| 177 | -> http://www.rwth-aachen.de |
|---|