I've been a bit slow recently with the robotics work. I'm at the stage where I am tidying up the architecture to allow more of a plug-and-play feel for additional sensor modules. By plug and play, I mean that the modules are robot-independent and can simply be included in the code with no modification. Going ok so far. I'm also trying to encapsulate the SRF04 and servo turret as a single entity, so that theoretically 1 rangefinder on a turret behaves like 5 fixed rangefinders. Indeed, the next iteration robot will use a OS/RTOS of some description - hopefully not homebrew by me - and will allow me to use some more powerful programming models. Unfortunately, my limited skill in C is a bit of a weakness - I know what I want to do, but I don't know how to achieve it. I think function pointers are going to be involved.
Having said that, Scaredy has a four-component behaviour at present, which has seen it become pretty much unstoppable (except for getting snagged) - it has retreat, collision avoidance, wall-avoidance, and roam behaviours which are all indepenently coded. I'm thinking that an accelerometer would be a good way of detecting a stall or snagged condition. Also need to figure out how to avoid mindless loops (ie if A then B, if B then C, if C then A) which can happen over and over again in corners (although, remarkably, it does eventually break free).
I've also been reading Rodney Brooks book 'Robot: the future of flesh and machine' and now I realise that I am about 20 years behind the times! However, it was quite gratifying reading some of his approaches and seeing how I have been going down the same path anyway, fairly independently. I'm only 1/4 of the way through the book, though.