Light Seeker, with obstacle avoidance
Update, 21/01/2014
I found that the ultrasonic sensor struggles with "box" obstacles towards its front flanks, probably due to reflection. Therefore to stop it "snagging" i had to add some bump switches (which i have been meaning to do for a while). I tried to add the bumps to interupts, but it ended up being so complex, it was much easier just to add this section of code into the begning of each "forward motion" while loop
if (digitalRead (LBumper) == LOW) { Serial.println("Left Bump interrupt"); BumpedLaction(); } if (digitalRead (RBumper) == LOW) { Serial.println("Right Bump interrupt"); BumpedRaction(); } else (Crack on!)
The bump code is really Dumb (simple), Upon bump, it backs up for half a second, then turns away from the bump for half a second (pivoting around the wheel on the bumped side) and then returns to the previous action. I have tried to build my sketch using lots of "voids", splitting each "action" into a seperate tab on the IDE. It makes it much easier to keep track of, and saves me from repeating myself over and over again.
It has taken me ages to get it to navigate a really simple course satisfactorly. To be honest, i think if i left it to its own devices it would get there in the end, but i wanted a relatively neat run for a video for you guys!
First Entry
Looking for a new objective, i decided to return to my "cyclops" light seeker, but add obstacle avoidance into it.
Using some Sugru (Awesome Christmas present) ive tidied up my Turret, and added a HC-SR04.
The objective is to navigate a floor, but to do so while navigating a maze of blockages. At this point they will be simple boxes, but i guess by working on the code and the "rules" it runs by, i could make it navigate proper mazes. The light seeker just acts as a "target" to work towards i guess, rather than just bimbling around in pointless circles
Suugruuuu:
Seek light & avoid obstacles
- Actuators / output devices: geared motors
- Control method: autonomous
- CPU: arduino uno
- Power source: 6V 4xAA for drive, 9V P for logic
- Programming language: wiring
- Sensors / input devices: HC-SR04, photoresistor
- Target environment: Floor