Subject:
|
Re: -1 with sonar routines?
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sun, 29 Nov 1998 18:17:55 GMT
|
Original-From:
|
Will <willbain@cs.umt.edu=StopSpam=>
|
Reply-To:
|
WILLBAIN@CS.antispamUMT.EDU
|
Viewed:
|
2550 times
|
| |
| |
Peter Eacmen wrote:
> What causes a -1 with the sonar routines. I checked about all the connections that I could think of. Any help would be appreciated
The elapsed time calculation can result in negative numbers since the
system clock wraps back to zero when it's maxed out. If the elapsed
time comes up negative, then the sonar_sample() and sonar_closeup()
functions return -1.
This could be due to the obstacle being very distant, accoustically
damped, or at such an angle that the echo bounces away from the
transducer. My sonar will generally not "see" smooth walls at an acute
angle.
You might get more consistent results and maybe a little more range out
of your sonar if you change the code to compensate for the negative
elapsed times. I think you could just add 32768 to the negative result.
You may still occasionally get sporadic readings for other reasons
(electrical noise, etc.). To filter out the noisy readings, try using
the median of three consecutive readings. It works almost perfectly for
my robot. Besides, the way I defined the timing of the pings, my sonar
makes a "galloping" sound. Good luck!
-- Will
, ,
__@_/ \_@__ |/
| /__, o @_/
)\ ) ( \ (\/\\,
~~~~~~~~~ ' ` ~~~~~~~~~~~ ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wendy Parson, America's one of the finest countries
Will Bain, anyone ever stole.
& Tatoosh --Bobcat Goldthwait
|
|
Message is in Reply To:
| | -1 with sonar routines?
|
| What causes a -1 with the sonar routines. I checked about all the connections that I could think of. Any help would be appreciated Thank you, -Peter ---...--- Peter Eacmen Boston Latin School babylongod@usa.net Knowledge is power, power is money, (...) (26 years ago, 29-Nov-98, to lugnet.robotics.handyboard)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|