Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pages are in `docs/g1/` (start at `docs/g1/index.md`).
|---|---|
| `docker/` | the images and containers (Dockerfiles, `docker-compose.yml`, the G1 overlay `docker-compose.g1.yml`, `scripts/`; the Mac's arm64 images in `docker/mac/` with the overlay `docker-compose.mac.yml`, `docs/MAC.md`) |
| `core_ws/` | the ROS 2 workspace — where the bulk of development happens (see §4); the G1's own package is `core_ws/src/dex_3/`, the safety layer, arm controller, leg controller, SLAM/navigation and skills both robots run in `core_ws/src/golem_safety/`, `core_ws/src/golem_upper_ik/`, `core_ws/src/golem_lowerbody_rl/`, `core_ws/src/golem_slam/` and `core_ws/src/golem_skills/` |
| `golem_robocasa/` | RoboCasa/MuJoCo simulator entry point for both robots (`h12_mujoco.py`; `--g1` hands over to the G1 sim package `golem_robocasa/g1/`) and the ROS/DDS bridges |
| `golem_robocasa/` | RoboCasa/MuJoCo simulator for both robots: one entry point and loop (`golem_sim.py`), a robot object each (`h12_robot.py`, `g1/g1_robot.py`) and the ROS/DDS bridges |
| `CL_isaaclab_sim/` | Isaac Lab simulator, H1-2 only (`sim_main.py`, DDS bridges, tasks) |
| `CL_Assets/` | both robots' URDFs, MJCFs, meshes and self-collision models (the G1's in `CL_Assets/g1/`), Isaac USD (Git-LFS submodule); `golem_ros2_models` installs the models for ROS, and the sims read them directly |
| `unitree_sdk2_python/` | vendored Unitree DDS SDK (Python) |
Expand Down Expand Up @@ -157,9 +157,9 @@ The compose files pass the RoboCasa sims' knobs from the shell or `docker/.env`:
(the H1-2's default 0.20, which a task env can set via `spawn_margin`, as
`battery_env.py` does; the G1's 0.05). Both robots' spawn searches
(`robosuite_common.place_robot_collision_free`) back the robot off, and shift it
sideways where that is not enough, until the clearance holds; the H1-2's must
also hold in its limp sag poses and along `golem_upper_ik`'s start-up arm moves
(`h12_mujoco.STARTUP_ARM_STAGES`, kept equal to its `robot.yaml` by
sideways where that is not enough, until the clearance holds; it must
also hold in each robot's limp sag poses and along `golem_upper_ik`'s start-up arm moves
(`STARTUP_ARM_STAGES` in `h12_robot.py` and `g1/g1_robot.py`, kept equal to each `robot.yaml` by
`tests/docker/test_sim_startup_poses.py`), which run while the band still holds it. `GOLEM_CAMERA_SCALE=<f>`
(H1-2 default 0.5 of the real 1280x720), `GOLEM_CAMERA_DEPTH=0` and
`GOLEM_CAMERA_POINTCLOUD=0` tune the H1-2's RoboCasa cameras.
Expand Down Expand Up @@ -519,9 +519,11 @@ ros2 action send_goal /named_config custom_ros_messages/action/NamedConfig \
`CL_isaaclab_sim` and `golem_robocasa` should generally not be modified unless
necessary, and their **default behaviors must be preserved**. Everyone's
sim-vs-real workflow depends on them behaving like the real robot.
`golem_robocasa/h12_mujoco.py` is the one RoboCasa entry point for both robots: it
picks the robot (`--h12`/`--g1`, else `GOLEM_ROBOT`, else `h12`) before its
H1-2 imports and hands the G1 over to `golem_robocasa/g1/g1_mujoco.py`. Both
`golem_robocasa/golem_sim.py` is the one RoboCasa entry point and physics loop for both
robots: it picks the robot (`--h12`/`--g1`, else `GOLEM_ROBOT`, else `h12`) before either
robot's imports and runs that robot's object (`h12_robot.H12Robot`, `g1/g1_robot.G1Robot`:
spawn, band, sensors, DDS interface, locking and what only it serves) through the same loop,
so a change to the loop is made once. Both
sims render their cameras and the MID-360's rays through EGL on an NVIDIA GPU:
without one (MuJoCo not on EGL, no EGL device, a software renderer) the sim
stops at start, once its command line is parsed and before it builds a scene or
Expand All @@ -530,8 +532,7 @@ it is the Mac images' opt-in `GOLEM_RENDER=cpu` (OSMesa for the cameras, the
MID-360 cast exactly on the CPU by `mid360.CpuCaster`; `sim_common.require_renderer`,
`mid360.make_caster`). The H1-2
stays the default, and nothing on the G1 path may change its behaviour. The robots share
`sim_common.py`, `measurement_bridge.py`, the pacer in `sim_timing.py` (its
`--timing` report is the H1-2's only) and the `mujoco_sensors` node in
`sim_common.py`, `measurement_bridge.py`, the pacer in `sim_timing.py` and the `mujoco_sensors` node in
`mujoco_ros_bridge.py`; each has its own sensor suite
(`h12_sensors.py`, `g1/g1_sensors.py`) and Unitree DDS interface
(`unitree_interface.py`, `g1/unitree_interface.py`), which share their command
Expand All @@ -546,7 +547,7 @@ lid) collide with everything as before.
They should publish only what the real robot publishes and consume only what
it consumes. Verified current surface:

**RoboCasa, H1-2 (`golem_robocasa/h12_mujoco.py`)** — publishes `/clock`, the real
**RoboCasa, H1-2 (`golem_robocasa/golem_sim.py`)** — publishes `/clock`, the real
RealSense drivers' topics, frame names and camera TF (`/tf_static` + `/tf`) for
`/realsense/{head,left_hand,right_hand}` — colour, depth and aligned depth with
their camera_info, and `depth/color/points` — as captured from the robot in
Expand Down Expand Up @@ -589,7 +590,7 @@ probe clear it.
`h12_sensors.py`, the grippers in `magpie_hand_bridge.py`, `/clock` and the
opt-in odom in `mujoco_ros_bridge.py`, Unitree DDS in `unitree_interface.py`.)

