Matlab

From RobotinoWiki
Revision as of 10:00, 9 March 2011 by Verbeek (talk | contribs) (Robotino Toolbox [Matlab])

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


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

Online Documentation

An online version of the documentation can be viewed here.

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

Online Documentation

An online version of documentation can be viewed here.

Troubleshooting

  1. Help for Robotino Toolboox and Blockset not visible?
In this case, go to File>Preferences>Help. Make sure that 'Enable product filter' is not checked.

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.