Skip to content

Commit 0dd288a

Browse files
committed
dynamically decide how actions are interpreted
1 parent de413bf commit 0dd288a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

robosuite/controllers/parts/mobile_base/joint_vel.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,18 @@ def set_goal(self, action, set_qpos=None):
206206
curr_theta = T.mat2euler(curr_ori)[2] # np.arctan2(curr_pos[1], curr_pos[0])
207207
theta = curr_theta - init_theta
208208

209+
forward_jnt = None
210+
forward_jnt_axis = None
211+
for jnt in self.joint_names:
212+
if "joint_mobile_forward" in jnt:
213+
forward_jnt = jnt
214+
forward_jnt_axis = self.sim.model.jnt_axis[self.sim.model.joint_name2id(jnt)]
215+
break
216+
217+
# reorder action if forward axis is y axis
218+
if forward_jnt and (forward_jnt_axis == np.array([0, 1, 0])).all():
219+
action = np.copy([action[i] for i in [1, 0, 2]])
220+
209221
# input raw base action is delta relative to current pose of base
210222
# controller expects deltas relative to initial pose of base at start of episode
211223
# transform deltas from current base pose coordinates to initial base pose coordinates

0 commit comments

Comments
 (0)