最近,Cartographer正在使用ODOM的时候,放入ODOM后制图失败了,车稍微转动一下就会重叠,定位失败了。 在解决这个问题的过程中,我熟悉了odom driver、cartographer launch的配置、lua文件的配置、坐标系的设定、tf关系。 介绍在cartographer中使用odom的流程。 请作为参考。
我的实验环境是,差动车、汽车导航选择p f的R2000,搭载工业级的高精度IMU。 本文介绍中没有使用IMU。 首先,明确坐标系的关系很重要。 需要理解坐标系的右手定则。 一般,odom的坐标系的初始位置与base_link、map等重叠。 在此,将x轴朝向车的前方
2 .准备2.ODOM的驱动程序。 关于ODOM的驱动程序,ros wiki有详细的介绍和示例代码。 参考链接: http://wiki.ROS.org/navigation/tutorials/robot setup/Odom wiki.ROS.org
这里需要注意的是,代码是值得参考的,但最终无论odom的数据是x、y、angle还是vx、vy、vz、angular_x、angular_y、angular_z
3. cartographer launch
在launch中声明base_link和scan link的静态tf关系,或者用urdf声明。 这里用launch用static_transform_publisher声明。 不知道的人请尝试搜索static_transform
4. lua配置
到这一步比较简单。 附上我的lua文件。 各参数的说明从网上也可以找到详细的说明,所以省略。
options={
map_builder=MAP_BUILDER,
trajectory _ builder=trajectory _ builder,
map_frame='map ',
tracking_frame='base_link ',
published_frame='odom ',
odom_frame='odom ',
provide_odom_frame=false,
publish _ frame _ projected _ to _ 2d=false,
use_odometry=true,
use_nav_sat=false,
use_landmarks=false,
num_laser_scans=1,
num_multi_echo_laser_scans=0,
num _ subdivisions _ per _ laser _ scan=1,
num_point_clouds=0,
lookup _ transform _ time out _ sec=0.2,
submap_publish_period_sec=0.3,
pose_publish_period_sec=5e-3,
trajectory _ publish _ period _ sec=30e-3,
rangefinder_sampling_ratio=1.
odometry_sampling_ratio=1.
fixed _ frame _ pose _ sampling _ ratio=1.
imu_sampling_ratio=1.
landmarks_sampling_ratio=1.
}
我经过实测,R2000 ODOM比单R2000或R2000 IMU效果好得多。 当然测试车同时使用IMU和ODOM。