workflowRos学习——移动机器⼈Ros导航详解及源码解析
1 执⾏过程
1.运⾏仿真机器⼈fake_turtlebot.launch:加载机器⼈模型——启动机器⼈仿真器——发布机器⼈状态
2.运⾏amcl节点fake_amcl.launch:加载地图节点map_rver——加载move_ba节点——加载fake_localization节点(AMCL)
3.运⾏rviz
英语补习学校
2 机器⼈仿真
//fake_turtlebot.launch
<launch>
<param name="/u_sim_time" value="fal" />
<!-- Load the URDF/Xacro model of our robot -->
<arg name="urdf_file" default="$(find xacro)/xacro.py '$(find rbx1_description)/urdf/turtlebot.urdf.xacro'" />
<param name="robot_description" command="$(arg urdf_file)" />
<node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen" clear_params="true">
<rosparam file="$(find rbx1_bringup)/config/fake_turtlebot_arbotix.yaml" command="load" />
<param name="sim" value="true"/>
</node>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher">
<param name="publish_frequency" type="double" value="20.0" />
</node>
</launch>
2.1加载机器⼈模型turtlebot.urdf.xacro,包括:颜色英语
1.硬件模型turtlebot_hardware.urdf.xacro
hanyiying
wearside 2.机器⼈本体模型turtlebot_body.urdf.xacro
3.标定参数turtlebot_calibration.xacro
4.运动学模型turtlebot_kinect.urdf.xacro
2.2 加载arbotix模拟器,即arbotix节点(加载配置⽂件:fake_turtlebot_arbotix.yaml)
port: /dev/ttyUSB0
baud: 115200
rate: 20
sync_write: True
sync_read: True
read_rate: 20
write_rate: 20
controllers: {
# Pololu motors: 1856 cpr = 0.3888105m travel = 4773 ticks per meter (empirical: 4100)
ba_controller: {type: diff_controller, ba_frame_id: ba_footprint, ba_width: 0.26, ticks_meter: 4100, Kp: 12, Kd: 12, Ki: 0, Ko: 50, accel_limit: 1.0 }
}
2.3 加载robot_state_publisher节点(设置频率publish_frequency:20)
3 机器⼈控制
//fake_amcl.launch
<launch>
<param name="u_sim_time" value="fal" />
<!-- Set the name of the map yaml file: can be overridden on the command line. -->
<arg name="map" default="test_map.yaml" />
<!-- Run the map rver with the desired map -->
<node name="map_rver" pkg="map_rver" type="map_rver" args="$(find rbx1_nav)/maps/$(arg map)"/>
<!-- The move_ba node -->
<include file="$(find rbx1_nav)/launch/fake_move_ba_amcl.launch" />
<!-- Run fake localization compatible with AMCL output -->
<node pkg="fake_localization" type="fake_localization" name="fake_localization" clear_params="true" output="screen">
<remap from="ba_po_ground_truth" to="odom" />
<param name="global_frame_id" value="map" />
<param name="ba_frame_id" value="ba_footprint" />
</node>
</launch>
3.1加载地图服务器节点map_rver,配置地图⽂件:test_map.yaml
image: test_map.pgm //包含占⽤数据的图像⽂件的路径; 可以是绝对的,或相对于YAML⽂件的位置
resolution: 0.050000 //地图的分辨率,⽶/像素
origin: [-13.800000, -12.200000, 0.000000] //地图中左下像素的2-D姿态为(x,y,yaw),偏航为逆时针旋转(yaw = 0表⽰⽆旋转)。系统的许多部分⽬前忽略偏航。negate: 0 //⽩/⿊⾃由/占⽤语义是否应该被反转(阈值的解释不受影响)
occupied_thresh: 0.9 //占据概率⼤于该阈值的像素被认为完全占⽤
free_thresh: 0.196 //占有概率⼩于该阈值的像素被认为是完全⾃由的
3.2加载moveba节点:fake_move_ba_amcl.launch——>运⾏成本、机器⼈半径、到达⽬标位置的距离,机器⼈移动的速度
either的用法
1.costmap_common_params.yaml:配置基本的参数,这些参数会被⽤于local_costmap和global_costmap.
obstacle_range: 2.5 //障碍物探测,引⼊地图
raytrace_range: 3.0 //⽤于机器⼈运动过程中,实时清除代价地图中的障碍物
#footprint: [[0.175, 0.175], [0.175, -0.175], [-0.175, -0.175], [-0.175, 0.175]] //将机器⼈的⼏何参数告诉导航功能包集,机器⼈和障碍物之间保持⼀个合理的距离
#footprint_inflation: 0.01
robot_radius: 0.175
inflation_radius: 0.2 //机器⼈与障碍物之间必须要保持的最⼩距离
max_obstacle_height: 0.6
min_obstacle_height: 0.0
asu
obrvation_sources: scan //设定导航包所使⽤的传感器
scan: {data_type: LarScan, topic: /scan, marking: true, clearing: true, expected_update_rate: 0}
2.local_costmap_params.yaml;
local_costmap:
global_frame: map
robot_ba_frame: ba_footprint
update_frequency: 3.0 //发布信息的频率,也就是costmap可视化信息发布的频率
publish_frequency: 1.0
static_map: true
rolling_window: fal //true:在机器⼈运动过程中,代价地图始终以机器⼈为中⼼
width: 6.0
height: 6.0
resolution: 0.01 //这三个是代价地图的的尺⼨和分辨率,单位都是m
transform_tolerance: 1.0
3.global_costmap_params.yaml;
global_costmap:
global_frame: map //定义机器⼈和地图之间的坐标变换,建⽴全局代价地图必须使⽤这个变换。
robot_ba_frame: ba_footprint
update_frequency: 1.0 //地图更新的频率
publish_frequency: 1.0
static_map: true //是否使⽤⼀个地图或者地图服务器来初始化全局代价地图
rolling_window: fal
resolution: 0.01
transform_tolerance: 1.0
map_type: costmap
4.ba_local_planner_params.yaml;
controller_frequency: 3.0
recovery_behavior_enabled: fal
clearing_rotation_allowed: fal
TrajectoryPlannerROS: //机器⼈的最⼤和最⼩速度限制值,也设定了加速度的限值 max_vel_x: 0.5
min_vel_x: 0.1
max_vel_y: 0.0 # zero for a differential drive robot
min_vel_y: 0.0
max_vel_theta: 1.0
min_vel_theta: -1.0登乐游原李商隐
min_in_place_vel_theta: 0.4
escape_vel: -0.1
acc_lim_x: 1.5
acc_lim_y: 0.0 # zero for a differential drive robot
acc_lim_theta: 1.2
holonomic_robot: fal //全向移动机器⼈那么此值为true
yaw_goal_tolerance: 0.1 # about 6 degrees
xy_goal_tolerance: 0.05 # 5 cm
latch_xy_goal_tolerance: fal
pdist_scale: 0.4
毛孔粗的原因gdist_scale: 0.8
meter_scoring: true
heading_lookahead: 0.325
heading_scoring: fal
heading_scoring_timestep: 0.8
occdist_scale: 0.05
oscillation_ret_dist: 0.05
publish_cost_grid_pc: fal
prune_plan: true
sim_time: 1.0
sim_granularity: 0.05
angular_sim_granularity: 0.1
vx_samples: 8
vy_samples: 0 # zero for a differential drive robot
vtheta_samples: 20
caissondwa: true
simple_attractor: fal
5.nav_test_params.yaml
TrajectoryPlannerROS:
yaw_goal_tolerance: 6.28 # We don't care about orientation
xy_goal_tolerance: 0.1 # 10 cm
pdist_scale: 0.8
gdist_scale: 0.4
occdist_scale: 0.1
3.3加载fake_localization节点:ACML
3 Rviz显⽰