-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrpc_run_client.py
More file actions
27 lines (23 loc) · 937 Bytes
/
rpc_run_client.py
File metadata and controls
27 lines (23 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import time
from python.rcs.rpc.client import RcsClient
if __name__ == "__main__":
# Create the client (adjust host/port if needed)
client = RcsClient(host="localhost", port=50051)
try:
print("Resetting environment...")
obs = client.reset()
print(f"Initial observation: {obs}")
for i in range(5):
print(f"\nStep {i+1}")
# Replace with a valid action for your environment
action = 0
obs, reward, terminated, truncated, info = client.step(action)
print(f"Obs: {obs}, Reward: {reward}, Terminated: {terminated}, Truncated: {truncated}, Info: {info}")
if terminated or truncated:
print("Episode finished, resetting...")
obs = client.reset()
print(f"Reset observation: {obs}")
time.sleep(0.5)
finally:
print("Closing client.")
client.close()