Planning

# Required packages for plotting
# You can install graphviz with: !apt-get install graphviz
# And install Python interface: pip install graphviz

from graphviz import Digraph

# Create a new directed graph
dot = Digraph(name="Nav2_Architecture", format="png")
dot.attr(rankdir='TB', size='10')

# Define nodes for each major layer
dot.node('T', 'Task Planning\n(Behavior Trees, Recovery, Waypoints)', shape='box', style='filled', fillcolor='lightblue')
dot.node('G', 'Global Planning\n(Path Planning on Map)', shape='box', style='filled', fillcolor='lightgreen')
dot.node('L', 'Local Planning\n(Trajectory Planning, Obstacle Avoidance)', shape='box', style='filled', fillcolor='lightyellow')
dot.node('P', 'Prediction\n(Dynamic Obstacles, Social Nav)', shape='box', style='dashed', fillcolor='white')
dot.node('E', 'Control Execution\n(cmd_vel, Actuation)', shape='box', style='filled', fillcolor='lightgray')

# Connect layers
dot.edge('T', 'G', label='Dispatch goal')
dot.edge('G', 'L', label='Path')
dot.edge('L', 'E', label='Velocity commands')
dot.edge('P', 'L', label='Predicted motion')

# Render the diagram
dot.render('images/nav2_architecture_diagram', view=False)
dot.path
Figure 1: Planning components for the navigation use case