Skip to content

The Environment, and Where Dependencies Come From#

This page assumes you have a checkout and have run the tutorial. Every path it names exists on your disk now, so read it with a terminal open in ~/AutoSDV and run the commands as you go — that is the difference between believing where dependencies come from and seeing it.

Read it before, or immediately after, the first time something says "package not found".

Almost every early failure in AutoSDV is one mistake: a terminal that has not been told where ROS 2, Autoware and the AutoSDV workspace live. The mistake is easy to make because the project also ships a tool that hides it, and because the error messages point at the wrong thing.

AutoSDV does not install Autoware the way Autoware does#

If you have read the Autoware documentation, you arrived expecting to clone a workspace, run vcs import over dozens of repositories, and spend an hour or more in colcon build.

AutoSDV does not do that. Autoware arrives as Debian packages, installed into /opt/autoware/1.5.0. There is no Autoware source tree on your disk and nothing of Autoware is compiled on your machine.

The reason is cost. A source build of Autoware on a Jetson AGX Orin takes hours, and it takes them again after every clean checkout. A student setting up for a lab session, or an integrator provisioning a vehicle, should not pay that.

The trade

You get an installation in minutes instead of hours. In exchange you take the version that was built for you — 1.5.0, pinned in versions.yaml — and you cannot patch Autoware's own sources without building it yourself.

AutoSDV itself is still compiled. Everything under src/ is a colcon workspace and just build builds it: the launch files, the sensor kit, the vehicle interface, the CUDA NDT matcher.

So you are always in a hybrid: a binary Autoware underneath, a source workspace on top. That shape is what the rest of this page is about.

One line for packages, and one thing it does not carry#

source install/setup.bash    # from the repository root, after `just build`

That is enough to find everything. install/setup.bash is generated by colcon at build time, and it records the prefixes that were sourced when the workspace was built:

# inside install/setup.sh
COLCON_CURRENT_PREFIX="/opt/autoware/1.5.0"
_colcon_prefix_chain_sh_source_script "$COLCON_CURRENT_PREFIX/local_setup.sh"

So sourcing the workspace pulls ROS 2 and Autoware in behind it. Measured on a clean shell with nothing else sourced:

$ source install/setup.bash
$ ros2 pkg prefix autoware_launch
/opt/autoware/1.5.0
$ ros2 pkg prefix autosdv_launch
…/AutoSDV/install/autosdv_launch

What it does not carry is the middleware. The chain pulls local_setup.bash, which colcon generates and which contains the package environment and nothing else. RMW_IMPLEMENTATION and CYCLONEDDS_URI are plain exports in /opt/autoware/1.5.0/setup.bash — a hand-written wrapper around that generated file — so they are not inherited:

$ source install/setup.bash
$ echo "${RMW_IMPLEMENTATION:-unset}"
unset

Unset means ROS 2's default, rmw_fastrtps_cpp, which is a different middleware from the one a stack started elsewhere is using. That is the failure described below, and it is why .envrc exists: it makes the choice once, for the directory, so one source install/setup.bash is genuinely all a terminal needs.

If you would rather not rely on .envrc, source Autoware first and the workspace second — that order gets you both the packages and the middleware:

source /opt/autoware/1.5.0/setup.bash
source install/setup.bash

The first line is doing more than it looks#

You might expect to need three commands — one for ROS 2, one for Autoware, one for the workspace. You need two, because /opt/autoware/1.5.0/setup.bash sources ROS 2 itself before adding Autoware:

# inside /opt/autoware/1.5.0/setup.bash
if [ -f /opt/ros/humble/setup.bash ]; then
    source /opt/ros/humble/setup.bash
...
    source "$AUTOWARE_HOME/local_setup.bash"

One command, two layers. This is not something you could guess, and it is why instructions elsewhere that begin source /opt/ros/humble/setup.bash are not wrong so much as incomplete here.

It also prints a few lines when it runs — a note that ROS_LOCALHOST_ONLY was unset for CycloneDDS, and warnings if the kernel network settings are not configured. Those are informational. The line that matters is Autoware 1.5.0 environment loaded.

Skipping the Autoware layer also changes the middleware#

This is the part that costs people days, so it is worth stating on its own. /opt/autoware/1.5.0/setup.bash sets two variables nothing else sets:

RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
CYCLONEDDS_URI=file:///opt/autoware/1.5.0/config/cyclonedds.xml

Source only ROS 2 and the workspace and RMW_IMPLEMENTATION stays unset, which means ROS 2's default — rmw_fastrtps_cpp. That is not a slower option or a worse one. It is a different middleware, and two ROS 2 processes on different middlewares cannot see each other at all.

Nothing reports this. Both sides start cleanly, list their own nodes, and publish into a void. What it looks like in practice:

  • ros2 topic list from your terminal shows nothing, while the stack's own web UI reports every node ready
  • ros2 bag record writes a bag with zero messages
  • a script waiting on /clock waits out its whole timeout while the bag is plainly playing

It has happened in this repository more than once, most recently to a demo runner that sourced ROS and the workspace but not Autoware.

One line instead of two#

source scripts/env.sh

scripts/env.sh sources the Autoware prefix recorded in versions.yaml and then the workspace, in that order. Every just recipe uses it. Use the two explicit lines when you want to see what is happening, and this when you do not.

Which middleware is your choice, and it lives in .envrc#

Nothing in the repository forces an RMW on you. .envrc is the one file that decides, and the default is whatever Autoware selects — CycloneDDS today.

# use Zenoh instead, for this directory
RMW_IMPLEMENTATION=rmw_zenoh_cpp direnv reload

