Robotics StackExchange | Archived questions

Cannot build a map

when i launch the file in ubuntu 14.04 indigo ,it show some message :

/slam_karto/resolution: 0.025

NODES / slam_karto (slam_karto/slam_karto)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found process[slam_karto-1]: started with pid [11332] [ INFO] [1525954587.980608653]: laser base_scan's pose wrt base: 0.254 0.000 0.000 Info: clipped range threshold to be within minimum and maximum range! Registering sensor: [base_scan] LaserRangeScan contains 720 range readings, expected 721

it cannot show a map in rviz.

this is my launch file:

<launch>
  <node pkg="slam_karto" type="slam_karto" name="slam_karto" output="screen">
    <remap from="scan" to="scan"/>
    <param name="odom_frame" value="odom"/>
    <param name="map_update_interval" value="25"/>
    <param name="resolution" value="0.025"/>
  </node>
</launch>

Asked by suzy419 on 2018-05-10 07:47:56 UTC

Comments

Answers

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.

Asked by jinseoi on 2019-05-06 00:04:52 UTC

Comments

Thanks! I was having the issue as described in the question and was able to fix it by modifying the values I set for angle max and min when modelling the laser range finder!

Asked by anonymous49656 on 2020-04-20 07:32:19 UTC