コード例 #1
0
    description=
    'Print out vehicle state information. Connects to SITL on local PC by default.'
)
parser.add_argument(
    '--connect',
    help=
    "vehicle connection target string. If not specified, SITL automatically started and used."
)

args = parser.parse_args()
connection_string = args.connect

sitl = None

if not connection_string:
    import dronekit_sitl
    sitl = dronekit_sitl.start_default()
    connection_string = sitl.connection_string()

drone = Cyclone(connection_string, configs)
# drone.awake_script()
drone.arm_and_takeoff(5)
drone.set_airspeed(5)
print(drone.vehicle.location.local_frame)
# drone.goto_global_NED(0, 5, 0)
drone.goto_local_NED(5, 0, 0, mavutil.mavlink.MAV_FRAME_LOCAL_OFFSET_NED)
# drone.goto_local_NED(0, 5, -5, mavutil.mavlink.MAV_FRAME_LOCAL_NED)
# drone.set_position_target_local_NED(0, 5, -5, mavutil.mavlink.MAV_FRAME_LOCAL_NED)
# time.sleep(10)
print(drone.vehicle.location.local_frame)
del drone
コード例 #2
0
if args.simulate:
    simulate = True

sitl = None

if not connection_string:
    import dronekit_sitl
    sitl = dronekit_sitl.start_default()
    connection_string = sitl.connection_string()

drone = Cyclone(connection_string, configs, handlers=handlers)
# drone.awake_script()
drone.obtain_home_location()
if simulate:
    groundHeight = drone.vehicle.location.global_relative_frame.alt
    drone.arm_and_takeoff(groundHeight + 5)
    drone.obtain_home_location()
else:
    drone.wait_for_user()
drone.obtain_home_location()
#drone.set_home_location()
#print("Set home location. Waiting for 10 seconds")
#time.sleep(10)
drone.set_airspeed(5)
startPosition = drone.vehicle.location.local_frame
ang = drone.vehicle.attitude
print("Roll, Pitch, Yaw: {}, {}, {}".format(ang.roll, ang.pitch, ang.yaw))
print("Initialized")
#drone.goto_global_NED(0, 5, 0)

point1 = drone.translate_location(