Skip to content

webots_ros2_driver on macOS - #115

Draft
Tobias-Fischer wants to merge 3 commits into
mainfrom
ports/webots-macos
Draft

Tobias-Fischer wants to merge 3 commits into
mainfrom
ports/webots-macos

Conversation

@Tobias-Fischer

@Tobias-Fischer Tobias-Fischer commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

For #102: builds webots_ros2_driver on macOS. Upstream's macOS work (cyberbotics/webots_ros2#733) is a stalled WIP; this takes a smaller route. The bundled Webots controller library compiles on macOS as is, but its Makefiles assume the app bundle layout and universal binaries. The patch (all distributions, applies to their sync versions):

  • maps Contents/ onto the plain layout (webots/Contents -> .) and installs webots-controller from MacOS/;
  • plain @rpath/<lib> install names and @loader_path rpaths for the controller libraries and the driver executables (instead of $ORIGIN);
  • under conda (target_platform), builds only the target architecture and links without an explicit -target (conda's clang++ then rejects its libLTO);
  • builds the launcher with $(CC) and header padding (it used the system gcc, and rattler-build's relinking failed);
  • Ros2LightSensor.cpp: fixes chained comparisons (a < x < b), an upstream bug that clang 21 rejects (GCC only warns).
  • runtime: utils.py finds Webots.app's Contents/Resources/version.txt, the launcher starts Contents/MacOS/webots, the Python controller/vehicle modules load the bundled libraries from lib/controller, and Driver.cpp's /proc/<pid>/cmdline check (only for a deprecation warning) is Linux-only.
  • webots_ros2_importer: run-depends on pillow (urdf2webots imports PIL; the package.xml doesn't declare it, on any platform).

Only webots_ros2_driver is selected on macOS; webots_ros2 stays linux-64. Linux builds use the same CMake paths as before ($ORIGIN, webots/webots-controller).

Recipe test: the bundled controller library (lib/controller/libController.*) is installed and webots_ros2_driver.utils imports (shared/tests/ros2-webots-ros2-driver.yaml).

Built locally

  • lyrical, osx-arm64: webots_ros2_driver incl. recipe tests, and end to end with Webots R2025a (nightly) and the webots_ros2_mavic demo (built locally for this test; only the driver is selected on macOS): the controller connects, the Mavic's camera (~124 Hz), GPS, compass and IMU topics publish, and /cmd_vel makes it climb (GPS z 0.78 → 2.28 m). (The R2025a release build didn't start on this Mac at all, independent of ROS: it failed to open any TCP port.)
  • humble, osx-arm64: webots_ros2_driver (2025.0.0 patch) incl. recipe tests.
  • jazzy, linux-64 (checks the Linux code paths stay as before): webots_ros2_driver incl. recipe tests.
  • rolling: the patch applies to its sync version; not built locally.

Prepared and built on top of the current rosdistro syncs (#62 humble, #61 jazzy, #60 lyrical, #99 rolling) merged together, so it targets their package versions: merge after them. CI is held with [skip ci] until the syncs are in. The jazzy sync (#61) also changes jazzy's patch; rebase after it merges.

🤖 Generated with Claude Code

Tobias-Fischer and others added 3 commits October 19, 2026 09:18
For #102 (upstream WIP: cyberbotics/webots_ros2#733).
The bundled Webots controller library builds on macOS, but its Makefiles
assume the app bundle layout and universal binaries:
- map Contents/ onto the plain layout (symlink) and install the launcher
  from MacOS/; plain @rpath install names and @loader_path rpaths
- build only the target architecture under conda (target_platform), and
  link without an explicit -target (conda's clang++ then rejects libLTO)
- build the launcher with $(CC) and header padding for install_name_tool
- Ros2LightSensor: fix chained comparisons (a < x < b), rejected by clang 21
Only webots_ros2_driver is selected on macOS; webots_ros2 stays linux-64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found running the webots_ros2_mavic demo against Webots R2025a on macOS:
- utils.py: Webots.app's version.txt is in Contents/Resources
- webots_launcher.py: start Contents/MacOS/webots
- controller/wb.py, vehicle/driver.py: the ROS nodes point WEBOTS_HOME at
  this package's prefix, so load the controller libraries from lib/controller
- Driver.cpp: the /proc/<pid>/cmdline check (only for a deprecation
  warning) is Linux-only; without /proc it aborted the driver
- webots_ros2_importer: run-depend on pillow (urdf2webots imports PIL; the
  package.xml doesn't declare it, on any platform)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…[skip ci]

Turns the local checks of this PR into a recipe test, so later rebuilds keep them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant