ROS2、slam_toolbox、Navigation2、Gazebo(转)

references:

  • wiki.ros.org/slam_toolbox
  • github.com/SteveMacenski/slam_toolbox
  • ros-planning.github.io/navigation2/

Slam Toolbox software package based on LaserScan combined information from the laser range finder in the form of messages, and the TF conversion from odom-> base link, creating a two-dimensional map space. This package will allow the complete sequence of reloading data and gesture SLAM map map map for continued construction, positioning, merger, or other operations. SLAM Toolbox allows synchronization (i.e., the effective processing of all sensor measurements, whether or not hysteresis) and asynchronous (i.e., the processing of sensor measurements in an effective where possible) operating mode.

ROS replaced ggapping, cartographer, karto, hector and other functions, has a fully functional SLAM, the core functionality built on Karto powerful scanning matcher, has been widely used for the package and accelerate. Also introduced a new plug-in-based optimization of Google Ceres. Also describes a technique known as "positioning elastic FIG attitude" "Elastic Graph POSE-localization"  new positioning method, which uses a sliding window to measure and add graphics to be optimized and refined. This allows the local elements of tracking environment that have changed, rather than as a deviation, and when leaving an area of the map without affecting the long-term, will remove these extra nodes.

It is to deal with the large dynamic indoor environments GMapping, inadequate mapping and positioning Karto, Cartographer and quality AMCL created, although it has been tested and deployed on the sidewalk robot.

RVIZ which includes a plug-in to interact with the service via ROS themes and SLAM Toolbox. Although it is provided as a debugging tool, but for production, it is recommended to use its own package interface. FIG allow manual operation by the gesture RVIZ insert which is very suitable for the mini-map. In a larger map, the interactive mark will RVIZ overload, or so it is most useful as a debugging tool for self-examination when a small map. FIG posture in an interactive mode of operation, the node may move and rotate the figure, while the laser scan display of the node, so as to better match with a closed loop or aligned, and then rerun on the part pattern optimization gesture device. Axially aligned so as to rotate the map is also useful.


Outline

Navigation 2 project is a new version of ROS Navigation Stack (applicable ROS2). The project seeks to find a safe way to make a mobile robot to move from point A to point B. This will complete the dynamic path planning, the calculation speed of the motor, avoid obstacles and structural recovery behavior. To learn more about this project, please refer to the About and Contact .

2 Use the navigation tree to call the behavior of modular server to complete the operation. Action may be calculated route, the workload of the control, recovery, or any other action related to the navigation. These are separate node in communication with the behavior of the tree (BT) on ROS action server. FIG Under good understanding of the structure of Navigation 2. Note: You can in each server controller, planners and restore provide multiple plug-ins, and BT with a matching plug. This can be used to create contextual navigation behavior. If you want to see the project and ROS (1) comparison between navigation, please refer to the ROS and ROS2 navigation .

Navigation2 (Nav2) is in line with the expected input TF conversion REP-105, the use of static Costmap map layers source, BT XML file and any related sensor data sources. It then provides an effective speed of the motor command complete or complete robot. We currently support base type of complete and differential drive, but the program also supports Ackermann (similar car) robots in the near future.

It has the following tools:

  • Load, service and store maps (Map Server)
  • Positioning robot (AMCL) on the map
  • Planning obstacle route from A to B (Nav2 Planner)
  • Controlling the robot along a path (Nav2 Controller)
  • The sensor data is converted to world view showing cost (Nav2 Costmap 2D)
  • Usage behavior tree (Nav2 behavior tree and BT Navigator) to build complex robot behavior
  • Calculated recovery behavior under fault conditions (Nav2 recovery)
  • Follow the order of waypoints (Nav2 waypoints followers)
  • Server lifecycle management (Nav2 Lifecycle Manager)
  • To enable your own plug-ins (Nav2 Core) defined algorithm and behavior

It also provides a set of plug-ins start to help get started. NavFn calculates the shortest path to the target gesture from the gesture using Dijkstra's algorithm or A *. DWB DWA algorithm will be used to calculate the effect of controlling the path followed, and provides a plurality of tracks selected for widget. Including the following recovery behaviors: Wait, rotation, clear diagrams and backup costs. BT has a set of plug-ins can be used to call these servers and computing conditions. Finally, there is a group Rviz plug for interacting with the stack and control the life cycle. You can navigate plugins find a list of plug-ins for all users on the report.

Navigation2 Tutorial

Introduction

ROS 2 set of packages and Gazebo interface element included in the package name gazebo_ros_pkgs. See  ROS 2 Overview  to get background information, then continue here.

These software packages support ROS 2 Dashing and Gazebo 9, or may be installed from debian packages from the source code.

