1.安装依赖库,以ros-melodic版本为例,终端输入,
sudo apt install ros-melodic-moveit ros-melodic-moveit-visual-tools ros-melodic- kdl-* ros-melodic-joint-state-publisher-gui ros-melodic-trac-ik liborocos-kdl-dev ros-melodic-teleop-twist-keyboard ros-melodic-moveit-resources ros-melodic- navigation ros-melodic-gmapping ros-melodic-hector-slam ros-melodic-slam-karto ros-melodic-robot-state-publisher ros-melodic-geographic-msgs ros-melodic-libuvc- * ros-melodic-rtabmap-ros libavformat-dev libavcodec-dev libswresample-dev libswscale-dev libavutil-dev libsdl1.2-dev ros-melodic-pointcloud-to-laserscan ros-melodic-mbf-msgs ros-melodic-mbf-costmap-core ros-melodic-costmap-converter ros-melodic-bfl ros-melodic-serial ros-melodic-teleop-twist-joy ros-melodic- laser-proc ros-melodic-rosserial-arduino ros-melodic-rosserial-python ros- melodic-rosserial-server ros-melodic-rosserial-client ros-melodic-rosserial-msgs ros-melodic-amcl ros-melodic-map-server ros-melodic-urdf ros-melodic-xacro ros- melodic-interactive-markers ros-melodic-octomap* ros-melodic-joy* ros-melodic- dwa-local-planner ros-melodic-multirobot-map-merge python-catkin-tools python3- dev python3-catkin-pkg-modules python3-numpy python3-yaml build-essential ros- melodic-imu-tools ros-melodic-cartographer*
2.启动建图命令
在启动建图命令之前,需要安装 gmapping 包(用于构建地图):
sudo apt install ros-<ROS版本>-gmapping
然后以gmapping建图为例,终端输入
roslaunch oradar_lidar test_gmapping.launch
其中test_gmapping.launch文件的内容如下
<launch>
<include file="$(find oradar_lidar)/launch/ms200_scan.launch"/>
<include file="$(find rf2o_laser_odometry)/launch/rf2o_laser_odometry.launch"/>
<!-- 激光雷达的坐标系-->
<node pkg="tf" type="static_transform_publisher" name="base_link_to_laser"
args="0 0 1 0 0 0 /base_link /laser 100"/>
<include file="$(find oradar_lidar)/launch/gmapping.launch"/>
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find oradar_lidar)/rviz/test_map.rviz" />
</launch>
出现以下画面,即表示成功运行