起因
要把建立出来的图像,放在hdl_localization里面进行定位,但是lego-loam输出的点云是垂直的,很离谱。就在 src下的mapOptmization.cpp做出了一定的修改:
//在line145左右的pcl::PointCloud<PointType>::Ptr globalMapKeyFramesDS;下面添加
pcl::PointCloud<PointType>::Ptr globalMapKeyFramesDS_rotate;
//在line306左右的globalMapKeyFramesDS.reset(new pcl::PointCloud<PointType>());下面添加
globalMapKeyFramesDS_rotate.reset(new pcl::PointCloud<PointType>());
//最后在line722左右添加一坨代码:
void visualizeGlobalMapThread()
{
ros::Rate rate(0.2);
while (ros::ok())
{
rate.sleep();
publishGlobalMap();
}
// save final point cloud
Eigen::Affine3f transform_2 = Eigen::Affine3f::Identity();
//绕x轴旋转一个theta角
transform_2.rotate(Eigen::AngleAxisf(1.570795, Eigen::Vector3f::UnitX()));
pcl::transformPointCloud(*globalMapKeyFramesDS, *globalMapKeyFramesDS_rotate, transform_2);
pcl::io::savePCDFileASCII(fileDirectory + "finalCloud.pcd", *globalMapKeyFramesDS_rotate);
string cornerMapString = "/tmp/cornerMap.pcd";
要是懒的话,直接下载我的mapOptmization.cpp吧,覆盖之后重新编译就行。
https://download.csdn.net/download/qq_15536485/74091717
旋转变换解决LOAM点云垂直问题
798

被折叠的 条评论
为什么被折叠?



