Skip to main content

SoftwarePilot is an open source middleware and API that supports aerial applications for Parrot Anafi drones

Project description

SoftwarePilot

SoftwarePilot is an open source middleware and API that supports aerial applications. SoftwarePilot allows users to connect consumer Parrot Anafi drones to programmable pythonscripts that provide access to the drones flight controller, camera, and navigation system as well as custom rest api and dockerfile integration.

(Streaming features are currently bugged)

Getting Started

Install the library:

  1. Clone the repo
git clone https://github.com/boredbot2/SoftwarePilot.git
  1. Pip install
pip install SoftwarePilot

Examples

  1. Simple Start:
  from SoftwarePilot import SoftwarePilot

  '''
  This is short demo demonstrating how to connect to the drone, and execute a few basic commands
  '''

  sp = SoftwarePilot()

  # Setup a parrot anafi drone, connected through a controller, without a specific download directory
  drone = sp.setup_drone("parrot_anafi", 1, "None")

  drone.connect()

  drone.piloting.takeoff()

  # The drone will move forward 10 feet (x, y, z, angle)
  drone.piloting.move_by(10,0,0,0)

  drone.piloting.land()

  drone.disconnect()
  1. Handling Media
  from SoftwarePilot import SoftwarePilot
  import time

  '''
  This is short demo demonstrating how to get drone media
  '''

  sp = SoftwarePilot()

  # Setup a parrot anafi drone, connected through a controller, without a specific download directory
  drone = sp.setup_drone("parrot_anafi", 1, "None")

  drone.connect()

  # Without a specified directory, media will be automatically downloaded to AnafiMedia/

  # Example of how to setup, take, and download photos
  drone.camera.media.setup_photo()
  drone.camera.media.take_photo()
  drone.camera.media.download_last_media()

  # Example of how to setup, take, and download recordings
  drone.camera.media.setup_recording()
  drone.camera.media.start_recording()
  time.sleep(5)
  drone.camera.media.stop_recording()
  drone.camera.media.download_last_media()

  # Example of how to setup and process video live feed
  drone.camera.media.setup_stream(
  	yuv_frame_processing = "None", 
  	yuv_frame_cb = "None",
  	h264_frame_cb = "None",
  	start_cb = "None",
  	end_cb = "None",
  	flush_cb = "None",
  )
  # All the callbacks are optional and are automatically set to "None"
  # When set to default the stream will download all the frames and provide framerate and bitrate metadata
  drone.camera.media.start_stream()
  time.sleep(5)
  drone.camera.media.stop_stream()

  drone.disconnect()
  1. Service Interaction
  from SoftwarePilot import SoftwarePilot
  import time

  '''
  This is a short demo demonstrating how to boot up a dockerized service and requesting it with SoftwarePilot

  SoftwarePilot provides a python template of a Rest API which the user is meant to modify and dockerize
  This API is meant to offload the image processing workload to a more capable machine
  SoftwarePilot does not limit the service to which it will connect to, but the basic structure must be followed for proper behavior
  '''

  sp = SoftwarePilot()

  sp.setup_docker()
  time.sleep(5)

  # REPLACE : DOCKER_IMAGE
  container = sp.docker.deploy_container("DOCKER_IMAGE", detach = True, ports = {8000:8000})

  ip_host = sp.get_host_ip()
  service = sp.setup_service(ip_address = ip_host)
  response = service.get()
  print(response)

  # REPLACE : IMAGE_PATH
  response = service.run("IMAGE_PATH")
  print(response)
  1. All Together
  from SoftwarePilot import SoftwarePilot
  import time

  '''
  This is a short demo combining all the utilies demonstrated
  '''
  sp = SoftwarePilot()

  sp.setup_docker()
  time.sleep(5)
  # Dockerize SoftwarePilotAPITest and replace "DOCKER_IMAGE" for your custom name
  container = sp.docker.deploy_container("DOCKER_IMAGE", detach = True, ports = {8000:8000})

  ip_host = sp.get_host_ip()
  service = sp.setup_service(ip_address = ip_host)

  response = service.get()
  print(response)

  download_dir = service.get_download_path()
  drone = sp.setup_drone("parrot_anafi", 1, download_dir)
  drone.connect()

  drone.camera.media.setup_photo()
  drone.piloting.takeoff()

  num_img = 0
  while (num_img < 20):
  	drone.camera.media.take_photo()
  	image_path = drone.camera.media.download_last_media()
  	
  	response = service.run(image_path)
  	print(response)
  	drone.piloting.move_by(response['x'], response['y'], response['z'], response['angle'])
  	
  	num_img += 1

  drone.piloting.land()	

  drone.disconnect()

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SoftwarePilot-1.1.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

SoftwarePilot-1.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file SoftwarePilot-1.1.0.tar.gz.

File metadata

  • Download URL: SoftwarePilot-1.1.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for SoftwarePilot-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a2759b8ac28e6dbb39549696c8a8925c4ebb89c958d69314a1032b7103b493ef
MD5 17a2352d383ca2ca47d3d8d0272dc56e
BLAKE2b-256 15dbef4603576433e6a172d50c290244d68d6b0b4cb6b2d21de7bc42cc55a5f6

See more details on using hashes here.

File details

Details for the file SoftwarePilot-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: SoftwarePilot-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for SoftwarePilot-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fb2601f6287950f4e32b931e15e5fd916e8918f1198a6974af0d5d1e5909c7d
MD5 f76a38179d237bfc5ec2001443b44b4f
BLAKE2b-256 ace81fd139d084a2e1f6ea7861ec690ccfda69a2d1f9a7df4895e13b43b0c59d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page