How yuanfengjeff/ipec works
1. What this repository is
ipec is an integration layer for running OpenPI-style robot policy inference on ARX dual-arm systems. The repo is organized around two execution patterns: a split-process GMP setup and single-process direct inference scripts. The main architectural concern is moving data between robot observation sources, policy inference backends, and action execution endpoints.
2. Two robot backends define the main hardware boundary
The code targets two different robot stacks:
- Acone / ROS2: observation and control are handled locally through utils.DualArmCollector and ROS2 message/control APIs.
- Lift2 / Noetic: control is built around Mobile Aloha / RosOperator style tooling from the lijinarui/ARX_Play/mobile_aloha workspace.
This is the biggest boundary in the repo: the same policy interface is adapted to two robot runtime environments with different middleware and state sources.
3. Robot service layer: the GMP HTTP services
gmp_service_acone.py, gmp_service_lift2.py, and gmp_service_xdeploy.py are the robot-facing servers. They expose HTTP endpoints for:
- reading observations,
- starting/resetting robot sessions,
- stepping actions,
- and legacy GenManip/GMP-compatible routes.
Architecturally, these services isolate low-level robot access behind a simple request/response API so the policy pipeline can run elsewhere, even on another machine.
4. Pipeline layer: observation → policy → action
gmp_pipeline_acone.py and gmp_pipeline_lift2.py are the main orchestration scripts. Their job is to:
- fetch observations from the robot service,
- transform them into the OpenPI input schema,
- send them to a policy server,
- receive an action horizon,
- and execute a chosen prefix of that horizon back through the GMP service.
This is the core runtime loop of the repo and the clearest place to draw the system’s end-to-end data flow.
5. Direct inference scripts collapse the pipeline into one process
The pi_infer_*.py files run the same logical loop without the split service boundary. They combine local observation collection, policy inference, and action execution in a single Python process. These are useful for simpler deployments, timing experiments, or robot setups where the policy server is local and the control path does not need to be distributed.
6. Policy backend: OpenPI WebSocket protocol
The policy side is accessed through the vendored openpi-client package and the pi_infer_* scripts. The policy server is treated as a WebSocket endpoint that returns action chunks, not as a robot-specific control service. This keeps policy inference independent from robot middleware and makes the robot-specific code mostly an adapter layer.
7. Mock policy server for integration testing
pi_infer_service_mockup.py provides a local WebSocket-compatible policy server for wiring tests. It produces a fixed-horizon action output from current observations, which makes it useful for validating transport, schema conversion, and robot-service connectivity before connecting a real model.
8. Zenoh/RIO is an alternate transport path
The zenoh_*.py scripts represent a parallel transport stack that talks to a Zenoh/RIO-based runtime instead of the OpenPI WebSocket client. These are not the primary path in the README, but they form a second integration boundary for deployments that use Zenoh messaging infrastructure rather than direct WebSocket inference.
9. Vendored openpi-client is the policy-runtime adapter
The openpi-client/ subtree is a lightweight local dependency that contains:
- WebSocket policy client logic,
- runtime/agent/environment abstractions,
- action chunk handling,
- image preprocessing,
- and msgpack-numpy serialization helpers.
Its role is to normalize OpenPI communication and hide transport details from the repo’s pipeline scripts. It is effectively the policy I/O adapter layer.
10. Data model and action conventions are shared across all paths
The repo standardizes observations into OpenPI-style fields such as:
- RGB images for head and wrist cameras,
- joint positions and gripper positions,
- and a prompt/task string.
Actions are expected as a 14-value dual-arm command: left arm joints + gripper, then right arm joints + gripper. Control mode selection is also explicit, with joint-position and end-effector styles mapped differently. This schema conversion is a key architectural responsibility of the pipeline code.
11. The main control flow is chunked and latency-sensitive
The policy typically returns a horizon of actions, but the pipeline may only execute a prefix of that chunk before querying again. That design is important because it decouples policy inference frequency from robot execution frequency and allows the pipeline to handle latency, safety limits, and partial commitment to predicted actions.
12. External dependencies define the deployment environment
The repo assumes a robotics workspace with ROS2 for Acone, ROS1/Noetic and Mobile Aloha dependencies for Lift2, plus networking/serialization libraries such as requests, websockets, opencv-python, zenoh, and msgpack-numpy. These dependencies matter architecturally because they determine which runtime can host which entrypoint and how the observation/action transport is implemented.
Main entry points: websocket_client_policy.py WebSocket client · zenoh_policy_client.py Zenoh client · gmp_service_acone.py Acone service · gmp_service_lift2.py Lift2 service
Components 23
Robot services
HTTP-facing robot adapters for different hardware and middleware stacks.
- Acone service · Robot-facing HTTP service for the Acone/ROS2 dual-arm stack.
gmp_service_acone.py - Lift2 service · Robot-facing HTTP service for the Lift2 / Mobile Aloha / ROS1 stack.
gmp_service_lift2.py - Xdeploy service · Compatibility service exposing GenManip/GMP-style robot endpoints.
gmp_service_xdeploy.py
Pipelines
Split-process orchestration that bridges robot state, policy inference, and action execution.
- Acone pipeline · Fetches observations from the Acone service, calls policy inference, and executes action prefixes.
gmp_pipeline_acone.py - Lift2 pipeline · Fetches observations from the Lift2 service, calls policy inference, and executes action prefixes.
gmp_pipeline_lift2.py
Direct inference
Single-process loops that combine observation, policy, and control.
- Sync infer · Direct policy inference and action execution in one process.
pi_infer_sync.py - Async infer · Asynchronous direct inference path for robot control and timing-sensitive execution.
pi_infer_async_630.py - RTC infer · Direct inference entrypoint using runtime/RTC-style coordination.
pi_infer_rtc_630.py - Acone direct · Direct inference path specialized for the Acone/ROS2 stack.
pi_infer_sync_acone.py - Lift2 direct · Direct inference path specialized for the Lift2/Noetic stack.
pi_infer_sync_lift2.py - Mock policy · Local mock policy server for integration and transport validation.
pi_infer_service_mockup.py
Policy runtime
Vendored OpenPI client and shared policy/runtime abstractions.
- WebSocket client · OpenPI WebSocket client that exchanges observations for action chunks.
openpi-client/src/openpi_client/websocket_client_policy.py - Runtime core · Core runtime, agent, and environment abstractions for policy execution.
openpi-client/src/openpi_client/runtime/runtime.py - Policy agent · Agent wrapper coordinating policy calls inside the runtime.
openpi-client/src/openpi_client/runtime/agents/policy_agent.py - Action chunks · Handles horizon chunks and prefix selection for execution.
openpi-client/src/openpi_client/action_chunk_broker.py - Msgpack codec · Msgpack-numpy helpers used to serialize observations and actions.
openpi-client/src/openpi_client/msgpack_numpy.py - Image tools · Image preprocessing utilities used before policy submission.
openpi-client/src/openpi_client/image_tools.py
Zenoh path
Alternate transport and inference path using Zenoh/RIO-style messaging.
- Zenoh Acone · Acone pipeline variant using Zenoh-based transport.
zenoh_pipeline_acone.py - Zenoh async · Asynchronous Acone Zenoh pipeline variant.
zenoh_pipeline_acone_async.py - Zenoh Lift2 · Lift2 Zenoh pipeline variant using asynchronous transport.
zenoh_pipeline_lift2_async.py - Zenoh RTC · Zenoh/RIO inference entrypoint for RTC-style runtime coordination.
zenoh_pi_infer_rtc.py - Zenoh client · Policy-side client for Zenoh/RIO communication.
zenoh_policy_client.py - Zenoh dist · Distributed Zenoh policy runtime and transport coordination.
zenoh_policy_dist.py
Connections 23
- Acone pipeline → Acone service: obs/actions · Reads robot observations and sends action steps through the Acone service.
- Lift2 pipeline → Lift2 service: obs/actions · Reads robot observations and sends action steps through the Lift2 service.
- Acone service → WebSocket client: policy call · Forwards normalized observations to the OpenPI policy client path.
- Lift2 service → WebSocket client: policy call · Forwards normalized observations to the OpenPI policy client path.
- Sync infer → WebSocket client: policy call · Single-process direct inference uses the OpenPI WebSocket client.
- Async infer → WebSocket client: policy call · Asynchronous direct inference uses the OpenPI WebSocket client.
- RTC infer → Runtime core: runtime · RTC-style entrypoint builds on the OpenPI runtime abstractions.
- Acone direct → Acone service: control · Specialized direct loop for the Acone robot stack.
- Lift2 direct → Lift2 service: control · Specialized direct loop for the Lift2 robot stack.
- Mock policy → WebSocket client: mock policy · Implements a WebSocket-compatible mock policy endpoint for integration tests.
- WebSocket client → Action chunks: chunks · Receives action horizons and exposes chunk selection for execution.
- Runtime core → Policy agent: agent · Runtime delegates policy execution to an agent wrapper.
- Policy agent → WebSocket client: infer · Agent invokes the WebSocket policy backend.
- WebSocket client → Msgpack codec: serialize · Uses msgpack-numpy encoding for transport payloads.
- WebSocket client → Image tools: preprocess · Applies image preprocessing before policy submission.
- Acone pipeline → WebSocket client: policy backend · Split-process Acone pipeline depends on the OpenPI policy client.
- Lift2 pipeline → WebSocket client: policy backend · Split-process Lift2 pipeline depends on the OpenPI policy client.
- Zenoh Acone → Zenoh client: transport · Acone Zenoh pipeline uses the Zenoh policy client.
- Zenoh async → Zenoh client: transport · Async Acone Zenoh pipeline uses the Zenoh policy client.
- Zenoh Lift2 → Zenoh client: transport · Async Lift2 Zenoh pipeline uses the Zenoh policy client.
- Zenoh RTC → Zenoh dist: runtime · RTC-style Zenoh inference uses the distributed Zenoh runtime.
- Zenoh dist → Zenoh client: client · Distributed Zenoh runtime relies on the transport client.
- Xdeploy service → WebSocket client: compat · Legacy GMP-compatible service can forward policy requests through the OpenPI client path.