Navigation package for ROS Noetic running on a Raspberry Pi 4 for an autonomous 2WD Robot to act in an environment according to sensor information.
DiffBot Navigation Package
fjp@diffbot:~/catkin_ws/src/diffbot$ catkin create pkg diffbot_navigation --catkin-deps amcl map_server move_base diffbot_bringup
Creating package "diffbot_navigation" in "/home/fjp/git/ros_ws/src/diffbot"...
Created file diffbot_navigation/package.xml
Created file diffbot_navigation/CMakeLists.txt
Successfully created package files in /home/fjp/git/ros_ws/src/diffbot/diffbot_navigation.
We also need the following ROS packages that can be installed from the ROS Ubuntu packages:
$ sudo apt install ros-noetic-dwa-local-planner ros-noetic-amcl ros-noetic-map-server ros-noetic-move-base
After this we create the required launch files and parameter configurations. These will be used for the simulation and the real robot. First we focus on the simulation in Gazebo.
Launch files
All launch files are in the folder named launch
of the diffbot_navigation
package.
Inside the move_base.launch
it is important to remap the following topics:
<!-- Arguments -->
<arg name="cmd_vel_topic" default="/diffbot/mobile_base_controller/cmd_vel" />
<arg name="odom_topic" default="/diffbot/mobile_base_controller/odom" />
...
<!-- remappings of move_base node -->
<remap from="cmd_vel" to="$(arg cmd_vel_topic)"/>
<remap from="odom" to="$(arg odom_topic)"/>
Parameter Configuration
The parameters for the navigation package go into the config
(for some robots named param
) folder.
Most of them can be changed during runtime using dynamic reconfigure with the rqt_reconfigure
gui.
-
amcl
: amcl is a probabilistic localization system for a robot moving in 2D. It implements the adaptive (or KLD-sampling) Monte Carlo localization approach (as described by Dieter Fox), which uses a particle filter to track the pose of a robot against a known map. -
map_server
: provides themap_server
ROS Node, which offers map data as a ROS Service. It also provides themap_saver
command-line utility, which allows dynamically generated maps to be saved to file. -
move_base
: Themove_base
package provides an implementation of an action (see theactionlib
package) that, given a goal in the world, will attempt to reach it with a mobile base. Themove_base
node links together a global and local planner to accomplish its global navigation task. It supports any global planner adhering to thenav_core::BaseGlobalPlanner
interface specified in thenav_core
package and any local planner adhering to thenav_core::BaseLocalPlanner
interface specified in thenav_core
package. Themove_base
node also maintains two costmaps, one for the global planner, and one for a local planner (see thecostmap_2d
package) that are used to accomplish navigation tasks. -
gmapping
: This package contains a ROS wrapper for OpenSlam’s Gmapping. The gmapping package provides laser-based SLAM (Simultaneous Localization and Mapping), as a ROS node called slam_gmapping. Using slam_gmapping, you can create a 2-D occupancy grid map (like a building floorplan) from laser and pose data collected by a mobile robot. - ROS cartographer
slam_toolbox
Examples
Navigation in Gazebo with available Map
To navigate the robot in the simulation run the following command but make sure to first download the
turtlebot3_world
to your ~/.gazebo/models/
folder. This is required because the turtlebot3_world.world
file references the turtlebot3_world
model.
roslaunch diffbot_navigation diffbot.launch world_name:='$(find diffbot_gazebo)/worlds/turtlebot3_world.world'
This will spawn DiffBot inside the turtlebot3 world inside Gazebo and visualize the elements of the navigation stack in RViz.
To navigate the robot using the default DWA planner in the known map,
coming from the running map_server
, you can use the
2D Nav Goal in RViz.
Just select the navigation arrow to where the robot should move as shown in the animation above.
The DWA local planner is working for differential drive robots, like DiffBot. For other robots such as non-holonomic robots or other types of mobile robots (also differential drive robots) other planners can be used. See for example teb_local_planner
.
Resources
Global Planners:
Local Planners:
Comments