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
0

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 77 times

Last updated: May 06