**RoboCasa, G1 (`h12_mujoco.py --g1`, `golem_robocasa/g1/`)** — publishes `/clock`,
**RoboCasa, G1 (`golem_sim.py --g1`, `golem_robocasa/g1/`)** — publishes `/clock`,
the Livox MID-360 as its driver does in CustomMsg mode (`/livox/lidar`,
`/livox/imu`, no `/livox/pointcloud`), the head RealSense D435
(`/realsense/head/*` and its `/tf_static`), and over Unitree DDS `rt/lowstate`
Expand All @@ -600,7 +601,7 @@ motor is off until the first `rt/lowcmd` with a valid CRC, `mode_machine` 5
and `mode_pr` 0, and an elastic band on `torso_link` holds the robot until the
toggle (or SPACE in the viewer) releases it; the G1 bringup's leg node
calls it. It reads none of HOMIE's files. (Trust `g1/g1_sensors.py` for
the ROS side, `g1/unitree_interface.py` for the DDS side and `g1/g1_mujoco.py`
the ROS side, `g1/unitree_interface.py` for the DDS side and `g1/g1_robot.py`
for the band.) Its knobs are `GOLEM_LIDAR`, `GOLEM_LIDAR_POINTS` (points per
frame, default the real sensor's 20,000), `GOLEM_LIDAR_HZ`, `GOLEM_CAMERAS`,
`GOLEM_CAMERA_HZ`,
Expand All @@ -609,13 +610,13 @@ frame, default the real sensor's 20,000), `GOLEM_LIDAR_HZ`, `GOLEM_CAMERAS`,
`GOLEM_SIM_RATE` (as on the H1-2, above). Their
defaults are in the code
that reads them: `SensorConfig` in `g1/g1_sensors.py` (sensors),
`unitree_common.py` (the command timeout), `g1/g1_mujoco.py`
(spawn, odom), `measurement_bridge.py` (experiment) and `sim_common.py`
`unitree_common.py` (the command timeout), `g1/g1_robot.py`
(spawn), `golem_sim.py` (odom), `measurement_bridge.py` (experiment) and `sim_common.py`
(rate); the compose files pass them
(`docker/docker-compose.g1.yml` the G1-only ones). The G1 sim ignores the H1-2-only
knobs (`GOLEM_SPAWN_OFFSET`, `GOLEM_HAND_CAMERA_RES`,
`GOLEM_CAMERA_DEPTH`, `GOLEM_CAMERA_POINTCLOUD`). It refuses
`--timing`, and the H1-2 sim refuses `--duration` (`sim_common.py`).
`GOLEM_CAMERA_DEPTH`, `GOLEM_CAMERA_POINTCLOUD`). The sim logs its real-time factor
every 30 s of sim time, with the sensors' counts.

