Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CAP General

CAP General is a framework-agnostic Code-as-Policy runtime for building, serving, and testing robot controls. A CAP scene can host one or more controls, route generated Python tasks to them, expose the scene through MCP, record execution history, and run configurable policy pipelines such as training jobs.

The repository currently integrates Genesis, LIBERO, and Robosuite. Genesis is one supported backend rather than the scope of the whole project.

For a runnable Genesis grasp walkthrough, see docs/quick_start.md.

Features

  • Scene-level routing for single-control and multi-control execution
  • Configurable controls, robots, policies, operators, and computation graphs
  • Ordered pipelines for training and other policy transformation jobs
  • Asynchronous task dispatch with status monitoring
  • MCP server tools for execution, retry, observation, reset, recording, and pipelines
  • Scene-level request/response history and robot execution artifacts
  • Recursive YAML overrides from the command line
  • Framework integrations for Genesis, LIBERO, and Robosuite

Architecture

cap_general/
├── core/
│   ├── control/     # Control execution and policy ownership
│   ├── operator/    # Graph operators and model adapters
│   ├── pipeline/    # Ordered jobs such as training
│   ├── policy/      # Policy runtime and graph representation
│   ├── robot/       # Framework-independent robot contract
│   ├── scene/       # Multi-control routing, monitoring, MCP, and history
│   └── utils/
├── frameworks/
│   ├── genesis/     # GO2, drone, grasp, and multi-control scenes
│   ├── libero/      # LIBERO VLA control and training pipeline
│   └── robosuite/   # Robosuite control integration
├── interface/       # capcmd CLI
└── skills/          # MCP-facing task, state, reset, and training skills

Runtime composition is configuration-driven:

Scene
└── Control(s)
    ├── Robot
    ├── Policy graph(s)
    │   └── Operator nodes
    └── Pipeline (optional)
        └── Job(s)

Installation

Install the core package and test dependencies:

pip install -e ".[test]"

Framework dependencies are intentionally environment-specific:

  • Genesis: install Genesis, PyTorch, and RSL-RL in a simulation environment.
  • LIBERO: install the LIBERO repository and its Robosuite dependencies. The optional package dependencies can be installed with pip install -e ".[libero]".
  • Robosuite: install the version required by the target environment and model stack.

Paths to external repositories, checkpoints, and models are configured in configs/.

Configuration

Ready-to-run configurations are grouped by framework:

configs/
├── genesis/
│   ├── genesis_drone.yaml
│   ├── genesis_go2.yaml
│   ├── genesis_grasp.yaml
│   ├── genesis_humanoid.yaml
│   └── genesis_multi_grasp.yaml
├── libero/libero_base.yaml
└── robosuite/robosuite_base.yaml

Configuration values can be overridden recursively when starting a server:

capcmd server \
  --config configs/genesis/genesis_grasp.yaml \
  --show_viewer false \
  --controls[0].robot.num_envs 1

The humanoid configuration ports the HumanoidBench G1 locomotion tasks to Genesis. Set paths.humanoid_bench_home in the scene YAML to the HumanoidBench checkout before running it.

MCP Server

Start a CAP scene as an MCP server:

capcmd server --config configs/genesis/genesis_grasp.yaml --client codex

--client selects an agent from cap_general/skills/config.yaml and defaults to nanobot.

The scene exposes tools including:

  • control_doc
  • execute
  • retry
  • monitor
  • get_obs
  • reset
  • record
  • run_pipe when a pipeline is configured
  • update_history

Task calls support multiple controls. Requests are routed by configured name or alias, while responses use each control's scene-visible mark.

Testing

The test suite covers the general CAP runtime as well as framework-specific integration cases.

Core tests

These tests do not require a simulator:

pytest \
  tests/test_core.py \
  tests/test_graph.py \
  tests/test_interface.py \
  tests/test_robot.py \
  tests/test_scene.py

Coverage includes registration, graph execution, operators, policies, robots, pipelines, configuration overrides, multi-control scene routing, task monitoring, and history tracing.

Genesis tests

Run these from an environment containing Genesis and RSL-RL:

python tests/genesis/test_genesis_go2.py
python tests/genesis/test_genesis_drone.py
python tests/genesis/test_genesis_grasp.py
python tests/genesis/test_genesis_multi_grasp.py

Training smoke tests use --train_ep:

python tests/genesis/test_genesis_grasp.py --task-num 0 --train_ep 1

The multi-control case supports round-robin execution by default and concurrent batches with --parallel:

python tests/genesis/test_genesis_multi_grasp.py --task-num 3
python tests/genesis/test_genesis_multi_grasp.py --task-num 1 --parallel

LIBERO test

Run from the environment containing LIBERO and its matching Robosuite installation:

python tests/libero/test_libero_base.py

Robosuite test

Run from the environment containing the configured Robosuite stack:

python tests/robosuite/test_robosuite_base.py

Remote MCP mode

Framework tests also support --remote. Start the configured server first, then run the matching test:

capcmd server --config configs/genesis/genesis_go2.yaml
python tests/genesis/test_genesis_go2.py --remote

Outputs

Each scene writes runtime data beneath its configured record_dir. Depending on the control and trace level, outputs include:

  • history.json with scene tool requests and responses
  • per-control execution metadata and generated code
  • observations, images, and videos
  • pipeline exports and training checkpoints beneath export_dir

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages