Skip to content

Commit b77ae58

Browse files
committed
minor update
1 parent 58d4aba commit b77ae58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

graspnetAPI/utils/rotation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def matrix_to_dexnet_params(matrix):
5555
R = np.c_[axis_x, np.c_[axis_y, axis_z]]
5656
approach = R.T.dot(approach)
5757
cos_t, sin_t = approach[0], -approach[2]
58-
angle = np.arccos(cos_t)
58+
angle = np.arccos(max(min(cos_t,1),-1))
5959
if sin_t < 0:
6060
angle = pi * 2 - angle
6161
return binormal, angle
@@ -139,4 +139,4 @@ def dexnet_params_to_matrix(binormal, angle):
139139
[-np.sin(angle), 0, np.cos(angle)]])
140140
R2 = np.c_[axis_x, np.c_[axis_y, axis_z]]
141141
matrix = R2.dot(R1)
142-
return matrix
142+
return matrix

0 commit comments

Comments
 (0)