karto运行报错LaserRangeScan contains 360 range readings, expected 361

process[slam_karto-1]: started with pid [3612]
[ INFO] [1521607328.487113394]: laser base_scan's pose wrt base: -0.032 0.000 0.000
Info: clipped range threshold to be within minimum and maximum range!
Registering sensor: [base_scan]
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
LaserRangeScan contains 360 range readings, expected 361
已邀请:

ncnynl

赞同来自:

 
https://answers.ros.org/questi ... arto/
http://docs.ros.org/kinetic/api/open_karto/html/Karto_8h_source.html
 
 
修改:
 
nav2d_karto/OpenKarto/source/OpenKarto/Sensor.h文件
 
找到

 m_NumberOfRangeReadings = static_cast<kt_int32u>(math::Round((GetMaximumAngle() - GetMinimumAngle()) / GetAngularResolution()) + 1);
 
修改为:
 
m_NumberOfRangeReadings = static_cast<kt_int32u>(math::Round((GetMaximumAngle() - GetMinimumAngle()) / GetAngularResolution()));
 
 

Elodie - 啦啦啦里

赞同来自:

如果是通过 apt-get install ros-kinetic-slam-karto 安装的话,上述头文件可能在 /opt/ros/kinetic/include/open_karto/Karto.h 中
但是 apt-get 下载的文件不能直接修改,需要下载源码再重新编译。
 
需要下载open-karto 和 slam-karto源码  (我的权限不够不能贴链接,大家自己找一下)
 
可以在ROS工作包caktkin_ws中的源码文件夹src中下载git源码
cd  ~/catkin_ws/src

git clone ........


下载完之后再修改 Karto.h 头文件中的上述代码,即
找到

 m_NumberOfRangeReadings = static_cast<kt_int32u>(math::Round((GetMaximumAngle() - GetMinimumAngle()) / GetAngularResolution()) + 1);
 
修改为:
 
m_NumberOfRangeReadings = static_cast<kt_int32u>(math::Round((GetMaximumAngle() - GetMinimumAngle()) / GetAngularResolution()));
 
 
再重新编译
 
cd  ~/catkin_ws

catkin_make
 
就可以啦~
 

要回复问题请先登录注册