Skip to content

Commit

Permalink
Merge pull request #234 from maxspahn/fix-orientation-diff-drives
Browse files Browse the repository at this point in the history
  • Loading branch information
maxspahn authored Sep 25, 2023
2 parents c7f7cb6 + fa4f4d3 commit 98e7b6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "urdfenvs"
version = "0.8.15"
version = "0.8.16"
description = "Simple simulation environment for robots, based on the urdf files."
authors = ["Max Spahn <m.spahn@tudelft.nl>"]
maintainers = [
Expand Down
14 changes: 12 additions & 2 deletions urdfenvs/urdf_common/differential_drive_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,17 @@ def correct_base_orientation(self, pos_base: np.ndarray) -> np.ndarray:
here. The function also makes sure that the orientation is always
between -pi and pi.
"""
pos_base -= self._spawn_rotation
pos_base[2] -= self._spawn_rotation
#TODO: The orientation is with respect to the spawn position
# If this is changed as suggested below, it breaks the velocities.
"""
if self._facing_direction == '-y':
pos_base[2] -= np.pi/2
elif self._facing_direction == 'y':
pos_base[2] += np.pi/2
elif self._facing_direction == '-x':
pos_base[2] + np.pi
"""
if pos_base[2] < -np.pi:
pos_base[2] += 2 * np.pi
return pos_base
Expand Down Expand Up @@ -314,7 +324,7 @@ def update_state(self) -> None:
]
)
# make sure that the rotation is within -pi and pi
self.correct_base_orientation(pos_base)
pos_base = self.correct_base_orientation(pos_base)
# wheel velocities
vel_wheels = p.getJointStates(self._robot, self._robot_joints)
v_right = vel_wheels[0][1]
Expand Down

0 comments on commit 98e7b6f

Please sign in to comment.