Request help understanding the Sonar Return Graph

Hello all, I was collecting profile data from the Ping 2 sonar, converting the string into values between 0 - 255 and plotting them. The attached image shows the profile return strength plotted for a scan range of 3.9 meters. I am trying to understand why the sonar is estimating a distance of 4.71 meters, when the profile distance clearly shows that there is strong return around 0.5 meter. My scan range is set such that the sonar looks for obstacles about 1.1 meters ahead of itself for a distance of 4 meters.

This sonar is mounted forward facing on the USV(pitch down angle of 12.5 degrees to compensate for the half - beam angle) and is about 1.1 meters behind the bow of the USV. These are my Sonar settings:

Sonar Mode: Manual
Sonar Scan Start: 1100 mm
Sonar Scan Length: 4000 mm
Sonar Gain: 4 (This I did not set, hence not sure if it is right)

I could really use some help understanding this graph.

A couple of thoughts: If you’re start is at 1100mm, the first signal return you get is at that range (not 0). If I recall, Ping 2 has more than 8 bits of profile data, no? If so, why is it saturating at 255? If your target really is at 0.5 m you’ll never see it because the return doesn’t start until 1100mm.

WRT the question about the bottom detection, keep in mind that to compare echo strength over range you need to compensate for the spreading loss with range. I don’t recall if Ping profile data is signal or power levels. Signal decreases with square of range, and power with the 4th power.

If I understand right, the half meter high strength return I get is in range of 1100mm to 4000mm correct? Are you suggesting that I should plot starting from 1100 to 4000, instead of starting from Zero?. My logic of starting from is because, thats the distance in front of the boat, that we care care about from a obstacle avoidance perspective.

If the signal is 8 bits, shouldn’t it be 0 - 255, because its an unsigned int?

I will look into what kind of data they provide, is it signal or power? Thank you for your comments

Yes if it is 8 bits it would go from 0 to 255. But I think it’s more than 8 bits.
You can plot it however it makes sense for you, but just remember that the signal profile does start at 1100mm.

I see what you mean, so do you think the values it returns is the distance from the sonar sensor to the obstacle, or is it distance assuming the scan start as zero. For example, the distance it reads is 1 meter with a scan start of 1100mm, it means the obstacle is at a distance of 2.1 meters from the sonar sensor?

Reported distance is from the sensor, so yes 2.1 m as you describe.

Hi @dskumar,

This sounds potentially problematic, depending on how you’re approaching it.

These forum posts may be worth a read through:

Hey Eliot, so I am converting the data as a list of integers in python:
“profile_data = list(profile_data_raw)” # Convert to a list of integers.
Is that correct?