1.雷达
使用雷达公司的代码:
在launch文件中 要发布 激光雷达与底盘的tf坐标关系
<node pkg = "tf" type = "static_transform_publisher" name = "xxx" args = "x y z 偏航 俯仰 翻滚 参考坐标系 自己的坐标系 100" />
2.串口
发布里程计信息
线速度:格式:geometry_msgs::TwistStamped 话题 raw_vel
欧拉角 格式:sensor_msgs 话题 imu/data_raw 其中有个参考坐标系的数据
再订阅一个消息,发出去:
格式:geometry_msgs::Twist 话题 cmd_vel
3.base节点
订阅串口发布的原始角速度,和线速度的话题
通过滤波,然后传给里程计
过滤器的安装:sudo apt-get install ros-版本-imu-complementary-filter
里程计信息计算:
http://wiki.ros.org/navigation/Tutorials/RobotSetup/Odom
里程计发布最终计算出的信息
4.slam_gmapping
安装一下包:
sudo apt-get install ros-版本-slam-gmapping
sudo apt-get install ros-版本-gmapping
代码地址:
https://github.com/ros-perception/slam_gmapping.git
(1)把代码中参数写成xml文件 再启动雷达比较好 比较简洁
(2)map 是地图的原点 odom 是里程计起点 理论上重合的 但是有误差
(3)base_link 是机器人的坐标
安装 map_server功能包来保存地图
rosrun map_server map_server -f 名字
4.amcl定位
获得地图来定位:
安装包:rosrun apt-get-install ros-版本-amcl
代码地址https://github.com/ros-planning/navigation.git
5.move_base
安装包:sudo apt-get install ros-版本-move-base
写5个.yaml文件
地址http://wiki.ros.org/navigation/Tutorials/RobotSetup
2.3.1公共的机器人的参数:
Common Configuration (local_costmap) & (global_costmap)
障碍物
obstacle_range:2.5
raytrace_range:3.0
车身的规格
footprint: [[x0, y0], [x1, y1], ... [xn, yn]]
膨胀半径
inflation_radius: 0.1
容忍误差
transform_tolerance:0.2
observation_sources:
2.3.2 Global Configuration (global_costmap)
global_costmap_params.yaml文件
2.3.3 Local Configuration (local_costmap)
local_costmap_params.yaml文件
2.4 Base Local Planner Configuration
base_local_planner_params.yaml文件
允许的误差
xy_goal_tolerance:
yaw_goal_tolerance:
5.再调整一下 move_base的yaml文件