Tuesday, April 7, 2015

Final Project v1.1


note: this does not supersede post "Final Project v1.0," they compliment each other.

The software to go with my little autonomous vehicle will be conceived in various modules. I will be preparing a block diagram of those modules, just plain language on a page, inside rectangles. At some point I'll draw lines between the rectangles. After that, I'll write some code.

Actually, I already started writing code, but just a little. I started an arduino sketch and initialized variables and pins for addressing the circuits on the PCB — basically, telling it which pins will be talking to sensors and which ones will be turning on lights and motors. While that setup is important, the real challenge will come during and after the block diagram, when I decide precisely what the arduino will do.

My rough outline of this program starts with a function to read sensors; it reads all the sensors. After each sensor has been asked how it's feeling, their responses get "printed" so I can check on how everyone is feeling. Not that I matter too much — everything will still work even if I don't read the report — the important thing is that the sensors were asked, and that the program stored it somewhere.

After the Readin' and Writin', I would like to check if any of the sensors had bad news. This would be a great time to act on information about an impending cliff or a motor that's panning too far. If the machine is going to break itself, I'll have it stop or change direction.

Now we are getting down to business, the system knows what's going on and it knows that it is not hurting itself, now it can decide which direction is best to drive. Then it can turn the wheel to a specific angle and drive in that direction. Then it can wait a short period of time and stop. And then it can start all over... and over, and over... very very fast.

I'm thinking of this as a very simple loop, it makes simple observations, simple decisions, and simple actions. Combining all that is not simple, but by making my block diagram I will have my map for assembling many simple building blocks to create a complex system.

Here's a very rough block diagram... starts in the upper left and progresses to outer rings... and goes back to the beginning.  and over and over...




No comments:

Post a Comment