ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OK, I have known what happened in this situation. The warning is thrown from the following code in karto.cpp of open_karto

  kt_bool LaserRangeFinder::Validate(SensorData* pSensorData)
  {
    LaserRangeScan* pLaserRangeScan = dynamic_cast<LaserRangeScan*>(pSensorData);

    // verify number of range readings in LaserRangeScan matches the number of expected range readings
    if (pLaserRangeScan->GetNumberOfRangeReadings() != GetNumberOfRangeReadings())
    {
      std::cout << "LaserRangeScan contains " << pLaserRangeScan->GetNumberOfRangeReadings()
                    << " range readings, expected " << GetNumberOfRangeReadings() << std::endl;
      return false;
    }
    return true;
  }

It will compare the range size calculated by the max/min angle and resolution from laser scan info with the size of data of laser scan. You can find the relevant codes in karto.h(I attach some key codes below)

void Update()
{
  m_NumberOfRangeReadings = static_cast<kt_int32u>(math::Round((GetMaximumAngle() -
                                                                GetMinimumAngle())
                                                                / GetAngularResolution()) + 1);
}

and

m_NumberOfRangeReadings = static_cast<kt_int32u>(rRangeReadings.size());

The right solution to solve this problem is to check if the size of the laser data matches the size calculated by max/min angle and resolution from the laser scan. Maybe it is a computational accuracy problem.

OK, I have known what happened in this situation. The warning is thrown from the following code in karto.cpp of karto.cpp of open_karto

  kt_bool LaserRangeFinder::Validate(SensorData* pSensorData)
  {
    LaserRangeScan* pLaserRangeScan = dynamic_cast<LaserRangeScan*>(pSensorData);

    // verify number of range readings in LaserRangeScan matches the number of expected range readings
    if (pLaserRangeScan->GetNumberOfRangeReadings() != GetNumberOfRangeReadings())
    {
      std::cout << "LaserRangeScan contains " << pLaserRangeScan->GetNumberOfRangeReadings()
             << " range readings, expected " << GetNumberOfRangeReadings() << std::endl;
      return false;
    }
    return true;
  }

It will compare the range size calculated by the max/min angle and resolution from laser scan info with the size of data of laser scan. You can find the relevant codes in karto.h(I karto.h(I attach some key codes below)

void Update()
{
  m_NumberOfRangeReadings = static_cast<kt_int32u>(math::Round((GetMaximumAngle() -
                                                                GetMinimumAngle())
                                                                / GetAngularResolution()) + 1);
}

and

m_NumberOfRangeReadings = static_cast<kt_int32u>(rRangeReadings.size());

The right solution to solve this problem is to check if the size of the laser data matches the size calculated by max/min angle and resolution from the laser scan. Maybe it is a computational accuracy problem.