Ultrasonic Distance Sensor/ Module

Post all your hardware and software upgrades/projects here.

Re: Ultrasonic Distance Sensor/ Module

Postby mrmacro » Mon Aug 05, 2013 12:37 am

If you look at the code for ping() you will see that there are a couple of different problem cases that it deals with. Some of these cases will likely cause ping() to take a long time. Add to that the fact that you are actually calling ping() multiple times for each position, some of the measurements will take longer than others.

I found that I had to surround Hexy with a semi-circular wall to get a reasonably smooth run through the arc. However, even then it was sometimes not smooth and those were likely the times that I got bad readings.

I have a version with reworked parsing logic that I posted here earlier. I have actually merged this into the code-base for the next Hexy software release. Email me direct, via this forum, and I will send you the updated files.

Using the new syntax I ran a number of multiPing() calls using 15 measurements each without moving Hexy's head.
Once I got 4 readings of exactly 19.31 but most of the time I got readings in the 17.8 to 20.2 range. However, there were a number of times that I got a response in the 1.2 to 6.0 range.

The new command parser makes it easy to take a lot of readings. Now we just need to dig into the potential reasons for the problems. I would expect a reasonably consistent answer using 15 measurements.
mrmacro
 
Posts: 12
Joined: Fri Jul 12, 2013 12:16 am

Re: Ultrasonic Distance Sensor/ Module

Postby rpcook » Mon Aug 05, 2013 5:46 pm

mrmacro, I'd love to have a look at your code, I'll pm you with my email address.

As for the apparent variation in the distances returned by the sensor, I'd expect to see some range of answers, just because it's measuring reality and noise will always creep in. Signal processing and data integrity is a part of my day job, so if I can start to get reliable multiPing() series of measurements back it shouldn't be too difficult to improve the reliability of these numbers being returned.
Rob
A record of my exploits and musings with Hexy and Sparki: http://robcook.eu, content available under a Creative Commons license.
rpcook
 
Posts: 121
Joined: Tue Sep 04, 2012 6:42 pm
Location: Luton, UK

Re: Ultrasonic Distance Sensor/ Module

Postby mrmacro » Mon Aug 05, 2013 9:27 pm

I have sent you the code in a ZIP file.
I was not too concerned about the readings from 17 to 20 when 19 was expected. However, when taking the median of 15 readings, I thought that answers less than 7 were a bit unexpected.

I suspect that one potential issue is that ping() does not indicate which kind of error it got. When navigating, the difference between "too far" and "too close" has real meaning to decision making logic. The other errors are just errors.

The multiPing() logic just piles all these zeroes into the array and counts them when finding the median. That is clearly wrong also. That means that there are two places to look for errors.

The new logic has been repaired so that if you tell multiPing() to return the median of just one reading, you will get whatever the only call to ping() returned. I suggest that you start with something like #1mMMMMM and see what you think of those results.

Good luck
mrmacro
 
Posts: 12
Joined: Fri Jul 12, 2013 12:16 am

Re: Ultrasonic Distance Sensor/ Module

Postby wokman10 » Tue Aug 27, 2013 10:26 pm

I get this error:

Servotor32.cpp: In member function 'void Servotor32::processChar(char)':
Servotor32.cpp:388: error: 'arcPing' was not declared in this scope
Servotor32.cpp: At global scope:
Servotor32.cpp:479: error: no 'void Servotor32::arcPing()' member function declared in class 'Servotor32'

How do I fix it?

Thanks
Walker
Thanks
Walker
wokman10
 
Posts: 15
Joined: Tue Aug 27, 2013 6:10 pm

Re: Ultrasonic Distance Sensor/ Module

Postby rpcook » Wed Aug 28, 2013 6:17 am

Hi Walker,

Is that error being thrown when you're using the Arduino programmer?
Rob
A record of my exploits and musings with Hexy and Sparki: http://robcook.eu, content available under a Creative Commons license.
rpcook
 
Posts: 121
Joined: Tue Sep 04, 2012 6:42 pm
Location: Luton, UK

Re: Ultrasonic Distance Sensor/ Module

Postby michal » Wed Aug 28, 2013 9:58 am

wokman10, you have to put declaration of arcPing() into Servotor32.h
michal
 
Posts: 36
Joined: Thu Jun 06, 2013 7:01 pm
Location: Delft, NL

Re: Ultrasonic Distance Sensor/ Module

Postby wokman10 » Wed Aug 28, 2013 11:51 am

Yes this the error I get from Arduino programmer and what line do I declare arcPing() in Servotor32.h

Thanks
Walker

P.S Rob I've read your whole Hexy website :D
Thanks
Walker
wokman10
 
Posts: 15
Joined: Tue Aug 27, 2013 6:10 pm

Re: Ultrasonic Distance Sensor/ Module

Postby rpcook » Wed Aug 28, 2013 12:04 pm

Walker, thanks for the note.

If you're trying to get Hexy just up and running, you can use the stock Servotor32 code from the main Arcbotics website. This thread is about how to get the ultrasonic distance sensor playing nice with Hexy, which might be more than you need right now.

I think Michael has posted a link to his version of the Servotor32 in an earlier post, if you're interested.
Rob
A record of my exploits and musings with Hexy and Sparki: http://robcook.eu, content available under a Creative Commons license.
rpcook
 
Posts: 121
Joined: Tue Sep 04, 2012 6:42 pm
Location: Luton, UK

Re: Ultrasonic Distance Sensor/ Module

Postby wokman10 » Wed Aug 28, 2013 12:07 pm

In the beginning after

#define GROUPS 4
#define SERVOS_PER_GROUP 8

Do I just put #define ARCPING()

Thanks
Walker
Thanks
Walker
wokman10
 
Posts: 15
Joined: Tue Aug 27, 2013 6:10 pm

Re: Ultrasonic Distance Sensor/ Module

Postby wokman10 » Wed Aug 28, 2013 12:11 pm

Well, yes I have Hexy up and running. I've had Hexy for a month and I've fix/made a few programs and learned a little python.
I'm trying to get you explore program work.

Oh and check out my website walkerwhitehouse.com I made it myself

Thanks
Walker
Thanks
Walker
wokman10
 
Posts: 15
Joined: Tue Aug 27, 2013 6:10 pm

PreviousNext

Return to Projects and Upgrades

Who is online

Users browsing this forum: No registered users and 2 guests

cron