硬件设备:镭神c16
1、include/utility.h修改如下
extern const string pointCloudTopic = "/lslidar_point_cloud";
extern const string imuTopic = "/imu/data";
extern const bool useCloudRing = false; // if true, ang_res_y and ang_bottom are not used
extern const int N_SCAN = 16;
extern const int Horizon_SCAN = 2000;
extern const float ang_res_x = 0.18;
extern const float ang_res_y = 2.0;
extern const float ang_bottom = 15.0+0.1;
extern const int groundScanInd = 7;
2、修改imageproject.cpp,把cloudHeader.stamp = ros::Time::now();的注释去掉。
void copyPointCloud(const sensor_msgs::PointCloud2ConstPtr& laserCloudMsg){
cloudHeader = laserCloudMsg->header;
// cloudHeader.stamp = ros::Time::now(); // Ouster lidar users may need to uncomment this line
pcl::fromROSMsg(*laserCloudMsg, *laserCloudIn);
// Remove Nan points
std::vector<int> indices;
pcl::removeNaNFromPointCloud(*laserCloudIn, *laserCloudIn, indices);
// have "ring" channel in the cloud
if (useCloudRing == true){
pcl::fromROSMsg(*laserCloudMsg, *laserCloudInRing);
if (laserCloudInRing->is_dense == false) {
ROS_ERROR("Point cloud is not in dense format, please remove NaN points first!");
ros::shutdown();
}
}
}
3、修改run.launch
<param name="/use_sim_time" value="true" />
4、重新编译,然后可用。
参考资料: