I'm trying to modify the roaming with IR on the BOE BOT to escape corners. I have tried using arrays and other techniques, but no luck. Any help would be appreciated. Thanks
Here's a tip -- check out the code in Robotics with the Boe-bot for roaming with whiskers -- there is code there for escaping corners when navigating with the tactile sensors. The same concept can be applied to roaming with IR.
In pseudo-code:
if IRleft then
turn right
if oldIR = right
count = count + 1
else
count = 0
endif
oldIR = left
else if IRright then
turn left
if oldIR = left
count = count + 1
else
count = 0
endif
oldIR = right
endif
if count > 3 then 'or however many bounces back and forth you want to limit it to
backup and turnaround
count = 0
endif
Make sense? Basically you want to add to your count ONLY if the last thing you did was an IR avoid from the OTHER side (so you are counting the times you are bouncing back and forth between left/right IR avoids). If the count gets too big, do something else.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
boe bots are fun!
I won the synopsis science fair last year for doing what you are doing, once you are done with that project, try adding a CMUcam! for vision
-peace
Comments
In pseudo-code:
Make sense? Basically you want to add to your count ONLY if the last thing you did was an IR avoid from the OTHER side (so you are counting the times you are bouncing back and forth between left/right IR avoids). If the count gets too big, do something else.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
I won the synopsis science fair last year for doing what you are doing, once you are done with that project, try adding a CMUcam! for vision
-peace