├── ROS笔记-01 install和helloworld.txt ├── ROS笔记-02 环境管理和workspace.txt ├── ROS笔记-03 初入仿真(Rviz).txt ├── ROS笔记-04 install UTM-30LX-EW on ROS.txt ├── ROS笔记-05 hector-slam安装和测试.txt ├── ROS笔记-06 使用激光雷达建图.txt ├── ROS笔记-07 hector后续.txt ├── ROS笔记-08 hector-slam后续阅读笔记.txt ├── ROS笔记-08 ros_by_example.txt ├── ROS笔记-09 Networking ROS.txt ├── ROS笔记-10 ros on RaspberryPi.txt ├── ROS笔记-11 Navigation.txt ├── ROS笔记-12 Control by KeyBoard.txt ├── ROS笔记-13 定位与导航迷惑后阅读.txt ├── ROS笔记-14 hector_slam with NetWorking ROS.txt ├── ROS笔记-15 amcl with NetWorking ROS.txt ├── ROS笔记-16 Navigation with Networking ROS.txt ├── ROS笔记-16 Navigation without Networking ROS.txt ├── ROS笔记-17 Unknown_Area_Navigation(move_base with hector_slam).txt ├── ROS笔记-18 Car Control.txt ├── ROS笔记-19 Velodyne.txt ├── books ├── Introduction to Autonomous Mobile Robots.pdf ├── Learning ROS for Robotics Programming.pdf ├── Programming Robots with ROS A Practical Introduction to the Robot Operating System.pdf ├── ros_by_example_1_indigo.pdf └── ros_by_example_2_indigo.pdf ├── 拿ROS玩移动机器人自主导航攻略--by 西工大一小学生.txt └── 老王说ROS.txt /ROS笔记-01 install和helloworld.txt: -------------------------------------------------------------------------------- 1 | 1. Ubuntu install of ROS Indigo<-- LTS (Long Term Service) 2 | http://wiki.ros.org/indigo/Installation/Ubuntu 3 | 4 | 2. HelloWorld 5 | http://3.1415926.science/ros/2015/06/15/ROS%E6%91%B8%E7%B4%A2(3)%E4%B9%8BHelloWorld/ 6 | 7 | workspace_folder/ -- WORKSPACE, provided by yourself 8 | build/ -- provided by catkin, $ catkin_make 9 | devel/ -- provided by catkin, $ catkin_make 10 | src/ -- SOURCE SPACE, provided by yourself 11 | CMakeLists.txt -- 'Toplevel' CMake file, provided by catkin, $ catkin_init_workspace 12 | package_1/ 13 | CMakeLists.txt -- CMakeLists.txt file for package_1 14 | package.xml -- Package manifest for package_1 15 | ... 16 | package_n/ 17 | CMakeLists.txt -- CMakeLists.txt file for package_n 18 | package.xml -- Package manifest for package_n 19 | 20 | 21 | 22 | 1). 初始化项目目录 创建工作空间目录workspace/src后进入并执行命令以初始化此项目目录 23 | catkin_init_workspace 24 | 2). 编译工作空间 先切换到workspace目录 25 | catkin_make 26 | 3). 配置工作空间环境 27 | source devel/setup.bash 28 | 环境变量设置检查 29 | echo $ROS_PACKAGE_PATH 30 | 若返回类似这样 /root/dev/workspace/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks, 则环境变量配置成功 31 | 4). 创建包 32 | cd src 33 | catkin_create_pkg pachage_1 std_msgs rospy roscpp 34 | 35 | Created file pachage_1/CMakeLists.txt 36 | Created file pachage_1/package.xml 37 | Created folder pachage_1/include/pachage_1 38 | Created folder pachage_1/src -- your source file 39 | 40 | 41 | 42 | a. 两种创建ROS程序包的方式介绍 43 | catkin包是ROS的一个官方的编译构建系统,是原本的ROS的编译构建系统rosbuild的后继者 44 | rosbuild包(不使用) 45 | b. 过程(学习如何开发catkin工程) 46 | b.1 参照上文完成工程源码编写,熟悉工程结果,了解大致原理 47 | cmake CMakeLists.txt 48 | make 49 | b.2 运行 ROS 节点前需要开启 ros_master 50 | roscore 51 | b.3 运行上述创建的两个节点 52 | ./listener 53 | ./talker 54 | -------------------------------------------------------------------------------- /ROS笔记-02 环境管理和workspace.txt: -------------------------------------------------------------------------------- 1 | [了解] 2 | 参考网址:http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment 3 | 4 | 3. Managing Your Environment 5 | $ printenv | grep ROS 6 | 7 | 4. Create a ROS Workspace -- catkin/rosbuild 8 | -------------------------------------------------------------------------------- /ROS笔记-03 初入仿真(Rviz).txt: -------------------------------------------------------------------------------- 1 | 1. 安装 2 | apt-get install ros-indigo-rviz 3 | 2. 运行 4 | rosrun rviz rviz 5 | 3. 如何使用 6 | 3.1 ROS摸索(4)之初入仿真 7 | http://3.1415926.science/ros/2015/07/12/ROS%E6%91%B8%E7%B4%A2(4)%E4%B9%8B%E5%88%9D%E5%85%A5%E4%BB%BF%E7%9C%9F/ 8 | (已学习,作为了解吧) 9 | 10 | 3.2 http://wiki.ros.org/rviz 11 | 建议这里 http://wiki.ros.org/rviz/UserGuide 12 | Install from debian repository 13 | Startup 14 | Displays 15 | Name(Add Type) Laser Scan 16 | Description Shows data from a laser scan, with different options for rendering modes, accumulation, etc. 17 | Messages Used sensor_msgs/LaserScan 18 | -------------------------------------------------------------------------------- /ROS笔记-04 install UTM-30LX-EW on ROS.txt: -------------------------------------------------------------------------------- 1 | 1. 浏览一下官网 2 | http://wiki.ros.org/hokuyo_node 3 | 然后跳到 http://wiki.ros.org/urg_node,因为他说:Looking for a newer driver?... 4 | 5 | 2. 安装 urg_node(可行的!!!) 6 | 2.1 sudo apt-get install ros-indigo-urg-node (https://github.com/ros-drivers/urg_node.git) 7 | follow: http://answers.ros.org/question/165016/problem-installing-urg_node-on-ros-hydro/ 8 | 2.2 然后使用RVIZ测试一下: 9 | a. terminal-1 运行master节点 10 | roscore 11 | b. terminal-2 运行驱动urg_node节点 12 | follow: http://answers.ros.org/question/58822/use-hokuyo-lidar-with-ethernet-in-ros/?answer=59260#post-id-59260 13 | 运行前需要连接传感器,并配置好网络(能ping通) 14 | sudo ifconfig eth0 192.168.0.11 netmask 255.255.255.0 15 | sudo route add default gw 192.168.0.10 16 | ping 192.168.0.10 17 | 运行节点 18 | rosrun urg_node urg_node _ip_address:="192.168.0.10" 19 | c. 运行仿真,添加Laser Scan 20 | rosrun rviz rviz 21 | [rosrun rviz rviz -d `rospack find urg_node`/urg_node.rviz] 22 | 23 | 2.3 直接源代码安装(后面可能需要修改源码) 24 | 2.3.1 需要调整 CMakeList.txt 25 | ## Modify by Durant35 to put it here, before!!!!!!!!!!!!!! ## LIBRARIES: 26 | ## Specify additional locations of header files 27 | include_directories(include ${catkin_INCLUDE_DIRS}) 28 | 29 | ## LIBRARIES: libraries you create in this project that dependent projects also need 30 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need 31 | ## DEPENDS: system dependencies of this project that dependent projects also need 32 | catkin_package( 33 | INCLUDE_DIRS include 34 | LIBRARIES urg_c_wrapper 35 | CATKIN_DEPENDS roscpp sensor_msgs urg_c rosconsole nodelet dynamic_reconfigure laser_proc 36 | DEPENDS 37 | ) 38 | 2.3.2 需要设置安装目录到你的ros目录 39 | cmake -DCMAKE_INSTALL_PREFIX=/opt/ros/indigo .. 40 | 41 | 2.3.3 然后就是 make 和 make install 了 42 | 2.3.4 关键源代码 43 | !!!!!!!!! 44 | urg_node/src/urg_node.cpp 45 | !!!!!!!!! 46 | line 210: 改成发布 scan 47 | bool publish_intensity; 48 | //pnh.param("publish_intensity", publish_intensity, true); 49 | // !!!! modified by Durant35 50 | pnh.param("publish_intensity", publish_intensity, false); 51 | 52 | bool publish_multiecho; 53 | //pnh.param("publish_multiecho", publish_multiecho, true); 54 | // !!!! modified by Durant35 55 | pnh.param("publish_multiecho", publish_multiecho, false); 56 | 57 | 58 | !!!使用的第一种方法 hokuyo_node 不行呀 59 | cd ${ROS_WORKSPACE}/sandbox 60 | git clone https://github.com/ros-drivers/hokuyo_node.git 61 | 62 | 63 | 安装过程各种问题摘录,也许会有用 64 | use Hokuyo LIDAR with ethernet in ROS 65 | from: http://answers.ros.org/question/58822/use-hokuyo-lidar-with-ethernet-in-ros/ 66 | roslaunch hokuyo_node hokuyo_test.launch 67 | rosrun hokuyo_node hokuyo_node _ip_address:="192.168.0.10" 68 | 69 | sourceforge -- URG Network 70 | from: https://sourceforge.net/p/urgnetwork/wiki/ROS%20Support/?version=2 71 | 72 | http://wiki.ros.org/hokuyo_node 73 | Package Summary for hokuyo_node 74 | 75 | Problem with Hokuyo UTM-30LX-EW. [closed] 76 | http://answers.ros.org/question/134911/problem-with-hokuyo-utm-30lx-ew/ 77 | hokuyo_test.launch 78 | This launch file shows how to start a hokuyo node. 79 | 80 | Hokuyo UTM-30LX-EW not detected in Ubuntu or PC 81 | http://answers.ros.org/question/62830/hokuyo-utm-30lx-ew-not-detected-in-ubuntu-or-pc/ 82 | hokuyo UTM-30LX-EW laser scanner: problems to detect 83 | http://answers.ros.org/question/212527/hokuyo-utm-30lx-ew-laser-scanner-problems-to-detect/ 84 | -------------------------------------------------------------------------------- /ROS笔记-05 hector-slam安装和测试.txt: -------------------------------------------------------------------------------- 1 | How to build a Map Using Logged Data(Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag) 2 | 参考网址:http://wiki.ros.org/hector_slam/Tutorials/MappingUsingLoggedData 3 | 4 | 1. 安装 /opt/ros/indigo 5 | sudo apt-get install ros-indigo-hector-slam 6 | [sudo apt-get purge ros-indigo-hector-* 卸载] 7 | 8 | 源码:https://github.com/tu-darmstadt-ros-pkg/hector_slam 9 | 10 | 11 | 2. 获取数据集(这里需要翻墙 https://code.google.com/archive/p/tu-darmstadt-ros-pkg/downloads) 12 | [或者从我的github备份版 下载 https://github.com/Durant35/tu-darmstadt-ros-pkg-dataset_backup.git] 13 | wget http://tu-darmstadt-ros-pkg.googlecode.com/files/Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag 14 | 15 | 16 | 3. 测试: 17 | terminal-1 按照tutorial.launch 节点配置来运行,包含启动master节点 18 | roslaunch hector_slam_launch tutorial.launch 19 | terminal-2 20 | rosbag play Team_Hector_MappingBox_Dagstuhl_Neubau.bag --clock 21 | rosbag play Team_Hector_MappingBox_L101_Building.bag --clock 22 | rosbag play Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag --clock 23 | rosbag paly Team_Hector_MappingBox_RoboCupGermanOpen2011_Arena.bag --clock 24 | 25 | 26 | 备注信息: 27 | hector_mapping 28 | provides 2D pose estimates at scan rate of the sensors (40Hz for the UTM-30LX) 29 | -------------------------------------------------------------------------------- /ROS笔记-06 使用激光雷达建图.txt: -------------------------------------------------------------------------------- 1 | 1. 安装框架 hector_slam_example [https://github.com/DaikiMaekawa/hector_slam_example] 2 | 参考网址: http://m.blog.csdn.net/article/details?id=49026955 3 | 或 http://www.cnblogs.com/zxouxuewei/p/5307736.html ----- 二.利用深度相机仿激光数据创建地图 4 | 5 | 1.1 git clone 6 | 1.2 添加 clone 路径到 $ROS_PACKAGE_PATH 7 | ROS_PACKAGE_PATH=/home/durant35/Workspace/ROS/hector_slam/hector_slam_example:$ROS_PACKAGE_PATH 8 | 1.3 安装 9 | rosdep install hector_slam_example 10 | 2. 运行 11 | 2.1 确保 $ROS_PACKAGE_PATH 找到 hector_slam_example 12 | ROS_PACKAGE_PATH=/home/durant35/Workspace/ROS/hector_slam/hector_slam_example:$ROS_PACKAGE_PATH 13 | 2.2 修改 clone 路径下的 launch 文件,这里修改 hector_hokuyo.launch,换成我们自定义的驱动 urg_node 14 | 17 | 18 | 19 | 20 | 21 | 22 | 注:param节点用于传参数,可有可无,因为默认就是 192.168.0.10 23 | 具体参数及参数类型,请查看驱动wiki说明 24 | 25 | 2.3 启动,运行,进入实验建图 26 | roslaunch hector_slam_example hector_hokuyo.launch 27 | 28 | 2.4 如何解决没办法显示轨迹的问题 29 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 备注信息: 41 | ROS探索总结(十三)——导航与定位框架 42 | http://www.guyuehome.com/267 43 | ROS探索总结(十四)——move_base(路径规划) 44 | http://www.guyuehome.com/270 45 | ROS探索总结(十五)——amcl(导航与定位) 46 | http://www.guyuehome.com/273 47 | Setup and Configuration of the Navigation Stack on a Robot 48 | http://wiki.ros.org/navigation/Tutorials/RobotSetup 49 | Publishing LaserScans over ROS(含具体ROS代码) 50 | http://wiki.ros.org/navigation/Tutorials/RobotSetup/Sensors 51 | 52 | ROS实战(1)之架构设计 53 | http://3.1415926.science/ros/2016/01/02/ROS%E5%AE%9E%E6%88%98(1)%E4%B9%8B%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1/ 54 | 55 | gmapping库需要两个输入,其一为激光雷达数据/scan,其二为全局的tf转换关系;且gmapping需求的tf中需要一个里程计数据以构建坐标系 56 | 57 | -------------------------------------------------------------------------------- /ROS笔记-07 hector后续.txt: -------------------------------------------------------------------------------- 1 | Team Hector Project (https://code.google.com/archive/p/tu-darmstadt-ros-pkg/) 2 | http://www.teamhector.de/resources 3 | http://wiki.ros.org/tu-darmstadt-ros-pkg 4 | 5 | hector_slam 6 | http://wiki.ros.org/hector_slam 7 | How to build a Map Using Logged Data(Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag) 8 | http://wiki.ros.org/hector_slam/Tutorials/MappingUsingLoggedData 9 | sudo apt-get install ros-indigo-hector-slam 10 | 11 | wget http://tu-darmstadt-ros-pkg.googlecode.com/files/Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag 12 | 13 | terminal-1 14 | roslaunch hector_slam_launch tutorial.launch 15 | terminal-2 16 | rosbag play Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag --clock 17 | 18 | 19 | hector_navigation 20 | http://wiki.ros.org/hector_navigation 21 | 22 | hector_localization 23 | http://wiki.ros.org/hector_localization 24 | 25 | 首先需要安装依赖 26 | sudo apt-get install ros-indigo-geographic-msgs 27 | -------------------------------------------------------------------------------- /ROS笔记-08 hector-slam后续阅读笔记.txt: -------------------------------------------------------------------------------- 1 | ROS 学习系列 -- RViz 实时观测机器人建立导航2D封闭空间地图过程 (SLAM) 2 | http://m.blog.csdn.net/article/details?id=44993391 3 | 4 | ROS 对机器人导航提供了非常强大的支持,这可以让我们在不了解细节和海量复杂无比的科学计算的情况下就可以对机器人的导航,定位,路径规划。这其中第一步就是要建立一个封闭环境的地图,这个过程叫做SLAM (simultaneous localization and mapping),也称为CML (Concurrent Mapping and Localization), 即时定位与地图构建,或并发建图与定位 5 | 6 | -------------------------------------------------------------------------------- /ROS笔记-08 ros_by_example.txt: -------------------------------------------------------------------------------- 1 | 1. 新建工程项目 ros_by_example 2 | 2. 在 ros_by_example/src/ 下, 3 | git clone https://github.com/pirobot/rbx1.git 4 | cd rbx1 5 | git checkout indigo-devel 6 | cd .. 7 | catkin_make 8 | source devel/setup.bash 9 | rospack profile 10 | 11 | 3. amcl(导航与定位) 12 | 测试: 13 | source devel/setup.sh 14 | roslaunch rbx1_bringup fake_turtlebot.launch 15 | 16 | # 然后运行amcl节点,使用测试地图 17 | # 这个lanuch文件作用是加载地图,并且调用fake_move_base.launch文件打开move_base节点并加载配置文件,最后运行amcl 18 | source devel/setup.sh 19 | roslaunch rbx1_nav fake_amcl.launch map:=test_map.yaml 20 | 21 | # 在rviz中就显示出地图和机器人 22 | rosrun rviz rviz -d `rospack find rbx1_nav`/amcl.rviz 23 | 24 | -------------------------------------------------------------------------------- /ROS笔记-09 Networking ROS.txt: -------------------------------------------------------------------------------- 1 | 2 | Robot 3 | hostname 4 | 5 | export ROS_HOSTNAME=raspberrypi.local 6 | roscore & 7 | 8 | Desktop 9 | hostname 10 | 11 | export ROS_HOSTNAME=tarantula7-B480.local 12 | export ROS_MASTER_URI=http://raspberrypi.local:11311 13 | 14 | rosrun rviz rviz -d `rospack find urg_node`/urg_node.rviz 15 | 16 | 17 | hector slam with NetWorking ROS 18 | Raspberry pi 19 | cd ~/ros_my_ws 20 | source devel/setup.sh 21 | export ROS_HOSTNAME=durant35.local 22 | roscore & 23 | roslaunch urg_node urg_node.launch 24 | 25 | Desktop 26 | cd Workspace/ROS/hector_slam/ 27 | source devel/setup.sh 28 | export ROS_HOSTNAME=tarantula7-B480.local 29 | export ROS_MASTER_URI=http://durant35.local:11311 30 | roslaunch hector_slam_example hector_hokuyo_networking.launch 31 | 32 | PC端时间同步 33 | sudo ntpdate durant35.local 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ROS笔记-10 ros on RaspberryPi.txt: -------------------------------------------------------------------------------- 1 | how to install? follow here: 2 | http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Indigo%20on%20Raspberry%20Pi 3 | 4 | 1. 采用 Raspbian Jessie(通过命令 hostnamectl 查看) 5 | 6 | 2. sudo apt-get update 7 | sudo apt-get upgrade 依赖网速 8 | 9 | 3. 使用wstool 安装ROS-Comm (包括ROS package, build, and communication libraries. No GUI tools) 10 | $ rosinstall_generator ros_comm --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-ros_comm-wet.rosinstall 11 | $ wstool init src indigo-ros_comm-wet.rosinstall 12 | 13 | 建议随手安装 robot 版本 14 | $ rosinstall_generator robot --rosdistro indigo --deps --wet-only --tar > indigo-robot-wet.rosinstall 15 | $ wstool init src indigo-robot-wet.rosinstall 16 | 17 | 4. 解决 rosdep 依赖 18 | $ cd ~/ros_catkin_ws 19 | $ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:jessie 20 | 21 | 5. 接下来是耗人的构建 建议使用-j2两核,不然会卡死 22 | sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo -j2 23 | 24 | 6. 安装新package 25 | $ cd ~/ros_catkin_ws 26 | $ rosinstall_generator ros_comm urg_node --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-custom_ros.rosinstall 27 | 28 | 使用 wstool 更新 29 | $ wstool merge -t src indigo-custom_ros.rosinstall 30 | $ wstool update -t src 31 | 32 | 更新 rosdep 依赖 33 | $ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:jessie 34 | 35 | 构建,之前的似乎会跳过安装,不过还是会make的 36 | $ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo 37 | 38 | 可以使用参数(--install之前) 39 | # "List of ';' separated packages to build" 40 | $ catkin_make -DCATKIN_BLACKLIST_PACKAGES="foo;bar" 41 | 42 | sudo ./src/catkin/bin/catkin_make_isolated --install -DCATKIN_BLACKLIST_PACKAGES="pcl_conversions;pcl_msgs;pcl_ros" -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo 43 | 44 | 45 | $ sudo ./src/catkin/bin/catkin_make_isolated --install -DCATKIN_BLACKLIST_PACKAGES="catkin;genmsg" -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo 46 | 或者 47 | $ sudo ./src/catkin/bin/catkin_make_isolated --pkg urg_node --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo 48 | 49 | 50 | !! 如何安装laser_scan_matcher 51 | 参考-1: http://answers.ros.org/question/197658/errors-at-catkin_make-for-laser_scan_matcher/ 52 | 53 | pcl_conversions 54 | pcl_msgs 55 | perception_pcl/pcl_ros 56 | 57 | $ cd ~/ros_catkin_ws 58 | $ rosinstall_generator ros_comm pcl_ros --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-custom_ros.rosinstall 59 | 60 | $ wstool merge -t src indigo-custom_ros.rosinstall 61 | $ wstool update -t src 62 | 63 | $ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:jessie 64 | 65 | !!只能使用=j1参数,否则会出现编译内存错误!! 66 | sudo ./src/catkin/bin/catkin_make_isolated --pkg pcl_conversions pcl_msgs pcl_ros --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo -j1 67 | 68 | 69 | 参考-2: http://answers.ros.org/question/229788/how-to-building-pcl-laser_scan_matcher-on-raspberry-pi-2/ 70 | $ git clone https://github.com/AndreaCensi/csm.git (I cloned this into a sub directory of scan_tools) 71 | $ ./install_quickstart.sh 72 | 73 | $ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/durant35/Workspace/ROS_ws/src/csm/sm/pkg-config 74 | 75 | $ cp -r /home/durant35/Workspace/ROS_ws/src/csm/deploy/include/* /home/durant35/Workspace/ROS_ws/src/laser_scan_matcher/include 76 | 77 | // catkin_make [make_targets] 78 | $ catkin_make laser_scan_matcher 79 | 80 | 81 | ~~ traversing 74 packages in topological order: 70 + urg_node + pcl_conversions pcl_msgs pcl_ros 82 | ~~ - catkin 83 | ~~ - genmsg 84 | ~~ - gencpp 85 | ~~ - genlisp 86 | ~~ - genpy 87 | ~~ - angles 88 | ~~ - cmake_modules 89 | ~~ - class_loader 90 | ~~ - cpp_common 91 | ~~ - message_generation 92 | ~~ - message_runtime 93 | ~~ - mk 94 | ~~ - ros 95 | ~~ - ros_comm 96 | ~~ - rosbash 97 | ~~ - rosboost_cfg 98 | ~~ - rosbuild 99 | ~~ - rosclean 100 | ~~ - roscpp_traits 101 | ~~ - roscreate 102 | ~~ - rosgraph 103 | ~~ - roslang 104 | ~~ - rosmake 105 | ~~ - rosmaster 106 | ~~ - rosmsg 107 | ~~ - rospack 108 | ~~ - roslib 109 | ~~ - rosparam 110 | ~~ - rospy 111 | ~~ - rosservice 112 | ~~ - rostime 113 | ~~ - roscpp_serialization 114 | ~~ - roslaunch 115 | ~~ - rosunit 116 | ~~ - rosconsole 117 | ~~ - pluginlib 118 | ~~ - roslz4 119 | ~~ - rosbag_storage 120 | ~~ - rostest 121 | ~~ - smclib 122 | ~~ - std_msgs 123 | ~~ - actionlib_msgs 124 | ~~ - bond 125 | ~~ - diagnostic_msgs 126 | ~~ - geometry_msgs 127 | ~~ - rosgraph_msgs 128 | ~~ - sensor_msgs 129 | ~~ - pcl_msgs 130 | ~~ - std_srvs 131 | ~~ - tf2_msgs 132 | ~~ - tf2 133 | ~~ - urg_c 134 | ~~ - xmlrpcpp 135 | ~~ - roscpp 136 | ~~ - bondcpp 137 | ~~ - nodelet 138 | ~~ - laser_proc 139 | ~~ - pcl_conversions 140 | ~~ - rosout 141 | ~~ - diagnostic_updater 142 | ~~ - dynamic_reconfigure 143 | ~~ - message_filters 144 | ~~ - rosnode 145 | ~~ - rostopic 146 | ~~ - roswtf 147 | ~~ - tf2_py 148 | ~~ - topic_tools 149 | ~~ - rosbag 150 | ~~ - actionlib 151 | ~~ - nodelet_topic_tools 152 | ~~ - tf2_ros 153 | ~~ - tf 154 | ~~ - pcl_ros 155 | ~~ - urg_node 156 | 157 | 158 | -------------------------------------------------------------------------------- /ROS笔记-11 Navigation.txt: -------------------------------------------------------------------------------- 1 | 导航包含节点: 2 | move_base: path planning 3 | amcl: localization 4 | Navigation 仿真 5 | $ roscore 6 | $ roslaunch rbx1_nav fake_nav_test.launch 7 | 8 | AMCL without using odomedry (but laser_scan_matcher instead) 9 | http://answers.ros.org/question/30124/amcl-without-using-odomedry-but-laser_scan_matcher-instead/ 10 | 11 | amcl transforms incoming laser scans to the odometry frame (~odom_frame_id). 12 | So there must exist a path through the tf tree 13 | from the frame in which the laser scans are published to the odometry frame. 14 | 15 | fake_nav_test.launch: 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | $ rosrun rviz rviz -d `rospack find rbx1_nav`/amcl.rviz 51 | 52 | Navigation on Real 53 | $ roscore 54 | 55 | robot setup 56 | $ roslaunch rbx1_bringup turtlebot_minimal_create.launch 57 | 58 | generate /scan 59 | $ roslaunch rbx1_bringup turtlebot_fake_laser_freenect.launch 60 | 61 | map_server, amcl and move_base 62 | $ roslaunch rbx1_nav tb_nav_test.launch map:=test_map.yaml 63 | 64 | $ rosrun rviz rviz -d `rospack find rbx1_nav`/nav_test.rviz 65 | 66 | 67 | -------------------------------------------------------------------------------- /ROS笔记-12 Control by KeyBoard.txt: -------------------------------------------------------------------------------- 1 | pi@raspberrypi:~ $ cd ros_my_ws/ 2 | pi@raspberrypi:~/ros_my_ws $ su 3 | root@raspberrypi:/home/pi/ros_my_ws# source devel/setup.sh 4 | root@raspberrypi:/home/pi/ros_my_ws# export ROS_HOSTNAME=durant35.local 5 | root@raspberrypi:/home/pi/ros_my_ws# roscore & 6 | root@raspberrypi:/home/pi/ros_my_ws# rosrun raspberry_pi_pwm motor_control 7 | 8 | 9 | 10 | durant35@tarantula7-B480:~/Workspace/ROS/ros_by_example$ source devel/setup.sh 11 | durant35@tarantula7-B480:~/Workspace/ROS/ros_by_example$ export ROS_HOSTNAME=tarantula7-B480.local 12 | durant35@tarantula7-B480:~/Workspace/ROS/ros_by_example$ export ROS_MASTER_URI=http://durant35.local:11311 13 | durant35@tarantula7-B480:~/Workspace/ROS/ros_by_example$ roslaunch rbx1_nav keyboard_teleop.launch 14 | -------------------------------------------------------------------------------- /ROS笔记-13 定位与导航迷惑后阅读.txt: -------------------------------------------------------------------------------- 1 | 《ROS下用gmapping 构建实验室地图的实现》 2 | http://blog.csdn.net/lanhuadechenmo/article/details/46456483 3 | 4 | hector_slam,不用里程计的信息,用hector_slam构建地图时,机器人的位置很容易偏移,导致扫描得到的地图有部分是重复的,而且是歪斜的。 5 | 6 | tf变换关系: 7 | 将里程计的信息传给/odom,通过/odom发布出来并广播变换,这样坐标系/odom和/base_link之间就建立的联系。 8 | 这步是关键,如果变换关系没有理清楚,各个节点之间无法建立连接,没有消息进行通信,数据不能向下传输,再下面的努力是白费的。 9 | 10 | 启动hokuyo激光测距仪,发布/base_link 和/laser 的静态变换base2laser 11 | 12 | 13 | 14 | 《ROS下使用Hokuyo和AMCL进行P3dx平台导航的实现》 15 | http://blog.csdn.net/lanhuadechenmo/article/details/46696337 16 | 17 | 构建地图思路是: 18 | 首先启动小车与电脑的连接,启动激光测距仪,将激光测距仪的位置变换到/base_link坐标系(:laser 和base_link frame之间的静态tf 变换。激光测距仪安装位置相对于base_link坐标系的位置变换是(0.28,0,0.16),单位是米。这个可以根据实际的激光测距仪的安装位置而定。), 19 | 加载小车外形文件; 20 | 然后将里程计的信息提取出来,发布并广播/odom,建立/base_link 和/odom之间的变换关系, 21 | 发布并广播变换odom。这里我根据官网上的发布tf变换的教程写了自己用的odom_tf变换。这部分主要是将里程计的信息发布出去并广播,主要涉及/odom和/base_link frame之间的变换 22 | 运行gmapping, 23 | 用joystick 来控制小车移动, 24 | 用rviz来显示构建过程,最终完成整个地图的构建,将所建的地图保存。 25 | 地图的保存。$rosrun map_server map_saver -f mymapname 26 | 将会得到.pgm格式的图片和.yaml格式的地图配置文件。 27 | 28 | 导航和避障 29 | 地图建立好之后,我们就可以用AMCL 定位来进行导航了。这部分的关键是move_base 里的配置文件,参数会影响到实际小车跑的效果,需要不断尝试 30 | 31 | 思路: 32 | 基本配置文件p3dx_configuration.launch文件不变,首先和小车建立连接, 33 | 启动激光测距仪,发布激光测距仪坐标系和以小车为中心的坐标系间的静态变换, 34 | 35 | 36 | 加载小车外形文件用于显示。 37 | 38 | 然后是发布并广播/odom,建立/base_link 和/odom frame 之间的变换(这个是动态变化的), 39 | 发布并广播/odom变换,启动节点tf_odom,将/base_link变换到/odom。这一步非常关键,如果没有考虑到这个动态变换,在信息的流动上是不通的,所以下面再怎么做都是没用的。可以用$rosrun tf view_frames察看tf变换之间的关系,确保tf变换关系是正确的。很多人会遇到这个问题。 40 | 41 | 加载建立好的地图, 42 | 加载地图。将建立好的地图的配置文件.yaml加载进去。里面有分辨率,要注意在下面的路径规划中全局和局部的costmap的地图分辨率在数值上不能低于这个分辨率的值,即路径规划地图的分辨率不要高于所建立地图的分辨率。 43 | 44 | 使用AMCL 定位模块, 45 | 加载move_base类配置规划的参数,并给出/odom和/map 之间的静态变换关系, 46 | 用rviz 来显示。 47 | 最后设置目标点, 48 | 用action client 和server来响应。 49 | 50 | AMCL是机器人在二维移动过程中概率定位系统。它应用自适应的蒙特卡洛定位方式(或者KLD采样),采用微粒过滤器来跟踪已知地图中机器人的位姿。 51 | 52 | move_base package 的输入和输出: 53 | 输入: 54 | amcl:定位模块,基于概率的定位系统。 55 | 56 | odometry:根据机器人左右轮速度推算出的航向信息(即/odom 坐标系中机器人x,y坐标以及航向角yaw),是小车编码器可以提供的信息。 57 | 58 | tf : 各个坐标系之间的转换关系, 59 | 如/map frame --> /odom frame , 60 | /odom frame --> /base_link frame, 61 | 需要弄清楚各个变换之间的关系,确保位置信息的传递。 62 | 63 | LaserScan:激光传感器的信息,可通过Laser建立环境地图,也可用于定位和避障。 64 | 65 | Map:用于定位和避障,表示了周围的环境信息。 66 | 67 | goal : 期望机器人在地图中的目标位置,或者自己设定的在全局坐标系中的目标点。 68 | 69 | 也可以用其他的传感器,如RGB_D。如果没有其中的一些传感器,也是可以的,各个部分不是每一个都需要的,可根据自己的实际情况来选择。 70 | 71 | 输出: 72 | cmd_vel: 73 | 在cmd_vel这个主题上发布Twist消息,这个消息包含的就是机器人的期望前进速度和转向速度。 74 | 可以通过速度接口把上层的速度指令转换为轮子的转速,从而控制小车运动。(这里对于Pioneer是用p2os实现的。) 75 | 76 | 《对Navigation基础的了解》 77 | http://blog.csdn.net/lanhuadechenmo/article/details/46715169 78 | 79 | 机器人本身的电机驱动和控制部分, 80 | 驱动器接收的是电机左右轮期望速度,根据期望速度对左右轮分别进行 PID控速。 81 | 同时,定时采样电机码盘值,并转化为左右轮速度值上传给电机控制器。 82 | 控制器将左右轮的速度值,结合机器人的运动学模型,用航迹推演法推算出机器人当前的速度,包括线速度和角速度。 83 | 控制器也可以接受机器人的控制指令(cmd_vel),将速度解算为左右轮的期望速度,从而给电机的驱动部分,控制电机转动。 84 | 它的输入是控制速度值,输出是电机的转速。 85 | 86 | 87 | 速度接口 88 | 在我们了解move_base之后,会知道导航规划层的输出是cmd_vel topic, 数据类型为 geometry_msgs/Twist 。对于移动平台来说,有差分和全向之分,对于一般的差分平台,我们只用到了linear.x 和angular z两个值,对于全向平台,还多了一个linear.y。 89 | 90 | 如果是开发的下位机或者底层平台,需要注意速度的平滑,可以用插值的方法平滑速度,避免因为过大的加减速等造成的下危机或底层平台无法正常运动。 91 | 92 | 93 | 里程计接口 94 | 里程计属于内部传感器,一般的平台都会装入里程计进行航迹推测,对机器人平台的位置进行粗略的估计。 95 | 即:通过编码器的转动推测轮子在时间片中的位移,进一步算出机器人整体的位移与速度。 96 | 97 | 导航一般都会要求一个里程计数据的输入,里程计是相对于机器人中心的位置推测,误差会累积。这里需要注意的是发布频率,它涉及到之后的costmap更新与坐标系的访问超时问题。 98 | 99 | 100 | 传感器接口 101 | 传感器一般在消息的 header中都需要相应的传感器采集坐标系,当laser,camera等固定好之后,可以用静态tf来将传感器所在的坐标系的数据变换到以机器人中心所在的坐标系,便于信息的传递。 102 | 103 | 104 | tf库 105 | 目的是实现系统中任一个点在所有坐标系之间的坐标变换,也就是说,只要给定一个坐标系下的一个点的坐标,就能获得这个点在其他坐标系的坐标。为了达到这个目的,就需要确定各个坐标系之间的关系,也就是获得任一坐标系在其他任一个坐标系下的描述。 106 | 107 | ROS的坐标转换库,提供实时的坐标转换查询与更改服务。它将坐标转换表示为树形结构,而坐标转换数据的更新速度直接影响其他节点的实时性。ROS 中对于多坐标系的处理是使用树型表示。 108 | 109 | 基本原理: 110 | tb的类里有个publisher,tl的类里有个subscriber,一个发布叫/tf的topic,一个订阅这个topic,传送的消息tfmessage里包含了parent frameid和child frameid的信息。 111 | 112 | 这个机制意味着,所有的tb会发布某一特定的parent到child的变换,而所有tl会收到所有的这些变换, 113 | 然后tl利用一个 tfbuffercore的数据结构维护一个完整的树结构及其状态。 114 | 基于此,tl在使用这棵树时,会lookuptransform或 waitfortransform来获得任意坐标系之间的变换。 115 | 那就是只要是一个tl,就要跟所有tb建立连接,就要收取所有的/tf消息,来维护一棵完整的树,并且还要 负责搜索这棵树,找到一条变换的路径,然后乘呀乘,并且每次都要如此。 116 | 117 | 118 | base_link, odom, fixed_frame,target_frame和map的关系 119 | map 120 | map是虚拟世界中的固定frame, 它的Z轴指向正上方,也就是天空。 121 | 一个时间点上移动机器人的姿态相对于map不应该出现明显的漂移。 122 | 如果一个map是不连续稳定的那就意味着机器人的位置在任何一个时间点上都会是变化的。 123 | 一般激光地位仪等设备会连续的计算map的位置因而造成它的不稳定性,这也使它不能成为一个好的参照体frame. 124 | 125 | 一般与odom(或者odom_combined)相连,语义为一个经过先验(或者SLAM)地图数据矫正过的,在地图中的位姿信息。与odom同为全局坐标系,原点为地图原点(地图原点在地图相应的yaml文件中有规定) 126 | 127 | odom 128 | odom是一个很好的固定世界参照frame. 129 | 机器人的姿态相对odom而言是随时间是经常可变,所以在长远中它不是一个好的全局参照系。 130 | 但在某一时间点而言它相对机器人的位置是不变的。 131 | 典型的odom frame 是通过运动源来计算出来的, 例如轮子运动,视觉偏移等。 132 | Odom frame 的准确性使它在局部参照系中是很有用的。 133 | 但是不适合作全局参照frame。 134 | 135 | 一般直接与base_link 相链接,语义为一个对于机器人全局位姿的粗略估计。 136 | 取名来源于odometry(里程计),一般这个坐标系的数据也是来源于里程计,原点为开始计算位姿那个时刻的机器人的位置。 137 | 138 | odom_combined 139 | 一般为好几种位姿估计方法的信息融合后的数据。在navigation stack中有 robot_pose_ekf 这个包是用扩展卡尔曼滤波算法(EKF)融合不同传感器的数据。 140 | 141 | 142 | base_link 143 | 参照系紧紧粘在移动机器人基座上的任何一个位置和角度。 144 | 一般位于tf tree的最根部,物理语义原点一般为表示机器人中心,为相对机器人的本体的坐标系。 145 | 一般在urdf文件中都要定义base_link,它代表了机器人的主干,其它所有的 frame都是相对于base_link定义并粘在一起的。 146 | 它们一起相对于大地图map移动,让机器人移动就是向tf发布geometry_msgs::TransformStamped 消息通知ros base_link相对于map的tf转换关系。 147 | 148 | 149 | odom到base_link的坐标转换是从运动源计算出来广播的。 150 | map到base_link的坐标转换是被定位模块计算出来的。但定位模块并不发布map到base_link的转换。相反它先接受从odom到base_link的转换, 再计算并广播map到odom的位置转换关系。 151 | 152 | 153 | fixed_frame 154 | RViz中认定的大世界就是fixed_frame。 155 | 156 | 157 | target_frame 158 | Rviz中视觉跟踪的frame是 target_frame。 159 | 160 | 161 | AMCL 162 | 定位模块作为规划层的输入与参考数据,对于ROS navigation 体系,因为它先天的模块间通讯方式实现了模块间的完全解耦,所以对于导航规划层用什么定位方法,静态还是动态的地图,对于导航层内部几乎没有区别。 163 | 只要有相应的数据就可以执行相应功能。我们可以使用其他的定位方式。 164 | 165 | AMCL是机器人在二维移动过程中概率定位系统。它应用自适应的蒙特卡洛定位方式(或者KLD采样),采用微粒过滤器来跟踪已知地图中机器人的位姿。 166 | 167 | 目前所实施的,这个节点只和激光扫描和激光地图工作,在base_scan的topic上利用激光数据来定位。它可以被扩展应用与其他的激光数据工作。 168 | 169 | AMCL需要基于激光的地图/激光扫描/TF转换,并且输出位置估计。 170 | 在启动时,AMCL根据所提供的参数来初始化它的颗粒过滤器。 171 | 由于默认原因,如果没有参数设置,初始过滤状态以一个中等大小的粒子云为中心(0,0,0)。 172 | 有三种类型的ROS参数可以用来配置AMCL节点:整体滤波器,激光模式,odometery模型。 173 | 174 | AMCL将传入的激光扫描数据转为里程计结构(odom_frame_id)。 175 | 因此,必须存在从激光发布到里程计的tf树转换。 176 | 177 | 实现细节: 178 | 在接收第一个激光扫描,AMCL查找激光结构和base_link结构的TF转换,并且锁存。所以AMCL不能处理激光与base_link相对移动的情况。 179 | 180 | 181 | 用里程计和AMCL定位的不同之处。 182 | 1. Odometry Localization 183 | /odom_frame <--(Translation/Orientation)-- /base_frame 184 | 只是通过里程计的数据来处理/base和/odom之间的TF转换; 185 | 186 | 2. AMCL Map Localization 187 | /map_frame <--(Trans/Orien)-- /odom_frame <--(Translation/Orientation)-- /base_frame 188 | ^-------------------------------------------------------------------------| 189 | 190 | 查找/base和激光的TF。 191 | /base通过/odom在/map中行走, 192 | 机器人根据已知激光数据,估计/base相对于/global的TF, 193 | 那么我们可以知道/map和/base之间的TF,从而估计位置。 194 | 195 | move_base参数解析 196 | move_base提供了ROS导航的配置、运行、交互接口。 197 | 它实现了一个供上层节点调用的action接口(通过actionlib实现),即给定坐标信息与相应坐标位置,执行相应的安全导航动作。 198 | 对于下层控制器,输出为cmd_vel 速度。 199 | 200 | 行为层: 201 | move_base 综合机器人状态与上层指令,给出机器人当前行为: 202 | 正常导航,执行恢复动作,给上层节点返回失败,终止导航。其中恢复动作可以自己定义。 203 | 全局规划层:global_planner 204 | 局部规划层: local_planner 205 | 控制器层(一般就是之前自己写的速度发送部分) 206 | 207 | 路径规划有关的packages 208 | (1)costmap_2d: 209 | 这一部分可看作为navigation的输入处理器。 210 | 不同的传感器输入的数据差异很大(激光雷达 & RGBD-camera) 211 | 通过costmap_2d,不同的数据被处理成统一的格式:栅格地图。 212 | 权值用经过概率方法处理过的,表示空间中障碍物,未知与安全区域。 213 | 生成出来的costmap则是planner 的输入。 214 | 215 | (2)global_planner: 216 | 根据给定的目标位置进行总体路径的规划,为navigation的全局规划器, 217 | 接受costmap生成的 global costmap 规划出从起始点到目标点的路径,为local_planner作出参考。 218 | 219 | 在ROS的导航中,首先会通过全局路径规划,计算出机器人到目标位置的全局路线。 220 | 这一功能是navfn这个包实现的。 221 | navfn通过Dijkstra最优路径的算法,计算costmap上的最小花费路径,作为机器人的全局路线。 222 | 223 | (3)local_planner: 224 | 根据附近的障碍物进行躲避路线规划,为navigation 的局部规划器, 225 | 接受costmap 生成的local costmap 规划出速度。 226 | 227 | 本地的实时规划是利用base_local_planner包实现的。 228 | 该包使用Trajectory Rollout 和 Dynamic Window approaches 算法计算机器人每个周期内应该行驶的速度和角度(dx,dy,dtheta velocities)。 229 | 230 | base_local_planner这个包通过地图数据,通过算法搜索到达目标的多条路经, 231 | 利用一些评价标准(是否会撞击障碍物,所需要的时间等等)选取最优的路径, 232 | 并且计算所需要的实时速度和角度。 233 | 234 | 其中,Trajectory Rollout 和 Dynamic Window approaches算法的主要思路如下 235 | 1) 采样机器人当前的状态(dx,dy,dtheta); 236 | 2) 针对每个采样的速度,计算机器人以该速度行驶一段时间后的状态,得出一条行驶的路线。 237 | 3) 利用一些评价标准为多条路线打分。 238 | 4) 根据打分,选择最优路径。 239 | 5) 重复上面过程。 240 | 241 | (4)recovery_behavior: 规定move_base 行为集合中处理异常情况的行为 242 | 243 | (5)nav_core: 244 | 要理解ROS navigation最重要的部分是nav_core,它包含了global_planner,local_planner 与 recovery_behavior的基类的头文件。 245 | 246 | 对于pluginlib,在 ROS navigation 中,move_base 提供的是框架,在move_base中是通过nav_core中规定的planner 与 recovery_behavior的基类的接口进行调用。 247 | 与具体的实现方法隔离开来。 248 | 而具体采用的方法由pluginlib 根据不同参数导入。 249 | 这样的实现方法使得navigation的可定制性大大增加。这赋予了这个框架很大的灵活性。 250 | 通过不同的配置方法可以让navigation适应很多不同的任务。 251 | 252 | 253 | 对于导航规划层来说,整个系统的表现与实时性息息相关。 254 | 制约表现好坏的最重要一部分就是costmap的生成。 255 | costmap会分别生成两份,一个是global_costmap ,另一个是local_costmap,这两份的参数是完全不同的。 256 | local_costmap,local_planner要求的实时性还是挺高的(特别是你把速度调高的时候),而local_costmap 所依赖的全局坐标系一般是odom,绘制costmap的时候会反复询问odom->base_link frame的信息,tf数据延迟要是大了会影响costmap,进而导致机器人planner实时性降低,机器人移动迟缓或者撞上障碍物。 257 | 所以有个参数transform_tolerance一定要慎重。 258 | 259 | 如果是使用静态先验地图做导航,那么全局的costmap可以选择使用static_map选项,这 样的话在move_base 创建之初就会根据先验地图生成一次,以后不会再更新了。这样会节省一些计算量。 260 | 261 | 而如果采用动态地图(实时slam出来的)或者根本不使用先验地图,那可以将全局的costmap所依赖的全局坐标系也改为odom,rolling_window选项代替static选项,这样costmap就会实时更新,要注意的是这样的话你上层程序给出的目标点就不能超过 rolling_window的范围。 262 | 263 | 总结: 264 | goal_tolerance,frequency,resolution ,obstacle_range,raytrace_range, pdist_scale,transform_tolerance等参数都是非常关键的, 265 | 需要注意地图的分辨率以及各种频率,到达目标和轨迹的tolerance,这些都会影响整个系统的性能。 266 | 267 | 268 | -------------------------------------------------------------------------------- /ROS笔记-14 hector_slam with NetWorking ROS.txt: -------------------------------------------------------------------------------- 1 | 1. Robot端时间同步 2 | $ sudo ntpdate tarantula7-B480.local 3 | 4 | # PC need to install ntpdate first 5 | sudo apt install ntpdate 6 | # Robot & PC time synchronization 7 | sudo ntpdate -u time.windows.com 8 | #sudo ntpdate -u durant35-Aspire-TC.local 9 | #sudo date -s "2016-08-15 20:53:00" 10 | 11 | 2. Robot 启动 12 | $ source devel/setup.sh 13 | $ export ROS_HOSTNAME=durant35.local 14 | $ ./laserScannerConfig.sh 15 | $ roslaunch hector_slam_launch hector_slam.launch & 16 | cd ../git_ws/CarControlServer/build/ 17 | ./CarControlServer 18 | 19 | http://ros-users.122217.n3.nabble.com/amcl-for-localization-td1168887.html 20 | Is the robot moving? 21 | The /amcl_pose data is published only on filter updates, which occur each time the robot has moved a sufficient distance. 22 | The /tf data is published continuously; 23 | this is where most programs look for the pose estimates produced by amcl. To see it, try tf_echo: 24 | rosrun tf tf_echo map odom 25 | rostopic echo /amcl_pose 26 | 27 | Robot: 28 | fuser 13000/tcp -v 29 | kill PID 30 | 31 | 3. PC 启动 32 | source devel/setup.sh 33 | #export ROS_HOSTNAME=tarantula7-B480.local 34 | export ROS_HOSTNAME=durant35-Aspire-TC.local 35 | export ROS_MASTER_URI=http://durant35.local:11311 36 | 37 | roslaunch hector_slam_example hector_hokuyo_networking.launch 38 | 39 | source devel/setup.sh 40 | export ROS_HOSTNAME=tarantula7-B480.local 41 | export ROS_MASTER_URI=http://durant35.local:11311 42 | rosbag record -o lab510_notf /scan 43 | 44 | source devel/setup.sh 45 | export ROS_HOSTNAME=tarantula7-B480.local 46 | export ROS_MASTER_URI=http://durant35.local:11311 47 | rosbag record -o lab510_withtf /scan /tf 48 | 49 | durant35@tarantula7-B480:~/Workspace/ROS/motor_driver$ source devel/setup.sh 50 | durant35@tarantula7-B480:~/Workspace/ROS/motor_driver$ roslaunch motor_driver_launch keyboard.launch 51 | 52 | rosrun map_server map_saver -f lab510_0518 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ROS笔记-15 amcl with NetWorking ROS.txt: -------------------------------------------------------------------------------- 1 | amcl with NetWorking ROS 2 | 3 | The location of the robot, also known as its pose, is represented by a position and orientation in the map coordinate frame (sometimes also called the world coordinate frame) 4 | 5 | amcl maintains a set of these poses, representing where it thinks the robot might be. 6 | Each of these candidate poses has associated with it a probability; higher-probability poses are more likely to be where the robot actually is. 7 | As the robot moves around the world, the sensor readings are compared to the readings that would be expected for each of the poses, according to the map. 8 | 9 | For each candidate pose, 10 | if the readings are consistent with the map, then the probability of that pose increases. 11 | If the readings are inconsistent, then the probability decreases. 12 | 13 | Over time, candidate poses with very low probability 14 | (i.e., where the robot is most likely not really in that pose) go away, while those with high probability stick around 15 | 16 | 1. PC端时间同步 17 | $ sudo ntpdate durant35.local 18 | 19 | 2. Robot 启动 20 | $ source devel/setup.sh 21 | $ export ROS_HOSTNAME=durant35.local 22 | $ roscore & 23 | $ ./laserScannerConfig.sh 24 | // hector_slam 25 | //$ roslaunch hector_slam_launch hector_slam.launch 26 | 27 | $ roslaunch amcl_launch amcl.launch 28 | 29 | http://ros-users.122217.n3.nabble.com/amcl-for-localization-td1168887.html 30 | Is the robot moving? 31 | The /amcl_pose data is published only on filter updates, which occur each time the robot has moved a sufficient distance. 32 | The /tf data is published continuously; 33 | this is where most programs look for the pose estimates produced by amcl. To see it, try tf_echo: 34 | rosrun tf tf_echo map odom 35 | rostopic echo /amcl_pose 36 | 37 | 3. PC 启动 38 | source devel/setup.sh 39 | export ROS_HOSTNAME=durant35-aspire-tc.local 40 | export ROS_MASTER_URI=http://durant35.local:11311 41 | 42 | //roslaunch amcl_launch amcl.launch map:=lab314_2.yaml 43 | 44 | roslaunch amcl_launch amcl.launch map:=lab510_0518.yaml 45 | 46 | 47 | roslaunch amcl_launch amcl_networking.launch map:=lab510_0817.yaml 48 | amcl_networking 49 | 设置 initial pose 并初始化 amcl 定位 50 | ./CarControlServer 51 | roslaunch motor_driver_launch keyboard.launch 52 | 53 | 54 | 55 | some problems 如何解决没有里程计下amcl运作的问题: 56 | 57 | 1. 《amcl does not need odometry data?》 58 | http://answers.ros.org/question/98221/amcl-does-not-need-odometry-data/ 59 | 60 | amcl receives its odometry informations through the /odom -> /base_link transform. (Or whatever you have set as odom_frame_id and base_frame_id parameters) 61 | 62 | This means that you need a node (typically your hardware abstraction) that accumulates odom information from your base-robot and publish the aggregated pose as a transform. 63 | 64 | So no, laser only will not be sufficient. 65 | 66 | 2.《iRobot Create + Hokuyo LIDAR + YAML map + AMCL》 67 | http://answers.ros.org/question/61891/irobot-create-hokuyo-lidar-yaml-map-amcl/ 68 | 69 | I guess you might need laser_scan_matcher to provide 'fake' odometry for amcl to work. 70 | 71 | 72 | 3.《how to: Building PCL & laser_scan_matcher on Raspberry pi 2》 73 | http://answers.ros.org/question/229788/how-to-building-pcl-laser_scan_matcher-on-raspberry-pi-2/ 74 | 75 | 76 | 4.《AMCL + Laser Scan Matcher Crashing》 77 | http://answers.ros.org/question/98736/amcl-laser-scan-matcher-crashing/ 78 | 79 | 1. Remove the static transforms from map -> odom and odom -> base_link. You want them dynamic from amcl and the laser_scan_matcher and not static. 80 | 81 | 2. fixed_frame for the laser_scan_matcher has to be set to /odom and not map, since the node is responsible for your odom -> base_link transform and not the localization within your map 82 | 83 | 84 | -------------------------------------------------------------------------------- /ROS笔记-16 Navigation with Networking ROS.txt: -------------------------------------------------------------------------------- 1 | 2 | Robot: 3 | sudo ntpdate -u time.windows.com 4 | 5 | source devel/setup.sh 6 | export ROS_HOSTNAME=durant35.local 7 | 8 | roslaunch move_base_launch move_base.launch 9 | 10 | 11 | PC: 12 | 13 | 14 | source devel/setup.sh 15 | export ROS_HOSTNAME=durant35-aspire-tc.local 16 | export ROS_MASTER_URI=http://durant35.local:11311 17 | roslaunch navigation_launch navigation_networking.launch map:=lab510_0817.yaml 18 | 19 | //roslaunch navigation_launch navigation.launch map:=lab314_2.yaml 20 | //roslaunch navigation_launch navigation.launch map:=lab510_0518.yaml 21 | roslaunch navigation_launch navigation.launch map:=lab510_0531.yaml 22 | 23 | roslaunch navigation_launch navigation_trajectory.launch map:=lab510_0531.yaml 24 | 25 | roslaunch navigation_launch navigation_smoother.launch map:=lab510_0531.yaml 26 | 27 | 28 | 29 | 使用键盘操控 30 | roslaunch motor_driver_launch keyboard.launch 31 | 32 | 开启导航功能 33 | roslaunch navigation_launch navigation.launch map:=lab510_0518.yaml 34 | roslaunch navigation_launch navigation.launch map:=lab510_0526.yaml 35 | 36 | 设置 initial pose 并初始化 amcl 定位 37 | ./CarControlServer 38 | roslaunch motor_driver_launch keyboard.launch 39 | 40 | roslaunch motor_driver_launch motor_driver.launch 41 | 42 | 43 | Robot: 44 | fuser 13000/tcp -v 45 | kill PID 46 | 47 | 48 | 49 | 《Obtaining nav_msgs/Odometry from a laser_scan (eg. with laser_scan_matcher)》 50 | http://answers.ros.org/question/12489/obtaining-nav_msgsodometry-from-a-laser_scan-eg-with-laser_scan_matcher/#18434 51 | 52 | It looks like the scan matcher isn't measuring velocity directly, but it is computing the delta in the laser position, which you could combine with the time between laser scans to produce a rough estimate of velocity, subject to jitter in your laser frequency and any errors in the scan matching. 53 | 54 | 55 | 《Does a static_map costmap continually update from map_server?》 56 | http://answers.ros.org/question/107281/does-a-static_map-costmap-continually-update-from-map_server/ 57 | 58 | does this only happen once, when initializing the costmap, or will the costmap be periodically updated when the map in map_server changes? 59 | 60 | Yes, it continually updates 61 | 62 | 63 | 《What's the difference between global and local costmap's static_map?》 64 | http://answers.ros.org/question/10620/whats-the-difference-between-global-and-local-costmaps-static_map/ 65 | 66 | The difference between the global and local costmap is that the global planner uses the global costmap to generate a long-term plan while the local planner uses the local costmap to generate a short-term plan. 67 | 68 | Setting the "static_map" parameter to true just means that you'll be taking an outside map source for navigation. That map could come from SLAM or it could come from a source like the map_server. 69 | 70 | gmapping can just replace the map_server with global static_map=true. An example of setting static_map=false, rolling_window=true would be a situation where you want to run navigation for the robot in the odometric frame without any map at all. 71 | 72 | -------------------------------------------------------------------------------- /ROS笔记-16 Navigation without Networking ROS.txt: -------------------------------------------------------------------------------- 1 | 2 | Robot: 3 | sudo ntpdate -u time.windows.com 4 | 5 | source devel/setup.sh 6 | export ROS_HOSTNAME=durant35.local 7 | 8 | roslaunch move_base_launch move_base.launch 9 | 10 | 11 | PC: 12 | 13 | 14 | source devel/setup.sh 15 | export ROS_HOSTNAME=tarantula7-B480.local 16 | export ROS_MASTER_URI=http://durant35.local:11311 17 | roslaunch navigation_launch navigation_networking.launch map:=lab510_0526.yaml 18 | 19 | //roslaunch navigation_launch navigation.launch map:=lab314_2.yaml 20 | //roslaunch navigation_launch navigation.launch map:=lab510_0518.yaml 21 | roslaunch navigation_launch navigation.launch map:=lab510_0531.yaml 22 | 23 | roslaunch navigation_launch navigation_trajectory.launch map:=lab510_0531.yaml 24 | 25 | roslaunch navigation_launch navigation_smoother.launch map:=lab510_0531.yaml 26 | 27 | 28 | 29 | 使用键盘操控 30 | roslaunch motor_driver_launch keyboard.launch 31 | 32 | 开启导航功能 33 | roslaunch navigation_launch navigation.launch map:=lab510_0518.yaml 34 | roslaunch navigation_launch navigation.launch map:=lab510_0526.yaml 35 | 36 | 设置 initial pose 并初始化 amcl 定位 37 | ./CarControlServer 38 | roslaunch motor_driver_launch keyboard.launch 39 | 40 | roslaunch motor_driver_launch motor_driver.launch 41 | 42 | 43 | Robot: 44 | fuser 13000/tcp -v 45 | kill PID 46 | 47 | 48 | 49 | 《Obtaining nav_msgs/Odometry from a laser_scan (eg. with laser_scan_matcher)》 50 | http://answers.ros.org/question/12489/obtaining-nav_msgsodometry-from-a-laser_scan-eg-with-laser_scan_matcher/#18434 51 | 52 | It looks like the scan matcher isn't measuring velocity directly, but it is computing the delta in the laser position, which you could combine with the time between laser scans to produce a rough estimate of velocity, subject to jitter in your laser frequency and any errors in the scan matching. 53 | 54 | 55 | 《Does a static_map costmap continually update from map_server?》 56 | http://answers.ros.org/question/107281/does-a-static_map-costmap-continually-update-from-map_server/ 57 | 58 | does this only happen once, when initializing the costmap, or will the costmap be periodically updated when the map in map_server changes? 59 | 60 | Yes, it continually updates 61 | 62 | 63 | 《What's the difference between global and local costmap's static_map?》 64 | http://answers.ros.org/question/10620/whats-the-difference-between-global-and-local-costmaps-static_map/ 65 | 66 | The difference between the global and local costmap is that the global planner uses the global costmap to generate a long-term plan while the local planner uses the local costmap to generate a short-term plan. 67 | 68 | Setting the "static_map" parameter to true just means that you'll be taking an outside map source for navigation. That map could come from SLAM or it could come from a source like the map_server. 69 | 70 | gmapping can just replace the map_server with global static_map=true. An example of setting static_map=false, rolling_window=true would be a situation where you want to run navigation for the robot in the odometric frame without any map at all. 71 | 72 | -------------------------------------------------------------------------------- /ROS笔记-17 Unknown_Area_Navigation(move_base with hector_slam).txt: -------------------------------------------------------------------------------- 1 | 《move_base and hector_slam》 2 | http://answers.ros.org/question/166566/move_base-and-hector_slam/ 3 | 4 | how to do? overview 5 | 6 | i solved my problem by publishing a fake optometry data using hector_slam position. 7 | only the speed of robot is computed from robot encoders. 8 | now my robot can navigate and follow the trajectory path to rich the goal. 9 | 10 | i don't use static map ( map server and amcl ) so for both local and global parameters , i set the static parameter false and windowing is true 11 | 12 | 13 | 《hectorslam + navigation stack : obstacle inflation problem》 14 | http://answers.ros.org/question/40251/hectorslam-navigation-stack-obstacle-inflation-problem/ 15 | 16 | The navigation stack creates a set of costmaps directly from the lasers scan data and not the map created with hector or gmapping. 17 | 18 | The laserscan data may indicate a wall and this is loaded into the costmap to create the inflated obstacles. 19 | 20 | If the map from hector has not been updated yet then the inflated obstacle costmap may lie partly in unknown space. This creates problems when using hector or gmapping with the navigation and exploration packages due to the differences between the costmaps and the map. 21 | 22 | 23 | 《Using odometry from hector_mapping for move_base (Nav stack)》 24 | http://answers.ros.org/question/62081/using-odometry-from-hector_mapping-for-move_base-nav-stack/ 25 | 26 | move_base doesn't need the odom topic, it can get odometry information from the tf that is being published by hector_mapping! 27 | 28 | use hector_mapping for odometry on my robot, and have set the pub_map_odom_transform option of my hector_mapping node to true to publish a tf between the map & the odom frames 29 | 30 | 《Autonomous navigation using navigation stack and hector slam》 31 | http://answers.ros.org/question/73261/autonomous-navigation-using-navigation-stack-and-hector-slam/ 32 | 33 | 1. Is it possible to do this without using the robot's odometry and just using the odometry information from the tf that is being published by hector_mapping? 34 | 35 | 2. Does AMCL works only with static maps i.e. can AMCL perform localization on the maps being generated in real time ? 36 | 37 | 3. Moreover do I need AMCL to perform localization in a dynamic map being generated using hector slam ? If, not then how exactly should I make this work without amcl. -------------------------------------------------------------------------------- /ROS笔记-18 Car Control.txt: -------------------------------------------------------------------------------- 1 | cp -r dir1/*.* dir2 2 | 3 | 4 | -------------------------------------------------------------------------------- /ROS笔记-19 Velodyne.txt: -------------------------------------------------------------------------------- 1 | 1. install dependencies 2 | sudo apt-get install libpcap* 3 | 4 | 2. create ros workspace 5 | mkdir ROS_ws 6 | cd ROS_ws 7 | mkdir src & cd src 8 | catkin_init_workspace 9 | cd .. 10 | catkin_make 11 | 12 | 3. git clone 13 | cd src 14 | git clone https://github.com/ros-drivers/velodyne.git 15 | cd .. 16 | catkin_make 17 | 18 | 4. configure your ethernet(here is enp3s0) 19 | sudo ifconfig enp3s0 192.168.1.110 netmask 255.255.255.0 20 | ping 192.168.1.201 21 | it should be ping successfully!! 22 | 23 | 5. Getting Started with the Velodyne HDL-32E 24 | http://wiki.ros.org/velodyne/Tutorials/Getting%20Started%20with%20the%20HDL-32E 25 | 26 | 4.1 rosrun velodyne_pointcloud gen_calibration.py 32db.xml 27 | 28 | 4.2 roslaunch velodyne_pointcloud 32e_points.launch calibration:=/home/durant35/Workspace/ROS_ws/32db.yaml 29 | 30 | 4.3 rosrun rviz rviz -f velodyne 31 | 32 | 6. velodyne_height_map --> Obtacles Detection 33 | http://wiki.ros.org/velodyne_height_map 34 | 35 | 6.1 roslaunch velodyne_height_map heightmap_launch.launch 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 6.2 rosrun rviz rviz -f velodyne 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /books/Introduction to Autonomous Mobile Robots.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Durant35/ROS_Note/e93ac9f545a06d7136c470693c1564f639094075/books/Introduction to Autonomous Mobile Robots.pdf -------------------------------------------------------------------------------- /books/Learning ROS for Robotics Programming.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Durant35/ROS_Note/e93ac9f545a06d7136c470693c1564f639094075/books/Learning ROS for Robotics Programming.pdf -------------------------------------------------------------------------------- /books/Programming Robots with ROS A Practical Introduction to the Robot Operating System.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Durant35/ROS_Note/e93ac9f545a06d7136c470693c1564f639094075/books/Programming Robots with ROS A Practical Introduction to the Robot Operating System.pdf -------------------------------------------------------------------------------- /books/ros_by_example_1_indigo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Durant35/ROS_Note/e93ac9f545a06d7136c470693c1564f639094075/books/ros_by_example_1_indigo.pdf -------------------------------------------------------------------------------- /books/ros_by_example_2_indigo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Durant35/ROS_Note/e93ac9f545a06d7136c470693c1564f639094075/books/ros_by_example_2_indigo.pdf -------------------------------------------------------------------------------- /拿ROS玩移动机器人自主导航攻略--by 西工大一小学生.txt: -------------------------------------------------------------------------------- 1 | 《拿ROS navigation 玩自主导航攻略(1)——by 西工大一小学生》 2 | http://blog.exbot.net/archives/1129 3 | 4 | 一般来说,导航规划层(不管是用什么自主移动的package),直接输出都是一个topic “cmd_vel”, 5 | 里面的数据类型为 geometry_msgs/Twist 这个数据类型表示的是3d空间中的速度,2d的移动机器人只会用到三个值 linear.x linear.y 与 angular.z 分别表示水平分速度,垂直分速度,与角速度。 6 | 7 | 关于速度的平滑: 8 | 对于规划层而言,即使有加速度等一些参数的限制,它输出的速度值可能还是对于下位机过于不友好(比如过大的加速减速,不定的发送频率等等),那么就在速度接口这边就要执行一个平滑的过程 9 | 10 | 里程计接口: 11 | 一般导航都会要求一个里程计数据的输入,这个可以解释为“通过编码器的转动推测轮子在时间片中的位移,进一步算出机器人整体的位移与速度” 12 | 13 | 这个部分需要注意的地方主要就是发布频率了。这个频率涉及到之后的costmap更新与坐标系的访问超时问题 14 | 15 | 传感器接口: 16 | 一般rgbd-camera与激光雷达都有相应的sensor driver 提供,roslaunch相应文件就可以了。 17 | 传感器一般在消息的 header中都需要相应的传感器采集坐标系,对于固定的传感器使用 tf 中的 static_transform_publisher 给定传感器与机器人中心相对位姿就可以了。 18 | 19 | ROS 中的重要相关部分部分: 20 | tf : 坐标转换库,提供实时的坐标转换查询与更改服务。 21 | 它将坐标转换表示为树形结构,而坐标转换数据的更新速度直接影响 其他节点的实时性,进而导致整个系统的运行出错,出问题大部分也是在这部分。 22 | 23 | actionlib: 24 | 提供动作(action ROS 中表示一些长时间,连续性的行为) 的编程接口, 25 | 提供动作执行时的查看状态,终止,抢占等一系列功能。 26 | ROS中的自主移动规划层向上的编程接口一般都是通过这个库。 27 | 28 | pluginlib : 29 | 提供可配置的组件(配置文件就可以规定组件的添加与更换,提供了运行时改变组件的可能性)navigaion 中提供了对于多种planner的支持。 30 | 31 | dynamic_reconfigure : 32 | 提供运行时改变算法(节点)参数的功能。 33 | 34 | 35 | SLAM: 36 | 提到SLAM,在社区中应用最多的应该是 Gmapping 与 hector_slam这两种2d slam方法了 37 | 38 | 39 | 机器人的导航规划部分 40 | 我了解最深的是ROS navigation metapackage , 41 | 一般它输入为激光雷达(使用rgbd-camera 效果不佳)与里程计数据, 42 | 输出为cmd_vel 机器人在2d平面上的速度。 43 | 与之类似的是hector_navigation。这一部分主要解决安全路径的规划问题。 44 | 45 | ROS 中对于多坐标系的处理是使用树型表示,在机器人自主导航中,ROS会构建这几个很重要的坐标系: 46 | base_link: 47 | 一般位于tf tree 的最根部,物理语义原点一般为表示机器人中心,为相对机器人的本体的坐标系。 48 | 49 | odom: 50 | 一般直接与base_link 相链接,语义为一个对于机器人全局位姿的粗略估计。取名来源于odometry(里程计),一般这个坐标系的数据也是来源于里程计。 51 | 对于全局位姿的估计方法很多, 52 | 比如在hector SLAM与导航体系中,就采用了imu数据估计全局位姿, 53 | 还有很多视觉里程计的算法(visual odometry)也能提供位姿估计。 54 | 原点为开始计算位姿那个时刻的机器人的位置。 55 | 56 | odom_combined 57 | 这个tf一般为好几种位姿估计方法的信息融合后的数据。在navigation metapackage中有 robot_pose_ekf 这个包是用扩展卡尔曼滤波算法(EKF)融合不同传感器的数据。 58 | 59 | map: 60 | 一般与odom(或者odom_combined)相连,语义为一个经过先验(或者SLAM)地图数据矫正过的,在地图中的位姿信息。 61 | 与odom同为全局坐标系。 62 | 原点为地图原点(地图原点在地图相应的yaml文件中有规定)。 63 | 64 | 在机器人定位与导航体系中,定位模块作为规划层的输入与参考数据所存在。 65 | 而对于ROS navigation 体系而言,因为它先天的模块间通讯方式实现了模块间的完全解耦,所以对于导航规划层而言(具体就是move_base 这个node),什么定位方法,静态还是动态的地图,对于导航层内部几乎没有区别。 66 | 67 | 在这种思想指导下,navigation metapackage 中 就有了为仿真器环境下的定位工具包fake_localization: 用于把仿真器中的位姿(就是直接吧odom 变换成map)估计直接变换成关于全局地图的定位,简化定位部分; 68 | 69 | 对于动态创建的地图slam, gmapping 在ROS中提供从 odom -》map的坐标转换,也可以作为navigation 中 move_base 的输入 70 | 71 | 从定位这部分扩展开来, 对于导航规划层来说,仿真器还是实物传回来的数据这些都无所谓。只要有相应的数据就可以执行相应功能。所以我们配置navigation的时候思路就是先把数据流接对,然后再根据自己机器人硬件与执行任务的不同修改相应的参数。 72 | 73 | 74 | 75 | 76 | 77 | 《拿ROS玩移动机器人自主导航攻略(二) --by 西工大一小学生》 78 | http://blog.exbot.net/archives/2308 79 | 80 | Local Planner 81 | Local planner 需要订阅里程计信息获得当前机器人移动速度, 所以保证里程计odom topic中twist部分的正确性也是非常重要的. 82 | 83 | local planner 部分是navigation中参数最多, 最能直接影响机器人行为的部分. 调节local planner 中的 acceleration & velocity limit 可以直接控制机器人速度/加速度上限. 而设置holonomic_robot 与 y_vels 参数, 是否采样y 方向速度, 全向移动机器人可以通过调整这些参数实现平移避障等动作. 84 | 85 | 对于local planner, local costmap global frame 的选取一般是odom, odom坐标系在局部准确性满足要求而且实时性比map 更好(少经过一层处理). 一般要把rolling window选上, 因为局部避障要考虑先验地图中没有的障碍物. 86 | 87 | Global Planner 88 | 全局路径规划navigation中实现的方法是基于栅格地图的cost 搜索找最优, 而我们所喜闻乐见的A*与dijkstra 只是扩展栅格路径的不同方式而已, dijstra 一般消耗时间和空间都较A*要多,但是A*找到的一般不是全局最优解 89 | 90 | navigation中的这两层规划(Global vs Local)之间联系纽带就是local_planner中的cost function 有将全局路径考虑在内, 也就是说 local_planner 输出的local path会有靠近global path 的趋势, 而具体情况得看当时的速度以及障碍物情况(cost function 去最大值而global path 只是一个因素) 91 | 92 | 对于global costmap, global frame的选取一般要看机器人需求, 93 | 如果是在已知地图中, 使用static map预生成costmap是又快又好的方法, 使用map坐标系做全局坐标系, 94 | 但是如果要执行一些探索任务, 没有先验地图, 定位数据选取就看你手上有什么类型的数据了, rolling_window也是看需求选取 95 | 96 | Move base 97 | 这个模块负责整个navigation 行为的调度, 98 | 包括初始化costmap与planner, 监视导航状态适时更换导航策略等. 涉及到行为的控制, 99 | 100 | move_base 具体实现就是有限状态机, 定义了若干recovery_behavior , 指定机器人导航过程中出问题后的行为. 出问题有这几种情况: 101 | <1 控制失败, 找不到合法的速度控制量输出, 一般就是local_planner 出问题了. 102 | <2 规划失败, 找不到合法的路径, 一般就是global planner 出问题了. 103 | <3 局部规划震荡, 局部规划器在某些特定情况下, cost function 出现局部最小, 具体表现为以一个较小的速度来回移动,这个时候机器人光靠local planner无法给出合适的速度控制量. 104 | 105 | 前两种情况, 一般就是planner 在当前的cost map中无法找到合法路径, 所以recovery_behavior一般是清除costmap 中的occupied grid,重新通过传感器数据生成costmap, 这样可以消除一些costmap 建图不准产生的杂点所导致的失败. 106 | 107 | 后一种情况, move_base 会给底盘发送一小段时间的很小的速度.通过主动移动给一个扰动逃离local planner cost function的局部最小. 108 | 109 | 在前两轮的recovery 失败后,move_base默认会采用一种更加激进的方式,原地旋转来企图清除costmap中的障碍物.所以很多navigation 失败情况之前都会原地转上好几圈, 这个行为完全可以通过move_base的参数进行更改,recovery_behavior也是通过pluginlib构建,自己定制也是完全可行. -------------------------------------------------------------------------------- /老王说ROS.txt: -------------------------------------------------------------------------------- 1 | 《老王说ROS(1-5)》 2 | http://blog.exbot.net/archives/1412 3 | 4 | 1. ROS结构 5 | ros提供了订阅发布的通信机制,也就是有个发布者发布一个topic,订阅者订阅这个topic,当有发布者就某个topic 发布message的时候,订阅这个topic的订阅者就可以收到这个message 了。当订阅者收到这个消息的时候,通过一个自定义的回调函数来处理消息,来完成自己的业务。 6 | 7 | 2. ROS消息 8 | 9 | 10 | 3. ROS Node 11 | 当你建立一个node后,要么它按照一个固定的周期运行,要么它阻塞等待事件发生,由事件驱动运行。无论是那种,node都要干活,node干的什么活呢?callback queue里的活。 12 | 这个callback queue里的callback是哪里来的呢? 13 | 常见的是subscriber的callback,当然还有其他的,包括publisher的,service的。 14 | 15 | 那这些callback是什么时候被调用的呢。那就是spin()或者spinonce()。 16 | spin调用在queue 里所有的availiable的callback,如果没有availible的,它就阻塞。 17 | spinonce,显然只调用一次,看看有没有准备好的callback,有就调用,没有就返回。 18 | 19 | 那什么是availible的、准备好的呢? 20 | 对于subscribe,准备好的就是那些有新消息的subscriber的callback。 21 | 22 | 1)第一个问题就是,如果subscriber没有收到新消息,那么它的callback就不会被执行。如果你想每次都运行callback呢?对不起,没办法 23 | 24 | 2)第二个问题,callback执行有个timeout值, 25 | 如果设置不合理,要么费时,要么callback被中止。万一是一个重要逻辑的一环呢? 26 | 27 | 如果你想实现事件触发的node就用spin; 28 | 如果你要固定周期的node,那就用spinonce+sleep,但一定要牢记,在每个周期里不是所有callback被执行。 29 | 30 | 31 | 4. ROS Master 32 | 33 | 在很久很久以前,计算机里的程序是顺序执行的,在很久很久以后计算机里的程序还是顺序执行的。 34 | 35 | 不同的是以前计算机解决的问题比较简单,现在有点复杂。人类已经很难用结构化的思维来描述系统,很难用面向过程的语言把系统描述给计算机了。 36 | 37 | 于是,面向对象思维登场,把世界抽象为对象以及对象间的交互。这个说法没错,但牛叉的说一切皆对象并奉若神明否定过程,这是不对的。因为,对象从生到死是个过程,对象间交互也是个过程,没有面向过程的思维也是不行的。 38 | 39 | 但面向过程思维不能太结构化,特别是解决复杂系统问题的时候,要面向多进程并发,把世界抽象为过程以及过程间的交互。 40 | 41 | 42 | master提供两种基础服务,naming service和parameter server。这两个服务本质上没有什么不同,就是注册和查询,只不过一个是地址,一个是参数。 43 | 44 | 1)master死了会怎样? 45 | 2)node死了会怎样? 46 | 3)怎么知道master死了?怎么知道node死了? 47 | 48 | 先说第一个master死了,可以重启嘛,只是重启之后,以前的node注册信息会丢失,你无法和以前的node建立交互关系。 49 | node只在实例化nodehandler的时候注册信息。 50 | 第二个,node非正常死亡后,master是不知道的,rosnode list的时候,你还会看到它。 51 | 第三个问题,答案很简单。自己想办法! 52 | 53 | 54 | 5. ROS node里的线程 55 | 56 | 在一个node里除了主线程外,至少有两个线程, 57 | 一个好像是pollmanager里有个类似于select()的线程,负责poll各个socket的读写事件; 58 | 另外一个,我忘了在哪了,功能是监听、建立新的pub/sub链接。 59 | 60 | 61 | 《老王说ROS(6)如何设计node》 62 | http://blog.exbot.net/archives/1626 63 | 64 | node是一个提供了 65 | 外部接口、 66 | 内部有结构、 67 | 用于实现业务 68 | 的进程。 69 | 70 | node提供的接口有三种: 71 | message-based的p/s interface,rpc-based的service interface,data-based的parameter interface。 72 | 73 | node的内部结构可以分两种: 74 | 按时间周期工作,由事件驱动工作。 75 | 76 | 从抽象的角度来说,node要干的活可以分为: 77 | data的生产者、消费者、加工者; 78 | event的发起者、响应者; 79 | service的提供者、需求者; 80 | configuration的接受者、设定者; 81 | 其他基础服务者,如计算节点管理、数据记录、数据显示、系统异常检测与处理等等。 82 | 83 | 举slam node这个例子: 84 | a.它是一个数据加工者。 85 | 86 | b.它需要两个对外的输入接口: 87 | 环境感知传感器数据、定位定向数据; 88 | 两个输出接口: 89 | 地图和位姿。 90 | 那就用p/b吧。 91 | 92 | c.它的内部结构按固定周期来吧。当然也有多种选择。 93 | c1. 按最慢的那个输入的周期来,把算法放到感知传感器的回调函数里,靠数据生产者的周期控制自己的周期。 94 | c2. 自己固定个周期,写个处理函数,在loop里调用,订阅数据的回调函数只管赋值。 95 | 96 | 它的算法参数应该可以设置,比如里程计和激光扫描仪的概率模型,因为每个传感器都有区别。 97 | 98 | d.它需要作为一个configuration的接受者。用parameter service吧。 99 | 100 | 有个家伙需要控制你启动和停止运行,并且需要你报告执行的结果 101 | 102 | e. 它需要作为一个服务的提供者。 103 | 用service吧,当然还要去设计个状态机来控制不同的流程,并且还需要找个地方来实施。 104 | 105 | 玩slam的小伙伴: 106 | (1)不标定里程计、不给它建个概率模型,就玩slam,等于在对激光扫描仪这个好姑娘耍流氓! 107 | (2)不把里程计和扫描仪的时间同步考虑进去,就预测更新,那就是以组织的名义拉郎配! 108 | 109 | 110 | 111 | 《老王说ROS(7)用ros做系统设计》 112 | http://blog.exbot.net/archives/1675 113 | 114 | 115 | 《老王说ros(8)ros的tf库》 116 | http://blog.exbot.net/archives/1686 117 | 118 | 119 | --------------------------------------------------------------------------------