Obtaining raw data from the Ping360 using Ping-cpp

Hi there! We have been looking at using the ping-cpp library to obtain the raw sonar intensity data recorded from the ping360. We have set our system up so we conduct a set_auto_transmit() by following the example code from test-device-ping360.cpp at ping-cpp/test/test-device-ping360.cpp at master · bluerobotics/ping-cpp · GitHub. Is it correct to assume that the following lines obtain and store the raw data?


  for(int number = 0; number < 200; number += 1) {
        [[maybe_unused]] const auto message_device_data = static_cast<const ping360_auto_device_data*>(device.waitMessage(Ping360Id::AUTO_DEVICE_DATA, 8000));
        assert(message_device_data);
        assert(message_device_data->angle() == number);
    }

If not, what is the best way to access the raw data after conducting an auto_transmit?

Thank you!

Hi @blutonomy,

Apologies for the confusion here - while the latest version of ping-protocol has a specification for auto-transmit functionality for the ping360 message set, there is not yet a released Ping360 device firmware that supports it.

The existing test code has been set up to help us evaluate an upcoming firmware (and to serve as an example in future, and for any current users with custom devices/drivers that support ping-protocol’s ping360 message set) although it really aught to be checking the connected device’s reported protocol version before deciding whether to use auto-transmit control messages, or fall back to only manually looping through angles with the lower level transducer control messages.

Those lines wait for and receive a data message into the message_device_data variable, then perform some basic checks to make sure the message was actually received and is the intended one, then move on to the next iteration (discarding the data from the previous one in the process).

For non-test applications you’ll likely want to write some code to process and/or persistently store the received data as well :slight_smile: