当前位置: 首页 > news >正文

ros1仿真导航机器人 navigation

仅为学习记录和一些自己的思考,不具有参考意义。

1navigation导航框架

2导航设置过程

(1)启动仿真环境

roslaunch why_simulation why_robocup.launch

(2)启动move_base导航、amcl定位

roslaunch why_simulation nav.launch 

<launch><node pkg="move_base" type="move_base" name="move_base"><rosparam file="$(find why_simulation)/config/costmap_common_params.yaml" command="load" ns="global_costmap" /><rosparam file="$(find why_simulation)/config/costmap_common_params.yaml" command="load" ns="local_costmap" /><rosparam file="$(find why_simulation)/config/global_costmap_params.yaml" command="load" /><rosparam file="$(find why_simulation)/config/local_costmap_params.yaml" command="load" /><param name="base_global_planner" value="global_planner/GlobalPlanner" /> <param name="base_local_planner" value="wpbh_local_planner/WpbhLocalPlanner" /></node><node pkg="map_server" type="map_server" name="map_server" args="$(find why_simulation)/maps/map.yaml"/><node pkg="amcl" type="amcl" name="amcl"/></launch>

(3)启动rviz

rviz

(4)设置目标点

(5)将左右指令完善到launch文件中

<launch><include file="$(find why_simulation)/launch/why_robocup.launch"/><node pkg="move_base" type="move_base" name="move_base"><rosparam file="$(find why_simulation)/config/costmap_common_params.yaml" command="load" ns="global_costmap" /><rosparam file="$(find why_simulation)/config/costmap_common_params.yaml" command="load" ns="local_costmap" /><rosparam file="$(find why_simulation)/config/global_costmap_params.yaml" command="load" /><rosparam file="$(find why_simulation)/config/local_costmap_params.yaml" command="load" /><param name="base_global_planner" value="global_planner/GlobalPlanner" /> <param name="base_local_planner" value="wpbh_local_planner/WpbhLocalPlanner" /></node><node pkg="map_server" type="map_server" name="map_server" args="$(find why_simulation)/maps/map.yaml"/><node pkg="amcl" type="amcl" name="amcl"/><node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/nav.rviz"/></launch>

3全局路径规划算法

功能包简介

navfn与global_planner功能相同,同时包含了Dijkstra与A*算法。

navfn默认使用Dijkstra算法,算法无问题,但是此包的A*存在问题。

global_planner功能包无bug。

carrot_planner功能包碰到障碍物就停止了,常作为自己书写的规划器的模板。

启动全局规划

    <node pkg="move_base" type="move_base" name="move_base"><param name="base_global_planner" value="global_planner/GlobalPlanner" /> </node>

golbal_planner默认使用Dijkstra算法,若要切换为A*,则需要以下修改。

    <node pkg="move_base" type="move_base" name="move_base"><param name="base_global_planner" value="global_planner/GlobalPlanner" /> .<param name="GlobalPlanner/use_dijkstra" value="false" /> <param name="GlobalPlanner/use_grid_path" value="true" /> </node>

4 amcl

    <node pkg="amcl" type="amcl" name="amcl"/>

开始导航后真实位置的粒子越来越少

5 costmap

代价地图

代价地图的参数设置

costmap_common_params.yaml

robot_radius: 0.25
inflation_radius: 0.5
obstacle_range: 6.0
raytrace_range: 6.0
observation_sources: base_lidar
base_lidar: {data_type: LaserScan,topic: /scan, marking: true, clearing: true}

global_costmap_params.yaml

global_costmap:global_frame: maprobot_base_frame: base_footprintstatic_map: trueupdate_frequency: 1.0publish_frequency: 1.0transform_tolerance: 1.0recovery_behaviors:- name: 'conservative_reset'type: 'clear_costmap_recovery/ClearCostmapRecovery'- name: 'rotate_recovery'type: 'rotate_recovery/RotateRecovery'- name: 'aggressive_reset'type: 'clear_costmap_recovery/ClearCostmapRecovery'conservative_reset:reset_distance: 2.0layer_names: ["obstacle_layer"]aggressive_reset:reset_distance: 0.0layer_names: ["obstacle_layer"]

