Skip to main content

PX4/ArduPilot autopilot tools

Project description

PX4/ArduPilot Autopilot tools

autopilot_tools is a python package intended to be used as part of automated work with PX4 and ArduPilot autopilots.

1. INSTALLATION

The package is distrubuted via pypi.org/project/autopilot-tools/.

pip install autopilot_tools

Alternatively, you can install the package from sources in Development Mode (a.k.a. “Editable Installs”). Clone the repository, install the package in development mode and use it in virtual environment:

git clone https://github.com/PonomarevDA/autopilot_tools.git
python3 -m venv venv
./venv/bin/activate
pip install -e .

2. USE CASES

After the installation the package is accessible as a few executables.

2.1. Autopilot configurator

Let's say you have an autopilot, but you’re unsure about its current firmware version or configuration. All you want is to upload the exact firmware you need and configure it according to your specifications. This is where autopilot-configurator can be extremely helpful. This script:

  • uploads the specified PX4 or ArduPilot firmware to the autopilot,
  • resets all parameters to default and then applyed the required parameters in the given order,
  • performs a force sensor calibration, which is especially useful for HITL simulators.

There are a few ways how to use this feature.

First way. Using --firmware and --params options you can configure the autopilot with desired firmware and/or parameters:

autopilot-configurator -v --firmware https://github.com/ZilantRobotics/PX4-Autopilot/releases/download/v1.15.0-0.4.3-beta1/px4_fmu-v6c_cyphal.px4 --params examples/px4_sys_autostart_13000.yaml

Second way. Using --force or --load option you can either configure (upload firmware + load parameters) or only load parameters to the target using a singel yaml file:

cd ~/zilant/uav_hitl_sim # or your path to the simulator
autopilot-configurator -v --force configs/vehicles/px4_v1_15_0_cyphal_quadplane_vtol.yaml

Third way. You can import the module and perform the configuration manually from your custom python script:

from autopilot_tools.configurator import AutopilotConfigurator

AutopilotConfigurator.configure_with_yaml_file(config_path="path_to_config_file.yaml",
                                               need_upload_firmware=True,
                                               need_load_parameters=True)

2.2. Test scenario

test-scenario uploads the given mission to the autopilot, run it and wait until it is finished, then download the log from the vehicle and upload it to review.px4.io. It returns a user the result of the flight and link to the flight report.

You can run this utility as follows:

test-scenario examples/plan_without_fence.plan --output flight.ulg

This will run mission from the examples folder.

2.3. Using as a module

The package can be imported as a module. This allows you to implement more customized behaviour and use extended features if you need.

An example is shown below:

from autopilot_tools.vehicle import Vehicle
from autopilot_tools.analyzer import Analyzer

vehicle = Vehicle()
vehicle.connect(device="serial")
vehicle.upload_firmware(firmware_path_or_url)
vehicle.configure(params_path)
vehicle.load_mission(mission_path)

res = vehicle.run_mission()
print(res)

log_file = vehicle.load_latest_log(mission_path)

analzyer = Analyzer()
res = analzyer.analyse_log(log_file, analyze_requests=("airspeed", "ice", "esc_status"))
print(res)

2. DESIGN

The package is primarily based on ArduPilot/pymavlink.

3. Developer guide

A developer should follow the CONTRIBUTING.md guide.

Deployment. Please, deploy initially on test.pypi.org. Only if everything is fine, then deploy on pypi.org. Try the script below to get details:

./deploy.sh --help

4. LICENSE

The package inherits ArduPilot/pymavlink license and is distributed under GPLv3 license.

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

autopilot_tools-0.5.2.tar.gz (56.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autopilot_tools-0.5.2-py3-none-any.whl (64.0 kB view details)

Uploaded Python 3

File details

Details for the file autopilot_tools-0.5.2.tar.gz.

File metadata

  • Download URL: autopilot_tools-0.5.2.tar.gz
  • Upload date:
  • Size: 56.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for autopilot_tools-0.5.2.tar.gz
Algorithm Hash digest
SHA256 a01224049782356a7d8d4d2fa949b62d027143a4f17388237918ac9159f4beec
MD5 5e91a268f0f29c8099a9362fe3949dfe
BLAKE2b-256 ba03df1dba02931880af7442048189f5122b2ffdd3694d3a98ce1ecd7c695938

See more details on using hashes here.

File details

Details for the file autopilot_tools-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for autopilot_tools-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 158e8680c5bb5604f537072a14bdfad2942857c6c83e96a197c61160701ac4cc
MD5 6aef153e31b0ea06e34a37e6ba560ae5
BLAKE2b-256 ce09281a1d86c8c5a37158e8dbca2375893b9d078afc5b18352dc2a90f382c0c

See more details on using hashes here.

Supported by

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