### Setup the Environment Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/README.md Commands to create and activate a virtual environment with all dependencies for Holosoma inference. ```bash cd ~/holosoma bash scripts/setup_inference.sh # Create a virtual environment with all dependencies source scripts/source_inference_setup.sh # Activate the virtual environment ``` -------------------------------- ### Install and run with packaged entry point Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Installs the package in editable mode and runs run_policy with the inference preset. The preset is discovered automatically without any registration code. ```bash pip install -e . python -m holosoma_inference.run_policy inference:go2-12dof-loco # discovered automatically, no registration code ``` -------------------------------- ### Set up environment on Jetson Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/real-robot-wbt.md Navigate to the holosoma directory and run the setup scripts to prepare the inference environment. ```bash cd ~/holosoma bash scripts/setup_inference.sh source scripts/source_inference_setup.sh ``` -------------------------------- ### Setup scripts for IsaacGym, IsaacSim, MJWarp, inference, and retargeting Source: https://github.com/amazon-far/holosoma/blob/main/README.md Choose the appropriate setup script based on your use case. IsaacSim requires Ubuntu 22.04 or later. MJWarp training and MuJoCo simulation can be set up via conda or uv. ```bash bash scripts/setup_isaacgym.sh ``` ```bash bash scripts/setup_isaacsim.sh ``` ```bash bash scripts/setup_mujoco.sh ``` ```bash bash scripts/setup_mujoco_via_uv.sh ``` ```bash bash scripts/setup_inference.sh ``` ```bash bash scripts/setup_retargeting.sh ``` -------------------------------- ### Start the Docker container Source: https://github.com/amazon-far/holosoma/blob/main/docs/g1-docker-cheatsheet.md Starts the container named holosoma-inference-container. Idempotent. ```bash docker start "$CONTAINER_NAME" ``` -------------------------------- ### Install pre-commit hooks Source: https://github.com/amazon-far/holosoma/blob/main/CONTRIBUTING.md Run this command from the repository root to install pre-commit hooks, which ensure code formatting and tests pass. ```bash pre-commit install ``` -------------------------------- ### Install dependencies and run data processing script Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/holosoma_retargeting/ADD_MOTION_FORMAT_README.md Commands to install dependencies and run the provided data processing script for converting AMASS SMPLX data. Requires cloning the human_body_prior repository and installing Python packages. The script takes paths to AMASS data, output folder, and model files. ```bash # Install dependencies git clone https://github.com/nghorbani/human_body_prior.git pip install tqdm dotmap PyYAML omegaconf loguru cd human_body_prior/ python setup.py develop # Run data processing python prep_amass_smplx_for_rt.py \ --amass-root-folder /path/to/amass \ --output-folder /path/to/output \ --model-root-folder /path/to/models ``` -------------------------------- ### Start MuJoCo Environment Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/sim-to-sim-wbt.md Launch the MuJoCo environment for the Unitree G1 29-DOF robot. The robot spawns hanging from a gantry. ```bash source scripts/source_mujoco_setup.sh python src/holosoma/holosoma/run_sim.py robot:g1-29dof ``` -------------------------------- ### Launch WBT Policy with run_policy.py Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/real-robot-wbt.md Source the inference setup script and run the WBT policy with the specified model, joystick, rate, and interface. Replace eth0 with your network interface name. ```bash source scripts/source_inference_setup.sh python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-wbt \ --task.model-path src/holosoma_inference/holosoma_inference/models/wbt/fastsac_g1_29dof_dancing.onnx \ --task.use-joystick \ --task.rl-rate 50 \ --task.interface eth0 ``` -------------------------------- ### Run Thor inference with Makefile shortcuts Source: https://github.com/amazon-far/holosoma/blob/main/docker/thor/README.md Use Makefile shortcuts from the docker/thor directory to run the same inference commands as the compose examples. ```bash cd docker/thor make run-inference ARGS='inference:g1-29dof-loco --task.interface eth0' make run-inference-ros ARGS='inference:g1-29dof-loco --task.velocity-input ros2 --task.state-input interface --task.interface eth0' ``` -------------------------------- ### Onboard Deployment: SSH, Setup, and Run Policy Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/real-robot-locomotion.md Steps to run the policy on the robotic arm mounted on the robot. SSH to the Jetson, set maximum performance with jetson_clocks, set up the environment, and run the policy with the eth0 interface. ```bash ssh unitree@192.168.123.164 # Default password: '123' ``` ```bash sudo jetson_clocks ``` ```bash cd ~/holosoma bash scripts/setup_inference.sh source scripts/source_inference_setup.sh ``` ```bash python3 src/holosoma_inference/holosoma_inference/run_policy.py inference: \ --task.model-path \ --task.use-joystick \ --task.interface eth0 ``` -------------------------------- ### Train G1 with PPO for whole-body tracking on IsaacSim Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train the G1 robot with PPO for whole-body tracking on IsaacSim. Requires sourcing the IsaacSim setup script. ```bash source scripts/source_isaacsim_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof-wbt \ logger:wandb ``` -------------------------------- ### Run policy with Wandb model path (G1 locomotion) Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/README.md Example command to run the policy with a Wandb model path, using the G1 locomotion config and joystick interface. ```bash source scripts/source_inference_setup.sh python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \ --task.model-path wandb://my-username/my-project/run-abc123/fastsac_g1_29dof.onnx \ --task.use-joystick \ --task.interface eth0 ``` -------------------------------- ### Run policy with Wandb HTTPS URL Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/README.md Example command to run the policy using a Wandb HTTPS URL for the model path. ```bash python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \ --task.model-path https://wandb.ai/username/project/runs/abc123/files/model.onnx \ --task.use-joystick \ --task.interface eth0 ``` -------------------------------- ### Whole-Body Tracking (WBT) with joystick Source: https://github.com/amazon-far/holosoma/blob/main/docs/g1-docker-cheatsheet.md Runs the G1 29-DOF whole-body tracking policy with joystick control. Press Select+A to start a motion clip. ```bash docker exec -it "$CONTAINER_NAME" bash -c \ "source /opt/ros/humble/setup.bash && cd /workspace/holosoma && \ python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-wbt \ --task.model-path src/holosoma_inference/holosoma_inference/models/wbt/fastsac_g1_29dof_dancing.onnx \ --task.use-joystick --task.rl-rate 50 --task.interface eth0" ``` -------------------------------- ### Run launch scripts for input modes Source: https://github.com/amazon-far/holosoma/blob/main/docker/thor/README.md Thin wrappers around 'docker compose run' for common input-mode combinations. Quick start: run_joystick.sh for blind-loco via joystick (no ROS), run_ros2_joystick.sh for /cmd_vel from ROS plus joystick state, and run_shuttle_publisher.sh in another terminal to drive /cmd_vel. ```bash cd docker/thor/scripts ./run_joystick.sh # blind-loco via joystick (no ROS) ./run_ros2_joystick.sh # /cmd_vel from ROS + joystick state ./run_shuttle_publisher.sh # (other terminal) drives /cmd_vel ``` -------------------------------- ### Train G1 with FastSAC for whole-body tracking on IsaacSim Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train the G1 robot with FastSAC for whole-body tracking on IsaacSim. Requires sourcing the IsaacSim setup script. ```bash source scripts/source_isaacsim_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof-wbt-fast-sac \ logger:wandb ``` -------------------------------- ### Train T1 with PPO on IsaacSim for locomotion Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train the T1 robot with PPO on IsaacSim for velocity tracking. Requires sourcing the IsaacSim setup script first. Uses seed 1. ```bash source scripts/source_isaacsim_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:t1-29dof \ simulator:isaacsim \ logger:wandb \ --training.seed 1 ``` -------------------------------- ### Run joystick script with custom model path Source: https://github.com/amazon-far/holosoma/blob/main/docker/thor/scripts/README.md Passes extra arguments to run_policy.py. This example overrides the model path with a custom ONNX file. ```bash ./run_joystick.sh --task.model-path /models/my_custom.onnx ``` -------------------------------- ### Train G1 with PPO on MJWarp for locomotion Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train the G1 robot with PPO using the MJWarp simulator (beta). Requires sourcing the MuJoCo setup script. ```bash source scripts/source_mujoco_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof \ simulator:mjwarp \ logger:wandb ``` -------------------------------- ### Drive the robot with velocity and state commands Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_inference_service/README.md Use the bundled demo publisher to send velocity commands (e.g., shuttle pattern). Publish start and kill commands to /holosoma/state_input for state transitions and emergency kill. ```bash # velocity (e.g. the bundled demo publisher, from the repo root) python demo_scripts/ros2_velocity_publisher.py --pattern shuttle # state transitions / emergency kill ros2 topic pub --once /holosoma/state_input std_msgs/String "{data: start}" ros2 topic pub --once /holosoma/state_input std_msgs/String "{data: kill}" ``` -------------------------------- ### Start MuJoCo Environment for Unitree G1 Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/sim-to-sim-locomotion.md Launch the MuJoCo environment for the Unitree G1 robot. The first command uses keyboard control; the second enables joystick control via the bridge. The robot spawns hanging from a gantry. ```bash source scripts/source_mujoco_setup.sh python src/holosoma/holosoma/run_sim.py robot:g1-29dof ``` ```bash source scripts/source_mujoco_setup.sh python src/holosoma/holosoma/run_sim.py robot:g1-29dof \ --simulator.config.bridge.enabled=True \ --simulator.config.bridge.use-joystick=True ``` -------------------------------- ### Start MuJoCo Environment for Booster T1 Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/sim-to-sim-locomotion.md Launch the MuJoCo environment for the Booster T1 robot. The first command uses keyboard control; the second enables joystick control via the bridge. The robot spawns hanging from a gantry. ```bash source scripts/source_mujoco_setup.sh python src/holosoma/holosoma/run_sim.py robot:t1-29dof-waist-wrist ``` ```bash source scripts/source_mujoco_setup.sh python src/holosoma/holosoma/run_sim.py robot:t1-29dof-waist-wrist \ --simulator.config.bridge.enabled=True \ --simulator.config.bridge.use-joystick=True ``` -------------------------------- ### Train G1 with FastSAC on IsaacGym for locomotion Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train the G1 robot with FastSAC on IsaacGym for velocity tracking. Requires sourcing the IsaacGym setup script first. Uses seed 1. ```bash source scripts/source_isaacgym_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof-fast-sac \ simulator:isaacgym \ logger:wandb \ --training.seed 1 ``` -------------------------------- ### Train G1 with FastSAC on MJWarp for locomotion Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train the G1 robot with FastSAC using the MJWarp simulator (beta). Requires sourcing the MuJoCo setup script. ```bash source scripts/source_mujoco_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof-fast-sac \ simulator:mjwarp \ logger:wandb ``` -------------------------------- ### Train T1 with FastSAC on MJWarp for locomotion Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train the T1 robot with FastSAC using the MJWarp simulator (beta). Requires sourcing the MuJoCo setup script. ```bash source scripts/source_mujoco_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:t1-29dof-fast-sac \ simulator:mjwarp \ logger:wandb ``` -------------------------------- ### Convert data on Mac using mjpython Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/README.md Converts retargeted .npz files to RL training format on Mac, using mjpython instead of python. Two examples are shown: one for robot-only motion and one for object interaction with a dynamic object. ```bash mjpython data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/robot_only/omomo/sub3_largebox_003.npz --output_fps 50 --output_name converted_res/robot_only/sub3_largebox_003_mj_fps50.npz --data_format smplh --object_name "ground" --once mjpython data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/object_interaction/omomo/sub3_largebox_003_original.npz --output_fps 50 --output_name converted_res/object_interaction/sub3_largebox_003_mj_w_obj.npz --data_format smplh --object_name "largebox" --has_dynamic_object --once ``` -------------------------------- ### Convert AMASS SMPL-X data for retargeting Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/README.md Installs dependencies and runs prep_amass_smplx_for_rt.py to convert AMASS .npz files to .npz format with global joint positions and height information. Optionally specify --subdataset-folder to process only a specific subdataset. ```bash # Install dependencies cd holosoma_retargeting/data_utils/ git clone https://github.com/nghorbani/human_body_prior.git pip install tqdm dotmap PyYAML omegaconf loguru cd human_body_prior/ python setup.py develop cd ../ # Run data processing python prep_amass_smplx_for_rt.py \ --amass-root-folder /path/to/amass \ --output-folder /path/to/output \ --model-root-folder /path/to/models ``` -------------------------------- ### Run sim-to-sim whole-body tracking Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_cpp/README.md Runs the C++ runtime in simulation mode using the MuJoCo bridge. Requires starting the simulator first with 'python src/holosoma/holosoma/run_sim.py robot:g1-29dof'. Uses --task.use-sim-time to read the simulator clock. ```bash src/holosoma_inference/holosoma_cpp/build/holosoma_run_policy inference:g1-29dof-wbt \ --task.model-path src/holosoma_inference/holosoma_inference/models/wbt/fastsac_g1_29dof_dancing.onnx \ --task.no-action-scales-by-effort-limit-over-p-gain --task.policy-action-scale 1.0 \ --task.use-sim-time \ --task.interface lo ``` -------------------------------- ### Run demo scripts for retargeting and whole-body tracking policy training Source: https://github.com/amazon-far/holosoma/blob/main/README.md Run the complete pipeline including data downloading/processing, retargeting, data conversion, and whole-body tracking policy training. Two demos are provided: one using OMOMO data and one using LAFAN data. ```bash bash demo_scripts/demo_omomo_wb_tracking.sh ``` ```bash bash demo_scripts/demo_lafan_wb_tracking.sh ``` -------------------------------- ### Build Docker image and create container Source: https://github.com/amazon-far/holosoma/blob/main/docs/g1-docker-cheatsheet.md Builds the Docker image from the repo root and creates the container, bind-mounting the repo at /workspace/holosoma. Use --new to recreate from scratch. ```bash # Build (from the repo root) ECR_REGISTRY="account-id.dkr.ecr.region.amazonaws.com" \ bash src/holosoma_inference/docker/build.sh # Create container (bind-mounts repo at /workspace/holosoma) bash src/holosoma_inference/docker/run.sh # Or recreate from scratch bash src/holosoma_inference/docker/run.sh --new ``` -------------------------------- ### Create and enter Docker container Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/real-robot-wbt.md Run the Docker container using the provided run script. ```bash bash holosoma/src/holosoma_inference/docker/run.sh ``` -------------------------------- ### Register format in DEMO_JOINTS_REGISTRY Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/holosoma_retargeting/ADD_MOTION_FORMAT_README.md Add the new format to the unified registry dictionary. The example shows adding 'myformat' mapping to MYFORMAT_DEMO_JOINTS. ```python DEMO_JOINTS_REGISTRY: dict[str, list[str]] = { "lafan": LAFAN_DEMO_JOINTS, "smplh": SMPLH_DEMO_JOINTS, "mocap": MOCAP_DEMO_JOINTS, "smplx": SMPLX_DEMO_JOINTS, "myformat": MYFORMAT_DEMO_JOINTS, # ← Add your format here } ``` -------------------------------- ### Add robot defaults to _ROBOT_DEFAULTS Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/holosoma_retargeting/ADD_ROBOT_TYPE_README.md Adds a new robot type to the _ROBOT_DEFAULTS dictionary in config_types/robot.py. The example shows adding 'myrobot' with robot_dof=25, robot_height=1.4, and object_name='ground'. ```python _ROBOT_DEFAULTS: dict[str, RobotDefaults] = { "g1": {"robot_dof": 29, "robot_height": 1.32, "object_name": "ground"}, "t1": {"robot_dof": 23, "robot_height": 1.2, "object_name": "ground"}, "myrobot": {"robot_dof": 25, "robot_height": 1.4, "object_name": "ground"}, # ← Add your robot } ``` -------------------------------- ### Evaluate local checkpoint Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to evaluate a local checkpoint using eval_agent.py. Replace with the path to your checkpoint file. The example shows a path under /home/username/checkpoints/fastsac-t1-locomotion/. ```bash python src/holosoma/holosoma/eval_agent.py \ --checkpoint= # e.g., --checkpoint=/home/username/checkpoints/fastsac-t1-locomotion/model_0010000.pt ``` -------------------------------- ### Build the C++ runtime with CMake Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_cpp/README.md Builds the project in a build directory with Release configuration, then compiles and runs tests. Use -DONNXRUNTIME_ROOT for a local ONNX Runtime and -DHOLOSOMA_FETCH_DEPENDENCIES=OFF to forbid downloads. ```bash cd src/holosoma_inference/holosoma_cpp cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build -j ctest --test-dir build --output-on-failure ``` -------------------------------- ### Visualize motion file in IsaacSim before training Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to replay and visualize a motion file in IsaacSim before training. Uses headless=False and a single environment. ```bash source scripts/source_isaacsim_setup.sh python src/holosoma/holosoma/replay.py \ exp:g1-29dof-wbt \ --training.headless=False \ --training.num_envs=1 ``` -------------------------------- ### Declare entry points in pyproject.toml Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Configures packaging and declares one entry point per preset. The group name picks the registry, and the value is a module:attr reference. Dependencies must include the core package (holosoma_inference or holosoma). ```toml # pyproject.toml [project] dependencies = ["holosoma_inference"] # or "holosoma" for training-side presets [tool.setuptools.packages.find] include = ["holosoma_inference_ext_quadruped*"] # ship your config_values modules [project.entry-points."holosoma.config.robot"] go2-12dof = "holosoma_inference_ext_quadruped.config_values.robot:go2_12dof" [project.entry-points."holosoma.config.inference"] go2-12dof-loco = "holosoma_inference_ext_quadruped.config_values.inference:go2_12dof_loco" ``` -------------------------------- ### Docker Deployment: Build and Run Container Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/real-robot-locomotion.md Build and run the Docker container for the inference policy. The build command uses the ECR registry; the run command creates and enters the container. ```bash ECR_REGISTRY="account-id.dkr.ecr.region.amazonaws.com" \ bash holosoma/src/holosoma_inference/docker/build.sh ``` ```bash bash holosoma/src/holosoma_inference/docker/run.sh ``` -------------------------------- ### Add joint mappings for each robot type Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/holosoma_retargeting/ADD_MOTION_FORMAT_README.md Add human-to-robot joint mappings for each supported robot type in the JOINTS_MAPPINGS dictionary. The example shows mappings for 'g1' and 't1' robots. ```python JOINTS_MAPPINGS = { # ... existing mappings ... ("myformat", "g1"): { # ← Add for each robot type you support "HumanJoint1": "robot_joint_1", "HumanJoint2": "robot_joint_2", # ... map all relevant joints }, ("myformat", "t1"): { # ← If supporting t1 robot # ... mappings for t1 }, } ``` -------------------------------- ### Multi-GPU training with torchrun Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to launch multi-GPU training using `torchrun` with 4 processes. The `--training.num-envs` flag sets the global/total number of environments. ```bash source scripts/source_isaacgym_setup.sh torchrun --nproc_per_node=4 src/holosoma/holosoma/train_agent.py \ exp:t1-29dof-fast-sac \ simulator:isaacgym \ --training.num-envs 16384 # global/total number of environments ``` -------------------------------- ### Anti-patterns for default registration Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Shows three discouraged approaches: snapshot merge, in-place mutation, and manual entry point loop. These bypass type checks or error isolation and can miss presets registered later. Use an entry point or .add() / --import-file instead. ```python # ❌ Snapshot merge — misses presets registered later; visible only via this module. DEFAULTS = {**CORE_DEFAULTS, "x1_25dof": x1_25dof} # ❌ In-place mutation — import-side-effect global; bypasses the type check. CORE_DEFAULTS.update({"elf3_29dof": elf3_29dof}) # ❌ Hand-rolled ep loop — no error isolation; one bad plugin crashes the CLI. for ep in entry_points(group="holosoma.config.inference"): all_defaults[ep.name] = ep.load() ``` -------------------------------- ### Use --import-file to load a preset Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Runs run_sim with the --import-file flag to load the preset defined in my_presets.py. The flag is repeatable and the preset becomes selectable like a built-in. ```bash python -m holosoma.run_sim --import-file my_presets.py robot:g1-stiff # repeatable; selectable like a built-in ``` -------------------------------- ### Custom AssetServicePathLoader with matches() and load() Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Defines a custom loader for values that cannot be expressed as paths inside an installed package, such as asset service URIs. `matches()` inspects the string, `load()` performs network/filesystem work. ```python class AssetServicePathLoader: def matches(self, value: str) -> bool: return value.startswith("asset://") def load(self, value: str) -> str: return download_to_local_cache(value) path_loader = AssetServicePathLoader() ``` -------------------------------- ### Convert data for robot-only setting Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/README.md Converts retargeted .npz files for robot-only motion using the standard python interpreter. Two examples are shown: one for OMOMO data and one for LAFAN data. ```bash python data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/robot_only/omomo/sub3_largebox_003.npz --output_fps 50 --output_name converted_res/robot_only/sub3_largebox_003_mj_fps50.npz --data_format smplh --object_name "ground" --once python data_conversion/convert_data_format_mj.py --input_file ./demo_results/g1/robot_only/lafan/dance2_subject1.npz --output_fps 50 --output_name converted_res/robot_only/dance2_subject1_mj_fps50.npz --data_format lafan --object_name "ground" --once ``` -------------------------------- ### Evaluate checkpoint from Wandb Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to evaluate a checkpoint stored on Wandb using eval_agent.py. Replace , , , and with your specific values. The example shows a checkpoint path for a fastsac-t1-locomotion run. ```bash python src/holosoma/holosoma/eval_agent.py \ --checkpoint=wandb:///// # e.g., --checkpoint=wandb://username/fastsac-t1-locomotion/abcdefgh/model_0010000.pt ``` -------------------------------- ### Build Docker image Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/real-robot-wbt.md Build the Docker image for the inference environment using the provided build script. ```bash ECR_REGISTRY="account-id.dkr.ecr.region.amazonaws.com" \ bash holosoma/src/holosoma_inference/docker/build.sh ``` -------------------------------- ### Publish NPZ replay to CmdDense Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_inference_service/README.md Streams a reference-motion NPZ onto CmdDense as a live feed. Pair with input_type:=dense. ```bash python holosoma_service/scripts/publish_from_npz.py --loop ``` -------------------------------- ### Launch WBT policy with SMPL-H teleop Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_inference_service/README.md Launches the holosoma service with whole-body tracking using SMPL-H teleop (retargeter on by default). Requires an inference preset, a fixed-base G1 29-DOF URDF, and an ONNX model. ```bash ros2 launch holosoma_service teleop_with_holosoma_policy.launch.py \ preset:= \ urdf_path:= \ input_type:=smplh \ model_path:= ``` -------------------------------- ### Run on real robot with joystick Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_cpp/README.md Runs the C++ runtime on a real Unitree G1 robot using the wireless controller. Uses --task.use-joystick and --task.interface eth0 for the robot network interface. ```bash src/holosoma_inference/holosoma_cpp/build/holosoma_run_policy inference:g1-29dof-wbt \ --task.model-path src/holosoma_inference/holosoma_inference/models/wbt/fastsac_g1_29dof_dancing.onnx \ --task.no-action-scales-by-effort-limit-over-p-gain --task.policy-action-scale 1.0 \ --task.use-joystick \ --task.interface eth0 ``` -------------------------------- ### Launch the locomotion policy with holosoma_service Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_inference_service/README.md Launches the teleop_with_loco_policy.launch.py file. Set model_path to your ONNX model and interface to the network interface. The preset defaults to inference:g1-29dof-loco; override with preset:=. ```bash ros2 launch holosoma_service teleop_with_loco_policy.launch.py \ model_path:= interface:=eth0 # preset defaults to inference:g1-29dof-loco; override with preset:= ``` -------------------------------- ### Custom data loading logic in load_motion_data() Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/holosoma_retargeting/ADD_MOTION_FORMAT_README.md Optional code to add inside the load_motion_data() function in examples/robot_retarget.py. Place your custom format handling before the fallback else clause. The example shows a 'myformat' branch that loads a .npy file and computes smpl_scale using a default human height. ```python def load_motion_data(...): # ... existing code ... elif data_format == "smplx": npz_file = data_path / f"{task_name}.npz" human_data = np.load(str(npz_file)) human_joints = human_data["global_joint_positions"] human_height = human_data["height"] smpl_scale = constants.ROBOT_HEIGHT / human_height elif data_format == "myformat": # Add your custom loading logic here npy_path = data_path / f"{task_name}.npy" human_joints = np.load(str(npy_path)) # ... any preprocessing ... smpl_scale = constants.ROBOT_HEIGHT / default_human_height else: # Fallback: handles .npz files with global_joint_positions and height # ... (automatic handling for standard .npz format) ``` -------------------------------- ### Launch Policy Inference Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/sim-to-sim-wbt.md Run the WBT policy inference with the specified ONNX model and settings. Use --task.interface lo for loopback when inference and MuJoCo run on the same machine. ```bash source scripts/source_inference_setup.sh python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-wbt \ --task.model-path src/holosoma_inference/holosoma_inference/models/wbt/fastsac_g1_29dof_dancing.onnx \ --task.no-use-joystick \ --task.use-sim-time \ --task.rl-rate 50 \ --task.interface lo ``` -------------------------------- ### Run simulation with the custom plugin Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Command-line invocation to run the simulation with the custom plugin defined in my_plugins.py. The plugin is selected via the dynamic-dict syntax plugin.h:log_height, and the every field is overridden to 5Hz. ```bash python -m holosoma.run_sim --import-file my_plugins.py plugin.h:log_height --plugin.h.every=5Hz ``` -------------------------------- ### Create robot model directory Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/holosoma_retargeting/ADD_ROBOT_TYPE_README.md Creates a directory for the robot model files. Place URDF and XML files in this directory following the naming convention. ```bash mkdir -p models/myrobot ``` -------------------------------- ### Visualize object-interaction results Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/README.md Runs viser_player.py with the G1 robot and largebox object URDFs to visualize the saved object-interaction retargeting result from the omomo dataset. ```bash python viser_player.py --robot_urdf models/g1/g1_29dof.urdf \ --object_urdf models/largebox/largebox.urdf \ --qpos_npz demo_results_parallel/g1/object_interaction/omomo/sub3_largebox_003_original.npz ``` -------------------------------- ### Train with Weights & Biases logging Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train an agent with Weights & Biases logging. Pass the `exp:` preset before other config fragments like `logger:wandb` to avoid resolution errors. ```bash source scripts/source_isaacsim_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof \ simulator:isaacsim \ --training.seed 1 \ --algo.config.use-symmetry=False \ logger:wandb \ --logger.project locomotion-g1-29dof-ppo \ --logger.name ppo-without-symmetry-seed1 ``` -------------------------------- ### Run nightly training experiment with nightly.py Source: https://github.com/amazon-far/holosoma/blob/main/tests/nightly/README.md Executes a nightly training run for a specified experiment configuration, validating metrics and tagging the run as passed or failed. Requires an experiment configuration and optionally a logger and simulator. ```bash python tests/nightly/nightly.py exp:g1-29dof logger:wandb simulator:isaacgym ``` -------------------------------- ### Build and source the holosoma_inference_service package Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_inference_service/README.md Run these commands from the package directory to build and source the workspace. Re-run after editing a .msg file. Use the rm -rf command for a clean build. ```bash cd src/holosoma_inference/holosoma_inference_service rm -rf build install log # for a clean build colcon build && source install/setup.bash ``` -------------------------------- ### Create PackagePathLoader instances for singular and plural paths Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Creates two loaders for a Python package: one for a single path and one for multiple paths. The `multiple` flag controls the behavior. ```python # my_ext/paths.py from holosoma.utils.package_path_loader import PackagePathLoader path_loader = PackagePathLoader("my_ext", "@my_ext", multiple=False) paths_loader = PackagePathLoader("my_ext", "@my_ext", multiple=True) ``` -------------------------------- ### Visualize climbing results Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/README.md Runs viser_player.py with the G1 sphere-hand robot and climbing object URDFs to visualize saved climbing retargeting results, including a scaled variant. ```bash python viser_player.py --robot_urdf models/g1/g1_29dof_spherehand.urdf \ --object_urdf demo_data/climb/mocap_climb_seq_0/multi_boxes.urdf \ --qpos_npz demo_results_parallel/g1/climbing/mocap_climb/mocap_climb_seq_0_original.npz ``` ```bash python viser_player.py --robot_urdf models/g1/g1_29dof_spherehand.urdf \ --object_urdf demo_data/climb/mocap_climb_seq_0/multi_boxes_scaled_0.74_0.74_0.89.urdf \ --qpos_npz demo_results_parallel/g1/climbing/mocap_climb/mocap_climb_seq_0_z_scale_1.2.npz ``` -------------------------------- ### Run unitree split-body backend Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_inference_service/README.md Runs the unitree split-body controller. The robot must be standing in FSM-501. Use --no-arms for loco-only mode. ```bash # arm_sdk + LocoClient. Robot must be standing in FSM-501. ros2 run holosoma_service unitree_split_controller --iface eth0 ros2 run holosoma_service unitree_split_controller --iface eth0 --no-arms # loco only ``` -------------------------------- ### Generate and post nightly run summary with run_summary.py Source: https://github.com/amazon-far/holosoma/blob/main/tests/nightly/README.md Generates a summary of recent nightly runs. Use without arguments to print to console, or with --slack to post to Slack, automatically including a link to the most recent wandb report. ```bash # Print summary to console uv run --script ./tests/nightly/run_summary.py ``` ```bash # Post to Slack (includes report link if available) uv run --script ./tests/nightly/run_summary.py --slack ``` -------------------------------- ### Build and run ROS2 integration tests with Docker Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_inference_service/README.md Builds a Docker image for the ROS2 integration tests and runs it. The image is built from the Dockerfile.test in the service's docker directory. The tests run inside a minimal ROS2 Jazzy image. ```bash # from the repo root docker build -f src/holosoma_inference/holosoma_inference_service/docker/Dockerfile.test \ -t holosoma-service-test . docker run --rm holosoma-service-test ``` -------------------------------- ### Launch G1 29-DOF locomotion policy with joystick Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/real-robot-locomotion.md Launches the G1 29-DOF locomotion policy with a joystick. Replace eth0 with your network interface name (e.g., enp0s31f6). The task.model-path points to the ONNX model fastsac_g1_29dof.onnx. ```bash source scripts/source_inference_setup.sh python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \ --task.model-path src/holosoma_inference/holosoma_inference/models/loco/g1_29dof/fastsac_g1_29dof.onnx \ --task.use-joystick \ --task.interface eth0 ``` -------------------------------- ### Configure curriculum learning Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Commands to disable the penalty curriculum or set a custom level-up threshold for shorter episodes. ```bash # Disable curriculum source scripts/source_isaacgym_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof-fast-sac \ simulator:isaacgym \ --curriculum.setup-terms.penalty-curriculum.params.enabled=False # Custom curriculum threshold (for shorter episodes) source scripts/source_isaacgym_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof-fast-sac \ simulator:isaacgym \ --simulator.config.sim.max-episode-length-s=10.0 \ --curriculum.setup-terms.penalty-curriculum.params.level-up-threshold=350 ``` -------------------------------- ### Launch Policy Inference for Booster T1 Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/sim-to-sim-locomotion.md Run policy inference for the Booster T1 locomotion model. The first command uses keyboard control (--task.no-use-joystick); the second uses joystick control (--task.use-joystick). Both use the loopback interface (--task.interface lo) as required when inference and MuJoCo run on the same machine. ```bash source scripts/source_inference_setup.sh python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:t1-29dof-loco \ --task.model-path src/holosoma_inference/holosoma_inference/models/loco/t1_29dof/ppo_t1_29dof.onnx \ --task.no-use-joystick \ --task.interface lo ``` ```bash source scripts/source_inference_setup.sh python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:t1-29dof-loco \ --task.model-path src/holosoma_inference/holosoma_inference/models/loco/t1_29dof/ppo_t1_29dof.onnx \ --task.use-joystick \ --task.interface lo ``` -------------------------------- ### Launch Policy Inference for Unitree G1 Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/sim-to-sim-locomotion.md Run policy inference for the Unitree G1 locomotion model. The first command uses keyboard control (--task.no-use-joystick); the second uses joystick control (--task.use-joystick). Both use the loopback interface (--task.interface lo) as required when inference and MuJoCo run on the same machine. ```bash source scripts/source_inference_setup.sh python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \ --task.model-path src/holosoma_inference/holosoma_inference/models/loco/g1_29dof/fastsac_g1_29dof.onnx \ --task.no-use-joystick \ --task.interface lo ``` ```bash source scripts/source_inference_setup.sh python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \ --task.model-path src/holosoma_inference/holosoma_inference/models/loco/g1_29dof/fastsac_g1_29dof.onnx \ --task.use-joystick \ --task.interface lo ``` -------------------------------- ### Visualize robot only results Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/README.md Runs viser_player.py with the G1 robot URDF to visualize a saved robot-only retargeting result from the omomo dataset. ```bash python viser_player.py --robot_urdf models/g1/g1_29dof.urdf \ --qpos_npz demo_results_parallel/g1/robot_only/omomo/sub3_largebox_003_original.npz ``` -------------------------------- ### Visualize LAFAN robot only results Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_retargeting/README.md Runs viser_player.py with the G1 robot URDF to visualize a saved LAFAN robot-only retargeting result. ```bash python viser_player.py --robot_urdf models/g1/g1_29dof.urdf \ --qpos_npz demo_results/g1/robot_only/lafan/dance2_subject1.npz ``` -------------------------------- ### Run policy with eth0 interface Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/docs/workflows/real-robot-wbt.md Execute the policy on the Jetson using the eth0 network interface, with joystick control and a 50 Hz RL rate. ```bash python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-wbt \ --task.model-path \ --task.use-joystick \ --task.rl-rate 50 \ --task.interface eth0 ``` -------------------------------- ### Register a preset with ROBOT_REGISTRY.add() Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Shows how to register a new robot preset in the family's `config_values` module using the `.add()` method. ```python # holosoma/config_values/robot.py my_robot = ROBOT_REGISTRY.add("my_robot", RobotConfig(...)) ``` -------------------------------- ### Define a custom plugin class and config Source: https://github.com/amazon-far/holosoma/blob/main/docs/writing-extensions.md Shows a minimal plugin implementation that logs the robot's height at a fixed rate. The plugin class registers a hook on the FRAME_END phase, and the config class is registered in the plugin registry. Use this as a template for custom per-step behavior. ```python # my_plugins.py — log the robot's height, sampled at a fixed rate from dataclasses import dataclass from loguru import logger from holosoma.config_types.plugin import PluginConfig from holosoma.config_values.plugin import PLUGIN_REGISTRY from holosoma.simulator.base_simulator.hooks import Phase @dataclass(frozen=True) class LogHeightPluginConfig(PluginConfig): every: str = "2Hz" # int decimation or frequency string def get_cls(self): return LogHeightPlugin # import lazily here if the impl is heavy class LogHeightPlugin: def __init__(self, cfg: LogHeightPluginConfig, simulator): self.cfg, self.simulator = cfg, simulator # register one hook per phase you care about: simulator.hooks.add(Phase.FRAME_END, self.log, name="log_height", every=cfg.every) def log(self): # signature = the phase's payload (below) logger.info(f"height = {self.simulator.robot_root_states[0, 2]:.3f}") PLUGIN_REGISTRY.add("log_height", LogHeightPluginConfig()) ``` -------------------------------- ### Launch whole body policy with CmdDense input Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma_inference/holosoma_inference_service/README.md Launches the holosoma service with a whole body policy using dense input (retargeter off, no URDF needed). Requires an inference preset and an ONNX model. ```bash ros2 launch holosoma_service teleop_with_holosoma_policy.launch.py \ preset:= \ input_type:=dense \ model_path:= ``` -------------------------------- ### Locomotion: ROS2 cmd_vel + keyboard state Source: https://github.com/amazon-far/holosoma/blob/main/docs/g1-docker-cheatsheet.md Runs the G1 29-DOF locomotion policy with ROS2 cmd_vel velocity input and keyboard state input. ```bash docker exec -it "$CONTAINER_NAME" bash -c \ "source /opt/ros/humble/setup.bash && cd /workspace/holosoma && \ python3 src/holosoma_inference/holosoma_inference/run_policy.py inference:g1-29dof-loco \ --task.velocity-input ros2 --task.state-input keyboard --task.interface eth0" ``` -------------------------------- ### Build Docker images with Docker Compose Source: https://github.com/amazon-far/holosoma/blob/main/docker/thor/README.md Builds the same images using Docker Compose with the compose.yaml file. Use 'build inference' for the no-ROS target and 'build inference-ros' for the ROS-enabled target. ```bash docker compose -f docker/thor/compose.yaml build inference docker compose -f docker/thor/compose.yaml build inference-ros ``` -------------------------------- ### ROS2 velocity publisher (for testing) Source: https://github.com/amazon-far/holosoma/blob/main/docs/g1-docker-cheatsheet.md Runs the ROS2 velocity publisher in a second SSH session while a policy is running. Uses the shuttle pattern. ```bash docker exec -it "$CONTAINER_NAME" bash -c \ "source /opt/ros/humble/setup.bash && cd /workspace/holosoma && \ python3 demo_scripts/ros2_velocity_publisher.py --pattern shuttle" ``` -------------------------------- ### Train G1 with custom motion file for whole-body tracking Source: https://github.com/amazon-far/holosoma/blob/main/src/holosoma/README.md Command to train the G1 robot with a custom motion file for whole-body tracking on IsaacSim. Replace .npz with the actual motion file path. ```bash source scripts/source_isaacsim_setup.sh python src/holosoma/holosoma/train_agent.py \ exp:g1-29dof-wbt \ logger:wandb \ --command.setup_terms.motion_command.params.motion_config.motion_file="holosoma/data/motions/g1_29dof/whole_body_tracking/.npz" ```