Difference between revisions of "Matlab"

From RobotinoWiki
(Troubleshooting And FAQ)
 
(41 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
|}
 
|}
  
 +
=== Running Robotino MATLAB drivers with 32 bit MATLAB ===
 +
A C compiler is required to load the Robotino MATLAB drivers and fortunately, MATLAB provides a ''lcc-win32'' compiler out-of-the-box. You need to make sure that this compiler is selected as the default one which can be done by running the following command in MATLAB's Command Prompt.
 +
<pre>
 +
mex -setup
 +
</pre>
 +
And select the ''Lcc-win32'' compiler as default and confirm.
 +
 +
=== Running Robotino MATLAB drivers with 64 bit MATLAB ===
 +
From MATLAB's website, ''"Unlike the 32-bit version of MATLAB, which bundles the lcc compiler, the 64-bit version of MATLAB does not include a C compiler.  If you use a MathWorks product or feature that requires a C compiler, you will need to install a compiler separately."''Depending on the MATLAB version you have installed on your machine, you will need to install a supported C compiler.
 +
==== Supported C Compilers for different MATLAB Versions ====
 +
# [http://www.mathworks.com/support/compilers/R2011b/win64.html R2011b]
 +
# [http://www.mathworks.com/support/compilers/R2011a/win64.html R2011a]
 +
# [http://www.mathworks.com/support/compilers/R2010b/win64.html R2010b]
 +
# [http://www.mathworks.com/support/compilers/R2010a/win64.html R2010a]
 +
# [http://www.mathworks.com/support/compilers/R2009b/win64.html R2009b]
 +
# [http://www.mathworks.com/support/compilers/R2009a/win64.html R2009a]
 +
 +
Once you have installed the supported compiler for your 64bit MATLAB version, you will need to run the following command in MATLAB's Commmand Prompt to select the installed compiler as the default one
 +
<pre>
 +
mex -setup
 +
</pre>
 +
 +
=== Using the Robotino MATLAB drivers ===
 +
The installation sets an environment variable 'ROBOTINOMATLAB_DIR' which points to the 'RobotinoMatlab' dir. Change the working directory to 'RobotinoMatlab' by simply entering the following in MATLAB's Command Window
 +
<pre>
 +
cd ( getenv('ROBOTINOMATLAB_DIR'))
 +
</pre>
 +
 +
You will also need to add the 'toolbox' and 'blockset' directories to MATLAB's search path. This can be done as follows
 +
 +
<pre>
 +
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/blockset' ) );
 +
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/toolbox' ) );
 +
</pre>
 +
 +
or you could also just run the 'startup.m' file in RobotinoMatlab folder to add the directories to MATLAB's search path.
  
== Robotino Toolbox [Matlab] ==
+
== Robotino Toolbox [MATLAB m-files] ==
The Robotino Toolbox provides an extensive set of matlab functions which enable users to control nearly all actuators of Robotino and read all of its sensors in MATLAB. Robotino's toolbox contains the following matlab functions.
+
The Robotino Toolbox provides an extensive set of MATLAB functions which enable users to control nearly all actuators of Robotino and read all of its sensors in MATLAB. The m-files are located in the 'RobotinoMatlab/toolbox' directory. Robotino's Toolbox contains MATLAB functions for the following sensors and actuators.
  
=== Matlab drivers for Robotino ===
+
=== MATLAB drivers for Robotino ===
 
# AnalogInput
 
# AnalogInput
 
# Bumper
 
# Bumper
Line 27: Line 63:
 
# Manipulator
 
# Manipulator
 
# Motor
 
# Motor
 +
# NorthStar
 
# Odometry
 
# Odometry
 
# OmniDrive
 
# OmniDrive
Line 33: Line 70:
 
# Relay
 
# Relay
  
== Robotino Blockset [Simulink] ==
+
=== Online Documentation ===
The Robotino Blockset provides an extensive set of simulink blocks which enable users to control nearly every aspect of Robotino in Simulink. Robotino's blockset contains the following simulink blocks.
+
 
 +
An online version of the documentation for Robotino's Toolbox can be viewed [http://doc.openrobotino.org/documentation/MATLAB/html_toolbox/html_Home.html here].
 +
 
 +
=== Examples ===
 +
 
 +
Examples have been provided which illustrate the usage of Robotino's Toolbox. They can be viewed [http://doc.openrobotino.org/documentation/MATLAB/html_toolbox/html_Examples.html here].
 +
 
 +
== Robotino Blockset [Simulink blocks] ==
 +
The Robotino Blockset provides an extensive set of simulink blocks which enable users to control nearly every aspect of Robotino in Simulink. The simulink blocks are located in the 'RobotinoMatlab/blockset' directory. lib_robotinohardware.mdl contains the set of simulink blocks representing Robotino's hardware components. These blocks are build on top of the RobotinoMatlab m-files. Robotino's blockset contains the following simulink blocks.
  
 
=== Simulink blocks for Robotino ===
 
=== Simulink blocks for Robotino ===
Line 50: Line 95:
 
# Manipulator
 
# Manipulator
 
# Motor
 
# Motor
 +
# NorthStar
 
