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.
- Full Logging of some or all sensor data (configurable)
- All returning functions return either:
- a single variable, or
- 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
- Install python 3 (See instructions here)
- If pip3 was not installed along with python, install it now
- Install pymavlink
pip3 install pymavlink
Note: Use the--user
flag on Windows
- Install bluerobotics-ping
pip3 install bluerobotics-ping
Note: Use the--user
flag on Windows
- Download this repository
- Navigate a terminal or administrator CMD prompt to the folder containing
setup.py
- Run
python3 ./setup.py install
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.
- Import the library in your python script
import mavlinkinterface
- 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")
- If you are diving for the first time in a given body of water, set the surface pressure.
- 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
- Arm the Drone
- Proceed with script
- Disarm the Drone
See the examples for more in-depth instructions.
For Full function list, see here
For Mission commands, see here
This sets the execution mode of the attached command. For information of the various execution modes, see here
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 is available here.
Contribution instructions available here