How to get the Ping360 sensor data

Hello, I am using the STM32F407 development board to get the data of ping360 sonar, but I know that sonar needs to send a request from the host before returning data, but I do not know the specific request instructions, could you provide a PDF file about the communication protocol ? I just know the Request protocol version command, but I want to continue to get the ping360 sensor data, but I had not found relevant command.So I had to ask for help.

Thank you very much !

Hi @Lin,

As per the Ping360 section of the Ping Protocol, you need to send transducer (2601) messages in order to receive device_data (2300) messages. There’s a proposed auto_transmit message that would allow requesting a scanned region between two angles, but it’s not included in the currently available Ping360 firmware.

If you haven’t already I would recommend taking a look at our ping-cpp library, including the Ping360 transducer example :slight_smile:

@EliotBR 非常感谢您的回答。但是我使用的是keil5 IDE开发,我使用的语言是C,ping-cpp库是否可以使用?

Ping-cpp is a C++ library. There are a few different ways to use C++ from C, including using a C++ compiler, or potentially using a dynamic linked library (which may require modifying the ping-cpp code). It’s not something I have a lot of experience with, but it is possible at least in theory.

As you said, I looked at the protocol for 2601 transducer, but it’s not a hexadecimal instruction, and I want to get data by sending a hex instruction to Ping360, for example, like the get version protocol, sending 0x42, 0x52, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x05, 0x00, 0xa1, 0x00

I find it easiest to interrogate and play by using an interactive Python terminal together with our ping-python library. In this case to find the hex values you’re after you could do something like

>>> from brping import pingmessage, definitions
>>> m = pingmessage.PingMessage(definitions.PING360_TRANSDUCER)
>>> m.gain_setting = 0
>>> m.angle = 50
>>> m.transmit_duration = 11
>>> m.sample_period = 88
>>> m.transmit_frequency = 750
>>> m.number_of_samples = 400
>>> m.transmit = 1
>>> m.pack_msg_data()
bytearray(b'BR\x0e\x00)\n\x00\x00\x00\x002\x00\x0b\x00X\x00\xee\x02\x90\x01\x01\x00\xec\x02')
>>> m


--------------------------------------------------
ID: 2601 - transducer
Header: start_1: 66 start_2: 82 payload_length: 14 message_id: 2601 src_device_id: 0 dst_device_id: 0
Payload:
  - mode: 0
  - gain_setting: 0
  - angle: 50
  - transmit_duration: 11
  - sample_period: 88
  - transmit_frequency: 750
  - number_of_samples: 400
  - transmit: 1
  - reserved: 0
Checksum: 748 check: 748 pass: True
>>> print(*map(hex, m.msg_data))
0x42 0x52 0xe 0x0 0x29 0xa 0x0 0x0 0x0 0x0 0x32 0x0 0xb 0x0 0x58 0x0 0xee 0x2 0x90 0x1 0x1 0x0 0xec 0x2

which used the ping360 control example as a reference, and some of the default values from Ping Viewer for a 2m scan range (but with 400 samples, instead of the 1200 Ping Viewer uses).

1 Like

I’m really sorry to bother you again. I would like to ask whether you have the sonar underwater detection data set. I would like to conduct the analysis of sonar image processing

The forum is here for people to discuss marine robotics, so no need to apologise :slight_smile:

I’m not certain what you’re asking for here. @btrue has graciously shared some data from his dives here, which may be of interest, but if you’re after a dataset that includes object labels and positioning information or something then I’m not aware of any.

I am also using stm32 for development, but I have no response to send commands to Ping360 :worried:, can you please show me the code you use to send commands to Ping360?