Skip to content

Commit 8d95024

Browse files
committed
feat(env): add origin of relative actions space to info dict
1 parent b62bef3 commit 8d95024

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

python/rcs/envs/base.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class RelativeTo(Enum):
544544
NONE = auto()
545545

546546

547-
class RelativeActionSpace(gym.ActionWrapper):
547+
class RelativeActionSpace(ActObsInfoWrapper):
548548
DEFAULT_MAX_CART_MOV = 0.5
549549
DEFAULT_MAX_CART_ROT = np.deg2rad(90)
550550
DEFAULT_MAX_JOINT_MOV = np.deg2rad(5)
@@ -765,6 +765,15 @@ def action(self, action: dict[str, Any]) -> dict[str, Any]:
765765
raise RuntimeError(msg)
766766
return action
767767

768+
def observation(self, observation: dict, info: dict[str, Any]) -> tuple[dict[str, Any], dict[str, Any]]:
769+
if self._origin is not None:
770+
info["action_origin"] = (
771+
list(self._origin.translation()) + list(self._origin.rotation_q())
772+
if isinstance(self._origin, common.Pose)
773+
else self._origin
774+
)
775+
return observation, info
776+
768777

769778
class CameraSetWrapper(ActObsInfoWrapper):
770779
RGB_KEY = "rgb"

0 commit comments

Comments
 (0)