MCPcopy Create free account
hub / github.com/NVlabs/CTG / angle_diff

Function angle_diff

tbsim/models/diffuser_helpers.py:674–683  ·  view source on GitHub ↗

:param theta1: angle 1 (..., 1) :param theta2: angle 2 (..., 1) :return diff: smallest angle difference between angles (..., 1)

(theta1, theta2)

Source from the content-addressed store, hash-verified

672 return x_all
673
674def angle_diff(theta1, theta2):
675 '''
676 :param theta1: angle 1 (..., 1)
677 :param theta2: angle 2 (..., 1)
678 :return diff: smallest angle difference between angles (..., 1)
679 '''
680 period = 2*np.pi
681 diff = (theta1 - theta2 + period / 2) % period - period / 2
682 diff[diff > np.pi] = diff[diff > np.pi] - (2 * np.pi)
683 return diff
684
685def convert_state_to_state_and_action(traj_state, vel_init, dt, data_type='torch'):
686 '''

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected