Skip to content

An interface between Python and Mavlink, allowing for much simpler control of underwater drones

License

Notifications You must be signed in to change notification settings

DDriggs00/mavlinkinterface

Repository files navigation

Mavlink Interface

This is a Python interface between the Mavlink software used by the Sunfish’s Drone Controller and a Python script, allowing for simple control of the drone with both simple movement control and advanced waypoint-based navigation. Additionally, it provides access to any sensors attached to the drone, allowing for both individual and aggregate sensor data retrieval.

Features

  • Full Logging of some or all sensor data (configurable)
  • All returning functions return either:
    1. a single variable, or
    2. A JSON-formatted string
  • Multiple methods for handling sequential commands
  • All sensor info accessible
    • Per sensor
    • Per sensor module (eg. IMU, SENSOR_POD_1)
    • Together
  • Easily switch between flight modes

Installation

  1. Install python 3 (See instructions here)
    • If pip3 was not installed along with python, install it now
  2. Install pymavlink
    • pip3 install pymavlink Note: Use the --user flag on Windows
  3. Install bluerobotics-ping
    • pip3 install bluerobotics-ping Note: Use the --user flag on Windows
  4. Download this repository
  5. Navigate a terminal or administrator CMD prompt to the folder containing setup.py
  6. Run python3 ./setup.py install

Usage

To use this library, you must already have an underwater drone set up and working with qGroundControl. Once that is working, perform the following steps.

  1. Import the library in your python script
    • import mavlinkinterface
  2. Create an instance of the interface. All interactions with the drone will be completed through this interface. Note that you may provide a default execution mode (see here for details)
    • MLI = mavlinkinterface.mavlinkInterface(execMode="queue")
  3. If you are diving for the first time in a given body of water, set the surface pressure.
  4. If you are diving in a liquid that has a different density from fresh water or the last used medium (eg. salt water), set the density
  5. Arm the Drone
  6. Proceed with script
  7. Disarm the Drone

See the examples for more in-depth instructions.

Function List

For Full function list, see here
For Mission commands, see here

Common Parameters

execMode (string)

This sets the execution mode of the attached command. For information of the various execution modes, see here

Absolute (switch)

This argument causes movement commands to use absolute coordinates and directions, rather than coordinates and directions relative to the drone.

  • When present, direction is relative to magnetic north, depth is relative to the surface, etc.
  • When absent, direction coordinates, depth, and distances are all relative to the drone's current location and heading

Note: This argument is only relevant where a direction, depth, or coordinates are present

ChangeLog

Changelog is available here.

Contributing

Contribution instructions available here

About

An interface between Python and Mavlink, allowing for much simpler control of underwater drones

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages