From 67141071c9e1b351ac6c3819c0d53b58d9582103 Mon Sep 17 00:00:00 2001 From: Naveen Date: Wed, 2 Oct 2019 17:48:51 -0700 Subject: [PATCH] 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. --- .../drone_3d_trajectory_following.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AerialNavigation/drone_3d_trajectory_following/drone_3d_trajectory_following.py b/AerialNavigation/drone_3d_trajectory_following/drone_3d_trajectory_following.py index 438494a4..e00b3fff 100644 --- a/AerialNavigation/drone_3d_trajectory_following/drone_3d_trajectory_following.py +++ b/AerialNavigation/drone_3d_trajectory_following/drone_3d_trajectory_following.py @@ -99,7 +99,7 @@ def quad_sim(x_c, y_c, z_c): R = rotation_matrix(roll, pitch, yaw) acc = (np.matmul(R, np.array( - [0, 0, thrust]).T) - np.array([0, 0, m * g]).T) / m + [0, 0, thrust.item()]).T) - np.array([0, 0, m * g]).T) / m x_acc = acc[0] y_acc = acc[1] z_acc = acc[2] @@ -209,4 +209,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()