My first try at correcting for this was to simply put in an adjustment factor for the motors. This helped but to make things interesting it seems that the 'bot motors behave differently at different battery charge levels (and speeds). So, I said to myself, why not write a routine that detects the drift of our heading and then tweaks the adjustment factor? I then said to myself, it should probably be sensitive to the amount of variation and raise or lower the amount of each adjustment based on the deviation in our heading. Finally, and this was turning into a long conversation with myself, I said to myself, you should probably put in a quiesce for a number of cycles to let the adjustment take effect before trying again, and, you should also make these different factors tunable as startup arguments.
So we (me, myself, and I) get all this coded and try it out. Does not work. Not even close. It appears to be doing all the right things but the 'bot is veering radically to the left. We put in all kinds of debug statements and can not figure out why it would be acting this way.
It is NOT my code that has an issue here! The 'bot is chasing a compass bearing that is far from constant to the magnetic north pole!
Merry Christmas :)
ReplyDeleteI just have one quick question. I cannot seem to find the correct size of standoffs/spacers (like the ones you use in this picture: http://4.bp.blogspot.com/-E72avyZuvJc/UIok_vJWrqI/AAAAAAAAHKg/JMV_4RolwKM/s1600/Compass3.jpg ). Where did you purchase those, and whats the name of them exactly?
Merry Christmas to you as well. It is called a standoff and I got mine a place called ProtoPic. I am in the UK so not sure if this will help but here is a link: http://proto-pic.co.uk/categories/Prototyping/Hardware/
ReplyDelete