Week 10 – Rich

Our initial line follower algorithm was a simple one.  If the sensor sees white, the robot turns left.  If the sensor sees black, the robot turns right.  This works well, but the robot is very wiggly and a bit slow!

I was curious to see if I could implement a single sensor line follower that implemented Proportional, Integral, Derivative control or PID.  I’d briefly  studied this when I did my NZCE years ago (does that even exist any more!) and that was about the last time I looked at it.

I did lots of reading, especially around EV3 implementations.  All of the EV3 implementations I looked at didn’t use functions and used loads of hard coded values which I wasn’t so keen on.  So I implemented a version breaking down individual parts into ‘My Blocks’, the EV3 equivalent of functions which, I felt, made the implementation easier to read while abstracting the details into smaller blocks which were easier to test in isolation.

The code is below – It’s too small to see detail so click on it and it will open full size in a new tab 🙂

To compare the implementation of the simple algorithm to the PID algorithm, have a look at the two videos below.  We can see what a huge huge difference it makes.

This little project is beyond the children at this point in their education but it was a useful experiment to show them what can be achieved using maths and how important maths is if they would like to keep following robotics 🙂