pi05-pap-rtc / runtime /client_example.py
myx160's picture
Publish portable RTC/PAP inference runtime and step-003000 release
e027202 verified
Raw History Blame Contribute Delete
905 Bytes
"""Send the synthetic example to a running policy server; no robot actuation."""
import argparse
from pathlib import Path
import numpy as np
from pap_runtime import load_request
from openpi_client.websocket_client_policy import WebsocketClientPolicy
parser = argparse.ArgumentParser()
parser.add_argument('--host', default='127.0.0.1')
parser.add_argument('--port', type=int, default=8000)
parser.add_argument('--request', type=Path, default=Path(__file__).resolve().parent / 'examples/synthetic_request.npz')
parser.add_argument('--output', type=Path, default=Path('client_output.npz'))
args = parser.parse_args()
client = WebsocketClientPolicy(args.host, args.port)
result = client.infer(load_request(args.request))
np.savez_compressed(args.output, actions=result['actions'], action_postfix=result['action_postfix'])
print('actions:',result['actions'].shape,'postfix:',result['action_postfix'].shape)