Shop OBEX P1 Docs P2 Docs Learn Events
Problems with Ping)) — Parallax Forums

Problems with Ping))

fitzfitsaherofitzfitsahero Posts: 2
edited 2007-04-24 02:55 in BASIC Stamp
I'm doing a robotics competition and we're using the BS2, BOE-BOT, and Ping)) sensors.
What I'm doing is going back and forth along a 12' course, dropping ping-pong balls into
cups. I'm using the ping sensors to control when the robot stops. The problem I'm having
is that sometimes the ping sensor reads at the wrong time and drops a ball. The sensor is
set to stop and drop the balls at 18cm or less. I'm not sure if its a loose connection, or the fact
that the sensor pins are facing upwards.

Any help would be greatly appreciated.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-23 18:52
    It shouldn't make any difference whether the sensor pins are upwards or downwards. There should be enough pressure to maintain a good connection. You can always use a piece of duct tape to take the weight of the connecting wires off the connection. If you have a loose connection, you would probably see missing PING readings or wildly erroneous distance measurements. Most likely you have something strange going on in your program.
  • fitzfitsaherofitzfitsahero Posts: 2
    edited 2007-04-24 00:39
    Theres nothing wrong with the program, I've written it using the ping demo code from parallax,
    and I've just mirrored it depending on the direction that the robot is traveling. So when the robot
    is going forward, the front sensor is pinging, and when the robot is going backwards, the back sensor
    is pinging. The main problem is that it only happens some of the time.
  • dbc1218dbc1218 Posts: 33
    edited 2007-04-24 02:36
    Does your program wait for the first time a reading of less than 18cm is taken and then goes to droping the ball? If it does and you get one crazy value from the ping it could throw everything off and this might only happen on occasion like you explained. You could try changing the program to wait to get multiple readings of less than 18cm from the ping and then drop the ball. I was in a competition a while back and had to do something similar and when you get one bad reading everything goes down the tubes. Your competition sounds like the science olympiad's robot ramble is that it or is it something else.
  • DufferDuffer Posts: 374
    edited 2007-04-24 02:55
    If you're convinced that the code is OK and that the sensor is functioning properly (and it sounds like it is if it only gets a bad distance reading "some of the time", maybe it's time to look at the environment around your Bot and see if something is changing in a random way that would cause the kind of irratic behaviour that you describe. Things to consider:
    What sound reflecting surfaces are in the path of your Bot when it's pinging and does the size, angle, distance change while you're competing?

    Are there other Bots with PING sensors in the area while your Bot is running? Imagine what would happen if you fired up your Bot and started pinging while pointing it in the direction of another Bot while it's trying to ping (All's fair in love and war (including robot competitions)).

    Angle of the sensor relative to the surface it's running on. If you sensor is aimed downward to any degree, you may be picking up an echo from the surface it's running on or imperfections or seams in the surface. Try raising the angle of the sensor (if you start having trouble picking up shorter targets, try lowering the whole sensor.

    I don't know if any of these things are causing you particular problem, but they're the kinds of problems that I've run into at times using the PING sensor.

    One last thought. You can try using a "rolling average" for your distance measurement instead of a accepting each and every distance as correct and taking action based on the results of a single bad reading. If you average the last 3, 4 or 5 ping distances, a single (or even multiple) bad reading whould not cause a premature drop (in systems design, this is called fault tolerant).

    Good luck, Steve

    Post Edited (Duffer) : 4/24/2007 3:08:25 AM GMT
Sign In or Register to comment.