Getting started
Requirements
Petal requires:
- Python 3.10+
- ROS2 installed under
/opt/ros/<distro> rosdep- apt tools
uv
Install
bash
uv tool install petal-rosTo use the colcon deps verb, install the colcon extra:
bash
uv tool install "petal-ros[colcon]"For local development:
bash
git clone https://github.com/matthewyjiang/petal.git
cd petal
uv tool install --editable .For one-off local runs without installing the petal command:
bash
uv run petal --helpInitialize a workspace
Run from a ROS2 workspace root:
bash
petal initThis creates:
petal.tomlfor declared workspace dependencies..petal/venvfor PyPI-managed packages..petal/activatefor shell activation.
Add dependencies
Apt-resolved package:
bash
petal add numpyPyPI package:
bash
petal add huggingfaceVersion spec:
bash
petal add ultralytics ">=8,<9"Rosdep-resolved ROS package:
bash
petal add cv_bridgeBy default, Petal resolves dependencies apt/ROS-first and only uses PyPI when needed. You can force a source when necessary:
bash
petal add --apt numpy
petal add --pip some-pypi-only-packageSync and verify
bash
petal sync
petal statuspetal status exits with code 2 when the workspace is out of sync.
Activate
For bash or zsh:
bash
source <(petal activate)For POSIX shells:
sh
. .petal/activate