Skip to content

Commit

Permalink
fix bug in animate_joint_configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorlouisdg committed Mar 26, 2024
1 parent f34a0c7 commit 68a6ed9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion airo_drake/visualization/joints.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def animate_joint_configurations(
"""
if joint_configurations is None or len(joint_configurations) == 0:
logger.warning("Asked to animate joint configurations, but none provided.")
return

last_configuration = joint_configurations[-1].squeeze()
joint_configurations = np.array(joint_configurations).squeeze()

if time_per_configuration is not None:
Expand All @@ -93,7 +95,7 @@ def animate_joint_configurations(
# Due to how ZeroOrderHold works, we need to duplicate the last configuration.
# See note on how the second point is ignore when two points are provided:
# https://drake.mit.edu/doxygen_cxx/classdrake_1_1trajectories_1_1_piecewise_polynomial.html#a06278ca4588ba1adb004b84fdfc62f3c
joint_configurations = np.vstack([joint_configurations, joint_configurations[-1]])
joint_configurations = np.vstack([joint_configurations, last_configuration])

joint_times = np.linspace(0.0, duration, len(joint_configurations))
joints_interpolated = PiecewisePolynomial.ZeroOrderHold(joint_times, joint_configurations.T)
Expand Down

0 comments on commit 68a6ed9

Please sign in to comment.