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

Cannot build a map

asked 2018-05-10 07:47:56 -0600

suzy419 gravatar image

updated 2018-05-10 07:58:32 -0600

gvdhoorn gravatar image

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>
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-05-06 00:04:52 -0600

jinseoi gravatar image

updated 2019-05-06 00:07:20 -0600

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.

edit flag offensive delete link more

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!

anonymous userAnonymous ( 2020-04-20 07:32:19 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2018-05-10 07:47:56 -0600

Seen: 1,495 times

Last updated: May 06 '19