Ping 1D Profile Data Understanding

Hi!
I have a problem with understanding which values from profile data are distances and confidences of measurements. I obtain following data :

b'\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xbb5\x02\x11H\x8b\xbf\xba\x8drk^Ze\x9c\xd3\xfd\xfb\xd0\xb4\xb4\xc0\xc8\xda\xe3\xdd\xb6w3\x0b\x02\n\x17(6GLH:$\x0f\x03\x10+IN8\x1c\r\x12\x1e&"\x16\x0b\x03\x01\x07\x10\x12\x0e\x05\x01\x02\x06\x08\x08\x05\x03\x03\x03\x06\x0b\x0e\x11\x12\x0f\t\x04\x03\x03\x04\x03\x01\x00\x00\x01\x02\x02\x01\x00\x01\x03\x04\x05\x03\x01\x00\x00\x01\x02\x02\x00\x00\x00\x01\x03\x03\x03\x03\x03\x02\x03\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

and using code in Python I convert it to decimal data:

98 39 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 102 100 92 120 98 98 53 92 120 48 50 92 120 49 49 72 92 120 56 98 92 120 98 102 92 120 98 97 92 120 56 100 114 107 94 90 101 92 120 57 99 92 120 100 51 92 120 102 100 92 120 102 98 92 120 100 48 92 120 98 52 92 120 98 52 92 120 99 48 92 120 99 56 92 120 100 97 92 120 101 51 92 120 100 100 92 120 98 54 119 51 92 120 48 98 92 120 48 50 92 110 92 120 49 55 40 54 71 76 72 58 36 92 120 48 102 92 120 48 51 92 120 49 48 43 73 78 56 92 120 49 99 92 114 92 120 49 50 92 120 49 101 38 34 92 120 49 54 92 120 48 98 92 120 48 51 92 120 48 49 92 120 48 55 92 120 49 48 92 120 49 50 92 120 48 101 92 120 48 53 92 120 48 49 92 120 48 50 92 120 48 54 92 120 48 56 92 120 48 56 92 120 48 53 92 120 48 51 92 120 48 51 92 120 48 51 92 120 48 54 92 120 48 98 92 120 48 101 92 120 49 49 92 120 49 50 92 120 48 102 92 116 92 120 48 52 92 120 48 51 92 120 48 51 92 120 48 52 92 120 48 51 92 120 48 49 92 120 48 48 92 120 48 48 92 120 48 49 92 120 48 50 92 120 48 50 92 120 48 49 92 120 48 48 92 120 48 49 92 120 48 51 92 120 48 52 92 120 48 53 92 120 48 51 92 120 48 49 92 120 48 48 92 120 48 48 92 120 48 49 92 120 48 50 92 120 48 50 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 49 92 120 48 51 92 120 48 51 92 120 48 51 92 120 48 51 92 120 48 51 92 120 48 50 92 120 48 51 92 120 48 51 92 120 48 49 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 49 92 120 48 49 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 92 120 48 48 39

My code in Python:

from brping import PingParser, PingMessage, Ping1D
import time

myPing = Ping1D()           # obiekt klasy Ping1D
myMessage = PingMessage()   # obiekt klasy PingMessage
myParser = PingParser()     # obiekt klasy PingParser

myPing.connect_serial("COM4",115200)    # połączenie echosondy z komputerem
#myPing.set_ping_interval(200)           # ustawienie przedziału czasowego pomiędzy pomiarami
myPing.initialize()                     # inicjacja pracy echosondy
myPing.set_ping_enable(1)
time.sleep(1)

predkosc = myPing.get_speed_of_sound()
print(predkosc)
myMessage = myPing.get_profile()            # odczyt profilu danych
#data = myMessage.unpack_msg_data()
#myMessage = myParser.parse_byte(myMessage)  # dekodowanie informacji z profilu
dystanse = str(myMessage['profile_data'])
print('\n',dystanse,'\n')
print(' '.join(str(ord(c)) for c in dystanse))

There is an option to handle this problem with brping library? If yes, please let me know by share code.

Hi @Bartosz, welcome to the forum :slight_smile:

I have edited your post to include some code blocks so itā€™s more readable. You can learn how to do that in the How to Use the Blue Robotics Forums post.

As per the ping protocol docs, the profile data is

There is no ā€œconfidenceā€ for those values, because they are the samples from the transducer, measuring the sound intensities over time in response to a single ping. In Ping Viewer, one profile corresponds to one vertical line.

Each profile also has a distance estimate, which is calculated by the sensor firmware from the data in that profile and the measurements that came before it. It also includes a measure of confidence, which is how sure the sensor is that its ā€œdistanceā€ estimate is correct. You can access those values with myMessage['distance'] and myMessage['confidence'].

If you only want the distance estimate and confidence (and donā€™t need the profile data), you can use the myPing.get_distance() function instead of myPing.get_profile(), as in our example. The profile data is only useful if you want to do your own processing of it, for example to try to calculate your own alternative distance estimates, or maybe to try to estimate material types or surface shapes or something.