安装vlp驱动:
sudo apt-get install ros-melodic-velodyne
roscore
roslaunch velodyne_pointcloud VLP16_points.launch
rviz
打开rvizrviz -f velodyne
可以直接设置Fixed Frame参考链接:Velodyne VLP-16 gmapping 建图
手动发布base_link velodyne之间的转换,相当于机器人和雷达的坐标转换关系
rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link velodyne 10
启动gmapping
rosrun gmapping slam_gmapping
启动 laser_scan_matcher_node,并指定 fixed_frame 为 odom:即使用 laser_scan_matcher作为前端里程计,即使 laser_scan_matcher发布odom tf,gmapping接收odom tf,发布map tf
rosrun laser_scan_matcher laser_scan_matcher_node _fixed_frame:=odom
如果没有安装gmapping,使用以下命令安装
sudo apt install ros-melodic-gmapping
查看tf树下frame关系是否完整
rosrun rqt_tf_tree rqt_tf_tree
遇到错误:
[ WARN] [1580994954.426403779]: MessageFilter [target=odom ]: Dropped 100.00% of messages so far. Please turn the [ros.gmapping.message_notifier] rosconsole logger to DEBUG for more information.
总结此类问题,大多是frame之间的转换关系缺少导致,
使用 rosrun rqt_tf_tree rqt_tf_tree参看tf树下frame关系是否完整,如下:
https://blog.csdn.net/weixin_44827364/article/details/104202536
https://answers.ros.org/question/246928/messagefilter-dropped-100-of-messages/
LOAM安装运行:
mkdir -p catkin_velodyne/src
cd catkin_velodyne/src
git clone https://github.com/ros-drivers/velodyne.git
cd ..
rosdep install --from-paths src --ignore-src --rosdistro indigo -y
catkin_make
source devel/setup.bash
roslaunch velodyne_pointcloud VLP16_points.launch
roslaunch loam_velodyne loam_velodyne.launch
如遇到multiScanRegistration错误,将loam_velodyne/CMakeLists.txt,下面删除第35行,add_definitions(-march = native),重新编译
结果图:
增加了path topic及tum轨迹保存代码:https://gitee.com/nie_xun/loam_velodyne.git
轨迹的保存位置,可以在
loam_velodyne/ launch / loam_velodyne_xsens.launch文件中更改。
轨迹显示及评测工具可以使用evo。测评工具evo安装与使用
evo安装:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple evo --upgrade --no-binary evo
轨迹绘制:
evo_traj tum traj_tumxxx.txt -p
便可显示轨迹。
A-LOAM安装:
cd ~/catkin_ws/src
git clone https://github.com/HKUST-Aerial-Robotics/A-LOAM.git
cd ../
catkin_make
source ~/catkin_ws/devel/setup.bash
roslaunch velodyne_pointcloud VLP16_points.launch
roslaunch aloam_velodyne aloam_velodyne_VLP_16.launch
运行结果图:去掉点云地图,只显示路径,不得不说loam真的是一种实时性及准确性都很好的算法。
参考:A_LOAM建图同时构建栅格地图
sudo apt-get install ros-kinetic-octomap-ros #安装octomap
sudo apt-get install ros-kinetic-octomap-msgs
sudo apt-get install ros-kinetic-octomap-server
sudo apt-get install ros-kinetic-octomap-rviz-plugins
OccupancyGrid:显示三维概率地图
OccupancyMap:显示二维占据栅格地图。
opencv 编译问题参考:ubuntu1804 编译opencv2问题及解决办法
DEMO_RGBD在UBUNTU16.04上运行的一些修改
个人遇到的一些问题
no matching function for call to ‘cv::Mat::Mat(IplImage*&)
问题出现在featureTracking.cpp中的
Mat imageShowMat(imageShow);
if (showCount == showSkipNum) {
//Mat imageShowMat(imageShow);
Mat imageShowMat(cv::cvarrToMat(imageShow));
bridge.image = imageShowMat;
bridge.encoding = "mono8";
sensor_msgs::Image::Ptr imageShowPointer = bridge.toImageMsg();
imageShowPubPointer->publish(imageShowPointer);