File size: 905 Bytes
e027202 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | """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)
|