Ping360 obstacle detection working poorly

Dear Eliot,
I am using ping 360 for obstacle detection however I am experiencing most of the times false detection and sometimes if obstacle is there also it is not detecting.
can you please suggest.. It is common do i need to change any setting or Do I need to make any configuration changes.

Thanks & Regards,
Dr. Shakeera

Hi @DrShakeera, welcome to the forums :slight_smile:

Cool!

What kind of algorithm are you doing for object detection? The Ping360 just gives profiles of pulse echo strength, so depending on how much of the beam an object is reflecting (from its size, relative distance, orientation, and density relative to the surrounding water) it may have strong or weak responses to any given object.

Depending on your detection algorithm that could cause challenges with reliably detecting obstacles, especially given the vehicle can be rotating while the sonar scans, and the obstacles can move as well (which can cause issues if you’re trying to track them persistently over time).

The Ping360 also only scans around a plane, so if you move your vehicle orthogonal to that plane (e.g. up/down when the sonar is scanning horizontally) then the sonar won’t detect obstacles in the direction/path of motion.

That depends a lot on your current configuration, what kind of conditions you’re operating in, and what kind of failures you’re experiencing - none of which you’ve shared.

Have you tried running the Ping360 with Ping Viewer, and seeing whether the kinds of obstacles you’re trying to detect show up reliably in the sonar signal?

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

  1. 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.
  2. 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.

These parameters suggest you have some kind of object/peak detection algorithm running, but you haven’t shared the code for that, so it’s not possible to comment on what’s likely to be causing your failed detections (beyond the physical/environment suggestions I made in my previous comment).

As above,

I’m not entirely sure what you’re asking here, or what your use-case is. You mentioned requesting scan ranges based on the vehicle’s heading, but if the Ping360 is fixed to your vehicle then the angular range of your sectors should generally be fixed, potentially with a fixed offset for the orientation difference between the sonar and the vehicle, and possibly (likely minor) adjustments to account for differences between the heading (direction of travel) and the bearing (direction the vehicle is facing).

You haven’t shared the code that handles this though, so it’s possible you’re already doing that.

If I’m understanding your question correctly, yes, sector scans are performed in bouncing cycles (so it turns around when it reaches the end of the sector, and starts scanning back towards the start).

1 Like

A post was merged into an existing topic: Ping360 auto_transmit clarification