Docs menu

Build and test on the car

Source the workspace in each terminal, build with colcon and run a package's tests so that a missing import fails loudly.

Source the workspace

Connect with SSH in the browser or cloudflared, then run these in every new terminal, in this order, before any ros2 or colcon command:

cd ~/racerbot-ws
source /opt/ros/jazzy/setup.bash
source ~/racerbot-ws/install/setup.bash

Working when: both source lines print nothing. A later command not found, or a package you know exists that ROS cannot find, means one of these lines was skipped in that terminal.

Build

colcon build --symlink-install
colcon build --symlink-install --packages-select <pkg>

The first line builds the whole workspace; the second builds one package, which is faster while you iterate. With --symlink-install, edits to Python, launch and config files take effect on the next launch without a rebuild. Rebuild after changing package.xml, setup.py or C++ sources, or after adding or removing a file.

The Jetson has 8 GB of RAM, so a full rebuild can run out of memory. Add --parallel-workers 1 when it does. If the build state is broken, rm -rf build install log && colcon build --symlink-install is safe, because those three folders hold only build output.

Run the tests

Source ROS first. Without it, test files that import rclpy fail to collect, and pytest reports the remaining tests as a green run with hundreds missing.

python3 -m pytest src/<pkg>/test/ -v
colcon test --packages-select <pkg> && colcon test-result --verbose

Working when: the number of tests collected matches grep -c '^def test' src/<pkg>/test/*.py. Never pass --continue-on-collection-errors, which turns a collection failure into a pass over part of the suite.

The testing page in the workspace docs covers writing tests that can fail, and each workspace holds itself to TEST_QUALITY_STANDARDS.md.