Dear Eliot,
Thanks for your reply.
These are our config parameters used.
{
"ping360": {
"dead_zone_m": 1,
"intensity_threshold": 20,
"range_m": 30,
"sector_angle_deg": 180,
"transmit_duration": 27,
"resolution_deg": 10,
"transmit_frequency": 750,
"speed_of_sound_m/s": 1500,
"gain_setting": 1,
"minProminence": 0.05,
"headDown": true,
"normaliseValue":255
}
}
This is the mechanism we are using for data accessing. we are using auto transmit mode. We need 180 sector data hence we are fetching ±sector/2 from current heading and further we are normalising data with current heading and wrapping the edge angles.
bool SonarDevice::scanAngleRange(int start_idx, int stop_idx, int scanIdx, std::shared_ptr<SectorScanData> sectorScanData) {
try {
device.set_auto_transmit(
1, // mode (always for ping360)
gain_setting, // gain_setting
transmit_duration, // transmit_duration
samplePeriodTicks, // sample_period in 25nsec increments (80 to 40000 == 2 microseconds to 1000 microseconds)
transmit_frequency, // transmit_frequency
number_of_samples, // number_of_samples
gradianLookup[start_idx], // start_angle
gradianLookup[stop_idx], // stop_idx
resolution, // number_of_steps(converted to gradians)
0 // delay
);
for (int idx = start_idx; idx <= stop_idx; idx++) {
// Timer timer("SectorScan_" + std::to_string(scanIdx) + "_Angle_" + std::to_string(gradianLookup[idx]));
std::vector<uint8_t> intensity;
// index to actual degrees
int angle_degrees = idx * resolution;
const auto message_device_data = static_cast<const ping360_auto_device_data *>(device.waitMessage(Ping360Id::AUTO_DEVICE_DATA, 1500));
// if (angle == gradianLookup[idx]){
// SPDLOG_LOGGER_INFO(g_ping360_logger, "Angle recieved and expected MATCH {} {}", angle, gradianLookup[idx]);
// }
// else{
// SPDLOG_LOGGER_INFO(g_ping360_logger, "Angle recieved and expected DO NOT MATCH {} {}", angle, gradianLookup[idx]);
// return false;
// }
if (message_device_data) {
// int angle = message_device_data->angle();
// SPDLOG_LOGGER_INFO(g_ping360_logger, "[Ping360] Recieved data for angle {} grads ({} degs)", angle, angle_degrees);
} else {
SPDLOG_LOGGER_ERROR(g_ping360_logger, "[Ping360] Failed to receive data for angle: {} degrees", angle_degrees);
// timer.stop();
// timer.print();
return false;
}
// timer.stop();
// timer.print();
uint8_t *scanData = message_device_data->data();
int dataLen = message_device_data->data_length();
intensity.resize(dataLen);
for (int i = 0; i < dataLen; i++) {
intensity[i] = scanData[i];
}
sectorScanData->scanIntensities.push_back(intensity);
sectorScanData->angles.push_back(angle_degrees);
}
return true;
} catch (const std::exception &e) {
SPDLOG_LOGGER_ERROR(g_ping360_logger, "[Ping360] Exception in scanAngleRange: {}", e.what());
return false;
}
}
We have few quaries
- As we are using auto transmit mode however we want to write each time sector width data to shared memory is this the process correct.
- As ping 360 scan 270 to 0 to 90 then while going back also will it scans for example 90 to 0 to 270
Please provide the suggestions as soon as possible.
I am also ccing Ms.Sowkh who is extensively using ping360 for data fetching and writing into shared memory.