Skip to content

Commit 6714107

Browse files
authored
convert 1D array to scalar for np.matmul operation
thrust variable is currently a 1D numpy array so the matmul function throws an error when executed, converting thrust to a scalar before the matmul operation solves the issue.
1 parent 7e697d8 commit 6714107

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

AerialNavigation/drone_3d_trajectory_following/drone_3d_trajectory_following.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def quad_sim(x_c, y_c, z_c):
9999

100100
R = rotation_matrix(roll, pitch, yaw)
101101
acc = (np.matmul(R, np.array(
102-
[0, 0, thrust]).T) - np.array([0, 0, m * g]).T) / m
102+
[0, 0, thrust.item()]).T) - np.array([0, 0, m * g]).T) / m
103103
x_acc = acc[0]
104104
y_acc = acc[1]
105105
z_acc = acc[2]
@@ -209,4 +209,4 @@ def main():
209209

210210

211211
if __name__ == "__main__":
212-
main()
212+
main()

0 commit comments

Comments
 (0)