Boe-Bot Ping ))))
Andy Sismey
Posts: 6
Hi,
Does anyone have any suggestions on how I would go about writing code so when using only ping for roaming and the bot becomes cornered that it can escape, I have written the body of the code to roam but once it gets stuck in a corner it will happily go back and forth until the batteries run out !
I need to write something that counts the number of tries it'· had at· forward and reversing but just cant work it out ….. can anyone help ?
Cheers
Does anyone have any suggestions on how I would go about writing code so when using only ping for roaming and the bot becomes cornered that it can escape, I have written the body of the code to roam but once it gets stuck in a corner it will happily go back and forth until the batteries run out !
I need to write something that counts the number of tries it'· had at· forward and reversing but just cant work it out ….. can anyone help ?
Cheers
Comments
Is your ping stationary or mounted on a servo for a horizontal sweep. If you are sweeping the entire area and just always moving the vehicle in the direction of longest ping return. You could just set an overall minimum for turnaround. Such that if every value in the sweep is less than x cm then initiate a 180 degree turn in place.
The ping is fixed to the front of the Boe-Bot, I have read the code you were referring to but couldn't think of a way of adapting it for the ping, I'm quite new to BASIC Stamp
Cheers·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
If you are only using one Ping))) fixed mounted to the front of the BoeBot, you have no way of telling if the object is to the left, right, or in front of the BoeBot...
One approach is to set a loop that if the Ping))) detects an object, then turn right a bit and check again... if the Ping))) still detects an object, keep looping turning right a bit at a time until it does not detect an object.
You could then throw a random number in the mix to switch the above to turn left a bit at a time until no object is detected.
Good idea's ill give them a try !!
Thanks so much for your help !!
Cheers
Andy