参考自利用aloam跑数据集_aloam数据集-CSDN博客
第一步:查看bag的信息
输入rosbag info来查看bag包的信息:
joey@joey-Legion-Y7000P-IRX9:~$ rosbag info '/home/joey/Downloads/data2022/indoor/LiDAR_IMU.bag'
path: /home/joey/Downloads/data2022/indoor/LiDAR_IMU.bag
version: 2.0
duration: 1:34s (94s)
start: Apr 11 2022 22:27:35.73 (1649687255.73)
end: Apr 11 2022 22:29:10.34 (1649687350.34)
size: 2.5 GB
messages: 19869
compression: none [947/947 chunks]
types: sensor_msgs/Imu [6a62c6daae103f4ff57a132d6f95cec2]
sensor_msgs/PointCloud2 [1158d486dd51d683ce2f1be655c3c181]
topics: /hesai/pandar 946 msgs : sensor_msgs/PointCloud2
/imu/data 18923 msgs : sensor_msgs/Imu
可以看到topic中包含hesai和imu两份数据。
第二步:修改aloam中的部分
在launch中修改:使用remap
<node pkg="aloam_velodyne" type="ascanRegistration" name="ascanRegistration" output="screen" >
<remap from="/velodyne_points" to="/hesai/pandar"/>
</node>
完整的launch文件如下:(只需要改一处即可)
<launch>
<param name="scan_line" type="int" value="32" />
<!-- if 1, do mapping 10 Hz, if 2, do mapping 5 Hz. Suggest to use 1, it will adjust frequence automaticlly -->
<param name="mapping_skip_frame" type="int" value="1" />
<!-- remove too closed points -->
<param name="minimum_range" type="double" value="0.3"/>
<param name="mapping_line_resolution" type="double" value="0.2"/>
<param name="mapping_plane_resolution" type="double" value="0.4"/>
<node pkg="aloam_velodyne" type="ascanRegistration" name="ascanRegistration" output="screen" >
<remap from="/velodyne_points" to="/hesai/pandar"/>
</node>
<node pkg="aloam_velodyne" type="alaserOdometry" name="alaserOdometry" output="screen" />
<node pkg="aloam_velodyne" type="alaserMapping" name="alaserMapping" output="screen" />
<arg name="rviz" default="true" />
<group if="$(arg rviz)">
<node launch-prefix="nice" pkg="rviz" type="rviz" name="rviz" args="-d $(find aloam_velodyne)/rviz_cfg/aloam_velodyne.rviz" />
</group>
</launch>
修改之后,启动aloam
source devel/setup.bash
roslaunch aloam_velodyne aloam_velodyne_HDL_32.launch //还可以运行不同的.launch文件,跑不同线束的激光雷达。
rosbag play **.bag --clock 播发数据,可以看到运行效果。
补充 hesai Pandar-XT32的参数,在用lego-loam跑数据时,需要修改一下utility.h头文件中的参数:
// VLP-16
//extern const int N_SCAN = 16;
//extern const int Horizon_SCAN = 1800;
//extern const float ang_res_x = 0.2;
//extern const float ang_res_y = 2.0;
//extern const float ang_bottom = 15.0+0.1;
//extern const int groundScanInd = 7;
//Hesai Pandar-XT32
extern const int N_SCAN = 32;
extern const int Horizon_SCAN = 2000;
extern const float ang_res_x = 0.18;
extern const float ang_res_y = 1.0;
extern const float ang_bottom = 15+0.1;
extern const int groundScanInd =12;
修改之后重新编译一下即可。