Parcourir la source

[feat]:暂存,已经能跑起来了

sangxin il y a 3 ans
Parent
commit
40e0a7bbed

+ 2 - 2
docs/chapt10/10.7Nav2导航框架介绍.md

@@ -2,11 +2,11 @@
 
 上一节我们对机器人导航过程中所用到的2D地图进行了介绍,本节我们就来正式的学习下Nav2导航框架,关于Nav2相关的更多资料,请访问[Nav2中文网](https://nav2.fishros.com/)。
 
-1.Nav2是什么
+## 1.Nav2是什么
 
 Nav2项目继承并发扬ROS导航栈的精神。该项目力求以安全的方式让移动机器人从A点移动到B点。Nav2也可以应用于其他应用,包括机器人导航,如下动态点跟踪,在这个过程中需要完成动态路径规划、计算电机的速度、避免障碍、恢复行为。
 
-2.Nav2如何做到的
+## 2.Nav2如何做到的
 
 Nav2使用行为树调用模块化服务器来完成一个动作。动作可以是计算路径、控制力、恢复或任何其他与导航相关的操作。这些都是通过ROS Action服务器与行为树 (BT) 通信的独立节点。下图可以让你对Nav2的架构有一个很好的初步了解。
 

+ 12 - 7
docs/chapt10/10.8为Fishbot配置Nav2.md

@@ -95,18 +95,23 @@ touch fishbot_nav2.yaml
 
 ### 3.1 参数列表
 
+| 编号 | 配置项                 | 用途 |对应模块与参数详解                                  |
+| ----| ---------------------- | ------------ | --------------------------- |
+| 1 | amcl| 机器人定位 | [nav2_amcl](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-amcl.html) |
+| 2| bt_navigator| 导航行为树(用于加载行为树节点并根据xml配置进行调度) | [nav2_bt_navigator](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-bt-navigator.html),[nav2_behavior_tree](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-bt-xml.html) |
+| 3| controller_server| 控制器服务器 | [nav2_controller](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-controller-server.html),[nav2_dwb_controller](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-dwb-controller.html),[nav2_regulated_pure_pursuit_controller](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-regulated-pp.html) |
+| 4 | planner_server| 规划服务器 | [nav2_planner](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-planner-server.html),[nav2_navfn_planner](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-navfn.html),[smac_planner](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-smac-planner.html) |
+| 5 | recoveries_server| 恢复服务器 | [nav2_recoveries](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-recovery-server.html) |
+| 6 | local_costmap| 局部代价地图 | [nav2_costmap_2d](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-costmaps.html) |
+| 7 | global_costmap| 全局代价地图 |   [nav2_costmap_2d](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-costmaps.html),[nav2_map_server](http://dev.nav2.fishros.com/doc/configuration/packages/configuring-map-server.html)   |
 
 
-
-
-
-
-
-
-有关Nav2所有参数的详细介绍,可以访问Nav2中文网中的配置指南章节,非常的详细,无比的具体。
+有关更多的Nav2所有参数的详细介绍,可以访问Nav2中文网中的配置指南章节,非常的详细,无比的具体。
 
 ![image-20220517203105467](10.8%E4%B8%BAFishbot%E9%85%8D%E7%BD%AENav2/imgs/image-20220517203105467.png)
 
+### 3.2 配置机器人半径
+
 
 
 

+ 102 - 0
docs/chapt10/10.9使用Fishbot进行自主导航.md

@@ -2,6 +2,108 @@
 
 1.编写launch文件
 
+```
+'''
+作者: 小鱼
+公众号: 鱼香ROS
+QQ交流群: 2642868461
+描述: file content
+'''
+import os
+
+from ament_index_python.packages import get_package_share_directory
+from launch import LaunchDescription
+from launch.actions import DeclareLaunchArgument
+from launch.actions import IncludeLaunchDescription
+from launch.launch_description_sources import PythonLaunchDescriptionSource
+from launch.substitutions import LaunchConfiguration
+from launch_ros.actions import Node
+
+
+
+def generate_launch_description():
+    fishbot_navigation2_dir = get_package_share_directory('fishbot_navigation2')
+    nav2_bringup_dir = get_package_share_directory('nav2_bringup')
+
+    use_sim_time = LaunchConfiguration('use_sim_time', default='true')
+    map_yaml_path = LaunchConfiguration('map',default=os.path.join(fishbot_navigation2_dir,'maps','fishbot_map.yaml'))
+    nav2_param_path = LaunchConfiguration('params_file',default=os.path.join(fishbot_navigation2_dir,'param','fishbot.yaml'))
+
+    rviz_config_dir = os.path.join(nav2_bringup_dir,'rviz','nav2_default_view.rviz')
+
+    return LaunchDescription([
+        DeclareLaunchArgument('use_sim_time',default_value=use_sim_time,description='Use simulation (Gazebo) clock if true'),
+        DeclareLaunchArgument('map',default_value=map_yaml_path,description='Full path to map file to load'),
+        DeclareLaunchArgument('params_file',default_value=nav2_param_path,description='Full path to param file to load'),
+
+        IncludeLaunchDescription(
+            PythonLaunchDescriptionSource([nav2_bringup_dir,'/launch','/bringup_launch.py']),
+            launch_arguments={
+                'map': map_yaml_path,
+                'use_sim_time': use_sim_time,
+                'params_file': nav2_param_path}.items(),
+        ),
+        Node(
+            package='rviz2',
+            executable='rviz2',
+            name='rviz2',
+            arguments=['-d', rviz_config_dir],
+            parameters=[{'use_sim_time': use_sim_time}],
+            output='screen'),
+    ])
+
+```
+
+2.CMakeLists.txt
+
+```
+cmake_minimum_required(VERSION 3.5)
+project(fishbot_navigation2)
+
+# Default to C99
+if(NOT CMAKE_C_STANDARD)
+  set(CMAKE_C_STANDARD 99)
+endif()
+
+# Default to C++14
+if(NOT CMAKE_CXX_STANDARD)
+  set(CMAKE_CXX_STANDARD 14)
+endif()
+
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  add_compile_options(-Wall -Wextra -Wpedantic)
+endif()
+
+# find dependencies
+find_package(ament_cmake REQUIRED)
+# uncomment the following section in order to fill in
+# further dependencies manually.
+# find_package(<dependency> REQUIRED)
+
+
+
+if(BUILD_TESTING)
+  find_package(ament_lint_auto REQUIRED)
+  # the following line skips the linter which checks for copyrights
+  # uncomment the line when a copyright and license is not present in all source files
+  #set(ament_cmake_copyright_FOUND TRUE)
+  # the following line skips cpplint (only works in a git repo)
+  # uncomment the line when this package is not in a git repo
+  #set(ament_cmake_cpplint_FOUND TRUE)
+  ament_lint_auto_find_test_dependencies()
+endif()
+
+install(
+  DIRECTORY launch  config param maps
+  DESTINATION share/${PROJECT_NAME}
+)
+
+ament_package()
+
+```
+
+3.
+
 --------------
 
 技术交流&&问题求助: