simplify client usage of real2simenv

This commit is contained in:
pi4
2024-12-30 18:31:50 -08:00
parent b69b9b6f6e
commit aa669f6cdc
2 changed files with 8 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ simulation_app = app_launcher.app
import cv2 import cv2
import h5py import h5py
import torch import torch
# torch.set_printoptions(precision=3, threshold=10, edgeitems=3)
import gymnasium import gymnasium
import numpy as np import numpy as np
@@ -115,7 +116,13 @@ class URSimEnvironment(_environment.Environment):
action = action.copy() action = action.copy()
action[-1] = action[-1] * 2 - 1 action[-1] = action[-1] * 2 - 1
#####
# action = np.zeros(7)
# action[-1] = -1
####
action = torch.tensor(action, dtype=torch.float32)[None] action = torch.tensor(action, dtype=torch.float32)[None]
# print(action)
gym_obs, reward, terminated, truncated, info = self._gym.step(action) gym_obs, reward, terminated, truncated, info = self._gym.step(action)

View File

@@ -19,7 +19,7 @@ class Args:
task: str = "PIBussing" task: str = "PIBussing"
seed: int = 0 seed: int = 0
action_horizon: int = 10 action_horizon: int = 16
host: str = "0.0.0.0" host: str = "0.0.0.0"
port: int = 8000 port: int = 8000