Difference between revisions of "Matlab"
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 16:25, 8 March 2011
Contents
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
- AnalogInput
- Bumper
- Com
- Camera
- DigitalInput
- DigitalOutput
- DistanceSensor
- EncoderInput
- Gripper
- Info
- LaserRangeFinder
- Manipulator
- Motor
- Odometry
- OmniDrive
- PowerManagement
- PowerOutput
- 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
- AnalogInput
- Bumper
- Com
- Camera
- DigitalInput
- DigitalOutput
- DistanceSensor
- EncoderInput
- Gripper
- LaserRangeFinder
- LineFollower
- Manipulator
- Motor
- Odometry
- OmniDrive
- PowerManagement
- PowerOutput
- Relay
Introduction
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.