def order(): MAV = UAV.AUTOPILOT() #rospy.sleep(1) #MAV.set_home() rospy.sleep(1) MAV.arm() rospy.sleep(1) MAV.takeoff(trgt_height=1.0) #MAV.goto_xyz_rpy(0,0,1.5,0,0,0) a = time.time() time.sleep(5) b = time.time() print("time", b - a) R = 1.0 for i in range(180): print(i) theta = float(i) * 2.0 * np.pi / 180.0 x = R * np.cos(theta) y = R * np.sin(theta) z = 1.0 tangent = math.atan2(y, x) MAV.goto_xyz_rpy(x, y, z, 0, 0, (tangent + np.pi / 2)) #MAV.set_vel(x,y,0,0,0,0) print("to", x, y, z) if i == 0: time.sleep(3) rospy.sleep(1.8) #sin() #test() #MAV.gps() print("land") MAV.land()
import mav_class as UAV import rospy import time mav = UAV.AUTOPILOT() while True: time.sleep(1) a = mav.pose.position.x print(a)
import rospy import mav_class as UAV import numpy as np import math theta = np.linspace(0, 2 * np.pi, 100) MAV = UAV.AUTOPILOT() def order(): rospy.sleep(2) MAV.set_home() MAV.arm() MAV.takeoff(7) rate.sleep() if __name__ == "__main__": order()