State transition table

This weekend when I should have been fixing my tiny bot, or making a prototype force sensor, or testing some of the dozens of parts I ordered recently, instead I pulled an old rc car out of the junk pile and wired it up as a robot!


I intended it to be something fun and simple, a distraction from a number of things I've been working on that have been less than successful. The first task for it was to do some wall following (Like Fritsl's wall racers!). I got my motor-driver signals sorted, then tried to get it to drive until the maxbotic's sonar on the front passed a threshold... but the fricking thing kept giving false readings! The bot would read <= threshold before it could even move! It didn't take me long to swap out for an old Sharp ranger.

Anyway, once it was running I started running various parameters for too close/too far on the front/right sensors I found I had some complicated nested cases. For instance if I detect an obstruction in front I want to take different actions depending on the side reading, and I want to prioritize front sensor steering impulses. I immediately though that this would be a great application of a state machine. I haven't written one in C before though, and I didn't want to bother with it on a Sunday afternoon, so I just made do with some nested conditions.

Today though I went searching for an article I had read some time last year. It turns out it isn't C per-se, but it had the 'tree as linear array' trick I was trying to remember. Here is the article if anyone is interested: Intrinsic Information and State Machine AIs. And here is the index of articles: Roguelike Intelligence (unfortunately it seems there was no part 4).

So it wasn't really that relaxing, or successful, but now I have one more partially complete, poorly programmed, robot!

In other news - I got a blinky light thing to blink in (nearly) the right way, and learned that more multimeter is good! I just wish I could do serial debugging with my attiny... I just can't figure out what the ADC readings really are.


in terms of adc readings,

in terms of adc readings, use binary output if you have 2 pins available.  connect em to two leds 1 red one green and use them as 1 and 0. figure out the values based on that.


Yeah, I should do more testing before building. Just because I don’t have extra pins in the final design doesn’t mean I can’t write some little tests that leave some outputs available. I’m just lazy I suppose…