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.
All launch files are in the folder named
launch of 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)"/>
The parameters for the navigation package go into the
config (for some robots named
Most of them can be changed during runtime using dynamic reconfigure with the
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 the
map_serverROS Node, which offers map data as a ROS Service. It also provides the
map_savercommand-line utility, which allows dynamically generated maps to be saved to file.
move_basepackage provides an implementation of an action (see the
actionlibpackage) that, given a goal in the world, will attempt to reach it with a mobile base. The
move_basenode links together a global and local planner to accomplish its global navigation task. It supports any global planner adhering to the
nav_core::BaseGlobalPlannerinterface specified in the
nav_corepackage and any local planner adhering to the
nav_core::BaseLocalPlannerinterface specified in the
move_basenode also maintains two costmaps, one for the global planner, and one for a local planner (see the
costmap_2dpackage) 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
Navigation in Gazebo with available Map
To navigate the robot in the simulation run the following command but make sure to first download the
~/.gazebo/models/ folder. This is required because the
turtlebot3_world.world file references the
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
Leave a comment