Skip to content

Commit

Permalink
Fix array conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
cgokmen committed Oct 18, 2023
1 parent bdc9f17 commit 01df6ad
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions omnigibson/robots/tiago.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ def set_position_orientation(self, position=None, orientation=None):
if orientation is None:
orientation = current_orientation

# Make sure position and orientation are arrays (otherwise set attribute fails)
position = np.asarray(position)
orientation = np.asarray(orientation)

# If the simulator is playing, set the 6 base joints to achieve the desired pose of base_footprint link frame
if self._dc is not None and self._dc.is_simulating():
# Find the relative transformation from base_footprint_link ("base_footprint") frame to root_link
Expand All @@ -733,11 +737,6 @@ def set_position_orientation(self, position=None, orientation=None):
super().set_position_orientation(position, orientation)
# Move the joint frame for the world_base_joint
if self._world_base_fixed_joint_prim is not None:
# Position and orientation are lists when restoring scene from json. Cast them to np.array
if isinstance(position, list):
position = np.array(position)
if isinstance(orientation, list):
orientation = np.array(orientation)
self._world_base_fixed_joint_prim.GetAttribute("physics:localPos0").Set(tuple(position))
self._world_base_fixed_joint_prim.GetAttribute("physics:localRot0").Set(Gf.Quatf(*orientation[[3, 0, 1, 2]]))

Expand Down

0 comments on commit 01df6ad

Please sign in to comment.