The measured surface of each RoboCasa robot is checked in as a golden:
`tests/robocasa/surface/{h12,g1}.json`, compared by
Expand All @@ -629,6 +630,10 @@ three RealSense RGBD camera streams with camera info, and
`rt/lowcmd` and optional `rt/inspire/cmd`. The default asset is the floating-base Magpie H1-2; `--hand_type inspire`
selects the Inspire fixture. Magpie exposes the real gripper state, services,
and DeliGrasp action through a native ROS process inside the Isaac container.
With `--elastic_band` (opt-in, refused with `--fix_base`; without it the robot floats free,
the default) it hangs the robot from the RoboCasa H1-2 sim's elastic band on `torso_link` and
serves `/elastic_band/toggle` (`std_srvs/srv/Trigger`), checked by
`tests/isaaclab/run_elastic_band.sh`.
Its H1-2 (the USD) keeps the MID-360 upright, unlike the RoboCasa sim and the
real robot's raw frame, so `golem_slam`'s H1-2 configs do not match Isaac's lidar.
Its `rt/lowstate` tick counts publishes, not milliseconds, so
Expand All @@ -647,8 +652,7 @@ exists. Keeping it off by default keeps the sim honest and protects
sim-to-real transfer.

- **RoboCasa complies, for both robots:** ground-truth `/odom` + `odom→pelvis`
TF is gated by `GOLEM_SIM_ODOM` (default `'0'` = off, read in `h12_mujoco.py`
and `g1/g1_mujoco.py`). No stack opts in: every bringup's navigation runs on FAST-LIO, and the G1 bringup and tests refuse it. Keep it that way. The
TF is gated by `GOLEM_SIM_ODOM` (default `'0'` = off, read in `golem_sim.py`). No stack opts in: every bringup's navigation runs on FAST-LIO, and the G1 bringup and tests refuse it. Keep it that way. The
experiment surface (`/sim/ground_truth`, `/sim/reset_objects`) is gated by
`GOLEM_SIM_EXPERIMENT` (`measurement_bridge.py`). The closed-loop tests
(`tests/g1`, `tests/sim`) run the sim with both off (`GOLEM_SIM_ODOM=0`,
Expand Down Expand Up @@ -909,7 +913,7 @@ docker/scripts/docker_stack.sh logs robocasa

# Or three terminals, to choose the bringup's arguments (the wrappers do not
# check the sim's robot here; golem_safety's own check is in §8)
# Terminal 1 — the sim; wait for "[g1_mujoco] ROS bridges up"
# Terminal 1 — the sim; wait for "[golem_sim] ROS bridges up"
docker/scripts/docker_run.sh robocasa --g1 --layout 9 --style 9 --seed 42
# Terminal 2 — builds core_ws (both robots' packages), drops to a shell; no
# --g1 needed: the ros container runs either robot's bringup
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ services:
- QT_X11_NO_MITSHM=1
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-1}
# H1-2: m of clearance between the robot and any non-floor geom at
# spawn. Empty: the task's spawn_margin, else 0.20 (h12_mujoco.py).
# spawn. Empty: the task's spawn_margin, else 0.20 (golem_sim.py).
- GOLEM_SPAWN_MARGIN=${GOLEM_SPAWN_MARGIN:-}
# Both robots: m the robot is backed off the spawn counter into open
# floor, for walking and navigation. Empty: 0, at the counter.
- GOLEM_SPAWN_BACKOFF=${GOLEM_SPAWN_BACKOFF:-}
# H1-2: 0 keeps the robot's own links in its lidar scan as occluders.
# Empty: they are filtered out (h12_mujoco.py).
# Empty: they are filtered out (golem_sim.py).
- GOLEM_LIDAR_SELF_FILTER=${GOLEM_LIDAR_SELF_FILTER:-}
# Both robots: the target real-time factor, sim seconds per wall second
# (golem_robocasa/sim_common.py). Empty: 1, real time; 2 twice real time;
Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/docker_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ prepare_mounts() {
"$GOLEM_CACHE_DIR/isaac/local_share_ov" "$GOLEM_CACHE_DIR/isaac/isaacsim"
;;
robocasa)
require_file "$GOLEM_ROOT/golem_robocasa/h12_mujoco.py"
require_file "$GOLEM_ROOT/golem_robocasa/golem_sim.py"
require_file "$GOLEM_ROOT/core_ws/src/magpie_msgs/package.xml"
require_file "$GOLEM_ROOT/core_ws/src/custom_ros_messages/package.xml"
# Mount points of the two read-only package mounts inside msgs_ws.
Expand Down
6 changes: 3 additions & 3 deletions docker/scripts/launch_robocasa.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
# The robocasa container's command: build msgs_ws, then run the RoboCasa
# simulator (golem_robocasa/h12_mujoco.py) of the selected robot.
# simulator (golem_robocasa/golem_sim.py) of the selected robot.
#
# Usage: launch_robocasa.sh [h12_mujoco.py arguments...]
# Usage: launch_robocasa.sh [golem_sim.py arguments...]
# e.g. --headless or --layout 9 --style 9 --seed 42. Without a DISPLAY,
# --headless is added (no passive viewer).
# Environment: ROS_DOMAIN_ID (1..232, 1 when unset), DISPLAY,
Expand Down Expand Up @@ -58,4 +58,4 @@ fi
cd /home/code/golem_robocasa
# -u: Compose reads stdout through a pipe, which would block-buffer print() and
# hold back the "ROS bridges up" readiness line on a quiet headless run.
exec python -u h12_mujoco.py "$@"
exec python -u golem_sim.py "$@"
5 changes: 4 additions & 1 deletion docs/RUNNING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ Uses the same wrappers. The launcher honors
rejected. Select a task with `docker_run.sh isaac --task base --headless`.
Magpie H1-2 is the default asset, with a floating base. Start the ROS lower-body
controller to support it. Select the Inspire fixture with `--hand_type inspire`.
Use `--fix_base` only for a fixed-root bench test. Logs go to container stdout.
Use `--fix_base` only for a fixed-root bench test. `--elastic_band` (not with `--fix_base`)
hangs the floating robot from an elastic band on its torso, as the RoboCasa sims do, until
`ros2 service call /elastic_band/toggle std_srvs/srv/Trigger` releases it; a second call
enables it again. Logs go to container stdout.
The Magpie ROS gripper process starts inside the Isaac container using an
isolated Humble runtime. Its message interfaces are built into the image.

