Skip to content

Add Mac (Apple Silicon) compatibility: both RoboCasa sims and stacks at real time - #33

Merged
maxconwa merged 7 commits into
mainfrom
feat/mac-arm64-sim
Nov 19, 2026
Merged

maxconwa merged 7 commits into
mainfrom
feat/mac-arm64-sim

Conversation

@maxconwa

Copy link
Copy Markdown
Contributor

Run both RoboCasa sims and their stacks on an Apple Silicon Mac at real time

Adds a second, reduced platform: an Apple Silicon Mac runs the H1-2 or G1 RoboCasa sim and the robot's stack (safety, arms, legs, SLAM and Nav2) at 1.00x real time, in Docker. The Mac has no model servers, no skills and no Isaac. The x86 / NVIDIA path is unchanged (see Testing). Full write-up: docs/MAC.md.

What changes

  • Images: docker/mac/{Base,Ros,Robocasa}Dockerfile are native arm64 twins of the x86 images, on ubuntu:jammy (pinned by digest) with no CUDA.
    • Same commits, patches and asset digest as the x86 images.
    • CPU torch.
    • No model-server ML stack in the Mac golem_ros.
    • Python goes through arm64 locks (docker/locks/*-arm64*.txt), generated from the amd64 locks by docker/mac/derive_arm64_locks.sh.
  • Unitree DDS fix (Mac base image): the sims load the Unitree SDK's CycloneDDS and ROS's in one process. On arm64 the two libddsc.so.0 copies collide, and the first Unitree topic segfaults. The Mac base renames the SDK's copy (libddsc_unitree.so.0) and points the binding at it, and the image build fails if the pair can't share a process.
  • Compose and wrappers:
    • docker/docker-compose.mac.yml overlays the base compose file: arm64 images, no NVIDIA runtime, GOLEM_RENDER=cpu, cameras off, and a CycloneDDS override of the 16 MB receive-buffer minimum, which the VM refuses.
    • docker_common.sh configure_platform adds the overlay on Darwin arm64 (or GOLEM_PLATFORM=mac) and refuses Isaac.
    • configure_robot exports the Mac's lidar density per robot.
    • docker_stack.sh starts the Mac bringups.
    • On Linux nothing changes.
  • Sims (opt-in only):
    • GOLEM_RENDER=cpu lets the sims start without an NVIDIA GPU: OSMesa for the cameras, and mid360.CpuCaster casts the MID-360's rays exactly with mj_multiRay, on threads. mid360.make_caster picks the GPU or CPU caster. The default stays gpu, with the same GPU check and the same GpuCaster.
    • The H1-2 sim reads GOLEM_LIDAR_POINTS, as the G1's already does. Only the Mac overlay passes it, so the x86 H1-2 stays at the real 20,000 points per frame.
  • Bringup:
    • h12_mac_sim is h12_sim with use_vision:=false (a new argument, default true) and no skills.
    • g1_mac_sim is g1_sim with no skills and the Dex3-1 hand driver off by default.
    • The operator gates are unchanged: the H1-2 estop and the /lowerbody/confirm_engage call.

Mac defaults and measured speed

Measured on a MacBook Air M3 (8 cores, 16 GB) under OrbStack: the navigation stack in kitchen layout 9 / style 9 / seed 42, with a Nav2 goal 1.5 m ahead and one back to the start.

Lidar points per frame RTF Worst /lowstate gap Goal ahead / back to start
H1-2 6,000 (Mac default) 1.00 10 ms succeeded / succeeded
G1, no hand driver 10,000 (Mac default) 1.00, sim loop idle ~28% 22 ms succeeded / aborted 0.62 m short (same at every speed tried, not caused by the port)
H1-2 at the real 20,000 20,000 0.55 46 ms succeeded / succeeded

No faults or estop latches in these runs.

The VM is CPU-bound. golem_ros takes about 4 cores, and the CPU lidar is what sets the speed. The H1-2 needs fewer points than the G1 because its rays also hit the collision geoms.

These things didn't help:

  • More lidar threads: the sim alone ran faster, the stack didn't.
  • The Mac GPU (Podman/libkrun): containers only get Vulkan, and MuJoCo needs OpenGL/EGL.

Testing

  • x86 path unchanged:
    • No x86 Dockerfile, compose file, amd64 lock or patch differs from main.
    • The wrappers' docker calls on the Linux path (run and stack for both robots, ros, Isaac, build) are identical to main's: 33 calls, and the same stderr.
    • h12_sim starts the same node graph as on main for its defaults, for skills + RViz on (30 nodes), and for both off (27).
  • Unit tests:
    • tests/robocasa/test_mid360_cpu.py: the CPU caster matches mj_ray ray for ray, and the threads and points settings work.
    • test_gpu_required.py: the default still refuses to start without a GPU, and cpu needs OSMesa.
    • golem_bringup tests: the Mac bringups run on sim time, have no vision nodes, and the G1's hand driver is off. 90 pass. The 2 flake8 long lines in g1_sim and g1_real_robot were already on main.
    • tests/docker/test_source_pins.py: the Mac Dockerfiles use only arm64 locks and the same commits as x86, and the arm64 locks match what derive_arm64_locks.sh generates.
  • Not run (needs an x86 + NVIDIA host before merging):
    • The closed-loop gates tests/sim/test_sim_stack.sh --h12/--g1 and tests/g1.
    • The surface goldens (tests/robocasa/surface/run.sh h12|g1).
    • The 12 tests/docker/test_workflows.py tests that call /usr/bin/docker.

Caveats

  • The Mac lidar is sparser than the real sensor: 30% of the real density on the H1-2, 50% on the G1. Only short Nav2 goals were checked; map quality over a long exploration run hasn't been.
  • The H1-2's estop stream times out after 0.1 s. A VM stall longer than that latches the estop. That happened once, in an early overloaded run.

🤖 Generated with Claude Code

https://claude.ai/code/session_015EG7pDNJLWR31eQmyKaWhr

maxconwa and others added 7 commits November 19, 2026 12:05
Run either robot's RoboCasa sim and stack natively on arm64, without an
NVIDIA GPU: the command path, the legs and walking on /cmd_vel. No lidar,
navigation, model servers or Isaac on the Mac.

- docker/mac/: arm64 Base, Ros and Robocasa Dockerfiles (Ubuntu 22.04,
  CPU torch, no GPU vision stack), arm64 locks derived from the amd64 ones
  (derive_arm64_locks.sh), and a build-time check that the Unitree SDK's
  DDS and a ROS node share a domain in one process (the SDK's libddsc
  copy is renamed: on arm64 the shared soname made the binding segfault).
- docker-compose.mac.yml: arm64 images, no NVIDIA runtime, CPU rendering,
  no lidar, and a CycloneDDS URI without the 16 MB buffer minimum the VM
  refuses. configure_platform adds it on Darwin arm64 (GOLEM_PLATFORM);
  Isaac is refused there; docker_stack.sh starts the mac bringups.
- golem_robocasa: opt-in GOLEM_RENDER=cpu (OSMesa, requires
  GOLEM_LIDAR=0) past the GPU check; the H1-2 honours GOLEM_LIDAR=0 as
  the G1 does. Defaults are unchanged.
- golem_bringup: h12_sim gains use_nav and use_vision (default true);
  h12_mac_sim and g1_mac_sim include the sim bringups without nav,
  vision or skills.
- docs/MAC.md: setup, running, and speeds measured on an M3.

On Linux the wrappers make the same docker calls as before; the x86
Dockerfiles, compose file and amd64 locks are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GOLEM_RENDER=cpu (the Mac images) now casts the lidar's rays exactly on
the CPU with mid360.CpuCaster (mj_multiRay, restored from before
fb3c033) instead of refusing the lidar; mid360.make_caster picks the
caster by GOLEM_RENDER, and gpu, the default, still builds GpuCaster.

The Mac keeps the lidar off by default (GOLEM_LIDAR=0); GOLEM_LIDAR=1
turns it on in the sim, and h12_mac_sim and g1_mac_sim default use_nav
to it, so FAST-LIO, SLAM and Nav2 run exactly when the sim has a lidar.

Tests: test_mid360_cpu.py (CpuCaster against mj_ray, ray for ray;
make_caster), the cpu render mode with the lidar on, and the mac
bringups' navigation with and without GOLEM_LIDAR. docs/MAC.md records
both robots reaching Nav2 goals on an M3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mits

mid360.threads_from_env reads GOLEM_LIDAR_THREADS, the CpuCaster's thread
count (default unchanged: a quarter of the CPUs, at most 4), and
make_caster takes it; the Mac overlay passes it through.

Measured on an M3: more threads speed the G1 sim alone (1.48x at 2 to
2.10x at 6) but not the navigation stack, which stays at 0.80-0.89x
because the VM is CPU-bound (ros about 3.75 cores, the sim about 2.4).
docs/MAC.md records this, and that the Mac's GPU reaches a Podman
libkrun container only as Vulkan, not the OpenGL/EGL MuJoCo needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ks at 1x on the Mac

The H1-2 sim's MID-360 takes its points per frame from GOLEM_LIDAR_POINTS
(mid360.points_from_env; empty is the real 20,000), as the G1's does. Only
docker-compose.mac.yml passes it to the H1-2, so x86 runs are unchanged.

Measured on the M3 (navigation stack, kitchen 9/9/42, no recording): the H1-2
holds 1.00x at 6,000 points (0.55x at 20,000, 0.88-0.95x at 10,000), the G1
1.00x at 10,000 with use_hands:=false; every Nav2 goal succeeded, no faults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EG7pDNJLWR31eQmyKaWhr
…c default

Navigation is always on on the Mac, at the most lidar points each robot
holds real time with on an 8-core M3: configure_robot exports
GOLEM_LIDAR_POINTS 6000 (H1-2) or 10000 (G1) unless set, and g1_mac_sim
leaves the Dex3-1 hand driver out by default (use_hands:=true adds it).

Removed as not needed for that: GOLEM_LIDAR_THREADS (more threads did not
speed the stack), the H1-2's GOLEM_LIDAR=0 knob and h12_sim's use_nav, the
Mac's GOLEM_LIDAR default and use_nav-from-GOLEM_LIDAR in the Mac
bringups, the wrappers' platform line, and check_unitree_dds.py (the same
check now runs inline in docker/mac/BaseDockerfile). docs/MAC.md keeps the
setup, the run flow and the measurements.

Measured on the defaults, nothing set in the shell: both navigation stacks
at 1.00x, every goal ahead reached, no faults or estop latches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EG7pDNJLWR31eQmyKaWhr

@maxconwa maxconwa left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big changes shouldn't impact x86 and nvidia usage

@maxconwa
maxconwa merged commit 5041afb into main Nov 19, 2026
4 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.

1 participant