diff --git a/quadPlot.py b/quadPlot.py index 1bf19f1..ef58ce6 100644 --- a/quadPlot.py +++ b/quadPlot.py @@ -35,7 +35,7 @@ def plot_quad_3d(waypoints, get_world_frame): frames=400, interval=10, blit=False) if len(sys.argv) > 1 and sys.argv[1] == 'save': - print "saving" + print("saving") an.save('sim.gif', dpi=80, writer='imagemagick', fps=60) else: plt.show() diff --git a/runsim.py b/runsim.py index e7f0e48..a0ae74f 100644 --- a/runsim.py +++ b/runsim.py @@ -14,7 +14,7 @@ animation_frequency = 50 control_frequency = 200 # Hz for attitude control loop -control_iterations = control_frequency / animation_frequency +control_iterations = (int)(control_frequency / animation_frequency) dt = 1.0 / control_frequency time = [0.0] diff --git a/test/test_controller.py b/test/test_controller.py index 97647b2..e2bbac0 100644 --- a/test/test_controller.py +++ b/test/test_controller.py @@ -13,9 +13,9 @@ def test_run(self): time = 0.0 des_state = trajGen.genLine(time) F, M = controller.run(quad, des_state) - print "des_state", des_state - print "F", F - print "M", M + print("des_state", des_state) + print("F", F) + print("M", M) if __name__ == '__main__': unittest.main() diff --git a/test/test_quadcopter.py b/test/test_quadcopter.py index 02794dd..6881908 100644 --- a/test/test_quadcopter.py +++ b/test/test_quadcopter.py @@ -25,7 +25,7 @@ def test_state_dot(self): dt = 0.01 s_dot = quadcopter.state_dot(quadcopter.state,dt,F,M) - print "s_dot", s_dot + print("s_dot", s_dot) def test_update(self): pos = (0,0,0) @@ -41,7 +41,7 @@ def test_attitude(self): attitude = [0,0,np.pi/2] quadcopter = Quadcopter(pos, attitude) attitude = quadcopter.attitude() - print "attitude", attitude + print("attitude", attitude) if __name__ == '__main__': unittest.main() diff --git a/test/test_quaternion.py b/test/test_quaternion.py index 0429ff6..1be3a93 100644 --- a/test/test_quaternion.py +++ b/test/test_quaternion.py @@ -16,7 +16,7 @@ def test_as_v_thta(self): expected_v = np.array(x) expected_theta = np.pi/2 actual_v, actual_theta = q.as_v_theta() - print actual_v, actual_theta, expected_v + print(actual_v, actual_theta, expected_v) self.assertTrue(np.array_equal(expected_v, actual_v)) self.assertEqual(expected_theta, actual_theta) diff --git a/test/test_trajGen3D.py b/test/test_trajGen3D.py index 8691e8a..ef6d320 100644 --- a/test/test_trajGen3D.py +++ b/test/test_trajGen3D.py @@ -94,7 +94,7 @@ def test_desired_state_size(self): self.assertEqual(desired_state.vel.shape, (3,)) self.assertEqual(desired_state.acc.shape, (3,)) des_x_dot, des_y_dot, des_z_dot = desired_state.vel - print "desired_state", desired_state + print("desired_state", desired_state) if __name__ == '__main__': unittest.main() diff --git a/test/test_waypoints.py b/test/test_waypoints.py index 4e0bfb8..a093a35 100644 --- a/test/test_waypoints.py +++ b/test/test_waypoints.py @@ -6,8 +6,8 @@ def get_full_trajectory(): T = np.linspace(0, 100, 1000) waypoints = trajGen3D.get_helix_waypoints(0, 9) - print "T", T - print "waypoints", waypoints + print("T", T) + print("waypoints", waypoints) full_traj = np.zeros((T.size,3)) for i, t in enumerate(T): diff --git a/trajGen3D.py b/trajGen3D.py index 05f4b78..faf34d3 100644 --- a/trajGen3D.py +++ b/trajGen3D.py @@ -98,7 +98,7 @@ def generate_trajectory(t, v, waypoints, coeff_x, coeff_y, coeff_z): if yaw > np.pi: yaw = yaw - 2*np.pi - # print next_heading, current_heading, "yaw", yaw*180/np.pi, 'pos', pos + # print(next_heading, current_heading, "yaw", yaw*180/np.pi, 'pos', pos current_heading = next_heading yawdot = delta_psi / 0.005 # dt is control period return DesiredState(pos, vel, acc, yaw, yawdot)