7、Navigation obstacle avoidance

amcl:http://wiki.ros.org/amcl

navigation:http://wiki.ros.org/navigation/

navigation/Tutorials:http://wiki.ros.org/navigation/Tutorials/RobotSetup

costmap_2d:http://wiki.ros.org/costmap_2d

nav_core:http://wiki.ros.org/nav_core

global_planner:http://wiki.ros.org/global_planner

dwa_local_planner:http://wiki.ros.org/dwa_local_planner

teb_local_planner:http://wiki.ros.org/teb_local_planner

move_base:http://wiki.ros.org/move_base

depthimage_to_laserscan:http://wiki.ros.org/depthimage_to_laserscan

Function package:~/rplidar/src/transbot_nav

7.1、Usage

Note: [R2] on the handle can cancel the target point.

7.1.1、Start up

Start the driver and start it according to your needs (note: the pure depth mapping navigation effect is not good, so it is not recommended).

Start the navigation obstacle avoidance function, you can set the parameters according to your needs, and you can also modify the launch file.

lidar_type parameter: the type of lidar used: [a1, a2, a3, s1, s2].

image-20210918171858379

7.1.2、Usage

7.1.3、Dynamic parameter adjustment

image-20210918173110146

You can check the relationship between the node and the tf tree

7.1.4、2D navigation by depth mapping alone

Start the driver reference【7.1.1】# Astra + Transbot; the command for starting the map is the same as【7.1.1】.

The function package depthimage_to_laserscan is mainly used to convert the depth image into lidar data. Its mapping function is the same as that of lidar.

Note: The scanning range of the depth camera is not 360°.

image-20210918181057904

7.2、navigation

7.2.1、Introduction

navigation is a 2D navigation obstacle avoidance function package of ROS.

20190317224634772

7.2.2、Setting tf

The navigation function requires the robot to use tf to publish information about the relationship between coordinate systems.

Example: Lidar

image-20210917144744778

If we know that the lidar is installed at 10 cm and 20 cm above the center point of the mobile base.

This gives us the translation offset that associates the "base_link" frame with the "base_laser" frame.

Specifically, we know that to get data from the "base_link" coordinate system to the "base_laser" coordinate system, we must apply the translation of (x: 0.1m, y: 0.0m, z: 0.2m) and move from the "base_laser" frame To the "base_link" frame, we must apply the opposite translation (x: -0.1m, y: 0.0m, z: -0.20m).

image-20210917144913572

7.3、move_base

7.3.1、Introduction

move_base provides the configuration, operation, and interactive interface of ROS navigation.

image-20210917111812154

Realize the robot navigation function, it must be configured in a specific way, as shown in the figure above.

 

7.3.2、move_base communication mechanism

1)Action

The move_base node provides an implementation of SimpleActionServer, which receives the target containing the geometry_msgs/PoseStamped message.

You can directly communicate with the move_base node through ROS, but if you are concerned about tracking the status of the target, it is recommended to use SimpleActionClient to send the target to move_base.

NameTypeExplanation
move_base/goalmove_base_msgs/MoveBaseActionGoalmove_base subscription will reach the target point.
move_base/cancelactionlib_msgs/GoalIDmove_base subscription cancels a request for a specific target
move_base/feedbackmove_base_msgs/MoveBaseActionFeedbackpublish contains the current position of the chassis.
move_base/statusactionlib_msgs/GoalStatusArraypublish the status information of the process of moving to the target point.
move_base/resultmove_base_msgs/MoveBaseActionResultpost the final result of the move.
2)topic
NameTypeExplanation
move_base_simple/goalgeometry_msgs/PoseStampedProvides a non-action interface for not paying attention to the execution state of the tracking target. The move_base subscription will reach the target point.
cmd_velgeometry_msgs/TwistRelease the speed of the car.
3)servies
NameTypeExplanation
make_plannav_msgs/GetPlanAllow external users to request a plan for a given posture from move_base without causing move_base to execute the plan.
clear_unknown_spacestd_srvs/EmptyAllow external users to notify move_base to clear the unknown space around the robot. This is very useful when the costmaps of move_base are stopped for a long period of time and then restarted at a new location in the environment.
clear_costmapsstd_srvs/EmptyAllow external users to tell move_base to remove obstacles in the cost map used by move_base. This may cause the robot to hit something, so be careful when using it
4)Parameter configuration

move_base_params.yaml

7.3.3、Recovery Behavior

1)Introduction

image-20210918094233360

In the navigation function package set, there are 3 packages related to the recovery mechanism. They are: clear_costmap_recovery, move_slow_and_clear, rotate_recovery.

Three classes are defined in these three packages, all of which inherit the interface specifications in nav_core.

image-20210918110204025

 

4、costmap_params

The navigation function uses two cost maps to store obstacle information.

7.4.1、costmap_common

Cost map public parameter configuration costmap_common_params.yaml

 

7.4.2、global_costmap

Global cost map parameter configuration global_costmap_params.yaml

 

7.4.3、local_costmap

Local cost map parameter configuration local_costmap_params.yaml

 

7.4.4、costmap_2D

1)Introduction

costmap_rviz.png

7.5、planner_params

7.5.1、global_planner

global_planner_params.yaml

 

Global path planning algorithm renderings

If it appears at the very beginning:

 

7.5.2、local_planner

nav_core::BaseLocalPlanner provides an interface for local path planners used in navigation.

 

teb_local_planner_params.yaml

7.6、AMCL

7.6.1、Introduction

Adaptive Monte Carlo localization is a probabilistic positioning system for two-dimensional mobile robots.