代码改变世界

ROS 雷达运行数据

2022-04-05 15:42  jym蒟蒻  阅读(157)  评论(0编辑  收藏  举报

先测试一下雷达,记录数据。方便接下来分析源码。

1.roslaunch robot_navigation lidar.launch

@robot:~$ roslaunch robot_navigation lidar.launch
... logging to /home/jym/.ros/log/7136849a-92cc-11ec-acff-ac8247315e93/roslaunch-robot-9556.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.110:41393/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.10
 * /rplidarNode/angle_compensate: True
 * /rplidarNode/frame_id: base_laser_link
 * /rplidarNode/inverted: False
 * /rplidarNode/serial_baudrate: 115200
 * /rplidarNode/serial_port: /dev/rplidar
 * /rplidarNode/smart_control: True

NODES
  /
    base_footprint_to_laser (tf/static_transform_publisher)
    rplidarNode (rplidar_ros/rplidarNode)

auto-starting new master
process[master]: started with pid [9566]
ROS_MASTER_URI=http://192.168.0.110:11311

setting /run_id to 7136849a-92cc-11ec-acff-ac8247315e93
process[rosout-1]: started with pid [9588]
started core service [/rosout]
process[rplidarNode-2]: started with pid [9591]
process[base_footprint_to_laser-3]: started with pid [9593]
[ INFO] [1645416734.958421258]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.12.0
RPLIDAR S/N: B2BA9A86C0E09CC7A2E09DF720683077
[ INFO] [1645416737.467053046]: Firmware Ver: 1.29
[ INFO] [1645416737.467136487]: Hardware Rev: 7
[ INFO] [1645416737.468602280]: RPLidar health status : 0
[ INFO] [1645416737.513749572]: current scan mode: Sensitivity, max_distance: 12.0 m, Point number: 7.9K , angle_compensate: 2

@robot:~$ rostopic list
/rosout
/rosout_agg
/scan
/tf

@ubuntu:~$ rostopic info /tf
Type: tf2_msgs/TFMessage

Publishers: 
 * /base_footprint_to_laser (http://192.168.0.110:34067/)

Subscribers: None

@ubuntu:~$ rostopic info /scan
Type: sensor_msgs/LaserScan

Publishers: 
 * /rplidarNode (http://192.168.0.110:43615/)

Subscribers: None
                 
@ubuntu:~$ rostopic echo /tf
transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 1645416938
        nsecs: 168626559
      frame_id: "/base_footprint"
    child_frame_id: "base_laser_link"
    transform: 
      translation: 
        x: 0.1037
        y: 0.0
        z: 0.165
      rotation: 
        x: 0.0
        y: 0.0
        z: 1.0
        w: 1.79489651492e-09
---
transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 1645416938
        nsecs: 188753740
      frame_id: "/base_footprint"
    child_frame_id: "base_laser_link"
    transform: 
      translation: 
        x: 0.1037
        y: 0.0
        z: 0.165
      rotation: 
        x: 0.0
        y: 0.0
        z: 1.0
        w: 1.79489651492e-09
---
@ubuntu:~$ rostopic echo /scan
header: 
  seq: 3341
  stamp: 
    secs: 1645416999
    nsecs: 820906601
  frame_id: "base_laser_link"
angle_min: -3.12413907051
angle_max: 3.14159274101
angle_increment: 0.00871450919658
time_increment: 0.000101421544969
scan_time: 0.0729220882058
range_min: 0.15000000596
range_max: 12.0
ranges: [0.7699999809265137, 省略,0.7720000147819519]
intensities: [47.0, 省略,47.0]
---
header: 
  seq: 3342
  stamp: 
    secs: 1645416999
    nsecs: 894679719
  frame_id: "base_laser_link"
angle_min: -3.12413907051
angle_max: 3.14159274101
angle_increment: 0.00871450919658
time_increment: 0.000118369433039
scan_time: 0.0851076245308
range_min: 0.15000000596
range_max: 12.0
ranges: [0.7699999809265137,...省略,inf]
intensities: [47.0, 47.0,....省略, 0.0]
---

一部分ranges:
在这里插入图片描述
一部分intensities:
在这里插入图片描述

2.roslaunch robot_navigation lidar_rviz.launch

@ubuntu:~$ roslaunch robot_navigation lidar_rviz.launch
... logging to /home/jym/.ros/log/7136849a-92cc-11ec-acff-ac8247315e93/roslaunch-ubuntu-3100.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.117:41259/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.10

NODES
  /
    rviz (rviz/rviz)

ROS_MASTER_URI=http://192.168.0.110:11311

process[rviz-1]: started with pid [3113]

在这里插入图片描述

3.roslaunch robot_navigation robot_slam_laser.launch

@robot:~$ roslaunch robot_navigation robot_slam_laser.launch
... logging to /home/jym/.ros/log/a8ed1e48-92cd-11ec-8c26-ac8247315e93/roslaunch-robot-12482.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.110:38585/

SUMMARY
========

PARAMETERS
 * /base_control/ackermann_cmd_topic: ackermann_cmd
 * /base_control/base_id: base_footprint
 * /base_control/battery_topic: battery
 * /base_control/baudrate: 115200
 * /base_control/cmd_vel_topic: cmd_vel
 * /base_control/imu_id: imu
 * /base_control/imu_topic: imu
 * /base_control/odom_id: odom
 * /base_control/odom_topic: odom
 * /base_control/port: /dev/move_base
 * /base_control/pub_imu: False
 * /base_control/pub_sonar: False
 * /base_control/sub_ackermann: False
 * /gmapping/angularUpdate: 0.2
 * /gmapping/astep: 0.05
 * /gmapping/base_frame: base_footprint
 * /gmapping/delta: 0.05
 * /gmapping/iterations: 5
 * /gmapping/kernelSize: 1
 * /gmapping/lasamplerange: 0.005
 * /gmapping/lasamplestep: 0.005
 * /gmapping/linearUpdate: 1.0
 * /gmapping/llsamplerange: 0.01
 * /gmapping/llsamplestep: 0.01
 * /gmapping/lsigma: 0.075
 * /gmapping/lskip: 0
 * /gmapping/lstep: 0.05
 * /gmapping/map_frame: map
 * /gmapping/map_update_interval: 2.0
 * /gmapping/maxUrange: 5.0
 * /gmapping/minimumScore: 50
 * /gmapping/odom_frame: odom
 * /gmapping/ogain: 3.0
 * /gmapping/particles: 100
 * /gmapping/resampleThreshold: 0.5
 * /gmapping/sigma: 0.05
 * /gmapping/srr: 0.1
 * /gmapping/srt: 0.2
 * /gmapping/str: 0.1
 * /gmapping/stt: 0.2
 * /gmapping/temporalUpdate: 0.5
 * /gmapping/xmax: 10.0
 * /gmapping/xmin: -10.0
 * /gmapping/ymax: 10.0
 * /gmapping/ymin: -10.0
 * /rosdistro: melodic
 * /rosversion: 1.14.10
 * /rplidarNode/angle_compensate: True
 * /rplidarNode/frame_id: base_laser_link
 * /rplidarNode/inverted: False
 * /rplidarNode/serial_baudrate: 115200
 * /rplidarNode/serial_port: /dev/rplidar
 * /rplidarNode/smart_control: True
 * /use_sim_time: False

NODES
  /
    base_control (base_control/base_control.py)
    base_footprint_to_laser (tf/static_transform_publisher)
    gmapping (gmapping/slam_gmapping)
    rplidarNode (rplidar_ros/rplidarNode)

auto-starting new master
process[master]: started with pid [12492]
ROS_MASTER_URI=http://192.168.0.110:11311

setting /run_id to a8ed1e48-92cd-11ec-8c26-ac8247315e93
process[rosout-1]: started with pid [12504]
started core service [/rosout]
process[base_control-2]: started with pid [12512]
process[rplidarNode-3]: started with pid [12513]
process[base_footprint_to_laser-4]: started with pid [12514]
[ INFO] [1645417257.540586416]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.12.0
process[gmapping-5]: started with pid [12520]
RPLIDAR S/N: B2BA9A86C0E09CC7A2E09DF720683077
[ INFO] [1645417260.051225194]: Firmware Ver: 1.29
[ INFO] [1645417260.051379306]: Hardware Rev: 7
[ INFO] [1645417260.052906823]: RPLidar health status : 0
[ INFO] [1645417260.102903048]: current scan mode: Sensitivity, max_distance: 12.0 m, Point number: 7.9K , angle_compensate: 2
[INFO] [1645417260.503548]: NanoCar_Pro base control ...
[INFO] [1645417260.528157]: Opening Serial
[INFO] [1645417260.531035]: Serial Open Succeed
[INFO] [1645417261.110526]: Move Base Hardware Ver 2.1.0,Firmware Ver 2.1.3
[INFO] [1645417261.184878]: SN:002b00413138511532323338
[INFO] [1645417261.195020]: Type:RC_ACKERMAN Motor:RS365 Ratio:11.0 WheelDiameter:72.0
[ INFO] [1645417261.393525561]: Laser is mounted upwards.
 -maxUrange 5 -maxUrange 11.99 -sigma     0.05 -kernelSize 1 -lstep 0.05 -lobsGain 3 -astep 0.05
 -srr 0.1 -srt 0.2 -str 0.1 -stt 0.2
 -linearUpdate 1 -angularUpdate 0.2 -resampleThreshold 0.5
 -xmin -10 -xmax 10 -ymin -10 -ymax 10 -delta 0.05 -particles 100
[ INFO] [1645417261.399562302]: Initialization complete
update frame 0
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 0
Registering First Scan
update frame 7
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 1
Average Scan Matching Score=441.909
neff= 100
Registering Scans:Done
update frame 8
update ld=1.38778e-17 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 2
Average Scan Matching Score=458.721
neff= 100
Registering Scans:Done
update frame 9
update ld=1.38778e-17 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 3
Average Scan Matching Score=451.226
neff= 100
Registering Scans:Done
update frame 10
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 4
Average Scan Matching Score=463.392
neff= 100
Registering Scans:Done
update frame 11
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 5
^C[gmapping-5] killing on exit
[base_footprint_to_laser-4] killing on exit
[rplidarNode-3] killing on exit
[base_control-2] killing on exit
Average Scan Matching Score=443.591
neff= 100
Registering Scans:Done
update frame 12
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 6
Average Scan Matching Score=448.561
neff= 100
Registering Scans:Done
virtual GMapping::GridSlamProcessor::~GridSlamProcessor(): Start
virtual GMapping::GridSlamProcessor::~GridSlamProcessor(): Deleting tree
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
@robot:~$ rostopic list
/battery
/cmd_vel
/gmapping/entropy
/map
/map_metadata
/odom
/rosout
/rosout_agg
/scan
/tf
/tf_static

4.roslaunch robot_navigation slam_rviz.launch

@ubuntu:~$ roslaunch robot_navigation slam_rviz.launch
... logging to /home/jym/.ros/log/fd795bf2-92cd-11ec-a7fa-ac8247315e93/roslaunch-ubuntu-3189.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.117:37773/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.10

NODES
  /
    rviz (rviz/rviz)

ROS_MASTER_URI=http://192.168.0.110:11311

process[rviz-1]: started with pid [3198]

在这里插入图片描述

@ubuntu:~$ rostopic list
/battery
/clicked_point
/cmd_vel
/exploration_polygon_marker
/exploration_polygon_marker_array
/gmapping/entropy
/initialpose
/map
/map_metadata
/map_updates
/move_base/NavfnROS/plan
/move_base_simple/goal
/odom
/rosout
/rosout_agg
/scan
/tf
/tf_static
@ubuntu:~$ rosrun rqt_tf_tree rqt_tf_tree

在这里插入图片描述

@ubuntu:~$ rosrun rqt_graph rqt_graph

在这里插入图片描述

黑色边框部分是实际地形中的墙壁,地图四周边界已经全部闭合或者想要保存地图时候。
robot:
roscd robot_navigation/maps
rosrun map_server map_saver -f map

@robot:~$ roscd robot_navigation/maps
@robot:~/catkin_ws/src/robot_navigation/maps$ ls
cartographer.pgm   gmapping.pgm   hector.pgm   karto.pgm   map.pgm
cartographer.yaml  gmapping.yaml  hector.yaml  karto.yaml  map.yaml

@robot:~/catkin_ws/src/robot_navigation/maps$ vim map.yaml

打开看到:
image: map.pgm
resolution: 0.050000
origin: [-10.000000, -10.000000, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196
@robot:~/catkin_ws/src/robot_navigation/maps$ rosrun map_server map_saver -f map
[ INFO] [1645418348.405455319]: Waiting for the map
[ INFO] [1645418348.606461007]: Received a 384 X 384 map @ 0.050 m/pix
[ INFO] [1645418348.606572677]: Writing map occupancy data to map.pgm
[ INFO] [1645418348.620467557]: Writing map occupancy data to map.yaml
[ INFO] [1645418348.620892465]: Done

在这里插入图片描述

5.roslaunch robot_navigation robot_navigation.launch

@robot:~$ roslaunch robot_navigation robot_navigation.launch
... logging to /home/jym/.ros/log/d7006d78-92d0-11ec-a74f-ac8247315e93/roslaunch-robot-19558.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.110:34203/

SUMMARY
========

PARAMETERS
 * /amcl/aser_z_short: 0.05
 * /amcl/base_frame_id: base_footprint
 * /amcl/global_frame_id: map
 * /amcl/gui_publish_rate: 10.0
 * /amcl/initial_pose_a: 0.0
 * /amcl/initial_pose_x: 0.0
 * /amcl/initial_pose_y: 0.0
 * /amcl/kld_err: 0.05
 * /amcl/kld_z: 0.99
 * /amcl/laser_lambda_short: 0.1
 * /amcl/laser_likelihood_max_dist: 2.0
 * /amcl/laser_max_beams: 60
 * /amcl/laser_max_range: 12.0
 * /amcl/laser_model_type: likelihood_field
 * /amcl/laser_sigma_hit: 0.2
 * /amcl/laser_z_hit: 0.5
 * /amcl/laser_z_max: 0.05
 * /amcl/laser_z_rand: 0.5
 * /amcl/max_particles: 2000
 * /amcl/min_particles: 500
 * /amcl/odom_alpha1: 0.2
 * /amcl/odom_alpha2: 0.2
 * /amcl/odom_alpha3: 0.2
 * /amcl/odom_alpha4: 0.2
 * /amcl/odom_alpha5: 0.1
 * /amcl/odom_frame_id: odom
 * /amcl/odom_model_type: diff
 * /amcl/recovery_alpha_fast: 0.1
 * /amcl/recovery_alpha_slow: 0.001
 * /amcl/resample_interval: 1
 * /amcl/transform_tolerance: 1.0
 * /amcl/update_min_a: 0.2
 * /amcl/update_min_d: 0.25
 * /amcl/use_map_topic: True
 * /base_control/ackermann_cmd_topic: ackermann_cmd
 * /base_control/base_id: base_footprint
 * /base_control/battery_topic: battery
 * /base_control/baudrate: 115200
 * /base_control/cmd_vel_topic: cmd_vel
 * /base_control/imu_id: imu
 * /base_control/imu_topic: imu
 * /base_control/odom_id: odom
 * /base_control/odom_topic: odom
 * /base_control/port: /dev/move_base
 * /base_control/pub_imu: False
 * /base_control/pub_sonar: False
 * /base_control/sub_ackermann: False
 * /map_server/frame_id: map
 * /move_base/GlobalPlanner/use_dijkstra: True
 * /move_base/TebLocalPlannerROS/acc_lim_theta: 0.5
 * /move_base/TebLocalPlannerROS/acc_lim_x: 0.5
 * /move_base/TebLocalPlannerROS/allow_init_with_backwards_motion: True
 * /move_base/TebLocalPlannerROS/cmd_angle_instead_rotvel: False
 * /move_base/TebLocalPlannerROS/complete_global_plan: True
 * /move_base/TebLocalPlannerROS/costmap_converter_plugin: 
 * /move_base/TebLocalPlannerROS/costmap_converter_rate: 5
 * /move_base/TebLocalPlannerROS/costmap_converter_spin_thread: True
 * /move_base/TebLocalPlannerROS/costmap_obstacles_behind_robot_dist: 1.5
 * /move_base/TebLocalPlannerROS/delete_detours_backwards: True
 * /move_base/TebLocalPlannerROS/dt_hysteresis: 0.1
 * /move_base/TebLocalPlannerROS/dt_ref: 0.3
 * /move_base/TebLocalPlannerROS/dynamic_obstacle_inflation_dist: 0.6
 * /move_base/TebLocalPlannerROS/enable_homotopy_class_planning: False
 * /move_base/TebLocalPlannerROS/enable_multithreading: True
 * /move_base/TebLocalPlannerROS/exact_arc_length: False
 * /move_base/TebLocalPlannerROS/feasibility_check_no_poses: 2
 * /move_base/TebLocalPlannerROS/footprint_model/line_end: [0.1, 0.0]
 * /move_base/TebLocalPlannerROS/footprint_model/line_start: [0.05, 0.0]
 * /move_base/TebLocalPlannerROS/footprint_model/type: line
 * /move_base/TebLocalPlannerROS/free_goal_vel: False
 * /move_base/TebLocalPlannerROS/global_plan_overwrite_orientation: True
 * /move_base/TebLocalPlannerROS/global_plan_prune_distance: 1
 * /move_base/TebLocalPlannerROS/global_plan_viapoint_sep: -1
 * /move_base/TebLocalPlannerROS/h_signature_prescaler: 0.5
 * /move_base/TebLocalPlannerROS/h_signature_threshold: 0.1
 * /move_base/TebLocalPlannerROS/include_costmap_obstacles: True
 * /move_base/TebLocalPlannerROS/include_dynamic_obstacles: True
 * /move_base/TebLocalPlannerROS/inflation_dist: 0.6
 * /move_base/TebLocalPlannerROS/max_global_plan_lookahead_dist: 3.0
 * /move_base/TebLocalPlannerROS/max_number_classes: 4
 * /move_base/TebLocalPlannerROS/max_ratio_detours_duration_best_duration: 3.0
 * /move_base/TebLocalPlannerROS/max_samples: 500
 * /move_base/TebLocalPlannerROS/max_vel_theta: 0.53
 * /move_base/TebLocalPlannerROS/max_vel_x: 0.2
 * /move_base/TebLocalPlannerROS/max_vel_x_backwards: 0.2
 * /move_base/TebLocalPlannerROS/max_vel_y: 0.0
 * /move_base/TebLocalPlannerROS/min_obstacle_dist: 0.12
 * /move_base/TebLocalPlannerROS/min_turning_radius: 0.375
 * /move_base/TebLocalPlannerROS/no_inner_iterations: 5
 * /move_base/TebLocalPlannerROS/no_outer_iterations: 4
 * /move_base/TebLocalPlannerROS/obstacle_cost_exponent: 4
 * /move_base/TebLocalPlannerROS/obstacle_heading_threshold: 0.45
 * /move_base/TebLocalPlannerROS/obstacle_poses_affected: 15
 * /move_base/TebLocalPlannerROS/odom_topic: odom
 * /move_base/TebLocalPlannerROS/optimization_activate: True
 * /move_base/TebLocalPlannerROS/optimization_verbose: False
 * /move_base/TebLocalPlannerROS/oscillation_filter_duration: 10
 * /move_base/TebLocalPlannerROS/oscillation_omega_eps: 0.1
 * /move_base/TebLocalPlannerROS/oscillation_recovery: False
 * /move_base/TebLocalPlannerROS/oscillation_recovery_min_duration: 10
 * /move_base/TebLocalPlannerROS/oscillation_v_eps: 0.1
 * /move_base/TebLocalPlannerROS/penalty_epsilon: 0.1
 * /move_base/TebLocalPlannerROS/publish_feedback: False
 * /move_base/TebLocalPlannerROS/roadmap_graph_area_length_scale: 1.0
 * /move_base/TebLocalPlannerROS/roadmap_graph_area_width: 5
 * /move_base/TebLocalPlannerROS/roadmap_graph_no_samples: 15
 * /move_base/TebLocalPlannerROS/selection_alternative_time_cost: False
 * /move_base/TebLocalPlannerROS/selection_cost_hysteresis: 1.0
 * /move_base/TebLocalPlannerROS/selection_obst_cost_scale: 1.0
 * /move_base/TebLocalPlannerROS/selection_prefer_initial_plan: 0.95
 * /move_base/TebLocalPlannerROS/shrink_horizon_backup: True
 * /move_base/TebLocalPlannerROS/shrink_horizon_min_duration: 10
 * /move_base/TebLocalPlannerROS/switching_blocking_period: 0.0
 * /move_base/TebLocalPlannerROS/teb_autosize: True
 * /move_base/TebLocalPlannerROS/viapoints_all_candidates: True
 * /move_base/TebLocalPlannerROS/visualize_hc_graph: False
 * /move_base/TebLocalPlannerROS/visualize_with_time_as_z_axis_scale: False
 * /move_base/TebLocalPlannerROS/weight_acc_lim_theta: 1
 * /move_base/TebLocalPlannerROS/weight_acc_lim_x: 1
 * /move_base/TebLocalPlannerROS/weight_adapt_factor: 2
 * /move_base/TebLocalPlannerROS/weight_dynamic_obstacle: 10
 * /move_base/TebLocalPlannerROS/weight_dynamic_obstacle_inflation: 0.2
 * /move_base/TebLocalPlannerROS/weight_inflation: 0.2
 * /move_base/TebLocalPlannerROS/weight_kinematics_forward_drive: 1
 * /move_base/TebLocalPlannerROS/weight_kinematics_nh: 1000
 * /move_base/TebLocalPlannerROS/weight_kinematics_turning_radius: 1
 * /move_base/TebLocalPlannerROS/weight_max_vel_theta: 1
 * /move_base/TebLocalPlannerROS/weight_max_vel_x: 2
 * /move_base/TebLocalPlannerROS/weight_obstacle: 100
 * /move_base/TebLocalPlannerROS/weight_optimaltime: 1
 * /move_base/TebLocalPlannerROS/weight_shortest_path: 0
 * /move_base/TebLocalPlannerROS/weight_viapoint: 1
 * /move_base/TebLocalPlannerROS/wheelbase: 0.145
 * /move_base/TebLocalPlannerROS/xy_goal_tolerance: 0.1
 * /move_base/TebLocalPlannerROS/yaw_goal_tolerance: 0.2
 * /move_base/base_global_planner: global_planner/Gl...
 * /move_base/base_local_planner: teb_local_planner...
 * /move_base/clearing_rotation_allowed: False
 * /move_base/conservative_reset_dist: 0.2
 * /move_base/controller_frequency: 2.0
 * /move_base/controller_patience: 15.0
 * /move_base/global_costmap/footprint: [[-0.035, -0.1], ...
 * /move_base/global_costmap/global_frame: map
 * /move_base/global_costmap/inflation_layer/cost_scaling_factor: 10.0
 * /move_base/global_costmap/inflation_layer/enabled: True
 * /move_base/global_costmap/inflation_layer/inflation_radius: 0.1
 * /move_base/global_costmap/obstacle_layer/combination_method: 1
 * /move_base/global_costmap/obstacle_layer/enabled: True
 * /move_base/global_costmap/obstacle_layer/inflation_radius: 0.05
 * /move_base/global_costmap/obstacle_layer/laser_scan_sensor/clearing: True
 * /move_base/global_costmap/obstacle_layer/laser_scan_sensor/data_type: LaserScan
 * /move_base/global_costmap/obstacle_layer/laser_scan_sensor/marking: True
 * /move_base/global_costmap/obstacle_layer/laser_scan_sensor/topic: scan
 * /move_base/global_costmap/obstacle_layer/observation_sources: laser_scan_sensor
 * /move_base/global_costmap/obstacle_layer/obstacle_range: 2.5
 * /move_base/global_costmap/obstacle_layer/raytrace_range: 3.0
 * /move_base/global_costmap/obstacle_layer/track_unknown_space: False
 * /move_base/global_costmap/plugins: [{'type': 'costma...
 * /move_base/global_costmap/publish_frequency: 0.5
 * /move_base/global_costmap/robot_base_frame: base_footprint
 * /move_base/global_costmap/static_layer/enabled: True
 * /move_base/global_costmap/static_layer/map_topic: /map
 * /move_base/global_costmap/transform_tolerance: 0.5
 * /move_base/global_costmap/update_frequency: 1.0
 * /move_base/local_costmap/footprint: [[-0.035, -0.1], ...
 * /move_base/local_costmap/global_frame: map
 * /move_base/local_costmap/height: 3
 * /move_base/local_costmap/inflation_layer/cost_scaling_factor: 10.0
 * /move_base/local_costmap/inflation_layer/enabled: True
 * /move_base/local_costmap/inflation_layer/inflation_radius: 0.1
 * /move_base/local_costmap/obstacle_layer/combination_method: 1
 * /move_base/local_costmap/obstacle_layer/enabled: True
 * /move_base/local_costmap/obstacle_layer/inflation_radius: 0.05
 * /move_base/local_costmap/obstacle_layer/laser_scan_sensor/clearing: True
 * /move_base/local_costmap/obstacle_layer/laser_scan_sensor/data_type: LaserScan
 * /move_base/local_costmap/obstacle_layer/laser_scan_sensor/marking: True
 * /move_base/local_costmap/obstacle_layer/laser_scan_sensor/topic: scan
 * /move_base/local_costmap/obstacle_layer/observation_sources: laser_scan_sensor
 * /move_base/local_costmap/obstacle_layer/obstacle_range: 2.5
 * /move_base/local_costmap/obstacle_layer/raytrace_range: 3.0
 * /move_base/local_costmap/obstacle_layer/track_unknown_space: False
 * /move_base/local_costmap/plugins: [{'type': 'costma...
 * /move_base/local_costmap/publish_frequency: 5.0
 * /move_base/local_costmap/resolution: 0.05
 * /move_base/local_costmap/robot_base_frame: base_footprint
 * /move_base/local_costmap/rolling_window: True
 * /move_base/local_costmap/static_layer/enabled: True
 * /move_base/local_costmap/static_layer/map_topic: /map
 * /move_base/local_costmap/transform_tolerance: 0.5
 * /move_base/local_costmap/update_frequency: 5.0
 * /move_base/local_costmap/width: 3
 * /move_base/oscillation_distance: 0.2
 * /move_base/oscillation_timeout: 10.0
 * /move_base/planner_frequency: 0.2
 * /move_base/planner_patience: 5.0
 * /rosdistro: melodic
 * /rosversion: 1.14.10
 * /rplidarNode/angle_compensate: True
 * /rplidarNode/frame_id: base_laser_link
 * /rplidarNode/inverted: False
 * /rplidarNode/serial_baudrate: 115200
 * /rplidarNode/serial_port: /dev/rplidar
 * /rplidarNode/smart_control: True

NODES
  /
    amcl (amcl/amcl)
    base_control (base_control/base_control.py)
    base_footprint_to_laser (tf/static_transform_publisher)
    map_server (map_server/map_server)
    move_base (move_base/move_base)
    rplidarNode (rplidar_ros/rplidarNode)

auto-starting new master
process[master]: started with pid [19568]
ROS_MASTER_URI=http://192.168.0.110:11311

setting /run_id to d7006d78-92d0-11ec-a74f-ac8247315e93
process[rosout-1]: started with pid [19580]
started core service [/rosout]
process[base_control-2]: started with pid [19588]
process[rplidarNode-3]: started with pid [19589]
process[base_footprint_to_laser-4]: started with pid [19590]
[ INFO] [1645418623.654897278]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.12.0
process[map_server-5]: started with pid [19597]
process[amcl-6]: started with pid [19603]
process[move_base-7]: started with pid [19604]
[ INFO] [1645418624.119418253]: Subscribed to map topic.
[ INFO] [1645418624.297830472]: Received a 384 X 384 map @ 0.050 m/pix

[ INFO] [1645418624.318718895]: Initializing likelihood field model; this can take some time on large maps...
[ INFO] [1645418624.332496936]: Done initializing likelihood field model.
[INFO] [1645418626.164512]: NanoCar_Pro base control ...
RPLIDAR S/N: B2BA9A86C0E09CC7A2E09DF720683077
[ INFO] [1645418626.166586242]: Firmware Ver: 1.29
[ INFO] [1645418626.166672338]: Hardware Rev: 7
[ INFO] [1645418626.168322547]: RPLidar health status : 0
[INFO] [1645418626.191463]: Opening Serial
[INFO] [1645418626.194629]: Serial Open Succeed
[ INFO] [1645418626.214124208]: current scan mode: Sensitivity, max_distance: 12.0 m, Point number: 7.9K , angle_compensate: 2
[INFO] [1645418626.643383]: Move Base Hardware Ver 2.1.0,Firmware Ver 2.1.3
[INFO] [1645418626.709617]: SN:002b00413138511532323338
[INFO] [1645418626.714842]: Type:RC_ACKERMAN Motor:RS365 Ratio:11.0 WheelDiameter:72.0
[ INFO] [1645418628.458355880]: global_costmap: Using plugin "static_layer"
[ INFO] [1645418628.501041558]: Requesting the map...
[ INFO] [1645418628.706626676]: Resizing costmap to 384 X 384 at 0.050000 m/pix
[ INFO] [1645418628.806309371]: Received a 384 X 384 map at 0.050000 m/pix
[ INFO] [1645418628.815022252]: global_costmap: Using plugin "obstacle_layer"
[ INFO] [1645418628.832882923]:     Subscribed to Topics: laser_scan_sensor
[ INFO] [1645418628.910960088]: global_costmap: Using plugin "inflation_layer"
[ INFO] [1645418629.075856311]: local_costmap: Using plugin "static_layer"
[ INFO] [1645418629.090986271]: Requesting the map...
[ INFO] [1645418629.099615764]: Resizing static layer to 384 X 384 at 0.050000 m/pix
[ INFO] [1645418629.198297959]: Received a 384 X 384 map at 0.050000 m/pix
[ INFO] [1645418629.208358226]: local_costmap: Using plugin "obstacle_layer"
[ INFO] [1645418629.219131901]:     Subscribed to Topics: laser_scan_sensor
[ INFO] [1645418629.379627152]: Created local_planner teb_local_planner/TebLocalPlannerROS
[ INFO] [1645418629.552605769]: Footprint model 'line' (line_start: [0.05,0]m, line_end: [0.1,0]m) loaded for trajectory optimization.
[ INFO] [1645418629.553394023]: Parallel planning in distinctive topologies disabled.
[ INFO] [1645418629.553515537]: No costmap conversion plugin specified. All occupied costmap cells are treaten as point obstacles.
[ INFO] [1645418630.137914350]: Recovery behavior will clear layer 'obstacles'
[ INFO] [1645418630.150906637]: Recovery behavior will clear layer 'obstacles'
[ INFO] [1645418630.234827271]: odom received!
jym@ubuntu:~$ rostopic list
/amcl/parameter_descriptions
/amcl/parameter_updates
/amcl_pose
/battery
/cmd_vel
/diagnostics
/initialpose
/map
/map_metadata
/move_base/GlobalPlanner/parameter_descriptions
/move_base/GlobalPlanner/parameter_updates
/move_base/GlobalPlanner/plan
/move_base/GlobalPlanner/potential
/move_base/TebLocalPlannerROS/global_plan
/move_base/TebLocalPlannerROS/local_plan
/move_base/TebLocalPlannerROS/obstacles
/move_base/TebLocalPlannerROS/parameter_descriptions
/move_base/TebLocalPlannerROS/parameter_updates
/move_base/TebLocalPlannerROS/teb_feedback
/move_base/TebLocalPlannerROS/teb_markers
/move_base/TebLocalPlannerROS/teb_poses
/move_base/TebLocalPlannerROS/via_points
/move_base/cancel
/move_base/current_goal
/move_base/feedback
/move_base/global_costmap/costmap
/move_base/global_costmap/costmap_updates
/move_base/global_costmap/footprint
/move_base/global_costmap/inflation_layer/parameter_descriptions
/move_base/global_costmap/inflation_layer/parameter_updates
/move_base/global_costmap/obstacle_layer/clearing_endpoints
/move_base/global_costmap/obstacle_layer/parameter_descriptions
/move_base/global_costmap/obstacle_layer/parameter_updates
/move_base/global_costmap/parameter_descriptions
/move_base/global_costmap/parameter_updates
/move_base/global_costmap/static_layer/parameter_descriptions
/move_base/global_costmap/static_layer/parameter_updates
/move_base/goal
/move_base/local_costmap/costmap
/move_base/local_costmap/costmap_updates
/move_base/local_costmap/footprint
/move_base/local_costmap/obstacle_layer/parameter_descriptions
/move_base/local_costmap/obstacle_layer/parameter_updates
/move_base/local_costmap/parameter_descriptions
/move_base/local_costmap/parameter_updates
/move_base/local_costmap/static_layer/parameter_descriptions
/move_base/local_costmap/static_layer/parameter_updates
/move_base/parameter_descriptions
/move_base/parameter_updates
/move_base/result
/move_base/status
/move_base_simple/goal
/odom
/particlecloud
/rosout
/rosout_agg
/scan
/tf
/tf_static

roslaunch robot_navigation navigation_rviz.launch

@ubuntu:~$ roslaunch robot_navigation navigation_rviz.launch
... logging to /home/jym/.ros/log/d7006d78-92d0-11ec-a74f-ac8247315e93/roslaunch-ubuntu-3577.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.117:43839/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.10

NODES
  /
    rviz (rviz/rviz)

ROS_MASTER_URI=http://192.168.0.110:11311

process[rviz-1]: started with pid [3586]

在这里插入图片描述

![Snipaste_2022-02-21_12-49-32](Snipaste_2022-02-21_12-49-32.png)@ubuntu:~$ rostopic list
/amcl/parameter_descriptions
/amcl/parameter_updates
/amcl_pose
/battery
/clicked_point
/cmd_vel
/diagnostics
/initialpose
/map
/map_metadata
/map_updates
/move_base/DWAPlannerROS/cost_cloud
/move_base/DWAPlannerROS/global_plan
/move_base/DWAPlannerROS/local_plan
/move_base/DWAPlannerROS/trajectory_cloud
/move_base/GlobalPlanner/parameter_descriptions
/move_base/GlobalPlanner/parameter_updates
/move_base/GlobalPlanner/plan
/move_base/GlobalPlanner/potential
/move_base/GlobalPlanner/potential_updates
/move_base/TebLocalPlannerROS/global_plan
/move_base/TebLocalPlannerROS/local_plan
/move_base/TebLocalPlannerROS/obstacles
/move_base/TebLocalPlannerROS/parameter_descriptions
/move_base/TebLocalPlannerROS/parameter_updates
/move_base/TebLocalPlannerROS/teb_feedback
/move_base/TebLocalPlannerROS/teb_markers
/move_base/TebLocalPlannerROS/teb_poses
/move_base/TebLocalPlannerROS/via_points
/move_base/cancel
/move_base/current_goal
/move_base/feedback
/move_base/global_costmap/costmap
/move_base/global_costmap/costmap_updates
/move_base/global_costmap/footprint
/move_base/global_costmap/inflation_layer/parameter_descriptions
/move_base/global_costmap/inflation_layer/parameter_updates
/move_base/global_costmap/obstacle_layer/clearing_endpoints
/move_base/global_costmap/obstacle_layer/parameter_descriptions
/move_base/global_costmap/obstacle_layer/parameter_updates
/move_base/global_costmap/parameter_descriptions
/move_base/global_costmap/parameter_updates
/move_base/global_costmap/static_layer/parameter_descriptions
/move_base/global_costmap/static_layer/parameter_updates
/move_base/goal
/move_base/local_costmap/costmap
/move_base/local_costmap/costmap_updates
/move_base/local_costmap/footprint
/move_base/local_costmap/obstacle_layer/parameter_descriptions
/move_base/local_costmap/obstacle_layer/parameter_updates
/move_base/local_costmap/parameter_descriptions
/move_base/local_costmap/parameter_updates
/move_base/local_costmap/static_layer/parameter_descriptions
/move_base/local_costmap/static_layer/parameter_updates
/move_base/parameter_descriptions
/move_base/parameter_updates
/move_base/result
/move_base/status
/move_base_simple/goal
/odom
/particlecloud
/path_point
/rosout
/rosout_agg
/scan
/tf
/tf_static

@ubuntu:~$ rosrun rqt_graph rqt_graph

在这里插入图片描述

在这里插入图片描述

pc:rviz:2D Nav Goal设置导航目标。按下鼠标左键指定目标点方向,松开鼠标,执行导航任务。
robot:
[ WARN] [1645419212.414525914]: Clearing both costmaps to unstuck robot (0.20m).
[ INFO] [1645419227.414547893]: GOAL Reached!
到达指定目标点,过程中具有路径规划和避障功能。

在这里插入图片描述

@ubuntu:~$ rosnode list
/amcl
/base_control
/base_footprint_to_laser
/map_server
/move_base
/rosout
/rplidarNode
/rviz

@ubuntu:~$ rostopic echo /amcl_pose
header: 
  seq: 9
  stamp: 
    secs: 1645419587
    nsecs: 722414364
  frame_id: "map"
pose: 
  pose: 
    position: 
      x: 0.122417531975
      y: -0.138680257969
      z: 0.0
    orientation: 
      x: 0.0
      y: 0.0
      z: 0.214837962559
      w: 0.976649706826
  covariance: [0.029971075946912572, 0.008297713726329774, 0.0, 0.0, 0.0, 0.0, 0.008297713726329772, 0.027946463969230503, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06360104777578718]
---

roslaunch robot_navigation robot_slam_laser.launch

@robot:~$ roslaunch robot_navigation robot_slam_laser.launch
... logging to /home/jym/.ros/log/0d9eb03a-92d4-11ec-93b6-ac8247315e93/roslaunch-robot-26850.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.0.110:34605/

SUMMARY
========

PARAMETERS
 * /base_control/ackermann_cmd_topic: ackermann_cmd
 * /base_control/base_id: base_footprint
 * /base_control/battery_topic: battery
 * /base_control/baudrate: 115200
 * /base_control/cmd_vel_topic: cmd_vel
 * /base_control/imu_id: imu
 * /base_control/imu_topic: imu
 * /base_control/odom_id: odom
 * /base_control/odom_topic: odom
 * /base_control/port: /dev/move_base
 * /base_control/pub_imu: False
 * /base_control/pub_sonar: False
 * /base_control/sub_ackermann: False
 * /gmapping/angularUpdate: 0.2
 * /gmapping/astep: 0.05
 * /gmapping/base_frame: base_footprint
 * /gmapping/delta: 0.05
 * /gmapping/iterations: 5
 * /gmapping/kernelSize: 1
 * /gmapping/lasamplerange: 0.005
 * /gmapping/lasamplestep: 0.005
 * /gmapping/linearUpdate: 1.0
 * /gmapping/llsamplerange: 0.01
 * /gmapping/llsamplestep: 0.01
 * /gmapping/lsigma: 0.075
 * /gmapping/lskip: 0
 * /gmapping/lstep: 0.05
 * /gmapping/map_frame: map
 * /gmapping/map_update_interval: 2.0
 * /gmapping/maxUrange: 5.0
 * /gmapping/minimumScore: 50
 * /gmapping/odom_frame: odom
 * /gmapping/ogain: 3.0
 * /gmapping/particles: 100
 * /gmapping/resampleThreshold: 0.5
 * /gmapping/sigma: 0.05
 * /gmapping/srr: 0.1
 * /gmapping/srt: 0.2
 * /gmapping/str: 0.1
 * /gmapping/stt: 0.2
 * /gmapping/temporalUpdate: 0.5
 * /gmapping/xmax: 10.0
 * /gmapping/xmin: -10.0
 * /gmapping/ymax: 10.0
 * /gmapping/ymin: -10.0
 * /rosdistro: melodic
 * /rosversion: 1.14.10
 * /rplidarNode/angle_compensate: True
 * /rplidarNode/frame_id: base_laser_link
 * /rplidarNode/inverted: False
 * /rplidarNode/serial_baudrate: 115200
 * /rplidarNode/serial_port: /dev/rplidar
 * /rplidarNode/smart_control: True
 * /use_sim_time: False

NODES
  /
    base_control (base_control/base_control.py)
    base_footprint_to_laser (tf/static_transform_publisher)
    gmapping (gmapping/slam_gmapping)
    rplidarNode (rplidar_ros/rplidarNode)

auto-starting new master
process[master]: started with pid [26860]
ROS_MASTER_URI=http://192.168.0.110:11311

setting /run_id to 0d9eb03a-92d4-11ec-93b6-ac8247315e93
process[rosout-1]: started with pid [26872]
started core service [/rosout]
process[base_control-2]: started with pid [26880]
process[rplidarNode-3]: started with pid [26881]
process[base_footprint_to_laser-4]: started with pid [26882]
[ INFO] [1645420003.466982431]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.12.0
process[gmapping-5]: started with pid [26888]
[INFO] [1645420005.904613]: NanoCar_Pro base control ...
[INFO] [1645420005.930990]: Opening Serial
[INFO] [1645420005.934433]: Serial Open Succeed
RPLIDAR S/N: B2BA9A86C0E09CC7A2E09DF720683077
[ INFO] [1645420005.990420997]: Firmware Ver: 1.29
[ INFO] [1645420005.990503339]: Hardware Rev: 7
[ INFO] [1645420005.991967162]: RPLidar health status : 0
[ INFO] [1645420006.037426077]: current scan mode: Sensitivity, max_distance: 12.0 m, Point number: 7.9K , angle_compensate: 2
[INFO] [1645420006.511063]: Move Base Hardware Ver 2.1.0,Firmware Ver 2.1.3
[INFO] [1645420006.584277]: SN:002b00413138511532323338
[INFO] [1645420006.588490]: Type:RC_ACKERMAN Motor:RS365 Ratio:11.0 WheelDiameter:72.0
[ INFO] [1645420007.293346325]: Laser is mounted upwards.
 -maxUrange 5 -maxUrange 11.99 -sigma     0.05 -kernelSize 1 -lstep 0.05 -lobsGain 3 -astep 0.05
 -srr 0.1 -srt 0.2 -str 0.1 -stt 0.2
 -linearUpdate 1 -angularUpdate 0.2 -resampleThreshold 0.5
 -xmin -10 -xmax 10 -ymin -10 -ymax 10 -delta 0.05 -particles 100
[ INFO] [1645420007.299853112]: Initialization complete
update frame 0
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 0
Registering First Scan
update frame 7
update ld=1.38778e-17 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 1
Average Scan Matching Score=478.584
neff= 100
Registering Scans:Done
update frame 8
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 2
Average Scan Matching Score=454.423
neff= 100
Registering Scans:Done
update frame 9
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 3
Average Scan Matching Score=470.991
neff= 100
Registering Scans:Done
update frame 10
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 4
Average Scan Matching Score=456.326
neff= 100
Registering Scans:Done
update frame 11
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 5
^C[gmapping-5] killing on exit
[rplidarNode-3] killing on exit
[base_footprint_to_laser-4] killing on exit
[base_control-2] killing on exit
Average Scan Matching Score=468.525
neff= 100
Registering Scans:Done
update frame 12
update ld=0 ad=0
Laser Pose= 0.1037 0 -3.13287
m_count 6
Average Scan Matching Score=457.468
neff= 100
Registering Scans:Done
virtual GMapping::GridSlamProcessor::~GridSlamProcessor(): Start
virtual GMapping::GridSlamProcessor::~GridSlamProcessor(): Deleting tree
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
gmapping 是机器人的建图算法节点。
rplidarNode是雷达节点。
base_footprint_to_laser是激光雷达到底盘的坐标转换节点。
base_control是底盘控制节点。
@ubuntu:~$ rosnode list
/base_control
/base_footprint_to_laser
/gmapping
/rosout
/rplidarNode
@ubuntu:~$ rostopic list
/battery
/cmd_vel
/gmapping/entropy
/map
/map_metadata
/odom
/rosout
/rosout_agg
/scan
/tf
/tf_static

在这里插入图片描述

在这里插入图片描述

@ubuntu:~$ rostopic info /map
Type: nav_msgs/OccupancyGrid

Publishers: 
 * /gmapping (http://192.168.0.110:38195/)

Subscribers: None

@ubuntu:~$ rostopic echo /map
出现一堆

在这里插入图片描述

@ubuntu:~$ rostopic info /gmapping/entropy
Type: std_msgs/Float64

Publishers: 
 * /gmapping (http://192.168.0.110:38195/)

Subscribers: None

@ubuntu:~$ rostopic echo /gmapping/entropy
data: 4.60516902161
---
data: 4.60516902835
---
data: 4.60516903552
---
data: 4.60516903771
---

有cartographer、hector、karto、gmapping 四种常见的建图算法。切换:
robot:
 缺省为gmapping
 roslaunch robot_navigation robot_slam_laser.launch slam_methods:=hector
 roslaunch robot_navigation robot_slam_laser.launch slam_methods:=cartographer
 roslaunch robot_navigation robot_slam_laser.launch slam_methods:=karto
全局路径规划是机器人起点和目标点之间的完整的路径规划。不是机器人可以立刻执行的路径,比如阿克曼结构无法原地转向。此时需用局部路径规划器对全局路径规划进行动态调整。

局部路径规划算法:
	激光雷达导航:
		robot:roslaunch robot_navigation robot_navigation.launch
			默认使用的是 TEB 路径规划器,考虑到了机器人最小转向半径,适合阿克曼结构。
			roslaunch robot_navigation robot_slam_laser.launch planner:=teb
			dwa 算法可以实现原地转,适合差速转向结构。
			roslaunch robot_navigation robot_navigation.launch planner:=dwa
			
无地图场景下导航并建图:
robot:roslaunch robot_navigation robot_slam_laser.launch planner:=teb
pc:roslaunch robot_navigation slam_rviz.launch
pc:2D Nav Goal给定目标点,导航过程中不断完善地图。

保存地图:
robot:roscd robot_navigation/maps
robot:rosrun map_server map_saver -f map