local_costmap_params.yaml

local_costmap:global_frame: odomrobot_base_frame: base_footprintstatic_map: falserolling_window: truewidth: 3.0height: 3.0update_frequency: 10.0publish_frequency: 10.0transform_tolerance: 1.0

6 recovery_behaviors

应急机制,在导航进行停滞时,尝试刷新周围障碍物的信息,重新进行全局路径规划。

recovery_behaviors:- name: 'conservative_reset'type: 'clear_costmap_recovery/ClearCostmapRecovery'- name: 'rotate_recovery'type: 'rotate_recovery/RotateRecovery'- name: 'aggressive_reset'type: 'clear_costmap_recovery/ClearCostmapRecovery'

7局部路径规划算法

更改launch文件中的以下代码即可更换算法

        <param name="base_local_planner" value="wpbh_local_planner/WpbhLocalPlanner" />

DWA测试

<launch><include file="$(find why_simulation)/launch/why_robocup.launch"/><node pkg="move_base" type="move_base" name="move_base"><rosparam file="$(find why_simulation)/config/costmap_common_params.yaml" command="load" ns="global_costmap" /><rosparam file="$(find why_simulation)/config/costmap_common_params.yaml" command="load" ns="local_costmap" /><rosparam file="$(find why_simulation)/config/global_costmap_params.yaml" command="load" /><rosparam file="$(find why_simulation)/config/local_costmap_params.yaml" command="load" /><param name="base_global_planner" value="global_planner/GlobalPlanner" /> <!-- <param name="GlobalPlanner/use_dijkstra" value="false" />  --><!-- <param name="GlobalPlanner/use_grid_path" value="true" />  --><!-- DWA --><param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" /><rosparam file="$(find why_simulation)/config/dwa_local_planner_params.yaml" command="load" /></node><node pkg="map_server" type="map_server" name="map_server" args="$(find why_simulation)/maps/map.yaml"/><node pkg="amcl" type="amcl" name="amcl"/><node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/nav.rviz"/></launch>

导航结果可以看过许多白色的候选路径,绿色为最优路线。

dwa_local_planner_params.yaml

DWAPlannerROS:# 速度参数max_vel_x: 0.3      # 最大x方向速度min_vel_x: -0.05    # 最小x方向速度(设置负数将会允许倒车)max_vel_y: 0.0      # 差分驱动机器人的最大y方向速度为 0.0min_vel_y: 0.0      # 差分驱动机器人的最小y方向速度为 0.0max_vel_trans: 0.3  # 最大平移速度min_vel_trans: 0.01 # 最小平移速度(建议不要设置为 0.0 )trans_stopped_vel: 0.1  # 当平移速度小于这个值,就让机器人停止acc_lim_trans: 2.5      # 最大平移加速度acc_lim_x: 2.5          # x方向的最大加速度上限acc_lim_y: 0.0          # y方向的加速度上限(差分驱动机器人应该设置为 0.0 )max_vel_theta: 1.0      # 最大旋转速度,略小于基座的功能min_vel_theta: -0.01    # 当平移速度可以忽略时的最小角速度theta_stopped_vel: 0.1  # 当旋转速度小于这个值,就让机器人停止acc_lim_theta: 6.0      # 旋转的加速度上限# 目标容差参数yaw_goal_tolerance: 0.1         # 目标航向容差xy_goal_tolerance: 0.05         # 目标xy容差latch_xy_goal_tolerance: false  # 到达目标容差范围后,停止移动,只旋转调整航向# 向前模拟参数sim_time: 1.7       # 模拟时间,默认值 1.7vx_samples: 3       # x方向速度采样数,默认值 3vy_samples: 1       # 差分驱动机器人y方向速度采样数,只有一个样本vtheta_samples: 20  # 旋转速度采样数,默认值 20# 轨迹评分参数path_distance_bias: 32.0  # 靠近全局路径的权重,默认值 32.0goal_distance_bias: 24.0  # 接近导航目标点的权重,默认值 24.0occdist_scale: 0.01       # 控制器避障的权重,默认值 0.01forward_point_distance: 0.325 # 从机器人到评分点的位置,默认值 0.325stop_time_buffer: 0.2     # 在碰撞前机器人必须停止的时间长度,留出缓冲空间,默认值 0.2scaling_speed: 0.25       # 缩放机器人速度的绝对值,默认值 0.25max_scaling_factor: 0.2   # 机器人足迹在高速时能缩放的最大系数,默认值 0.2# 防振动参数oscillation_reset_dist: 1.05 # 重置振动标志前需要行进的距离,默认值 0.05# 辅助调试选项publish_traj_pc : true      # 是否在 RViz 里发布轨迹publish_cost_grid_pc: true  # 是否在 RViz 里发布代价网格global_frame_id: odom       # 基础坐标系# 差分驱动机器人配置holonomic_robot: false # 是否全向移动机器人

