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.
