@@ -46,8 +46,8 @@ class LimitedTRPYRelDictType(RCSpaceType):
4646 ]
4747
4848
49- class TQuartDictType (RCSpaceType ):
50- tquart : Annotated [
49+ class TQuatDictType (RCSpaceType ):
50+ tquat : Annotated [
5151 Vec7Type ,
5252 gym .spaces .Box (
5353 low = np .array ([- 0.855 , - 0.855 , 0 ] + [- 1 ] + [- np .inf ] * 3 ),
@@ -57,8 +57,8 @@ class TQuartDictType(RCSpaceType):
5757 ]
5858
5959
60- class LimitedTQuartRelDictType (RCSpaceType ):
61- tquart : Annotated [
60+ class LimitedTQuatRelDictType (RCSpaceType ):
61+ tquat : Annotated [
6262 Vec7Type ,
6363 lambda max_cart_mov : gym .spaces .Box (
6464 low = np .array (3 * [- max_cart_mov ] + [- 1 ] + [- np .inf ] * 3 ),
@@ -118,11 +118,11 @@ class CameraDictType(RCSpaceType):
118118
119119
120120# joining works with inheritance but need to inherit from protocol again
121- class ArmObsType (TQuartDictType , JointsDictType , TRPYDictType ): ...
121+ class ArmObsType (TQuatDictType , JointsDictType , TRPYDictType ): ...
122122
123123
124- CartOrJointContType : TypeAlias = TQuartDictType | JointsDictType | TRPYDictType
125- LimitedCartOrJointContType : TypeAlias = LimitedTQuartRelDictType | LimitedJointsRelDictType | LimitedTRPYRelDictType
124+ CartOrJointContType : TypeAlias = TQuatDictType | JointsDictType | TRPYDictType
125+ LimitedCartOrJointContType : TypeAlias = LimitedTQuatRelDictType | LimitedJointsRelDictType | LimitedTRPYRelDictType
126126
127127
128128class ObsArmsGr (ArmObsType , GripperDictType ):
@@ -140,7 +140,7 @@ class ObsArmsGrCamCG(ArmObsType, GripperDictType, CameraDictType):
140140class ControlMode (Enum ):
141141 JOINTS = auto ()
142142 CARTESIAN_TRPY = auto ()
143- CARTESIAN_TQuart = auto ()
143+ CARTESIAN_TQuat = auto ()
144144
145145
146146class RobotInstance (Enum ):
@@ -168,15 +168,15 @@ def __init__(self, robot: common.Robot, control_mode: ControlMode):
168168 self .action_space = get_space (JointsDictType )
169169 elif control_mode == ControlMode .CARTESIAN_TRPY :
170170 self .action_space = get_space (TRPYDictType )
171- elif control_mode == ControlMode .CARTESIAN_TQuart :
172- self .action_space = get_space (TQuartDictType )
171+ elif control_mode == ControlMode .CARTESIAN_TQuat :
172+ self .action_space = get_space (TQuatDictType )
173173 else :
174174 msg = "Control mode not recognized!"
175175 raise ValueError (msg )
176176 self .observation_space = get_space (ArmObsType )
177177 self .joints_key = get_space_keys (JointsDictType )[0 ]
178178 self .trpy_key = get_space_keys (TRPYDictType )[0 ]
179- self .tquart_key = get_space_keys (TQuartDictType )[0 ]
179+ self .tquat_key = get_space_keys (TQuatDictType )[0 ]
180180 self .prev_action : dict | None = None
181181
182182 def get_unwrapped_control_mode (self , idx : int ) -> ControlMode :
@@ -198,7 +198,7 @@ def override_control_mode(self, control_mode: ControlMode):
198198
199199 def get_obs (self ) -> ArmObsType :
200200 return ArmObsType (
201- tquart = np .concatenate (
201+ tquat = np .concatenate (
202202 [self .robot .get_cartesian_position ().translation (), self .robot .get_cartesian_position ().rotation_q ()]
203203 ),
204204 joints = self .robot .get_joint_position (),
@@ -208,8 +208,8 @@ def get_obs(self) -> ArmObsType:
208208 def step (self , action : CartOrJointContType ) -> tuple [ArmObsType , float , bool , bool , dict ]:
209209 action_dict = cast (dict , action )
210210 if (
211- self .get_base_control_mode () == ControlMode .CARTESIAN_TQuart
212- and self .tquart_key not in action_dict
211+ self .get_base_control_mode () == ControlMode .CARTESIAN_TQuat
212+ and self .tquat_key not in action_dict
213213 or self .get_base_control_mode () == ControlMode .CARTESIAN_TRPY
214214 and self .trpy_key not in action_dict
215215 or self .get_base_control_mode () == ControlMode .JOINTS
@@ -230,12 +230,12 @@ def step(self, action: CartOrJointContType) -> tuple[ArmObsType, float, bool, bo
230230 self .robot .set_cartesian_position (
231231 common .Pose (translation = action_dict [self .trpy_key ][:3 ], rpy_vector = action_dict [self .trpy_key ][3 :])
232232 )
233- elif self .get_base_control_mode () == ControlMode .CARTESIAN_TQuart and (
233+ elif self .get_base_control_mode () == ControlMode .CARTESIAN_TQuat and (
234234 self .prev_action is None
235- or not np .allclose (action_dict [self .tquart_key ], self .prev_action [self .tquart_key ], atol = 1e-03 , rtol = 0 )
235+ or not np .allclose (action_dict [self .tquat_key ], self .prev_action [self .tquat_key ], atol = 1e-03 , rtol = 0 )
236236 ):
237237 self .robot .set_cartesian_position (
238- common .Pose (translation = action_dict [self .tquart_key ][:3 ], quaternion = action_dict [self .tquart_key ][3 :])
238+ common .Pose (translation = action_dict [self .tquat_key ][:3 ], quaternion = action_dict [self .tquat_key ][3 :])
239239 )
240240 self .prev_action = copy .deepcopy (action_dict )
241241 return self .get_obs (), 0 , False , False , {}
@@ -279,7 +279,7 @@ def __init__(
279279 self .relative_to = relative_to
280280 if (
281281 self .unwrapped .get_control_mode () == ControlMode .CARTESIAN_TRPY
282- or self .unwrapped .get_control_mode () == ControlMode .CARTESIAN_TQuart
282+ or self .unwrapped .get_control_mode () == ControlMode .CARTESIAN_TQuat
283283 ):
284284 if max_mov is None :
285285 max_mov = (self .DEFAULT_MAX_CART_MOV , self .DEFAULT_MAX_CART_ROT )
@@ -319,17 +319,17 @@ def __init__(
319319 self .action_space .spaces .update (
320320 get_space (LimitedJointsRelDictType , params = {"joint_limits" : {"max_joint_mov" : self .max_mov }}).spaces
321321 )
322- elif self .unwrapped .get_control_mode () == ControlMode .CARTESIAN_TQuart :
322+ elif self .unwrapped .get_control_mode () == ControlMode .CARTESIAN_TQuat :
323323 assert isinstance (self .max_mov , tuple )
324324 self .action_space .spaces .update (
325- get_space (LimitedTQuartRelDictType , params = {"cart_limits" : {"max_cart_mov" : self .max_mov [0 ]}}).spaces
325+ get_space (LimitedTQuatRelDictType , params = {"cart_limits" : {"max_cart_mov" : self .max_mov [0 ]}}).spaces
326326 )
327327 else :
328328 msg = "Control mode not recognized!"
329329 raise ValueError (msg )
330330 self .joints_key = get_space_keys (LimitedJointsRelDictType )[0 ]
331331 self .trpy_key = get_space_keys (LimitedTRPYRelDictType )[0 ]
332- self .tquart_key = get_space_keys (LimitedTQuartRelDictType )[0 ]
332+ self .tquat_key = get_space_keys (LimitedTQuatRelDictType )[0 ]
333333 self .initial_obs : dict [str , Any ] | None = None
334334 self ._origin : common .Pose | Vec7Type | None = None
335335 self ._last_action : common .Pose | Vec7Type | None = None
@@ -426,16 +426,16 @@ def action(self, action: dict[str, Any]) -> dict[str, Any]:
426426 )
427427 )
428428 )
429- elif self .unwrapped .get_control_mode () == ControlMode .CARTESIAN_TQuart and self .tquart_key in action :
429+ elif self .unwrapped .get_control_mode () == ControlMode .CARTESIAN_TQuat and self .tquat_key in action :
430430 assert isinstance (self ._origin , common .Pose ), "Invalid origin type given the control mode."
431431 assert isinstance (self .max_mov , tuple )
432- pose_space = cast (gym .spaces .Box , get_space (TQuartDictType ).spaces [self .tquart_key ])
432+ pose_space = cast (gym .spaces .Box , get_space (TQuatDictType ).spaces [self .tquat_key ])
433433
434434 if self .relative_to == RelativeTo .LAST_STEP or self ._last_action is None :
435435 clipped_pose_offset = (
436436 common .Pose (
437- translation = action [self .tquart_key ][:3 ],
438- quaternion = action [self .tquart_key ][3 :],
437+ translation = action [self .tquat_key ][:3 ],
438+ quaternion = action [self .tquat_key ][3 :],
439439 )
440440 .limit_translation_length (self .max_mov [0 ])
441441 .limit_rotation_angle (self .max_mov [1 ])
@@ -445,8 +445,8 @@ def action(self, action: dict[str, Any]) -> dict[str, Any]:
445445 assert isinstance (self ._last_action , common .Pose )
446446 pose_diff = (
447447 common .Pose (
448- translation = action [self .tquart_key ][:3 ],
449- quaternion = action [self .tquart_key ][3 :],
448+ translation = action [self .tquat_key ][:3 ],
449+ quaternion = action [self .tquat_key ][3 :],
450450 )
451451 * self ._last_action .inverse ()
452452 )
@@ -462,8 +462,8 @@ def action(self, action: dict[str, Any]) -> dict[str, Any]:
462462 )
463463
464464 action .update (
465- TQuartDictType (
466- tquart = np .concatenate (
465+ TQuatDictType (
466+ tquat = np .concatenate (
467467 [
468468 np .clip (unclipped_pose .translation (), pose_space .low [:3 ], pose_space .high [:3 ]),
469469 unclipped_pose .rotation_q (),
0 commit comments