Shop OBEX P1 Docs P2 Docs Learn Events
Boe-Bot Ping )))) — Parallax Forums

Boe-Bot Ping ))))

Andy SismeyAndy Sismey Posts: 6
edited 2007-01-04 17:14 in Robotics
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 ?

roll.gif

Cheers

Comments

  • lboucherlboucher Posts: 139
    edited 2007-01-04 14:44
    In the book that came with the boe there is an example of solving the problem when encountered for whiskers. But the code is hard to read.
    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.
  • Andy SismeyAndy Sismey Posts: 6
    edited 2007-01-04 14:53
    Hi,

    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·
  • FranklinFranklin Posts: 4,747
    edited 2007-01-04 16:24
    The idea is to keep track of the number of attempts and when you get enough failures to turn 180 degrees and move off in a new direction or quit turning back and forth and keep turning in one direction until you are clear. The idea behind the boe-bot is to learn so I will leave the code up to you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Steve JoblinSteve Joblin Posts: 784
    edited 2007-01-04 16:30
    The idea is to look for a pattern... If the robot turns left, then right, then left, then right, then left, then right, you can assume that it is "stuck".

    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.
  • Andy SismeyAndy Sismey Posts: 6
    edited 2007-01-04 17:14
    Ahhhh !!

    Good idea's ill give them a try !!

    Thanks so much for your help !!

    Cheers


    Andy
Sign In or Register to comment.