コード例 #1
0
def connect_to_aircraft():
    text = prompt('TGCS> How many aircraft?:  ', key_bindings=bindings)
    text = prompt('TGCS> Serial (1) or IP (2)', key_bindings=bindings)
    if text == '1':
        if sys.platform == "darwin":
            serialport = "/dev/tty.usbmodem1"
        else:
            serial_list = mavutil.auto_detect_serial(preferred_list=[
                '*FTDI*', "*Arduino_Mega_2560*", "*3D_Robotics*",
                "*USB_to_UART*", '*PX4*', '*FMU*', "*Gumstix*"
            ])

            if len(serial_list) == 0:
                print("Error: no serial connsection found")
                return

            if len(serial_list) > 1:
                print('Auto-detected serial ports are:')
                for port in serial_list:
                    print(" {:}".format(port))
            print('Using port {:}'.format(serial_list[0]))
            serialport = serial_list[0].device
        drone = Craft('drone0', 'serial://' + serialport + ':57600')

    if text == '2':
        drone = Craft('drone0', 'udp://:14540')
    drone.start()
    return drone
コード例 #2
0
import asyncio
import time
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.position_velocity_control import PositionVelocityControl

from mavfleetcontrol.actions.land import land

if __name__ == "__main__":

    # loop = asyncio.get_event_loop()

    drone = Craft("drone1", "udp://:14540")
    # loop.run_until_complete(drone.arm(coordinate=[0.0,0.0,0.0],attitude=[0.0,0.0,0.0]))
    drone.start()
    drone.add_action(FlyToPoint(np.array([0, 0, -5]), tolerance=1))
    drone.add_action(
        PositionVelocityControl(1,
                                [np.array([0.0, 0.0]),
                                 np.array([0.0, 100.0])],
                                tolerance=10))
    drone.add_action(land)
    # drone.override_action(land)
    drone.close_conn()  # will run after FLYTOPOINT IS DONE)
    drone.join()
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.land import land

if __name__ == "__main__":



	drone1 = Craft("drone1", "udp://:14540")
	drone2 = Craft("drone2", "udp://:14541")


	drone1.start()
	drone2.start()

	drone1.add_action(FlyToPoint(np.array([0,0,-2]),tolerance = 0.25))
	drone1.add_action(FlyToPoint(np.array([2,0,-2]),tolerance = 0.25))

	drone2.add_action(FlyToPoint(np.array([0,0,-2]),tolerance = 0.25))
	drone2.add_action(FlyToPoint(np.array([2,0,-2]),tolerance = 0.25))

	drone1.add_action(land)
	drone2.add_action(land)


	# drone.override_action(land)


	drone1.close_conn()#will run after FLYTOPOINT IS DONE)
コード例 #4
0
import asyncio
import time
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.flip import Flip

from mavfleetcontrol.actions.land import land

if __name__ == "__main__":

    # loop = asyncio.get_event_loop()

    drone0 = Craft('drone0', "udp://:14540")
    drone1 = Craft('drone1', "udp://:14541")
    drone2 = Craft('drone1', "udp://:14542")
    drone3 = Craft('drone1', "udp://:14543")
    drone4 = Craft('drone1', "udp://:14544")
    # loop.run_until_complete(drone.arm(coordinate=[0.0,0.0,0.0],attitude=[0.0,0.0,0.0]))
    drone0.start()
    drone1.start()
    drone2.start()
    drone3.start()
    drone4.start()

    drone0.add_action(FlyToPoint(np.array([0, 0, -15]), tolerance=1))
    drone1.add_action(FlyToPoint(np.array([0, 0, -15]), tolerance=1))
    drone2.add_action(FlyToPoint(np.array([0, 0, -15]), tolerance=1))
    drone3.add_action(FlyToPoint(np.array([0, 0, -15]), tolerance=1))
    drone4.add_action(FlyToPoint(np.array([0, 0, -15]), tolerance=1))
コード例 #5
0
import asyncio
import time
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.percision_land import PercisionLand
from mavfleetcontrol.actions.land import land

if __name__ == "__main__":

    # loop = asyncio.get_event_loop()

    drone = Craft("drone1", "udp://:14540")
    # loop.run_until_complete(drone.arm(coordinate=[0.0,0.0,0.0],attitude=[0.0,0.0,0.0]))
    drone.start()
    drone.add_action(FlyToPoint(np.array([1, 1, -20]), tolerance=0.5))
    drone.add_action( PercisionLand( 1.0,   np.array([1, 1])   )  )
    drone.add_action(land)
    # drone.override_action(land)
    drone.close_conn()  # will run after FLYTOPOINT IS DONE)
    drone.join()
コード例 #6
0
# Test the implementation of a minimum snap trajectory generator
#
# By: Patrick Ledzian
# Date: 17Jul20
#

import asyncio
import time
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.min_snap import MinSnap
from mavfleetcontrol.actions.percision_land import PercisionLand
from mavfleetcontrol.actions.land import land

