Skip to content

Commit 5794d93

Browse files
Fix mobile base xml so forward means forward (x axis), side means side (y-axis); fix controller's weird x-y axis switching logic (#736)
1 parent 006c061 commit 5794d93

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

robosuite/controllers/parts/mobile_base/joint_vel.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,16 @@ 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-
base_action = np.copy([action[i] for i in [1, 0, 2]])
210209
# input raw base action is delta relative to current pose of base
211210
# controller expects deltas relative to initial pose of base at start of episode
212211
# transform deltas from current base pose coordinates to initial base pose coordinates
213-
x, y = base_action[0:2]
212+
x, y = action[0:2]
214213

215214
# do the reverse of theta rotation
216-
base_action[0] = x * np.cos(theta) + y * np.sin(theta)
217-
base_action[1] = -x * np.sin(theta) + y * np.cos(theta)
215+
action[0] = x * np.cos(theta) + y * np.sin(theta)
216+
action[1] = -x * np.sin(theta) + y * np.cos(theta)
218217

219-
self.goal_qvel = base_action
218+
self.goal_qvel = action
220219
if self.interpolator is not None:
221220
self.interpolator.set_goal(self.goal_qvel)
222221

robosuite/models/assets/bases/floating_legged_base.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
<site name="center" type="sphere" pos="0 0 0" size="0.01" group="1" rgba="0 0 0 0"/>
1414

15-
<joint name="joint_mobile_forward" pos="0 0 0" axis="0 1 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
16-
<joint name="joint_mobile_side" pos="0 0 0" axis="1 0 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
15+
<joint name="joint_mobile_forward" pos="0 0 0" axis="1 0 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
16+
<joint name="joint_mobile_side" pos="0 0 0" axis="0 1 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
1717
<joint name="joint_mobile_yaw" pos="-0.21 0 0" axis="0 0 1" type="hinge" limited="false" damping="0" armature="0.0" frictionloss="250"/>
1818
</body>
1919
</worldbody>

robosuite/models/assets/bases/null_mobile_base.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
<site name="center" type="sphere" pos="0 0 0" size="0.01" group="1" rgba="0 0 0 0"/>
1313

14-
<joint name="joint_mobile_forward" pos="0 0 0" axis="0 1 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
15-
<joint name="joint_mobile_side" pos="0 0 0" axis="1 0 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
14+
<joint name="joint_mobile_forward" pos="0 0 0" axis="1 0 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
15+
<joint name="joint_mobile_side" pos="0 0 0" axis="0 1 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
1616
<joint name="joint_mobile_yaw" pos="-0.21 0 0" axis="0 0 1" type="hinge" limited="false" damping="0" armature="0.0" frictionloss="250"/>
1717
</body>
1818
</worldbody>

robosuite/models/assets/bases/omron_mobile_base.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
<geom pos="0 0 0" size="0.35 0.25 0.19" type="box" name="pedestal_feet_col" density="10"/>
5454
</body>
5555

56-
<joint name="joint_mobile_forward" pos="-0.21 0 0" axis="0 1 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
57-
<joint name="joint_mobile_side" pos="-0.21 0 0" axis="1 0 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
56+
<joint name="joint_mobile_forward" pos="-0.21 0 0" axis="1 0 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
57+
<joint name="joint_mobile_side" pos="-0.21 0 0" axis="0 1 0" type="slide" limited="false" damping="0" armature="0.0" frictionloss="250"/>
5858
<joint name="joint_mobile_yaw" pos="-0.21 0 0" axis="0 0 1" type="hinge" limited="false" damping="0" armature="0.0" frictionloss="250"/>
5959
</body>
6060
</worldbody>

0 commit comments

Comments
 (0)