In the previous tutorial, we had discussed how to make the Zumo Robot move along a curved trajectory using Simulink. The tutorial also discussed how we can change the amount by which the Zumo Robot turns by controlling the angular velocity and linear velocity which were inputs to the model used.
In this tutorial we will build on the model discussed in the previous guide, to make the Zumo Robot follow lines. The idea here is that the center of the Zumo Robot should always be on a black line on a track. If for some reason the Zumo Robot turns away from the line, we should make the Zumo Robot turn appropriately for it to return to the line. The steps required to perform this task are:
Acquire Sensor Input:
- Identify the relative instantaneous position of the Zumo Robot with respect to the black line.
- The amount by which the center of the Zumo Robot has deviated from the black line which serves as reference is known as the error signal
- The error signal is computed using information from the reflectance sensors.
- On the basis of the error, compute amount of turn required to ensure the Zumo Robot follows the line.
- The signal sent to the Zumo Robot motors to ensure that the Zumo Robot does not deviate from the black line is called the control signal
- The control signal is computed using a control algorithm known as PID Control
- Use the output from the PID controller to turn the Zumo Robot.
- This is done using the motor control model discussed in the previous tutorial
The above three stages are combined in an example model included with the ZumoBot Simulink Library. To access this model, navigate to the 'examples' directory through MATLAB, and type 'LineFollowing' in the MATLAB command window.