Expand Down
4 changes: 2 additions & 2 deletions docs/g1/control-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ while `dex3_hands` uses the Unitree SDK. The user-facing interface is ROS 2 too:
puts the robot into debug mode before the bringup starts; nothing in this
stack does that step or checks it
([First real session](first-session.md#entering-debug-mode-not-yet-written)).
- **In the sim:** `golem_robocasa/g1/` (`g1_mujoco.py`, `unitree_interface.py`)
- **In the sim:** `golem_robocasa/g1/` (`g1_robot.py`, `unitree_interface.py`)
plays the robot in debug mode. Every motor is off (zero torque) until the
first `rt/lowcmd` with a valid CRC, `mode_machine` 5 and `mode_pr` 0; from
then on `rt/lowcmd` drives every body motor. Meanwhile an elastic band on the
torso holds the robot up, as the H1-2 sim's does: the leg node releases it
through `/elastic_band/toggle` once its policy runs and the arm controller has
finished its start-up moves, or `band.max_wait` after the policy started
(SPACE in the viewer toggles it by hand).
`g1/unitree_interface.py`'s and `g1_mujoco.py`'s docstrings are the
`g1/unitree_interface.py`'s and `g1_robot.py`'s docstrings are the
reference.

## Sim and real compared
Expand Down
4 changes: 2 additions & 2 deletions docs/g1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and frontier exploration use the shared `golem_slam` and `golem_skills`; its
models (Unitree's URDFs, MJCFs and meshes, and a sphere-packed self-collision
model) are in `CL_Assets/g1`, installed for ROS by `golem_ros2_models` with the
H1-2's, and its RoboCasa kitchen sim is `golem_robocasa/g1/`, started through the same entry point
as the H1-2's (`h12_mujoco.py --g1`). The same bringup runs against the sim or
as the H1-2's (`golem_sim.py --g1`). The same bringup runs against the sim or
the real robot, which speaks the same Unitree DDS interface.

On the real G1 every node runs in Docker on a laptop wired to the robot.
Expand Down Expand Up @@ -78,7 +78,7 @@ To send your own arm and hand goals, start the stack in three terminals:
```bash
# terminal 1: the sim with its viewer (add --headless for none)
docker/scripts/docker_run.sh robocasa --g1 --layout 9 --style 9 --seed 42
# wait for "[g1_mujoco] ROS bridges up"
# wait for "[golem_sim] ROS bridges up"

# terminal 2: builds core_ws (both robots' packages) if needed, then opens a shell
docker/scripts/docker_run.sh ros
Expand Down
2 changes: 1 addition & 1 deletion docs/g1/walking.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ standing, then it walks 5 s at 0.3 m/s. A passing run ends with
```bash
# terminal 1: the sim, the spawn backed 2 m into open floor
GOLEM_SPAWN_BACKOFF=2.0 docker/scripts/docker_run.sh robocasa --g1 --layout 9 --style 9 --seed 42
# wait for "[g1_mujoco] ROS bridges up"
# wait for "[golem_sim] ROS bridges up"

# terminal 2: wait for the leg node's "elastic band released" line
docker/scripts/docker_run.sh ros
Expand Down
2 changes: 1 addition & 1 deletion golem_robocasa/battery_env.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Register the Battery task: the robot at the ARPA battery workcell.

Both sim runners run it (``h12_mujoco.py --task Battery``, ``--g1`` for the
Both sim runners run it (``golem_sim.py --task Battery``, ``--g1`` for the
G1). It is a robosuite env, not a RoboCasa kitchen, around the robot the
kitchen tasks use (``H1_2`` or ``G1Dex3``), so every robot0_/gripper0_ name the
bridges resolve is the kitchen tasks'. The arena is ``CL_Assets/mujoco_assets/battery/
Expand Down
2 changes: 1 addition & 1 deletion golem_robocasa/blank_env.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Register the Blank task: the robot alone on a floor, under a light.

Both sim runners run it (``h12_mujoco.py --task Blank``, with or without
Both sim runners run it (``golem_sim.py --task Blank``, with or without
``--g1``). It is a robosuite env, not a RoboCasa kitchen, around the robot the
runner registers (``H1_2`` or ``G1Dex3``), so every robot0_/gripper0_ name the
bridges resolve is the kitchen tasks'. The arena is robosuite's ``EmptyArena``
Expand Down
2 changes: 1 addition & 1 deletion golem_robocasa/estop_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class EstopServer:
def __init__(self, port: int, tag: str):
"""Bind the port; raise OSError when another process holds it.

tag prefixes the log lines (e.g. "h12_mujoco").
tag prefixes the log lines (e.g. "golem_sim").
"""
self._tag = tag
self._lock = threading.Lock()
Expand Down
2 changes: 1 addition & 1 deletion golem_robocasa/g1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Run the Unitree G1 (29 DoF, Dex3-1 hands) in the RoboCasa sim.

h12_mujoco.py hands --g1 and GOLEM_ROBOT=g1 to g1_mujoco.main. Import this
golem_sim.py runs g1_robot.G1Robot for --g1 and GOLEM_ROBOT=g1. Import this
package as ``g1`` with golem_robocasa on sys.path, never with this directory on
sys.path: its unitree_interface and sim_names share their names with the H1-2
sim's modules. The modules here import each other relatively and the shared
Expand Down
Loading
Loading