if __name__ == "__main__":
    drone = Craft('drone1', "udp://:14540")
    drone.start()
    drone.add_action(FlyToPoint(np.array([0, 0, -5]), tolerance=1))
    drone.add_action(MinSnap())
    drone.add_action(PercisionLand(1.0, np.array([0, 0])))
    drone.add_action(land)
    drone.close_conn()
    drone.join()
コード例 #7
0
from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.sensor import Sensor
# drone = Craft('drone1',"serial:///dev/ttyUSB0:57600")
drone = Craft("drone1", "udp://:14540")

drone.start()
drone.add_action(Sensor())
drone.close_conn()  #will run after FLYTOPOINT IS DONE)
drone.join()
import asyncio
import time
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.land import land

if __name__ == "__main__":

    # loop = asyncio.get_event_loop()

    drone = Craft('drone1', "udp://:14540")
    # loop.run_until_complete(drone.arm(coordinate=[0.0,0.0,0.0],attitude=[0.0,0.0,0.0]))
    drone.start()
    drone.add_action(FlyToPoint(np.array([0, 0, -2]), tolerance=0.25))
    drone.add_action(FlyToPoint(np.array([2, 0, -2]), tolerance=0.25))
    drone.add_action(land)
    # drone.override_action(land)
    drone.close_conn()  #will run after FLYTOPOINT IS DONE)
    drone.join()
コード例 #9
0
import asyncio
import time
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.circle import Circle

from mavfleetcontrol.actions.land import land

if __name__ == "__main__":

    # loop = asyncio.get_event_loop()

    drone = Craft('drone1', "udp://:14540")
    # loop.run_until_complete(drone.arm(coordinate=[0.0,0.0,0.0],attitude=[0.0,0.0,0.0]))
    drone.start()
    drone.add_action(FlyToPoint(np.array([0, 0, -5]), tolerance=1))
    drone.add_action(Circle(velocity=20.0, radius=8.0, angle=0.0))
    drone.add_action(land)
    # drone.override_action(land)
    drone.close_conn()  #will run after FLYTOPOINT IS DONE)
    drone.join()
コード例 #10
0
                    print('land')
                if(((msg)[2])==53):#5
                    drone.add_action( PercisionLand( 1.0,   np.array([1, 1])   )  )
                    print('percision_land')
                if(((msg)[2])==54):#6
                    drone.add_action(FlyToPoint(np.array([0,0,-10]),tolerance =1))
                    print('FlyToPoint0,0,-10')
                if(((msg)[2])==55):#7
                    drone.add_action(Circle(velocity=2.0,radius=8.0,angle=0.0))
                    print('circle')
                if(((msg)[2])==56):#8
                    drone.add_action(Spin())
                    print('Spin')
                if(((msg)[2])==57):#9
                    drone.override_action(Killing())
                    print('Killing!')
        except Exception as E:
            print(E)
    def connection_lost(self, exc):
        print('port closed')
        asyncio.get_event_loop().stop()

# drone = Craft("drone1","serial:///dev/serial0:1000000")
drone = Craft('drone0',"udp://:14540")
drone.start()
loop = asyncio.get_event_loop()
# coro = serial_asyncio.create_serial_connection(loop, Output, '/dev/ttyUSB0', baudrate=57600)
coro = serial_asyncio.create_serial_connection(loop, Output, '/dev/serial0', baudrate=1000000)
loop.run_until_complete(coro)
loop.run_forever()
loop.close()
コード例 #11
0
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.land import land
from mavfleetcontrol.actions.arm import Arm

if __name__ == "__main__":

    drone1 = Craft("drone1", "udp://:14540")

    drone1.start()
    drone1.add_action(Arm())
    # drone1.add_action(FlyToPoint(np.array([0,0,-2]),tolerance = 0.25))

    # drone1.add_action(land)

    # drone.override_action(land)

    drone1.close_conn()  #will run after FLYTOPOINT IS DONE)

    drone1.join()
コード例 #12
0
import asyncio
import time
import numpy as np

from mavfleetcontrol.craft import Craft
from mavfleetcontrol.actions.point import FlyToPoint
from mavfleetcontrol.actions.circle import Circle

from mavfleetcontrol.actions.land import land

if __name__ == "__main__":

    # loop = asyncio.get_event_loop()

    drone0 = Craft('drone0', "udp://:14540")
    drone1 = Craft('drone1', "udp://:14541")
    # loop.run_until_complete(drone.arm(coordinate=[0.0,0.0,0.0],attitude=[0.0,0.0,0.0]))
    drone0.start()
    drone1.start()
    drone0.add_action(FlyToPoint(np.array([3, 0, -5]), tolerance=1))
    drone1.add_action(FlyToPoint(np.array([0, 0, -5]), tolerance=1))

    drone0.add_action(
        Circle(velocity=3.0, radius=5.0, angle=0.0, direction='cw'))
    drone1.add_action(
        Circle(velocity=3.0, radius=6.0, angle=0.0, direction='ccw'))
    drone0.add_action(land)
    drone1.add_action(land)
    # drone.override_action(land)
    drone0.close_conn()  #will run after FLYTOPOINT IS DONE)
    drone0.join()