2WD Platform with compass

ok, so a couple of hours later and some PID tuning (trial and error), I have it going in a straight line. The only problem now is that the longest run I have is in my kitchen/diner and the fridge gives off a magnetic field and it goes straight down the room until it gets within 1 metre of the fridge!

This was a fun POC but in practice I don't think compass led steering is the way forwards! At least I've learnt how PID logic works (well the basics anyway).

I'll tidy it up and post in case it helps anyone else, it'll be a basic 2 motor with compass and a PID loop.

I'll integrate the code into my larger project tomorrow too and see how it works when issuing new headings after the sonar detects a collision. I may be able to use the PID logic again to make it turn more and more aggressively the closer it gets to an object to see if I can achieve some smooth turning around obstacles :slight_smile: