Skip to content

feat: setup_local.sh — reproduce the docker stages natively on the host#6

Merged
mrpollo merged 2 commits into
mainfrom
feat-local-setup-script
May 13, 2026
Merged

feat: setup_local.sh — reproduce the docker stages natively on the host#6
mrpollo merged 2 commits into
mainfrom
feat-local-setup-script

Conversation

@TSC21
Copy link
Copy Markdown
Member

@TSC21 TSC21 commented May 12, 2026

For attendees who can't (or don't want to) use Docker — macOS without Docker Desktop, hosts hitting NVIDIA Container Toolkit / GPU forwarding issues, restricted environments — add a setup_local.sh at the repo root that runs the same stages the Dockerfile does, against the host's filesystem.

It calls the existing docker/scripts/*.sh so there is one source of truth for the install logic. The scripts are parameterised so the Dockerfile path is unchanged (defaults match the previous hard-coded values), and setup_local.sh just sets a few env vars to redirect the artifacts under $HOME:

Dockerfile default Local default
SUDO "" (root) sudo
OPENCV_BUILD_DIR /OpenCV $HOME/OpenCV
PX4_ROS_WS /root/px4_ros_ws $HOME/px4_ros_ws
PX4_BUILD_DIR /home/${USER} $HOME
QGC_INSTALL_DIR /home/${USER} $HOME

setup_local.sh supports --skip-deps / --skip-opencv / --skip-ros-deps / --skip-px4 / --skip-qgc / --skip-ws so it's safe to re-run. The PX4 rcS patch is now idempotent so re-running doesn't fail with patch already applied.

Platform support

Stage 1: deps Stage 2: OpenCV Stage 3: ROS 2 deps Stage 4: PX4 SITL Stage 5: QGC Stage 6: workshop ws
Ubuntu 22.04 / 24.04 apt (matches Dockerfile) from source colcon Tools/setup/ubuntu.sh + make AppImage extract colcon
macOS (any) brew tap osrf/simulation && brew install gz-harmonic … + PX4 brew deps from source (cmake handles it) skipped — ROS 2 Humble on macOS is REP-2000 Tier 3, source-only (docs) Tools/setup/macos.sh + make (build_px4.sh now dispatches on uname -s) downloads the official QGroundControl-installer.dmg, mounts it, copies the .app into the prefix skipped — needs a working ROS 2 Humble; re-run with the appropriate --skip-* after building ROS 2 by hand

So on macOS the script does the parts it CAN do (Gazebo Harmonic, OpenCV, PX4 SITL, QGC.app) and is explicit about the parts that need manual follow-up. The macOS section also prints the recommended Docker path (OrbStack / Colima / Lima / Docker Desktop) at the top, which is the fastest route for workshop attendees with a tight schedule.

Verified

  • bash -n on every modified script.
  • In a fresh ros:humble-ros-base container the new env defaults resolve to the original Dockerfile paths (so the docker image build is unaffected; same artifacts at the same locations) and all scripts parse cleanly.

TSC21 added 2 commits May 12, 2026 15:49
…he host

Some workshop attendees can't (or don't want to) use Docker — Mac
users without Docker Desktop, hosts with NVIDIA Container Toolkit
issues, restricted environments. Add a setup_local.sh at the repo
root that runs the same sequence of stages the Dockerfile does, on
the host's filesystem, by calling the existing docker/scripts/*.sh
with the right env vars:

  1. install_deps.sh        (apt: gz-harmonic, ROS 2 packages, build deps)
  2. build_opencv.sh        (OpenCV 4.10 from source)
  3. build_ros_deps.sh      (Micro-XRCE-DDS, px4_msgs,
                             px4-ros2-interface-lib, etc.)
  4. build_px4.sh           (PX4 v1.16 SITL)
  5. install_qgc.sh         (QGroundControl v5.0.8 AppImage)
  6. colcon build           (the workshop workspace)

The docker/scripts/*.sh are parameterised so the same files are used
by both the Dockerfile (default paths /OpenCV, /root/px4_ros_ws,
/home/${USER}) and setup_local.sh ($HOME/-rooted layout):

  * install_deps.sh    accepts SUDO="" (Docker, default) or SUDO=sudo
                       (local) so apt commands work in both contexts
  * build_opencv.sh    OPENCV_BUILD_DIR  (default /OpenCV)
  * build_ros_deps.sh  PX4_ROS_WS        (default /root/px4_ros_ws)
  * build_px4.sh       PX4_BUILD_DIR     (default /home/${USER})
  * install_qgc.sh     QGC_INSTALL_DIR   (default /home/${USER})

setup_local.sh detects Ubuntu 22.04/24.04 vs macOS, refuses macOS by
default (ROS 2 Humble + Gazebo Harmonic don't have first-class macOS
support; recommends Docker via OrbStack/Colima/Lima instead), and
supports per-stage --skip-* flags for re-runs.
The first cut of setup_local.sh refused macOS based on a too-strong
claim that ROS 2 + Gazebo Harmonic don't run there. Verified against
REP-2000 and the Gazebo docs, the picture is more nuanced:

  * ROS 2 Humble is Tier 3 on macOS (community-supported, source-build
    only, supported through May 2027).
  * Gazebo Harmonic has official Homebrew binaries via osrf/simulation
    for Big Sur / Monterey; macOS 15 has known OGRE build issues.

Rework the macOS branch so the script:

  * detects macOS version + arch and prints accurate status info with
    upstream links;
  * installs Homebrew prereqs and gz-harmonic via the osrf/simulation tap;
  * runs the OpenCV-from-source stage (cmake handles macOS fine);
  * builds PX4 v1.16 SITL — build_px4.sh now dispatches Tools/setup/
    ubuntu.sh on Linux and Tools/setup/macos.sh on Darwin;
  * downloads the official QGroundControl-installer.dmg into the prefix
    instead of writing a placeholder log;
  * skips the ROS 2 deps + workshop-workspace stages with a clear note
    pointing to docs.ros.org's macOS source install guide (those are
    the only stages that genuinely require a working ROS 2 Humble);
  * still recommends the Docker path on macOS for the easy route.

Also makes the in-place PX4 init.d-posix/rcS patch idempotent (the
script can now be re-run without `git apply` failing because the
patch is already applied).
@mrpollo mrpollo merged commit 8e819d8 into main May 13, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants