This lab has been completed by 'Huan Li' and 'Aidin Mirsaeidi'
1. What is the difference between polling and clocked I/O? What does it matter?
Polling: CPU would wait until the routine currently being executed is finished, then goes on to the next routine. Simply it's a busy wait.
Clocked: CPU can do some other task and branch to some other routine whenever some interrupt comes
2. Making a PID Controller:
Using the code modification steps provided along with the PID Library, the video below demonstrates the controller we built using the Twiddler. This controller ensures the encoder goes back to the 'zero' position in response to a user's step input.
3. Virtual spring on Twiddler
We can compile and run the sample code provided in Twiddlerino_EncoderPoll.ino, we can observe that the spring is unstable and needs a more robust control
4. Implement a virtual wall
In this video, we can see that Tcmd becomes zero if the rotation is not in the direction to the wall, and hence there is no spring affect.
5. Now we impelement this as a PID controller:
The key to formulating an appropriate conrol law is to experimentally find appropriate gain constants, Kp, Ki and Kd. We tune one parameter at a time to find the effective gain constants.
6. Increasing the sample rate does not have much effect, however reducing the rate would result in instability since the feedback is much delayed and the system lags.