View Full Version : Problems with Ping))
04-24-2007, 12:22 AM
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.
04-24-2007, 01:52 AM
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.
04-24-2007, 07:39 AM
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.
04-24-2007, 09:36 AM
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.
04-24-2007, 09:55 AM
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