@@ -11,20 +11,22 @@ class ObservationType(Enum):
11
11
The Observation have the following returns:
12
12
BODY_POS: (3,) x, y, z position of the body
13
13
BODY_ROT: (4,) quaternion of the body
14
- BODY_VEL: (6,) first angular velocity around x, y, z. Then linear velocity for x, y, z
14
+ BODY_VEL: (6,) first angular velocity around x, y, z. Then linear velocity for x, y, z, in local frame
15
+ BODY_VEL_WORLD: (6,) first angular velocity around x, y, z. Then linear velocity for x, y, z, in world frame
15
16
JOINT_POS: (1,) rotation of the joint OR (7,) position, quaternion of a free joint
16
17
JOINT_VEL: (1,) velocity of the joint OR (6,) FIRST linear then angular velocity !different to BODY_VEL!
17
18
SITE_POS: (3,) x, y, z position of the body
18
19
SITE_ROT: (9,) rotation matrix of the site
19
20
"""
20
- __order__ = "BODY_POS BODY_ROT BODY_VEL JOINT_POS JOINT_VEL SITE_POS SITE_ROT"
21
+ __order__ = "BODY_POS BODY_ROT BODY_VEL BODY_VEL_WORLD JOINT_POS JOINT_VEL SITE_POS SITE_ROT"
21
22
BODY_POS = 0
22
23
BODY_ROT = 1
23
24
BODY_VEL = 2
24
- JOINT_POS = 3
25
- JOINT_VEL = 4
26
- SITE_POS = 5
27
- SITE_ROT = 6
25
+ BODY_VEL_WORLD = 3
26
+ JOINT_POS = 4
27
+ JOINT_VEL = 5
28
+ SITE_POS = 6
29
+ SITE_ROT = 7
28
30
29
31
30
32
class ObservationHelper :
@@ -190,9 +192,10 @@ def get_state(self, model, data, name, o_type):
190
192
obs = data .body (name ).xpos
191
193
elif o_type == ObservationType .BODY_ROT :
192
194
obs = data .body (name ).xquat
193
- elif o_type == ObservationType .BODY_VEL :
195
+ elif o_type == ObservationType .BODY_VEL or o_type == ObservationType .BODY_VEL_WORLD :
196
+ local = o_type == ObservationType .BODY_VEL
194
197
obs = np .empty (6 )
195
- mujoco .mj_objectVelocity (model , data , mujoco .mjtObj .mjOBJ_XBODY , data .body (name ).id , obs , True )
198
+ mujoco .mj_objectVelocity (model , data , mujoco .mjtObj .mjOBJ_XBODY , data .body (name ).id , obs , local )
196
199
elif o_type == ObservationType .JOINT_POS :
197
200
obs = data .joint (name ).qpos
198
201
elif o_type == ObservationType .JOINT_VEL :
0 commit comments