Skip to content

Commit 0330761

Browse files
committed
temp fix mujoco robot bug
1 parent f28b45c commit 0330761

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/physics_simulator/robot/mujoco_robot.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ def set_world_velocity(self, velocity):
176176
dof_idx = self.model.jnt_dofadr[joint_id]
177177
self.data.qvel[dof_idx] = joint_vel
178178

179+
def get_world_pose(self):
180+
"""Get the position and orientation of the robot in world coordinates.
181+
182+
Returns:
183+
tuple: (position, orientation) where:
184+
- position: 3D position [x, y, z]
185+
- orientation: Quaternion [qx, qy, qz, qw]
186+
"""
187+
179188
def get_world_pose(self):
180189
"""Get the position and orientation of the robot in world coordinates.
181190
@@ -186,12 +195,13 @@ def get_world_pose(self):
186195
"""
187196

188197
# Get position and orientation from the root body
189-
position = self.data.xpos[self.root_body_id].copy()
190-
orientation = self.data.xquat[self.root_body_id].copy()
198+
# TODO@Chenyu Cao: Temp fix
199+
position = self.data.get_body_xpos(self.name + "/omni_chassis_base_link")
200+
orientation = self.data.get_body_xquat(self.name + "/omni_chassis_base_link")
191201

192202
# Convert from wxyz to xyzw quaternion format
193203
orientation = wxyz_to_xyzw(orientation)
194-
204+
195205
return position, orientation
196206

197207
def get_joint_dof_index(self, joint_name):

0 commit comments

Comments
 (0)