# Robot Environment and Precedence

When a PAL robot boots, it automatically sources **three** distinct ROS 2 workspaces. The order in which they are sourced determines which version of a package is used if duplicates exist.

| Priority | Path | Description |
| :--- | :--- | :--- |
| **1 (Highest)** | `/home/pal/deployed_ws` | **Deployment Workspace:** Target for the deploy tool. |
| **2 (Medium)** | `/opt/pal/alum/` | **PAL Distribution:** PAL-specific libraries and nodes. |
| **3 (Lowest)** | `/opt/ros/humble/` | **Base Distribution:** Official ROS 2 Humble packages. |

 Because `/home/pal/deployed_ws` is sourced last (top-level), it **overlays** the other two locations. Any package installed here will be the one executed by the system.

## Adding a new workspace

To change the workspace source procedure, for example to add a new ROS workspace, you have to modify the file `/usr/bin/init-pal-env`, e.g., to adapt the environment of the startup process.

## What is launched at startup and how

The startup is done with the [PAL Module Manager](./module_manager.md).
