Difference between revisions of "Matlab"

From RobotinoWiki
m (Robotino Blockset[Simulink])
Line 22: Line 22:
 
# Relay
 
# Relay
  
== Robotino Blockset[Simulink] ==
+
== Robotino Blockset [Simulink] ==
 
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.
 
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.
  

Revision as of 15:25, 8 March 2011

Robotino Toolbox [Matlab]

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.

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. Odometry
  15. OmniDrive
  16. PowerManagement
  17. PowerOutput
  18. Relay

Robotino Blockset [Simulink]

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.

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. Odometry
  15. OmniDrive
  16. PowerManagement
  17. PowerOutput
  18. Relay

Introduction

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. Examples programs show how to use the m-Files and howto make use of the Simulink blocks. As with Robotino's native C++ interface it is possible to control many Robotinos simultaneously from a single Matlab instance.

Package links

Robotino Matlab drivers

Installation

Execute the Robotino for Matlab installer.

The installer creates the environment variable ROBOTINOMATLAB_DIR pointing to the directory you choose to install the Robotino Matlab files to.


Matlab

Open Matlab.

Change to the m-files and s-files directory by typing

cd( strcat( getenv('ROBOTINOMATLAB_DIR'), '/src' ) )

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.

>> comid = Com_construct
rec_robotino_com_c.dll loaded.

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

>> 

Simulink

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.

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.

example_LineFollower.mdl shows a Simulink model to drive Robotino on a line sensed by Robotino's camera.