Skip to content

Commit 1c56b4c

Browse files
authored
Fix numpy warning in rox.hat() function (#30)
1 parent a70319f commit 1c56b4c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/general_robotics_toolbox/general_robotics_toolbox.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ def hat(k):
4949
"""
5050

5151
khat=np.zeros((3,3))
52-
khat[0,1]=-k[2]
53-
khat[0,2]=k[1]
54-
khat[1,0]=k[2]
55-
khat[1,2]=-k[0]
56-
khat[2,0]=-k[1]
57-
khat[2,1]=k[0]
52+
k_np = np.reshape(k, (3,))
53+
khat[0,1]=-k_np[2]
54+
khat[0,2]=k_np[1]
55+
khat[1,0]=k_np[2]
56+
khat[1,2]=-k_np[0]
57+
khat[2,0]=-k_np[1]
58+
khat[2,1]=k_np[0]
5859
return khat
5960

6061
def invhat(khat):

0 commit comments

Comments
 (0)