加载场景
roslaunch turtlebot3_gazebo turtlebot3_house.launch
更改激光雷达参数后的场景:
roslaunch turtlebot3_gazebo turtlebot3_house_hokuyo.launch
启动可视化仿真
roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch
启动键盘控制
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
记录全部话题
rosbag record -a
记录部分话题
rosbag record /scan /imu /odom
目前尚存在问题
roslaunch cartographer_ros sim_turtlebot_2d.launch
[ WARN] [1587979390.750571170, 567.000000000]: W0427 17:23:10.000000 8793 sensor_bridge.cc:207] Ignored subdivision of a LaserScan message from sensor scan because previous subdivision time 621355973669980000 is not before current subdivision time 621355973669980000
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.occupied_space_weight = 1.
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight = 25.
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight = 25.
POSE_GRAPH.optimization_problem.local_slam_pose_translation_weight = 1e4
POSE_GRAPH.optimization_problem.local_slam_pose_rotation_weight = 1e4
POSE_GRAPH.optimization_problem.odometry_translation_weight = 1e4
POSE_GRAPH.optimization_problem.odometry_rotation_weight = 1e4
效果依然不好。
在操作过程中遇到问题,修改后雷达无法启动,报错。
[gazebo-2] process has died [pid 1813, exit code 255, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver -e ode /opt/ros/kinetic/share/turtlebot3_gazebo/worlds/empty.world __name:=gazebo __log:=/home/parobot/.ros/log/1c817030-89c9-11ea-be5e-4074e08fa7fa/gazebo-2.log].
log file: /home/parobot/.ros/log/1c817030-89c9-11ea-be5e-4074e08fa7fa/gazebo-2*.log
在终端执行一下操作可以消除错误
killall gzserver
参考博文《ROS总结(三)在仿真模型添加激光雷达》
/opt/ros/kinetic/share/turtlebot3_gazebo/launch/turtlebot3_house_hokuyo.launch
/opt/ros/kinetic/share/turtlebot3_description/urdf/turtlebot3_burger.hokuyo.urdf.xacro
/opt/ros/kinetic/share/turtlebot3_description/urdf/turtlebot3_burger.hokuyo.gazebo.xacro
Gazebo/Blue
0 0 0 0 0 0
$(arg laser_visual)
50
720
1
-2.3550796
2.3550796
0.10
10.0
0.001
gaussian
0.0
0.0005
scan
base_scan
修改lua文件配置参数
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
TRAJECTORY_BUILDER_2D.motion_filter.max_time_seconds = 5.
TRAJECTORY_BUILDER_2D.motion_filter.max_distance_meters = 0.1
TRAJECTORY_BUILDER_2D.motion_filter.max_angle_radians = math.rad(0.3)
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.occupied_space_weight = 1.
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight = 25.
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight = 25.
POSE_GRAPH.optimization_problem.local_slam_pose_translation_weight = 1e5
POSE_GRAPH.optimization_problem.local_slam_pose_rotation_weight = 1e5
POSE_GRAPH.optimization_problem.odometry_translation_weight = 1e4
POSE_GRAPH.optimization_problem.odometry_rotation_weight = 1e4
修改参数配置
MAP_BUILDER.use_trajectory_builder_2d = true
TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 10
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.min_range = 0.1
TRAJECTORY_BUILDER_2D.max_range = 8.0
TRAJECTORY_BUILDER_2D.min_z = -0.05
TRAJECTORY_BUILDER_2D.max_z = 0.5
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 10.0
TRAJECTORY_BUILDER_2D.voxel_filter_size = 0.01
TRAJECTORY_BUILDER_2D.adaptive_voxel_filter.max_length = 0.5
TRAJECTORY_BUILDER_2D.adaptive_voxel_filter.min_num_points = 10
TRAJECTORY_BUILDER_2D.adaptive_voxel_filter.max_range = 50.
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = false
TRAJECTORY_BUILDER_2D.motion_filter.max_time_seconds = 5.
TRAJECTORY_BUILDER_2D.motion_filter.max_distance_meters = 0.1
TRAJECTORY_BUILDER_2D.motion_filter.max_angle_radians = math.rad(0.3)
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.occupied_space_weight = 1.
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight = 25.
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight = 25.
POSE_GRAPH.optimization_problem.local_slam_pose_translation_weight = 1e5
POSE_GRAPH.optimization_problem.local_slam_pose_rotation_weight = 1e5
POSE_GRAPH.optimization_problem.odometry_translation_weight = 1e4
POSE_GRAPH.optimization_problem.odometry_rotation_weight = 1e4
有所提升,但建图整体效果一般。