在线调参工具

rosrun rqt_reconfigure rqt_reconfigure

TEB测试

<launch><include file="$(find why_simulation)/launch/why_robocup.launch"/><node pkg="move_base" type="move_base" name="move_base"><rosparam file="$(find why_simulation)/config/costmap_common_params.yaml" command="load" ns="global_costmap" /><rosparam file="$(find why_simulation)/config/costmap_common_params.yaml" command="load" ns="local_costmap" /><rosparam file="$(find why_simulation)/config/global_costmap_params.yaml" command="load" /><rosparam file="$(find why_simulation)/config/local_costmap_params.yaml" command="load" /><param name="base_global_planner" value="global_planner/GlobalPlanner" /> <!-- <param name="GlobalPlanner/use_dijkstra" value="false" />  --><!-- <param name="GlobalPlanner/use_grid_path" value="true" />  --><!-- DWA --><!-- <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" /> --><!-- <rosparam file="$(find why_simulation)/config/dwa_local_planner_params.yaml" command="load" /> --><!-- TEB --><param name="base_local_planner" value="teb_local_planner/TebLocalPlannerROS" /><rosparam file="$(find why_simulation)/config/teb_local_planner_params.yaml" command="load" /></node><node pkg="map_server" type="map_server" name="map_server" args="$(find why_simulation)/maps/map.yaml"/><node pkg="amcl" type="amcl" name="amcl"/><node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/nav.rviz"/></launch>

http://www.lryc.cn/news/392963.html

相关文章:

  • Python制作动态颜色变换:颜色渐变动效
  • Python 异步编程介绍与代码示例
  • 堆叠的作用
  • ubuntu 如何查看某一个网卡的ip地址
  • 跨界客户服务:拓展服务边界,创造更多价值
  • linux驱动编程 - kfifo先进先出队列
  • JS 四舍五入使用整理
  • 上万组风电,光伏,用户负荷数据分享
  • 在物联网快速发展的趋势下,Java 怎样优化对低功耗、资源受限的边缘设备的支持,保障物联网应用的稳定运行?
  • java-HashSet 源码分析 1
  • K8S 部署 EFK
  • AI Earth应用—— 在线使用sentinel数据VV和VH波段进行水体提取分析(昆明抚仙湖、滇池为例)
  • 基于Hadoop平台的电信客服数据的处理与分析③项目开发:搭建基于Hadoop的全分布式集群---任务9:HBase的安装和部署
  • go语言day09 通道 协程的死锁
  • 黑马的ES课程中的不足
  • STM32 中断编程入门
  • 使用maven搭建一个SpingBoot项目
  • 使用 HTTPS 已成为网站的标配了
  • 前后端分离Nginx
  • 【简单讲解下Tauri】
  • mac上挂载linux目录
  • Linux系统的服务——以Centos7为例
  • Numpy矩阵运算
  • Spring容器Bean之XML配置方式
  • 【Rust入门】生成随机数
  • 普通Java工程如何在代码中引用docker-compose.yml中的environment值
  • 微观特征轮廓尺寸测量:光学3D轮廓仪、共焦显微镜与台阶仪的应用
  • Rust开发环境搭建
  • 图文识别0难度上手~基于飞浆对pdf简易ocr并转txt
  • FFmpeg常用命令手册