Post · 2 min read· pp. 75–77

Overview

DocsCLI

The as2 command for building, testing and moving around a source workspace, and fetching example projects.

Authored by

  • @alvgaona

The as2 command wraps the everyday tasks of working on Aerostack2 from source. It builds and tests packages from any directory, jumps to a package's folder, and downloads the example projects.

diagram

For source workspaces

The CLI works in a colcon workspace built from source against a ROS 2 install in /opt/ros. It doesn't apply to Pixi or Docker installs.

Set up

Point AEROSTACK2_PATH at the Aerostack2 folder inside your workspace and load the CLI from your shell's startup file. It works in bash and zsh, with tab completion in bash:

diagram

~/.bashrc

text
source /opt/ros/humble/setup.bash
export AEROSTACK2_PATH=$HOME/aerostack2_ws/src/aerostack2
source $AEROSTACK2_PATH/as2_cli/setup_env.bash

setup_env.bash defines the as2 command and sources the workspace's install/setup.bash once it's built. The workspace is taken as the folder two levels above AEROSTACK2_PATH.

It also sets AEROSTACK2_SIMULATION_DRONE_ID, which many launch files use as the default namespace, to drone_sim_<user>_0. The value is kept in as2_cli/env_variables.bash, where you can change it.

Commands

CommandWhat it does
as2 buildBuilds the workspace, or a package and what it depends on
as2 testRuns the tests of the workspace or of one package
as2 cleanRemoves build output, for some packages or the whole workspace
as2 listLists the packages in the workspace
as2 cdGoes to a package's folder, a project's folder or the Aerostack2 folder
as2 projectLists and downloads the example projects

Every command except as2 cd prints its help with -h. Short flags can be combined, so -dv is the same as -d -v.

[### Build and test

Build, test and clean packages from any directory.](/u/2c658ac28043e6f6)[### Packages and folders

List the workspace's packages and jump to their folders.](/u/78768fd52e42cadc)[### Projects

Download the example projects and move into them.](/u/4c078cda8f4e9277)

Last updated on November 11, 2026

[diagram

Other components

The interfaces of the map server, geozones, the external object to TF tool, the mission executor and the alerts.](068_2026-12-05_other-components.md)[diagram

Build and test

Build, test and clean the packages of a source workspace with as2 build, as2 test and as2 clean.](019_2026-12-05_build-and-test.md)