11from typing import Any
2+
23import gymnasium as gym
3- import rcs
44import numpy as np
5-
6- from rcs ._core .sim import SimConfig
5+ from gymnasium . envs . registration import EnvCreator
6+ from rcs ._core .sim import CameraType , SimCameraConfig , SimConfig
77from rcs .envs .base import ControlMode , RelativeActionSpace
8+ from rcs .envs .creators import SimTaskEnvCreator
89from rcs .envs .space_utils import ActObsInfoWrapper
910from rcs .sim import SimGripperConfig
1011from rcs_tacto .tacto_wrapper import TactoSimWrapper
11- from gymnasium .envs .registration import EnvCreator
1212
13-
14- from rcs ._core .sim import CameraType , SimCameraConfig
15- from rcs .envs .creators import SimTaskEnvCreator
13+ import rcs
1614
1715SCENE_FILE = "beast_refiner/rcs_env/rcs_icra_scene_digit/scene.xml"
1816CAMERAS = [
2321 "side_wide" ,
2422]
2523
24+
2625class AlignSpaceWrapper (ActObsInfoWrapper ):
2726
2827 def __init__ (self , env ):
2928 super ().__init__ (env )
30- self .observation_space = gym .spaces .Dict ({
31- "state" : gym .spaces .Box (low = - np .inf , high = np .inf , shape = (15 ,), dtype = np .float32 ),
32- "images.image" : env .observation_space ["frames" ]["side" ]["rgb" ]["data" ],
33- "images.image2" : env .observation_space ["frames" ]["wrist" ]["rgb" ]["data" ],
34- "images.tactile_left" : gym .spaces .Box (low = 0 , high = 255 , shape = (320 , 240 , 3 ), dtype = np .uint8 ),
35- "images.tactile_right" : gym .spaces .Box (low = 0 , high = 255 , shape = (320 , 240 , 3 ), dtype = np .uint8 ),
36- })
29+ self .observation_space = gym .spaces .Dict (
30+ {
31+ "state" : gym .spaces .Box (low = - np .inf , high = np .inf , shape = (15 ,), dtype = np .float32 ),
32+ "images.image" : env .observation_space ["frames" ]["side" ]["rgb" ]["data" ],
33+ "images.image2" : env .observation_space ["frames" ]["wrist" ]["rgb" ]["data" ],
34+ "images.tactile_left" : gym .spaces .Box (low = 0 , high = 255 , shape = (320 , 240 , 3 ), dtype = np .uint8 ),
35+ "images.tactile_right" : gym .spaces .Box (low = 0 , high = 255 , shape = (320 , 240 , 3 ), dtype = np .uint8 ),
36+ }
37+ )
3738 # self.action_space = env.action_space["joints"]
3839 gym .spaces .Box (low = - np .inf , high = np .inf , shape = (8 ,), dtype = np .float32 )
3940
@@ -48,7 +49,6 @@ def observation(self, observation: dict[str, Any], info: dict[str, Any]) -> tupl
4849 # tactile and tau_ext are still unsolved
4950
5051 return observation , info
51-
5252
5353 def action (self , action : np .ndarray ) -> dict [str , Any ]:
5454 action = {"joints" : action [:7 ], "gripper" : action [7 ]}
@@ -151,4 +151,4 @@ def make_env(n_envs: int = 1, use_async_envs: bool = False):
151151
152152class Pick (EnvCreator ):
153153 def __call__ (self ) -> gym .Env :
154- return make_single_env ()
154+ return make_single_env ()
0 commit comments