That indirection exists because Autoware's setup.bash exports RMW_IMPLEMENTATION=rmw_cyclonedds_cpp unconditionally: exporting your own choice and then sourcing Autoware loses it without a word. .envrc records the choice before sourcing and puts it back afterwards, and scripts/env.sh does the same so a just recipe cannot undo it either.

Whatever you pick, every process in the graph has to agree.

Working without direnv

direnv applies .envrc on entering the directory, which is the least error-prone setup and worth the five minutes to install. Without it, source the file yourself in every terminal:

source .envrc      # the PATH_add / watch_file lines are direnv's and
                   # will report as missing commands; the rest applies

A class is where this bites: one student with a terminal that skipped it gets a stack that starts perfectly and talks to nobody.

What each layer actually gives you#

This is the whole point of the page, so here it is measured rather than asserted. Each row is a completely clean shell with nothing inherited:

Sourced ros2 on PATH autoware_launch autosdv_launch RMW_IMPLEMENTATION
nothing not found — — —
/opt/ros/humble/setup.bash yes not found not found unset
/opt/autoware/1.5.0/setup.bash yes /opt/autoware/1.5.0 not found rmw_cyclonedds_cpp
install/setup.bash alone yes /opt/autoware/1.5.0 …/install/autosdv_launch unset
Autoware, then the workspace yes /opt/autoware/1.5.0 …/install/autosdv_launch rmw_cyclonedds_cpp

Read the last two rows together. The workspace alone finds every package, because the build recorded the layers underneath it — and still leaves the middleware unset. Package visibility and middleware selection are two different questions, and only the second one needs the Autoware line.

This is where your dependencies come from. Not from the build — the build only produced install/. The ROS 2 and Autoware packages that AutoSDV's nodes link against, the message types they publish, the launch files they include, all resolve at run time through this chain. A missing layer is a missing dependency, every time.

Overlays, briefly#

ROS 2 calls each sourced layer an overlay over the ones beneath it — the underlay. Sourcing appends to a search path, AMENT_PREFIX_PATH, and packages are found by walking it.

echo $AMENT_PREFIX_PATH | tr ':' '\n'

On the clean shells above that path had 1 entry with ROS 2 alone, 2 with Autoware added — Autoware is a single merged install, so it contributes one prefix — and 33 with the workspace sourced, because a --symlink-install workspace contributes one entry per package, and the two layers beneath it come along through the recorded chain rather than being counted separately.

Two consequences worth keeping:

  • Order matters. Source the underlay first. Sourcing the workspace before Autoware puts the layers in the wrong order, and although it often appears to work, package resolution is no longer what you think it is.
  • It is per-terminal. Sourcing changes environment variables in one shell. A new tab, a new SSH session, a new terminal split — each one starts clean and needs both lines again. Nothing is written to disk and nothing persists.

What it looks like when a layer is missing#

These are the errors, and what they actually mean.

ros2: command not found#

Nothing is sourced. You are in a fresh terminal.

Package 'autosdv_launch' not found#

Autoware is sourced, the workspace is not. Either you forgot the second line, or you are not in the repository root, or just build has not run yet.

ls install/setup.bash    # if this is missing, build first

The error names an Autoware package, and you were working on AutoSDV#

For example a launch file cannot find autoware_launch, or a node fails to start on a missing message type. This is the confusing one. The message names an AutoSDV file, so it looks like an AutoSDV bug, and it is not — you sourced install/setup.bash without the Autoware layer under it.

Check before you debug anything else:

ros2 pkg prefix autoware_launch   # expect /opt/autoware/1.5.0
ros2 pkg prefix autosdv_launch    # expect …/AutoSDV/install/autosdv_launch

If the first fails, the underlay is missing. Nothing else you are looking at is the real problem.

It works in one terminal and not another#

The first terminal is sourced and the second is not. This is also why "it works on my machine" happens — an inherited environment carries the variables into child processes, so a shell started from a sourced shell already has them.

Now the conveniences#

Everything above is the real mechanism. What follows only automates it, and you should be able to recognise that it does nothing else.

direnv#

The repository ships an .envrc which runs those same two lines whenever you enter the directory:

sudo apt install direnv
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc   # or your shell's equivalent
source ~/.bashrc

cd ~/AutoSDV
direnv allow

After direnv allow, entering the directory sources Autoware, then — if install/setup.bash exists — the workspace. The relevant part of the file is short enough to read:

if [ -f /opt/autoware/1.5.0/setup.bash ]; then
    source /opt/autoware/1.5.0/setup.bash
...
if [ -f install/setup.bash ]; then
    watch_file install/setup.bash
    source install/setup.bash
fi

That is all it is. It is genuinely convenient, and it is also why a newcomer can work for a week without learning any of this, and then be stranded the first time they open a terminal somewhere else — over SSH, in a container, in an editor's built-in shell, or in a cron job.

If you skip direnv, nothing breaks. Type the two lines.

just#

The same relationship. just build runs a colcon build with specific flags; just launch runs a play_launch command with specific arguments. Each recipe sources what it needs internally, which is why just build works in an unsourced terminal.

Throughout this book, a just recipe is shown next to the command it wraps. Use the recipes — they are shorter and they carry flags that matter — but know what is underneath, because the day something fails you will need to run that directly.

Checking your environment in one line#

ros2 pkg prefix autoware_launch && ros2 pkg prefix autosdv_launch

Two paths printed means both layers are present and you can stop thinking about this page.

Summary#

  • Autoware is installed as Debian packages; AutoSDV is compiled.
  • Two lines, in order: /opt/autoware/1.5.0/setup.bash, then install/setup.bash. The first also brings in ROS 2.
  • Those lines are where package dependencies are resolved, at run time.
  • Every new terminal needs them again.
  • .envrc and just automate exactly this and nothing more.

Next#