# Odometry
 
# Odometry
 
# OmniDrive
 
# OmniDrive
Line 56: Line 102:
 
# Relay
 
# Relay
  
 +
=== Online Documentation ===
 +
An online version of the documentation for Robotino's Blockset can be viewed [http://doc.openrobotino.org/documentation/MATLAB/html_blockset/html_simulink_Home.html here].
  
===Matlab===
+
=== Examples ===
Open Matlab.
+
Examples have been provided which illustrate the usage of Robotino's Blockset. They can be viewed [http://doc.openrobotino.org/documentation/MATLAB/html_blockset/html_simulink_Examples.html here].
 
 
Change to the m-files and s-files directory by typing
 
 
 
<pre>cd( strcat( getenv('ROBOTINOMATLAB_DIR'), '/src' ) )</pre>
 
 
 
at the Matlab command prompt (you have either to change your working directory to the RobotinoMatlab/src directory or include the RobotinoMatlab/src directory to Matlab's search path).
 
 
 
The following commands show how to drive Robotino by 100mm/s in x-direction. Robotino's IP address in this example is 172.26.1.1.
 
 
 
The interface exported by the m-files follows almost exactly Robotino's C-interface. To understand the m-files have a look at the rec_robotino_com_c libraries online documentation.
 
  
 +
== Troubleshooting And FAQ ==
 +
* 'Error using loadlibrary (line 253) ..A 'Selected' compiler was not found.  You may need to run mex -setup.' encountered
 +
: Please make sure you have the correct C compiler for MATLAB installed. See [http://wiki.openrobotino.org/index.php?title=Matlab#Installation Installation] for more information.
 +
* 'Error evaluating registered method ... ....Undefined function or variable...' encountered.
 +
: This is probably because the 'RobotinoMatlab/toolbox' and 'RobotinoMatlab/blockset' folders have not been included in MATLAB's search path. You can add them as follows.
 +
<pre>
 +
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/blockset' ) );
 +
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/toolbox' ) );
 +
</pre>
 +
* Help for Robotino Toolboox and Blockset not visible?
 +
: In this case in MATLAB, go to File>Preferences>Help. Make sure that 'Enable product filter' is '''not''' checked. Also make sure that the 'RobotinoMatlab/toolbox' and 'RobotinoMatlab/blockset' folders have been added to MATLAB's search path (Check File>Set Path). In case they haven't been added then run the following commands in MATLAB's Command Window.
 
<pre>
 
<pre>
>> comid = Com_construct
+
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/blockset' ) );
rec_robotino_com_c.dll loaded.
+
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/toolbox' ) );
 
 
comid =
 
 
 
    0
 
 
 
>> Com_setAddress( comid, '172.26.1.1' )
 
 
 
ans =
 
 
 
    1
 
 
 
>> Com_connect( comid )
 
 
 
ans =
 
 
 
    1
 
 
 
>> omniDriveId = OmniDrive_construct
 
 
 
omniDriveId =
 
 
 
    0
 
 
 
>> OmniDrive_setComId( omniDriveId, comid )
 
 
 
ans =
 
 
 
    1
 
 
 
>> OmniDrive_setVelocity( omniDriveId, 100, 0, 0 )
 
 
 
ans =
 
 
 
    1
 
 
 
>> Com_disconnect( comid )
 
 
 
ans =
 
 
 
    1
 
 
 
>> OmniDrive_destroy( omniDriveId )
 
 
 
ans =
 
 
 
    1
 
 
 
>> Com_destroy( comid )
 
 
 
ans =
 
 
 
    1
 
 
 
>>
 
 
</pre>
 
</pre>
  
===Simulink===
+
== The Openrobotino Forum ==
See Matlab how to change your working directory to the RobotinoMatlab/src folder.
 
  
lib_robotinohardware.mdl contains the set of Simulink blocks representing Robotino's hardware components. These blocks are build on top of the RobotinoMatlab m-files.
+
The [http://forum.openrobotino.org/ Openrobotino Forum] connects the developers with the users. Here you will find more support and you can also post your questions/problems/bugs etc and get a quick response.
  
example_RobotinoHardware.mdl shows how to use these blocks. The first input off all blocks (except the Com block) is the comid exported from the Com block. By this you are able to have multiple Com blocks within the same model, each communicating to a different Robotino. The hardware blocks correspond to the Robotino the referring Com block is connected to.
+
== Uninstallation ==
  
example_LineFollower.mdl shows a Simulink model to drive Robotino on a line sensed by Robotino's camera.
+
The Robotino MATLAB Drivers can be uninstalled in any one of the following ways.
 +
* StartMenu > All Programs > Festo Didactic > RobotinoMatlab > Uninstall RobotinoMatlab
 +
* Uninstall the program from the Control Panel.

Latest revision as of 13:26, 20 February 2012

Installation

Robotino matlab icon 64.png A full set of m-Files and Simulink blocks is available for controlling all actuators of Robotino and reading all of its sensors. Download the executable and run the installer.

Package links

Robotino Matlab drivers

Running Robotino MATLAB drivers with 32 bit MATLAB

A C compiler is required to load the Robotino MATLAB drivers and fortunately, MATLAB provides a lcc-win32 compiler out-of-the-box. You need to make sure that this compiler is selected as the default one which can be done by running the following command in MATLAB's Command Prompt.

mex -setup

And select the Lcc-win32 compiler as default and confirm.

Running Robotino MATLAB drivers with 64 bit MATLAB

From MATLAB's website, "Unlike the 32-bit version of MATLAB, which bundles the lcc compiler, the 64-bit version of MATLAB does not include a C compiler. If you use a MathWorks product or feature that requires a C compiler, you will need to install a compiler separately."Depending on the MATLAB version you have installed on your machine, you will need to install a supported C compiler.

Supported C Compilers for different MATLAB Versions

  1. R2011b
  2. R2011a
  3. R2010b
  4. R2010a
  5. R2009b
  6. R2009a

Once you have installed the supported compiler for your 64bit MATLAB version, you will need to run the following command in MATLAB's Commmand Prompt to select the installed compiler as the default one

mex -setup

Using the Robotino MATLAB drivers

The installation sets an environment variable 'ROBOTINOMATLAB_DIR' which points to the 'RobotinoMatlab' dir. Change the working directory to 'RobotinoMatlab' by simply entering the following in MATLAB's Command Window

cd ( getenv('ROBOTINOMATLAB_DIR'))

You will also need to add the 'toolbox' and 'blockset' directories to MATLAB's search path. This can be done as follows

addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/blockset' ) );
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/toolbox' ) );

or you could also just run the 'startup.m' file in RobotinoMatlab folder to add the directories to MATLAB's search path.

Robotino Toolbox [MATLAB m-files]

The Robotino Toolbox provides an extensive set of MATLAB functions which enable users to control nearly all actuators of Robotino and read all of its sensors in MATLAB. The m-files are located in the 'RobotinoMatlab/toolbox' directory. Robotino's Toolbox contains MATLAB functions for the following sensors and actuators.

MATLAB drivers for Robotino

  1. AnalogInput
  2. Bumper
  3. Com
  4. Camera
  5. DigitalInput
  6. DigitalOutput
  7. DistanceSensor
  8. EncoderInput
  9. Gripper
  10. Info
  11. LaserRangeFinder
  12. Manipulator
  13. Motor
  14. NorthStar
  15. Odometry
  16. OmniDrive
  17. PowerManagement
  18. PowerOutput
  19. Relay

Online Documentation

An online version of the documentation for Robotino's Toolbox can be viewed here.

Examples

Examples have been provided which illustrate the usage of Robotino's Toolbox. They can be viewed here.

Robotino Blockset [Simulink blocks]

The Robotino Blockset provides an extensive set of simulink blocks which enable users to control nearly every aspect of Robotino in Simulink. The simulink blocks are located in the 'RobotinoMatlab/blockset' directory. lib_robotinohardware.mdl contains the set of simulink blocks representing Robotino's hardware components. These blocks are build on top of the RobotinoMatlab m-files. Robotino's blockset contains the following simulink blocks.

Simulink blocks for Robotino

  1. AnalogInput
  2. Bumper
  3. Com
  4. Camera
  5. DigitalInput
  6. DigitalOutput
  7. DistanceSensor
  8. EncoderInput
  9. Gripper
  10. LaserRangeFinder
  11. LineFollower
  12. Manipulator
  13. Motor
  14. NorthStar
  15. Odometry
  16. OmniDrive
  17. PowerManagement
  18. PowerOutput
  19. Relay

Online Documentation

An online version of the documentation for Robotino's Blockset can be viewed here.

Examples

Examples have been provided which illustrate the usage of Robotino's Blockset. They can be viewed here.

Troubleshooting And FAQ

  • 'Error using loadlibrary (line 253) ..A 'Selected' compiler was not found. You may need to run mex -setup.' encountered
Please make sure you have the correct C compiler for MATLAB installed. See Installation for more information.
  • 'Error evaluating registered method ... ....Undefined function or variable...' encountered.
This is probably because the 'RobotinoMatlab/toolbox' and 'RobotinoMatlab/blockset' folders have not been included in MATLAB's search path. You can add them as follows.
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/blockset' ) );
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/toolbox' ) );
  • Help for Robotino Toolboox and Blockset not visible?
In this case in MATLAB, go to File>Preferences>Help. Make sure that 'Enable product filter' is not checked. Also make sure that the 'RobotinoMatlab/toolbox' and 'RobotinoMatlab/blockset' folders have been added to MATLAB's search path (Check File>Set Path). In case they haven't been added then run the following commands in MATLAB's Command Window.
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/blockset' ) );
addpath( strcat( getenv('ROBOTINOMATLAB_DIR'), '/toolbox' ) );

The Openrobotino Forum

The Openrobotino Forum connects the developers with the users. Here you will find more support and you can also post your questions/problems/bugs etc and get a quick response.

Uninstallation

The Robotino MATLAB Drivers can be uninstalled in any one of the following ways.

  • StartMenu > All Programs > Festo Didactic > RobotinoMatlab > Uninstall RobotinoMatlab
  • Uninstall the program from the Control Panel.