L12: Namespaces, Remapping, and Behavior Trees#
Overview#
This lecture covers three topics that are essential for building
production-quality ROS 2 systems. Namespaces isolate multiple
instances of the same node by prefixing all their topics, services, and
parameters. Remapping lets you redirect individual names (node,
topic, service) at runtime without modifying source code. Behavior
trees organize robot behaviors into a modular, hierarchical structure
where leaf nodes (actions and conditions) do the work and composite
nodes (Sequences and Selectors) make the decisions. All hands-on
examples use the namespace_demo, remapping_demo, and
bt_demo packages.
Learning Objectives
By the end of this lecture, you will be able to:
Apply namespaces to isolate multiple instances of the same node.
Remap node names, topic names, and parameters at runtime and from launch files.
Explain the structure of a behavior tree: nodes, ticks, and return statuses.
Implement a simple robot behavior tree in Python using
py_treesandpy_trees_ros.Drive a robot to a fixed goal in Gazebo using a BT with a condition and an action node.
Next Steps#
In the next lecture, we will cover Mapping and Navigation with Nav2:
Occupancy grid maps and the
mapframeSLAM with
slam_toolbox: building a map from LiDAR and odometryLocalization with AMCL against a saved map
The Nav2 stack: planner, controller, behavior tree, recovery
Sending navigation goals via the
NavigateToPoseaction
Complete the exercises from this lecture before the next class.
Read Nav2 Getting Started and skim Nav2 Concepts.