honyoker / arduino-new-ping

Automatically exported from code.google.com/p/arduino-new-ping
0 stars 0 forks source link

ping_median seems to freeze a lot #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use the function ping_median(5) in the loop() method 
2.
3.

What is the expected output? What do you see instead?
Expect reliable and continuous operation without freezing. Instead after a few 
seconds the adruino often freezes. I have a delay(50) in my loop.
ping() works very reliably without freezing, but ping median seems to have 
issues.

What version of the product are you using? On what operating system?
Downloaded on 02 JUNE 2013

Please provide any additional information below.
NO additional information.

Original issue reported on code.google.com by skip.mor...@gmail.com on 2 Jun 2013 at 9:01

GoogleCodeExporter commented 9 years ago
I've not experienced this issue nor has it been reported previously.  I would 
try to change the PING_MEDIAN_DELAY value in the NewPing.h file.  This sets the 
time delay between pings.  The delay(50) that you're using is between groups of 
pings, not between the 5 pings sent during a ping_median().  Changing this to 
50000 microseconds is a good starting point to diagnose a problem.  My guess is 
that the particular sensor you are using needs slightly more time between pings 
to reset.  It's still odd that it would freeze, as even if I set that value to 
1000 it won't freeze for me.

Original comment by eckel.tim on 15 Jul 2013 at 1:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Please report this in a more appropriate place.

Original comment by eckel.tim on 19 Sep 2013 at 6:58

GoogleCodeExporter commented 9 years ago
I am currently experiencing the same issue.

I am working on a obstacle sensing bot using 2 motors on a Tamiya double 
gearbox tracked chassis being driven by a second power source (6 AAA) 
batteries) and a L293D H Bridge as a controller.  The 5v source on my Arduino 
Uno V3 is powering the H Bridge, a mini servo (with a 100uF capacitor), and a 
HC-SR04 ultrasonic sensor.  I am using pin 8 for both the TRIGGER and ECHO.

I have only experienced system freezes when the bot is in 'Drive' mode.
During this time the code :
1) sets the speed on the 2 (Left & Right) Enable pins on the H Bridge.
2) calls myServo.ping_median(5).
3) evaluates the resulting range.
4) stops the bot if a collision is about to occur.

This loop runs about once every 50ms

It gets through between 3 and 20 loops before a call to myServo.ping_median() 
hangs the system (i have tried args of 3 and 5).  sometimes, but not always, 
the hang is so severe that the Uno drops the serial connection to the monitor.  
The motors, however, always keep running.

I have yet to experience this failure if I replace the call to ping_median() 
with ping().  Although this is undesirable since the resulting ranges are 
fairly inaccurate and frequently cause the bot to 'see' obstacles which do not 
exist.

Original comment by craig.n....@gmail.com on 12 Jun 2014 at 5:20