Ready condition

You should understand the basic concepts of ROS 2, and has read some  ROS 2 tutorials .

Installation ROS 2

ROS2 can be installed by installing the binary or source installation, see ROS 2 installation page . The current stable distribution Dashing .

Tip : Do not forget to follow the instructions on the page to get the source of ROS installation script. The exact command will vary depending on the installation method. Updatesetup.bash。

Installation Gazebo

Gazebo can be installed from a source or from a pre-built package. See  installation Gazebo .

It should be installed Gazebo9. If you install from source, make sure you build  gazebo9a branch.

Tip : If you have difficulty to find plug-ins and other resources, you may need to obtain Gazebo installation files. E.g:.source /usr/share/gazebo/setup.sh

Installation gazebo_ros_pkgs

Follow the instructions from debian packages mounted or installed from the source code instructions.

From debian packages installed (in Ubuntu on)

It assumes that you have some dashing debian package installed, gazebo_ros_pkgsinstalled in accordance with the following steps:

sudo apt install ros-dashing-gazebo-ros-pkgs

From source mounted (on Ubuntu)

If you are an active developer, is committed to contribute to the code base, it is recommended to install the source code, because it provides more access and control over the workflow.

Tip : These instructions require the use of  colcon build tool, which is used in the ROS 2 standard tools.

Need to gazebo_ros_pkgsbranch ROS 2 version selected based on. The branch is currently supported:

The following settings are assumed ros2branch installation gazebo_ros_pkgs.

  1. Make sure that gityou have installed on Ubuntu computer:

    sudo apt install git
  2. Create a directory for colcon work area and move to where:

    mkdir -p ~/ws/src
  3. Copy  this file , the file will get gazebo_ros_pkgsand other required packages:

    cd ~/ws
    wget https://bitbucket.org/api/2.0/snippets/chapulina/geRKyA/f02dcd15c2c3b83b2d6aac00afe281162800da74/files/ros2.yaml

    Note:version  YAML file mark indicates that we are checking out a specific repository branch, for example  version: ros2 check out the ros2branch.

  4. The package into the srcdirectory

    cd ~/ws
    vcs import src < ros2.yaml
  5. Install all dependencies:

    cd ~/ws
    rosdep install --from-paths src --ignore-src -r -y
  6. Then build all packages:

    cd ~/ws
    colcon build --symlink-install

    Note: Before building this version, make sure that the correct source of ROS 2 environment.

  7. If you encounter any problems in building, make sure the answer.gazebosim.org for help.

  8. Ensure the installation settings for this workspace for each new terminal opened:

    source ~/ws/install/setup.bash

    Tip : You can obtain this information for each new terminal by automatically run this command:echo "source ~/ws/install/setup.bash" >> ~/.bashrc

Gazebo and integration testing ROS 2

Assumed to have been set correctly and constructed ROS 2 and Gazebo environment, you should now be able to load plug-ins contain ROS 2 Gazebo in the world, and insert at runtime which contains the model ROS 2 plug-ins.

Gazebo ROS package provides you with a number of presentations in the world, so you started these plug-ins. Demos world can here be found, and in the case of the default installation./opt/ros/<distro>/share/gazebo_plugins/worlds/

The top of each file has a description of the world, and provides some examples of commands you can run these commands to test its functionality, be sure to check!

Let us now try to load one of them!

  1. Open a new terminal

  2. Installation according to instructions input ROS 2 ROS 2.

  3. Make sure that you have installed some of the core tools:

    sudo apt install ros-dashing-ros-core ros-dashing-geometry2
  4. If you gazebo_ros_pkgsinstall from source, please contact the source from a workspace:

    . ~/ws/install/setup.bash
  5. Gazebo differential drive is loaded with the world:

    gazebo --verbose /opt/ros/crystal/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world
  6. Gazebo in the GUI should appear with a simple tool:

     

  7. In the new terminal (this is the second terminal), run the following command to view the world file.

    gedit /opt/ros/crystal/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world
  8. Take a look at the top of the block there are some examples of orders? Let us open the third terminal, again gazebo_ros_pkgsas mentioned above, to obtain ROS source 2.

  9. Then run the following commands, such as:

    ros2 topic pub /demo/cmd_demo geometry_msgs/Twist '{linear: {x: 1.0}}' -1
  10. See the vehicle moving forward:

     

  11. Other commands listed on trial file and try to modify their values ​​in order to understand the way things work. You can also try other presentation of the world!


 

Published 475 original articles · won praise 1335 · Views 2.16 million +

Guess you like

Origin blog.csdn.net/ZhangRelay/article/details/104674621