blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 281 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 6 116 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 313 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 18.2k 668M ⌀ | star_events_count int64 0 102k | fork_events_count int64 0 38.2k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 107 values | src_encoding stringclasses 20 values | language stringclasses 1 value | is_vendor bool 2 classes | is_generated bool 2 classes | length_bytes int64 4 6.02M | extension stringclasses 78 values | content stringlengths 2 6.02M | authors listlengths 1 1 | author stringlengths 0 175 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4c4ab902447233183571e97e6d274b9e8136d331 | 52aafee78631a0a404a3ad189b8f836f459ad862 | /django_src/setup.py | 11de0c185b980c57f520484737f1ef4d5f8db7fb | [
"BSD-3-Clause"
] | permissive | TriangleWaves/django_lims | 7c802bcdf552f53a1ab6bd489b2e2ba9ae15891a | 7a03add90abf8a0cc742a4319a7a6ff1d04fcdd7 | refs/heads/main | 2023-08-14T10:06:11.999152 | 2021-06-01T19:00:38 | 2021-06-01T19:00:38 | 351,540,032 | 0 | 1 | null | 2021-06-01T19:00:39 | 2021-03-25T18:39:36 | Python | UTF-8 | Python | false | false | 4,328 | py | from distutils.core import setup
from distutils.command.install_data import install_data
from distutils.command.install import INSTALL_SCHEMES
import os
import sys
class osx_install_data(install_data):
# On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../
# which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix
# for this in distutils.command.install_data#306. It fixes install_lib but not
# install_data, which is why we roll our own install_data class.
def finalize_options(self):
# By the time finalize_options is called, install.install_lib is set to the
# fixed directory, so we set the installdir to install_lib. The
# install_data class uses ('install_data', 'install_dir') instead.
self.set_undefined_options('install', ('install_lib', 'install_dir'))
install_data.finalize_options(self)
if sys.platform == "darwin":
cmdclasses = {'install_data': osx_install_data}
else:
cmdclasses = {'install_data': install_data}
def fullsplit(path, result=None):
"""
Split a pathname into components (the opposite of os.path.join) in a
platform-neutral way.
"""
if result is None:
result = []
head, tail = os.path.split(path)
if head == '':
return [tail] + result
if head == path:
return result
return fullsplit(head, [tail] + result)
# Tell distutils to put the data_files in platform-specific installation
# locations. See here for an explanation:
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
for scheme in INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']
# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir != '':
os.chdir(root_dir)
django_dir = 'django'
for dirpath, dirnames, filenames in os.walk(django_dir):
# Ignore dirnames that start with '.'
for i, dirname in enumerate(dirnames):
if dirname.startswith('.'): del dirnames[i]
if '__init__.py' in filenames:
packages.append('.'.join(fullsplit(dirpath)))
elif filenames:
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
# Small hack for working with bdist_wininst.
# See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst':
for file_info in data_files:
file_info[0] = '\\PURELIB\\%s' % file_info[0]
# Dynamically calculate the version based on django.VERSION.
version = __import__('django').get_version()
if u'SVN' in version:
version = ' '.join(version.split(' ')[:-1])
setup(
name = "Django",
version = version.replace(' ', '-'),
url = 'http://www.djangoproject.com/',
author = 'Django Software Foundation',
author_email = 'foundation@djangoproject.com',
description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
download_url = 'https://www.djangoproject.com/m/releases/1.3/Django-1.3.4.tar.gz',
packages = packages,
cmdclass = cmdclasses,
data_files = data_files,
scripts = ['django/bin/django-admin.py'],
classifiers = ['Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.4',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: WSGI',
'Topic :: Software Development :: Libraries :: Application Frameworks',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
| [
"81380712+TriangleWaves@users.noreply.github.com"
] | 81380712+TriangleWaves@users.noreply.github.com |
effd21c6d2612ccff953a19a890cc50fdb359d64 | e4367f0779fff8b988e22779c64cf9b279943d81 | /F_biparty/gg.py | 58643861d43f0fac3b7718fa454b34739a409f2f | [] | no_license | exeex/final-exercise | 304d6bad1303734bc9449b777252087208728d01 | 2b2546e1ff5155288e1fec73958c9830652e454c | refs/heads/master | 2020-04-15T06:22:47.027662 | 2019-01-08T10:33:17 | 2019-01-08T10:33:17 | 164,458,793 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 978 | py | import numpy as np
x0 =[
[1, 2],
[2, 1], ]
x1 = [
[4, 4],
[1, 2],
[2, 3],
[3, 4],
[4, 1], ]
x2 = [
[3, 3],
[1, 2],
[1, 3],
[2, 3], ]
def read_input(x):
a = np.zeros((20, 20))
max_nb = 0
for link in x:
max_nb = link[0] if link[0] > max_nb else max_nb
max_nb = link[1] if link[1] > max_nb else max_nb
if link[0] == link[1]:
pass
else:
a[link[0] - 1, link[1] - 1] = 1
a = a[:max_nb, :max_nb]
return a, max_nb
a, n = read_input(x2)
print(a)
color = np.zeros((n,))
color[0] = 1
for i in range(n):
if color[i] == 0:
color[i] = 1
for j in range(n):
if a[i, j] == 1:
if color[j] == 0:
color[j] = 3 - color[i]
else:
if color[j] != 3 - color[i]:
print(color, j)
raise ValueError("Not biparty graph")
print("biparty graph!")
# print()
| [
"noreply@github.com"
] | noreply@github.com |
d08ca6e1f8c977b0f0fea4949846772e878a0a0b | 6117e1761a67095b542c1c59fe4dd98217f7c7ae | /cocovis_custom.py | 01abcb06b6cf8deddfa54fbb72bfb78f26de6dc8 | [] | no_license | keatingr/solo | 73bdb5fa8dc0c08300d419d45a5a365b63d27753 | fac1ee486e747c27e588c7cfc6355479b30621de | refs/heads/master | 2022-04-09T00:01:35.258984 | 2020-03-18T03:56:52 | 2020-03-18T03:56:52 | 245,478,295 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,386 | py | """
Visualize an image and its coco annotated segmentation map
"""
from pycocotools.coco import COCO
import numpy as np
import skimage.io as io
import matplotlib.pyplot as plt
import pylab
pylab.rcParams['figure.figsize'] = (8.0, 10.0)
#%%
annFile='./solo.json'
#%%
# initialize COCO api for instance annotations
coco=COCO(annFile)
#%%
# display COCO categories and supercategories
cats = coco.loadCats(coco.getCatIds())
nms=[cat['name'] for cat in cats]
# print('COCO categories: \n{}\n'.format(' '.join(nms)))
nms = set([cat['supercategory'] for cat in cats])
# print('COCO supercategories: \n{}'.format(' '.join(nms)))
#%%
# get all images containing given categories, select one at random
# catIds = coco.getCatIds(catNms=['person','dog','skateboard']);
# imgIds = coco.getImgIds(catIds=catIds )
# imgIds = coco.getImgIds(imgIds = [324158])
# img = coco.loadImgs(imgIds[np.random.randint(0,len(imgIds))])[0]
#%%
# load and display image
# I = io.imread('%s/images/%s/%s'%(dataDir,dataType,img['file_name']))
# use url to load image
import random
idx = random.randint(0,99)
I = io.imread('./traindata/logo{}.jpg'.format(idx))
plt.axis('off')
# plt.imshow(I)
# plt.show()
#%%
# load and display instance annotations
plt.imshow(I); plt.axis('off')
# annIds = coco.getAnnIds(imgIds=59, catIds=[91], iscrowd=None)
anns = coco.loadAnns([idx])
coco.showAnns(anns)
plt.show()
| [
"mark_noreply@noreply.com"
] | mark_noreply@noreply.com |
c51093ec5b4ed90b3cea19845b329fe5d2142562 | 8b760b7cf705dfb24b59cfe9078766764eefcf9e | /QGIS/1_Prep_VHR.py | c6a7c33ae194e5d092db37e0e80351b9624c969f | [] | no_license | diptanshu-singh/sample | 641e538cc2024d6b90e0f5f723fc9aba17ab2ba3 | 99ba83c1bcaf339a7b26cc9d2d249de5fd0e61f3 | refs/heads/master | 2020-04-01T16:51:33.171051 | 2016-10-17T17:28:35 | 2016-10-17T17:28:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 7,888 | py | ##RapidEye_Tile=vector
##Threshold=number .4
##Landcover_Map=raster
##Change_Map=raster
##Strata_Values=string 3;4;5
##No_Data_Values=string 0;255
##Output=output vector
from osgeo import ogr, osr
import numpy as np
import gdal
import os
#import sys
from qgis.core import *
from qgis.utils import iface
from PyQt4.QtCore import *
from PyQt4.QtGui import *
ogr.UseExceptions()
ogr.RegisterAll()
gdal.PushErrorHandler('CPLQuietErrorHandler')
def prep_vhr(changemap, rapideye, output,lcmap, thresh, ndv, strata):
""" Prepare the VHR tile vector based on a corresponding change map"""
#Open the change map and vector tiles
changemap_open, _ = open_raster(changemap)
lc_open, _ = open_raster(lcmap)
rapideye_open, _ = open_shapefile(rapideye)
#Open layer on VHR vector
rapideyelayer = rapideye_open.GetLayer()
#Create output strata
outShapefile = output
outDriver = ogr.GetDriverByName("ESRI Shapefile")
#Deleting file if it already exist
if os.path.exists(outShapefile):
outDriver.DeleteDataSource(outShapefile)
outDataSource = outDriver.CreateDataSource(outShapefile)
srs = rapideyelayer.GetSpatialRef()
#Create the layer
outLayer = outDataSource.CreateLayer("strata", srs, geom_type=ogr.wkbPolygon)
#Copy attributes from Rapid Eye Tile
inLayerDefn = rapideyelayer.GetLayerDefn()
for i in range(0, inLayerDefn.GetFieldCount()):
fieldDefn = inLayerDefn.GetFieldDefn(i)
outLayer.CreateField(fieldDefn)
#Create new fields:
##area: Area of change within individual tile
##proportion: Proportion of tile that contains change
##ch_pix: Total # of change pixels within tile
##noch_pix: Total # of non-change pixels within tile
area_field = ogr.FieldDefn("area", ogr.OFTInteger)
prop_field = ogr.FieldDefn("proportion", ogr.OFTReal)
pixel_field = ogr.FieldDefn("ch_pix", ogr.OFTInteger)
total_field = ogr.FieldDefn("noch_pix", ogr.OFTInteger)
outLayer.CreateField(area_field)
outLayer.CreateField(prop_field)
outLayer.CreateField(pixel_field)
outLayer.CreateField(total_field)
outLayerDefn = outLayer.GetLayerDefn()
#Total number of tiles in vector file
totalfeats = len(rapideyelayer)
itera = 0
percent = 0
ten_perc = totalfeats / 10
#Iterate over features, retrieving zonal statistics
for i in range(totalfeats):
if itera == ten_perc:
percent += 10
progress.setPercentage(percent)
itera = 0
feat = rapideyelayer.GetFeature(i)
try:
area, proportion, pix, totalpix = zonal_stats(feat, changemap_open, rapideyelayer, ndv, strata)
if proportion < thresh:
itera += 1
continue
except:
itera += 1
continue
outFeature = ogr.Feature(outLayerDefn)
# Add field values from input Layer
for i in range(0, inLayerDefn.GetFieldCount()):
outFeature.SetField(outLayerDefn.GetFieldDefn(i).GetNameRef(), feat.GetField(i))
#Fill zonal statistic fields in output file
outFeature.SetField('area',area)
outFeature.SetField('proportion',proportion)
outFeature.SetField('ch_pix',pix)
outFeature.SetField('noch_pix', totalpix)
# Set geometry as centroid
geom = feat.GetGeometryRef()
outFeature.SetGeometry(geom)
# Add new feature to output Layer
outLayer.CreateFeature(outFeature)
itera += 1
#Close and destroy the data source
changemap_open = None
rapideye_open.Destroy()
outDataSource.Destroy()
def zonal_stats(feat, raster, layer, ndv, strata):
"""Perform zonal statistics of vector feature
on change map"""
#Get extent information
transform = raster.GetGeoTransform()
xOrigin = transform[0]
yOrigin = transform[3]
#Pixel size
pixelWidth = transform[1]
pixelHeight = transform[5]
geom = feat.GetGeometryRef()
if (geom.GetGeometryName() == 'MULTIPOLYGON'):
count = 0
pointsX = []; pointsY = []
for polygon in geom:
geomInner = geom.GetGeometryRef(count)
ring = geomInner.GetGeometryRef(0)
numpoints = ring.GetPointCount()
for p in range(numpoints):
lon, lat, z = ring.GetPoint(p)
pointsX.append(lon)
pointsY.append(lat)
count += 1
elif (geom.GetGeometryName() == 'POLYGON'):
ring = geom.GetGeometryRef(0)
numpoints = ring.GetPointCount()
pointsX = []; pointsY = []
for p in range(numpoints):
lon, lat, z = ring.GetPoint(p)
pointsX.append(lon)
pointsY.append(lat)
#Extent of vector feature
xmin = min(pointsX)
xmax = max(pointsX)
ymin = min(pointsY)
ymax = max(pointsY)
# Specify offset and rows and columns to read
xoff = int((xmin - xOrigin)/pixelWidth)
yoff = int((yOrigin - ymax)/pixelWidth)
xcount = int((xmax - xmin)/pixelWidth)+1
ycount = int((ymax - ymin)/pixelWidth)+1
# Create memory target raster
target_ds = gdal.GetDriverByName('MEM').Create('', xcount, ycount, gdal.GDT_Byte)
target_ds.SetGeoTransform((
xmin, pixelWidth, 0,
ymax, 0, pixelHeight,
))
# Create for target raster the same projection as for the value raster
raster_srs = osr.SpatialReference()
raster_srs.ImportFromWkt(raster.GetProjectionRef())
target_ds.SetProjection(raster_srs.ExportToWkt())
# Rasterize zone polygon to raster
gdal.RasterizeLayer(target_ds, [1], layer, burn_values=[1])
# Read raster as arrays
banddataraster = raster.GetRasterBand(1)
dataraster = banddataraster.ReadAsArray(xoff, yoff, xcount, ycount).astype(np.float)
bandmask = target_ds.GetRasterBand(1)
datamask = bandmask.ReadAsArray(0, 0, xcount, ycount).astype(np.float)
# Mask zone of raster
zonemask = np.ma.masked_array(dataraster, np.logical_not(datamask))
zone_raster_full = np.ma.compressed(zonemask)
zone_masked = zone_raster_full[np.in1d(zone_raster_full, strata)]
#Area of change. 1 pixel = 30 X 30 m = 900m^2
area = len(zone_masked) * 900
#Proportion of change
proportion = float(len(zone_masked)) / len(zone_raster_full)
return area, proportion, len(zone_masked), len(zone_raster_full)
def open_raster(raster):
""" Open raster file """
raster_open = gdal.Open(raster)
if raster_open:
success = True
else:
success = False
return raster_open, success
def open_shapefile(shapefile):
""" Open vector file """
success = False
driver = ogr.GetDriverByName("ESRI Shapefile")
dataSource = driver.Open(shapefile, 0)
if dataSource:
success = True
return dataSource, success
rapideye = RapidEye_Tile
#Add a Sample ID field incase not all tiles are kept
driver = ogr.GetDriverByName('ESRI Shapefile')
dataSource = driver.Open(rapideye, 1) #1 is read/write
#Create new field for keeping track of sample ID
fldDef = ogr.FieldDefn('SampID', ogr.OFTInteger)
#get layer and add the field:
layer = dataSource.GetLayer()
attributes=[]
inFieldDefn = layer.GetLayerDefn()
for i in range(inFieldDefn.GetFieldCount()):
attributes.append(inFieldDefn.GetFieldDefn(i).GetNameRef())
if 'SampID' not in attributes:
layer.CreateField(fldDef)
sid=0
for feat in layer:
feat.SetField('SampID',sid)
layer.SetFeature(feat)
sid+=1
dataSource=None
ndv = []
ndvs = No_Data_Values.split(';')
for i in ndvs:
ndv.append(int(i))
strata = []
stratas = Strata_Values.split(';')
for i in stratas:
strata.append(int(i))
threshold = float(Threshold)
prep_vhr(Change_Map, RapidEye_Tile, Output, Landcover_Map, threshold, ndv, strata)
| [
"bullocke@bu.edu"
] | bullocke@bu.edu |
50f6e323bd840efde3d19e36d3ba0a7754aeba61 | e81b0ee5e5fda8d811dbb17a80c6c19754490e08 | /claim_extractor/extractors/legacy/channel4.py | f7c2950bc3b2734d946c69265fd0340468317bf7 | [] | no_license | claimskg/claimskg-extractor | dd8c2b00f11cc2a7469f8a9c82c665bd8b836433 | 523e9aa44b37832203a432b548ba682563ee1237 | refs/heads/master | 2022-09-24T12:52:25.507320 | 2022-02-22T10:02:01 | 2022-02-22T10:02:01 | 147,321,353 | 18 | 11 | null | 2022-02-21T16:03:08 | 2018-09-04T09:28:00 | Jupyter Notebook | UTF-8 | Python | false | false | 4,426 | py | # -*- coding: utf-8 -*-
import datetime
import pandas as pd
import requests
from bs4 import BeautifulSoup
from dateparser.search import search_dates
from claim_extractor import Claim
def get_all_claims(criteria):
headers = {
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36'}
# print criteria.maxClaims
# performing a search by each letter, and adding each article to a urls_ var.
now = datetime.datetime.now()
urls_ = {}
types = ["true", "mostly-true", "half-true", "barely-true", "false", "pants-fire", "no-flip", "half-flip",
"full-flop"]
last_page = []
for page_number in range(1, 500):
if (criteria.maxClaims > 0 and len(urls_) >= criteria.maxClaims):
break
url = "https://www.channel4.com/news/factcheck/page/" + str(page_number)
# url="http://www.politifact.com/truth-o-meter/rulings/"+str(type_)+"/?page="+str(page_number)
try:
page = requests.get(url, headers=headers, timeout=5)
soup = BeautifulSoup(page.text, "lxml")
soup.prettify()
links = soup.findAll("li", {"class": "feature factcheck"})
if (len(links) != 0) or (links != last_page):
for anchor in links:
anchor = anchor.find('a', {"class": "permalink"}, href=True)
ind_ = str(anchor['href'])
if (ind_ not in list(urls_.keys())):
if (criteria.maxClaims > 0 and len(urls_) >= criteria.maxClaims):
break
if (ind_ not in criteria.avoid_url):
urls_[ind_] = ind_
print("adding " + str(ind_))
last_page = links
else:
print ("break!")
break
except:
print("error=>" + str(url))
claims = []
index = 0
# visiting each article's dictionary and extract the content.
for url, conclusion in urls_.items():
print(str(index) + "/" + str(len(list(urls_.keys()))) + " extracting " + str(url))
index += 1
url_complete = str(url)
# print url_complete
try:
page = requests.get(url_complete, headers=headers, timeout=5)
soup = BeautifulSoup(page.text, "lxml")
soup.prettify("utf-8")
claim_ = Claim()
claim_.set_url(url_complete)
claim_.set_source("channel4")
if (criteria.html):
claim_.setHtml(soup.prettify("utf-8"))
# title
# if (soup.find("h1",{"class":"content-head__title"}) and len(soup.find("h1",{"class":"content-head__title"}).get_text().split("?"))>1):
title = soup.find("div", {"class": "factcheck-article-header"}).find("h1").get_text()
claim_.set_title(title)
# date
date_ = soup.find('li', {"class": "pubDateTime"})
# print date_["content"]
if date_:
date_str = search_dates(date_['data-time'])[0][1].strftime("%Y-%m-%d")
# print date_str
claim_.set_date(date_str)
# print claim_.date
# body
body = soup.find("div", {"class": "article-body article-main"})
claim_.set_body(body.get_text())
# related links
divTag = soup.find("div", {"class": "article-body article-main"})
related_links = []
for link in divTag.findAll('a', href=True):
related_links.append(link['href'])
claim_.set_refered_links(related_links)
claim_.set_claim(title)
tags = []
for tag in soup.findAll('meta', {"property": "article:tag"}):
# print "achou"
tags.append(tag["content"])
claim_.set_tags(", ".join(tags))
# if (claim_.conclusion.replace(" ","")=="" or claim_.claim.replace(" ","")==""):
# print claim_.conclusion
# print claim_.claim
# raise ValueError('No conclusion or claim')
claims.append(claim_.generate_dictionary())
except:
print("Error ->" + str(url_complete))
# creating a pandas dataframe
pdf = pd.DataFrame(claims)
return pdf
| [
"twk.theainur@gmail.com"
] | twk.theainur@gmail.com |
d812e31d2169e0df7cd04a3858f33a5a9ca23207 | 1a40b3c993fac119cc369d4a21595c9627f79454 | /HomeCooksGalore/HCG/migrations/0004_auto_20170515_1324.py | f68fb7fc979b55d1f033395df1667c8c3c054659 | [] | no_license | tusharsircar95/HomeCooksGalore | 8a859954c07da38f8800afb4e6703bc756187491 | 8eb6d0bb0fc4037ef55ad3f60f8c53d0833eb7b2 | refs/heads/master | 2021-03-16T06:40:42.875246 | 2017-07-26T04:02:40 | 2017-07-26T04:02:40 | 91,578,388 | 2 | 1 | null | null | null | null | UTF-8 | Python | false | false | 473 | py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-15 07:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('HCG', '0003_dish_dishcoverimage'),
]
operations = [
migrations.AlterField(
model_name='dish',
name='dishCoverImage',
field=models.FileField(upload_to=''),
),
]
| [
"noreply@github.com"
] | noreply@github.com |
d423f34e8c373ec11fdfd0833b33d93abcd4b663 | 36ec27c8cc7e18718655596306311bca344c8963 | /corona_start.py | a8e7f27431f3ecf8ad8d9c8c2c7e57ba4b60e7fe | [] | no_license | maxuw/covid_stats | 04aabf8c0306f81ecdedc8a588aeb2bfbfac663f | 6366ce63068e3243b95d55d4ea26d481bd96b728 | refs/heads/master | 2022-12-03T03:06:30.461105 | 2020-08-23T09:05:56 | 2020-08-23T09:05:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,113 | py | #- importing libraries
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#- function index dates
def convert_dates_to_python(df):
new_index = []
new_index[0:4] = df.index[0:4]
new_index[4:] = pd.to_datetime(df.index[4:])
new_index[4:] = [x.date() for x in new_index[4:]]
#print(temp_index)
df.index = new_index
return df
#-
#-
def return_country(df, country, region=False):
if country not in df.loc["Country/Region"].values:
print("No such country value in Country/Region: ", country)
return None
if not region:
print("region false")
mask = (df.loc["Country/Region"] == country) & (df.loc["Province/State"].isna())
column_number = mask[mask == True].index[0]
country_series = df[column_number]
country_series.name = country_series.iloc[1]
else:
mask = (df.loc["Country/Region"] == country) & (df.loc["Province/State"] == region)
column_number = mask[mask == True].index[0]
country_series = df[column_number]
country_series.name = country_series.iloc[1], "/", country_series.iloc[0]
# print(country_series.iloc[0])
country_series.drop(country_series.iloc[0:5].index, inplace=True)
return country_series
#-
#- importing data
url_humdata = "https://data.humdata.org/hxlproxy/api/data-preview.csv?url=https%3A%2F%2Fraw.githubusercontent.com%2FCSSEGISandData%2FCOVID-19%2Fmaster%2Fcsse_covid_19_data%2Fcsse_covid_19_time_series%2Ftime_series_covid19_confirmed_global.csv&filename=time_series_covid19_confirmed_global.csv"
#-
#-
df = pd.read_csv(url_humdata)
df = df.T
#-
df = convert_dates_to_python(df)
print(df.iloc[1])
#-
df.iloc[0:5]
quebec = return_country(df, "Canada", "Quebec")
print(quebec)
#-
#-
poland = return_country(df, "Poland")
print(poland)
#-
plt.figure()
plt.plot(poland)
plt.plot(quebec)
#-
print(df)
#-
pol = return_country(df, "Poland")
#-
def plot_days_from(df, list_countries, amount_days):
list_series = []
for c in list_countries:
print(c)
country = return_country(df, c)
print(country.name)
country = country[-amount_days:]
list_series.append(country)
plt.figure()
for co in list_series:
plt.plot(co)
#-
plot_days_from(df, ["Poland"], 30)
#-
mask_ab_zero = poland > 0
poland_ab_zero = poland[mask_ab_zero]
poland_ab_zero
#-
poland_ab_zero.plot()
#-
#-
days_poland = len(poland_ab_zero)
#-
poland_ab_zero.plot(logy=True, legend=False)
#-
poland_ab_zero.plot(loglog=True, legend=False)
#-
def preprocess_country(country_name, df):
mask = df.loc["Country/Region"] == country_name
column_number = mask[mask == True].index[0]
country = df[column_number]
new_index = []
new_index[0:4] = country.index[0:4]
new_index[4:] = pd.to_datetime(country.index[4:])
country.index = new_index
country.drop(country.iloc[[0,2,3]].index, inplace=True)
country.name = country.iloc[0]
country = country[1:]
return country
#-
italy = preprocess_country("Italy", df)
print(italy.name)
#-
def ret_starting_from(series, starting_number):
mask = series >= starting_number
series_mask = series[mask]
series_mask = series_mask[:days_poland]
series_mask.reset_index(drop=True, inplace=True)
return series_mask
#-
poland_toplot = preprocess_country("Poland", df)
poland_ab_zero_plot = ret_starting_from(poland_toplot, 1)
#-
italy_ab_zero = ret_starting_from(italy, 1)
# italy_ab_zero.plot(logy=True)
print(italy_ab_zero[22])
italy_ab_zero[:days_poland].plot(logy=True)
#-
print(italy_ab_zero[:days_poland])
italy_shorter = italy_ab_zero[:days_poland]
italy_shorter.plot()
#-
df_final = pd.DataFrame([poland_ab_zero, italy_shorter])
df_final
#-
# plt.figure(figsize=(12,5))
ax1 = poland_ab_zero_plot.plot(color='red', grid=True)
ax2 = italy_shorter.plot(color='blue', grid=True)
# h1, l1 = ax1.get_legend_handles_labels()
# h2, l2 = ax2.get_legend_handles_labels()
# plt.legend(h1+h2, l1+l2, loc=2)
plt.show()
#-
print(italy_shorter.index)
print(poland_ab_zero_plot.index)
#-
| [
"m.jackl@student.uw.edu.pl"
] | m.jackl@student.uw.edu.pl |
af6f8fa01e3dd3c3a068bcce200fc48515571e7f | c237d854f2fc78a7583f2bf0528355c8b14912f8 | /tests/test_example.py | 099b0812c779fffcc65bb463803178d1b6192432 | [
"MIT"
] | permissive | azridev/flask-dashboard-shards | da072e7406e9be3b85f31a9dff6167a0d87a7496 | c6833e6d55c7dd065b4c6e9b677288e9fe9aa344 | refs/heads/master | 2021-05-19T09:08:00.079436 | 2020-03-26T19:04:00 | 2020-03-26T19:04:00 | 251,620,836 | 0 | 1 | MIT | 2020-03-31T14:04:41 | 2020-03-31T14:04:40 | null | UTF-8 | Python | false | false | 584 | py | # -*- encoding: utf-8 -*-
"""
License: MIT
Copyright (c) 2019 - present AppSeed.us
"""
from tests.test_base import check_pages, check_blueprints
@check_pages('/', '/home/index')
def test_pages(base_client):
# do something
base_client.post('/', data={})
# the pages are tested (GET request: 200) afterwards by the
# @check_pages decorator
@check_blueprints('/forms', '/ui')
def test_blueprints(base_client):
# do something
base_client.post('/', data={})
# the blueprints are tested (GET request: 200) afterwards by the
# @check_blueprints decorator
| [
"developer@rosoftware.ro"
] | developer@rosoftware.ro |
dd0fcfed1ffc0216514293aa41a3b1f80f7c5803 | 2ad082cf86270413127b2d248a597b3c2dde9f1c | /magnum/tests/unit/conductor/handlers/test_conductor_listener.py | 316facbe72084da6827e6b8b1b46b62d0d29b092 | [
"Apache-2.0"
] | permissive | Tennyson53/magnum | 91fdeff8e2bf86b02900d91d25a169cc79c68294 | 13ba9607568423df1a213ae04b0cb5b9b524d0b1 | refs/heads/master | 2020-04-08T12:29:25.296217 | 2015-10-19T06:00:00 | 2015-10-19T06:00:00 | 42,226,196 | 3 | 1 | null | 2015-09-10T06:18:52 | 2015-09-10T06:18:51 | null | UTF-8 | Python | false | false | 888 | py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from magnum.conductor.handlers import conductor_listener
from magnum.tests import base
class TestHandler(base.BaseTestCase):
def setUp(self):
super(TestHandler, self).setUp()
self.handler = conductor_listener.Handler()
def test_ping_conductor(self):
self.assertEqual(self.handler.ping_conductor({}), True)
| [
"hongbin034@gmail.com"
] | hongbin034@gmail.com |
c19fa02dd797506fc8a85b9bbe6cc97be5b3be45 | 1632a494eda04f2afc20fe3788453a073765f7a0 | /websocket_io/views/index.py | 4214b1ceaec74a3a3c21725b2cae35b6c55a3dd3 | [] | no_license | KevinWMatthews/python-flask-websocket_io | cb54ed3ff158f9b92f1f86aa76288760921c485d | ce80e12bf13a07155147b5134ec91973f1b0a6d8 | refs/heads/master | 2021-01-11T16:16:45.841982 | 2017-01-25T20:06:40 | 2017-01-25T20:06:40 | 80,052,827 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 353 | py | from flask import render_template, Blueprint, abort
from jinja2 import TemplateNotFound
from websocket_io import app
default_view = Blueprint('index', __name__)
@app.route('/', defaults = {'page': 'index'})
@app.route('/<page>')
def show(page):
try:
return render_template('%s.html' % page)
except TemplateNotFound:
abort(404)
| [
"kmatthews@cyberdata.net"
] | kmatthews@cyberdata.net |
2b1842fadbcf04dd669b39ebe389b4d3dea0bc55 | 16c0ba8c04f52790828e7b3640fe10ffc498baf1 | /django/django_projects/app00/better/forms.py | 983e8d54730a18ccb13d574c05a58cb25feab91a | [] | no_license | JulienPoncelet/Web_1-Framework_1 | 73b29121f42107b417f7be69e399a63f7dd38fd9 | b18fdc95cfcd499bfbe7d1424edbfdbd138d03be | refs/heads/master | 2021-01-18T09:49:12.273756 | 2014-04-20T16:18:41 | 2014-04-20T16:18:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 521 | py | from django import forms
from django.forms import PasswordInput
class UserForm(forms.Form):
Login = forms.CharField(max_length = 16, required = True)
Password = forms.CharField(max_length = 16, required = True, widget = PasswordInput())
Password_bis = forms.CharField(max_length = 16, required = True, widget = PasswordInput())
Email = forms.EmailField(required = True)
Group = forms.ChoiceField(required = True, widget=forms.RadioSelect, choices = {("simple_user", "simple_user"), ("better_user", "better_user")})
| [
"jponcele@e2r7p3.42.fr"
] | jponcele@e2r7p3.42.fr |
ce7f68d218a1e0618b8c64c647d2630b922988ab | 5d5b20d80109b300df88e2fd4ee8954e05e275ce | /middleware/common/name.py | 63e0da6e2fb3cecb2d36077a8afdf89a574cc68a | [] | no_license | jiaweit2/msa-middleware | f7e247f8fe1a4e33fd0d1adfbd964a3cd79f2546 | fc5e6592fad723cae61bd551a01b23ff367277f9 | refs/heads/main | 2023-04-12T22:04:08.955585 | 2021-04-22T20:48:24 | 2021-04-22T20:48:24 | 319,446,137 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,263 | py | # -*- coding: utf-8 -*-
"""Module describing name
"""
import time
import pickle
class Name(object):
def __init__(self, name):
if name and name[0] != '/':
name = '/'+name
while '//' in name:
name = name.replace('//', '/')
self.name_components = name.split('/')[1:]
self.name_components = [comp for comp in self.name_components if comp]
self.name = '/'+'/'.join(self.name_components)
def __str__(self):
return self.name
def __len__(self):
return len(self.name_components)
#####################
# Getter Functions #
#####################
def get_name_components(self):
return self.name_components
def get_name_component(self, idx):
return self.name_components[idx]
def get_length(self):
return self.__len__()
def get_sub_name(self, begin_idx, end_idx):
if end_idx < 0:
if self.get_length() + end_idx >= 0:
end_idx = self.get_length() + end_idx
else:
return Name('/')
if begin_idx > end_idx:
end_idx = begin_idx
name_components = [''] + self.name_components[begin_idx:end_idx+1]
return Name('/'.join(name_components))
def get_common_prefix(self, name):
cnt = 0
name = Name(str(name))
for i in range(min(self.get_length(), name.get_length())):
if self.get_name_component(i) == name.get_name_component(i):
cnt += 1
continue
else:
break
if cnt == 0: return Name('/')
else: return self.get_sub_name(0, cnt-1)
#####################
# Name Operators #
#####################
def equal(self, name):
return self.name == str(name)
def is_prefix_of(self, name):
if self.equal(self.get_common_prefix(name)):
return True
else:
return False
if __name__ == '__main__':
a = Name('/test/a/b/c/123')
print(a.get_sub_name(0, 1))
# print(len(a))
# print(a.get_length())
# print(a.get_sub_name(0, -3))
# print(Name('/test').is_prefix_of(Name('/test')))
| [
"jiaweit2@illinois.edu"
] | jiaweit2@illinois.edu |
4825299ada1c314576b5b7d6ef81e6e9a85796e6 | 14c8434f6a4f09b84bc7dae3b6b225e7e13b156d | /app/errors.py | abd12d1d19f7af2be57ad88f68ab3f628692e411 | [] | no_license | mingming2513953126/flack | 07299d5cc62aa4ced0734f2b00db587a24261d69 | dbc793c0908629ae7fee87250f2e0f4456e76f33 | refs/heads/master | 2021-05-10T09:11:24.354831 | 2018-01-25T13:38:02 | 2018-01-25T13:38:02 | 118,917,210 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 134 | py | # encoding: utf-8
'''
@author: lileilei
@file: errors.py
@time: 2017/5/22 20:50
'''
from flask import render_template,jsonify,request
| [
"2513953126@qq.com"
] | 2513953126@qq.com |
26c50f94fd6c3db1508baaa22dd11fc7e43d5d8a | 4c61e3bdc99c32d540151af51da1bee71d6ee524 | /Code/Extra_Practice/anagram_checker_practice.py | 0f75cd7ea43bbadc4cec2af1e5ba7530ce070330 | [] | no_license | AnniePawl/Data-Structures-Intro | 0a02dabacddeaafddf6bf17fb86cf450e2bed923 | d6ce172c9d3e530293d691ca7d887cd6b1dc5b0a | refs/heads/master | 2020-08-23T17:15:17.163050 | 2019-10-30T21:28:53 | 2019-10-30T21:28:53 | 216,670,744 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 396 | py | # ANAGRAM CHECKER
import sys
def anagram_checker(input1, input2):
"""Checks if two commandline argument are anagrams"""
sorted_input1 = sorted(input1)
sorted_input2 = sorted(input2)
if sorted_input1 == sorted_input2:
return True
return False
if __name__ == '__main__':
input1 = sys.argv[1]
input2 = sys.argv[2]
print(anagram_checker(input1, input2))
| [
"annampawl@gmail.com"
] | annampawl@gmail.com |
88fa931dfa536fba871aeb84907237c5763eedfe | dcb46d745386fed52d4b7eaff142cbe8fdff4ab3 | /Day 06/customsprocessorp2.py | dce1f940c0e4b6da1c0c63150d7de05fce0002f3 | [] | no_license | kdedwards/2020-Advent | f8baa35e505e27056319c1fed5b5cd5d2fa492e2 | ab7c9e47f08a6073b05f16e3f8d52259d951b00c | refs/heads/master | 2023-02-11T09:49:03.890841 | 2021-01-05T03:35:48 | 2021-01-05T03:35:48 | 319,322,576 | 0 | 0 | null | 2020-12-31T07:18:00 | 2020-12-07T13:06:01 | Python | UTF-8 | Python | false | false | 1,077 | py | with open("customsanswers.dat") as customsData:
customsAnswersRaw = customsData.readlines()
answerGroups = []
thisAnswerGroup = []
for line in customsAnswersRaw:
if(line == '\n'):
answerGroups.append(thisAnswerGroup)
thisAnswerGroup = []
else:
thisAnswerGroup.extend(line.replace('\n', '').split(' '))
answerGroups.append(thisAnswerGroup)
groupSummaries = []
for answerGroup in answerGroups:
groupSummary = {}
groupSummary['answerCount'] = 0
for answer in answerGroup:
groupSummary['answerCount'] += 1
answers = list(answer)
for answer in answers:
if(answer in groupSummary):
groupSummary[(answer)] += 1
else:
groupSummary[(answer)] = 1
groupSummaries.append(groupSummary)
allYesTotal = 0
for groupSummary in groupSummaries:
for key in groupSummary:
if(groupSummary[key] == int(groupSummary['answerCount']) and key != 'answerCount'):
allYesTotal += 1
print('Total answers that are all Yes: {}'.format(allYesTotal))
| [
"kdedwards@gmail.com"
] | kdedwards@gmail.com |
44efa30e73995fd142bc76d65381f4b6e594a08c | c24294dcb5b3a58f6871c08793601758529d0fb9 | /instruments/old_python/old/generator_loading_edits.py | 8b88e426e629cd8ed1d86f60ba99a1a8044c3c23 | [] | no_license | murchlab/analyzer | ac8ece35b42be92caef34f7b8ea3a3c26980c537 | 9971d1d88a65025907963518b3f4a969a443e26a | refs/heads/master | 2022-02-02T08:18:59.208359 | 2022-01-20T17:56:35 | 2022-01-20T17:56:35 | 238,325,453 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 30,306 | py | import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import time
import tewx
SAMPLE_RATE = 1E9 # Gig samples/sec
class Pulse:
'''
DESCRIPTION: an object to contain all pulse parameters.
If using SSM, self.ssm_bool= True
Parameters for Non-Hermitian qubit
if ff is set to any number, the modulation with a cos wave affects the amplitude of the wave
the t_loop is the period of the sin wave
the phase_ini is the phase of the sin wave
(this function made change in gen_pulse)
M.A
PARAMETERS:
(base): duration, start (time), amplitude,
(if ssm_bool): ssm_freq (GHz), phase
FUNCTIONS:
make(): create short copy of pulse
show(): graph output
copy(): deep copy, I hope...
NOTES:
This does not include difference b/t cos/sin because they can be included in phase
'''
def __init__(self, duration, start, amplitude, ssm_freq=None, phase=0, clock_freq=None, gaussian_bool=False, phase_ini=None, t_loop=None, ff=None):
self.duration = int(duration)
self.start = int(start)
self.amplitude = amplitude
self.phase_ini = phase_ini
self.t_loop = t_loop
self.ff=ff
if ssm_freq is not None:
self.ssm_bool = True
self.ssm_freq = ssm_freq
self.phase = phase
else:
self.ssm_bool = False
if clock_freq is not None:
self.clock_bool = True
self.clock_freq = clock_freq
else:
self.clock_bool = False
#self.waveform = self.make() ## make is currently not working.
# FUTURE FEATURES:
self.gaussian_bool = gaussian_bool
def make(self):
new_array = np.zeros(self.duration)
if self.ssm_bool:
gen_pulse( dest_wave = new_array, pulse=self)
else:
gen_pulse(new_array, pulse=self)
return new_array
def show(self):
plt.plot(np.arange(self.start,self.duration), self.waveform)
plt.show()
def copy(self):
# there must be a better/ more general way to do this.
if self.ssm_bool & self.clock_bool:
return Pulse(self.duration, self.start, self.amplitude, self.ssm_freq, self.phase, self.clock_freq, self.gaussian_bool, self.phase_ini, self.t_loop, self.ff)
elif self.ssm_bool:
return Pulse(self.duration, self.start, self.amplitude, self.ssm_freq, self.phase, self.gaussian_bool, self.phase_ini, self.t_loop, self.ff)
else:
return Pulse(self.duration, self.start, self.amplitude, gaussian_bool=self.gaussian_bool)
def toString(self):
outString = "Pulse of {0} [amp] from {1}+{2}".format(self.amplitude, self.start, self.duration)
if self.ssm_bool:
outString += " SSM @ {0} MHz with phase={1}".format(self.ssm_freq*1000, self.phase)
return outString
#END pulse class
class Sequence:
'''
DESCRIPTION: an object to contain all sequence parameters.
PARAMETERS:
(base): duration, start (time), amplitude,
(if ssm_bool): ssm_freq (GHz), phase
FUNCTIONS:
NOTES:
This does not include difference b/t cos/sin because they can be included in phase
'''
def __init__(self,sequence_length, num_steps, mixer_orthogonality=90):
self.sequence_length = int(sequence_length)
self.num_steps = int(num_steps)
self.mixer_orthogonality = mixer_orthogonality
self.channel_list = self._initialize_channels()
# all_data is list of [ch1, ch2, ch3, ch4]
# e.g. ch1 = [waveform, m1, m2]
# e.g. waveform contains sweep: m1.shape = [num_steps, samples_per_step]
def __add__(self, other_seq):
new_seq = self
if not (self.sequence_length==other_seq.sequence_length):
print('attempted to combine sequences of difference sequence_length')
new_seq.num_steps = self.num_steps + other_seq.num_steps
new_seq.channel_list = np.concatenate((self.channel_list, other_seq.channel_list), 2)
return new_seq
def insert_waveform(self, channel_num, pulse, step_index):
full_seq_waveform = self.all_data[channel_num-1][0] # 0 for waveform
current_step = full_seq_waveform[step_index]
gen_pulse(current_step, pulse) ##in-place insertion
#self.all_data[channel_num-1][0] += current_step
def insert_marker(channel_num, marker_num, pulse):
full_seq_marker = self.all_data[channel_num-1][marker_num-1]
current_step = full_seq_marker[step_index]
gen_pulse(current_step, pulse)
self.all_data[channel_num-1][marker_num-1] += current_step
def insert_bothChannels(self,primary_channel_num, pulse,step_index):
## adds pulse to both channels, offset by mixer_ortho.
ch_num = primary_channel_num
self.insert_waveform(ch_num,pulse,step_index)
copy = pulse.copy()
copy.phase += self.mixer_orthogonality
self.insert_waveform(ch_num,copy,step_index)
def convert_to_tabor_format(self, channel_num):
# each of the following is a [num_steps x samples_per_step] matrix
waveform = self.all_data[channel_num][0]
mark1 = self.all_data[channel_num][1]
mark2 = self.all_data[channel_num][2]
binarized = int(2**12*waveform) + int(2**14 *mark1) + int(2**15 *mark2)
return binarized
def add_gate(self, source_1, source_2=None,destination_tuple=(1,1)): #input channel numbers #channel1 marker1 is default use dest_tuple=(3,2) for ch3/4 mkr2
# each of the following is a [num_steps x samples_per_step] matrix
channel1_channel = self.channel_list[source_1-1][0] # dim 0: channel 1; dim 1: [ch,m1,m2]
both_ch1_ch2 = channel1_channel**2
if source_2:
channel2_channel = self.channel_list[source_2-1][0] # dim 0: channel 1; dim 1: [ch,m1,m2]
both_ch1_ch2 += channel2_channel**2
qubit_gate = create_gate(both_ch1_ch2)
self.channel_list[destination_tuple[0]-1][destination_tuple[1]] = qubit_gate
def add_sweep(self, channel, marker=0, sweep_name='none', start=0, stop=0, initial_pulse=Pulse(amplitude=0, duration=0, start=0)):
'''
DESCRIPTION: A thin wrapper to add pulses to the correct channel
INPUT: channel = {1-4} (converts to indices); marker=0(channel),1,2; arguments for gen_sweep
OUTPUT:
'''
## error checking
if start==stop and sweep_name != 'none':
raise Warning("Start and sweep are the same; did you mean that?")
if channel not in [1,2,3,4]:
raise IOError("Invalid channel number: "+str(channel))
if marker not in [0,1,2]:
raise IOError("Invalid marker number: "+str(marker))
## send the input to _gen_sweep
dest_wave = self.channel_list[channel-1][marker]
self._gen_sweep(sweep_name, start=start, stop=stop, dest_wave=dest_wave, initial_pulse=initial_pulse )
#END add_sweep
def _initialize_sequence_matrix(self):
'''
DESCRIPTION: prepare an empty matrix of size [time_steps, sequence_steps] for each channel
INPUT:
OUTPUT:
'''
num_steps = self.num_steps
file_length = self.sequence_length
channel= np.zeros((num_steps,file_length))
mark1 = np.zeros((num_steps,file_length))
mark2 = np.zeros((num_steps,file_length))
return channel, mark1, mark2
##END _intiialize_sequence_matrix
def _initialize_channels(self):
'''
DESCRIPTION: prepare the channels and markers
INPUT:
OUTPUT:
'''
num_channels = 4
#channel_array = np.array([ [None,None,None] for i in range(num_channels) ])
channel_array = np.zeros((num_channels, 3, self.num_steps, self.sequence_length))
for ch_index in range(len(channel_array)):
wave, mark1, mark2 = self._initialize_sequence_matrix()
channel_array[ch_index] = [wave, mark1, mark2]
# The WX2184C channel (ch) 1 and 2 share markers; likewise ch 3 and 4
# so we will copy ch 1 to 2 and 3 to 4
mark1_index, mark2_index = 1,2
## set ch2 markers equal to ch1 markers
channel_array[1][mark1_index] = channel_array[0][mark1_index] # ch1/2 m1
channel_array[1][mark2_index] = channel_array[0][mark2_index] # ch1/2 m2
## set ch4 markers equal to ch3 markers
channel_array[3][mark1_index] = channel_array[2][mark1_index] # ch3/4 mmark1_index
channel_array[3][mark2_index] = channel_array[2][mark2_index] # ch3/4 mmark2_index
return channel_array
##END _intitialize_channels
def _gen_sweep(self, sweep_name, start, stop, dest_wave, initial_pulse=Pulse(amplitude=0, duration=0,start=0)):
'''
DESCRIPTION: sweeps 'none', 'amplitude', 'width', 'start' or 'phase'
'none' sets same pulse for all steps in sequence
INPUT: sets range for initial + [start,stop)
updates parameters to initial_pulse
OUTPUT: writes to dest_wave
'''
## Check input
if len(dest_wave) < self.num_steps:
raise IOError("dest_wave is too short ({0})".format(len(dest_wave)))
updated_pulse = initial_pulse.copy()
if sweep_name == 'none':
for step_index in range(self.num_steps):
gen_pulse( dest_wave = dest_wave[step_index], pulse=updated_pulse)
elif sweep_name == 'start':
for step_index, param_val in enumerate(np.linspace(start,stop,self.num_steps)):
updated_pulse.start = initial_pulse.start + int(param_val) #- initial_pulse.duration
gen_pulse( dest_wave = dest_wave[step_index], pulse=updated_pulse)
elif sweep_name == 'amplitude':
for step_index, param_val in enumerate(np.linspace(start,stop,self.num_steps)):
updated_pulse.amplitude = initial_pulse.amplitude+ param_val
gen_pulse( dest_wave = dest_wave[step_index], pulse=updated_pulse)
elif sweep_name == 'width':
for step_index, param_val in enumerate(np.linspace(start,stop,self.num_steps)):
updated_pulse.duration = initial_pulse.duration + int(param_val)
gen_pulse( dest_wave = dest_wave[step_index], pulse=updated_pulse)
elif sweep_name == 'phase':
if not initial_pulse.ssm_bool: raise ValueError("Sweeping phase w/o SSM")
for step_index, param_val in enumerate(np.linspace(start,stop,self.num_steps)):
updated_pulse.phase= initial_pulse.phase + param_val
gen_pulse( dest_wave = dest_wave[step_index], pulse=updated_pulse)
elif sweep_name == 'ssm_freq':
if not initial_pulse.ssm_bool: raise ValueError("Sweeping frequency w/o SSM")
for step_index, param_val in enumerate(np.linspace(start,stop,self.num_steps)):
updated_pulse.ssm_freq = initial_pulse.ssm_freq + param_val
gen_pulse( dest_wave = dest_wave[step_index], pulse=updated_pulse)
else:
raise ValueError("Bad sweep parameter: "+sweep_name)
#END gen_sweep
# def write_sequence(self, base_name='foo', file_path=os.getcwd(), use_range_01=False,num_offset=0, write_binary=False):
# '''
# DESCRIPTION: writes a single channel INPUT:
# (optional) mark1/2: numpy arrays with marker data (0,1)
# OUTPUT:
# TODO:
# '''
# if not file_path.endswith("\\"): file_path+= "\\"
# print("writing to {}".format(file_path))
#
# for ch_index, (channel, mark1, mark2) in enumerate(self.channel_list):
# ch_name = "ch" + str(ch_index+1)
# print("writing "+ch_name)
#
# for step_index in range(self.num_steps):
# if write_binary:
# file_name = file_path+base_name+"_"+ch_name+"_{:04d}.npy".format(step_index+num_offset)
# else:
# file_name = file_path+base_name+"_"+ch_name+"_{:04d}.csv".format(step_index+num_offset)
#
# if use_range_01: # write floats between 0 and 1
# with_index = zip(range(len(channel[step_index])), channel[step_index] )
# np.savetxt(file_name, with_index, fmt='%d, %f')
# continue
#
# # convert to binary
# # 15 bits = 12 bits of information, 2**13=sign bit, 2**14=mark1, 2**15=mark2
# else:
# new_mark1 = [ int(i*2**14) for i in mark1[step_index] ]
# new_mark2 = [ int(i*2**15) for i in mark2[step_index] ]
# if write_binary:
# binary_file = np.array([ round(2**12 *val + 8191.5) for val in channel[step_index] ])
# binary_file = binary_file.clip(0, 2**14
# -1)
# else:
# binary_file = np.array([ int(2**12 *val) for val in channel[step_index] ])
# binary_file += new_mark1
# binary_file += new_mark2
#
# #pd.DataFrame(binary_file).to_csv(file_name,float_format='%d', header=False)
# if write_binary:
# binary_file = binary_file.astype('uint16')
# np.save(file_name, binary_file)
# else:
# with_index = zip(range(len(binary_file)), binary_file)
# np.savetxt(file_name, list(with_index), fmt='%d, %d')
#
# ##end for loop through channels
# #END write_sequence
def write_sequence(self):
'''
DESCRIPTION: writes a single channel INPUT:
(optional) mark1/2: numpy arrays with marker data (0,1)
OUTPUT:
TODO:
'''
binary_seq = []
for ch_index, (channel, mark1, mark2) in enumerate(self.channel_list):
ch_name = "ch" + str(ch_index+1)
print("writing "+ch_name)
for step_index in range(self.num_steps):
# convert to binary
# 15 bits = 12 bits of information, 2**13=sign bit, 2**14=mark1, 2**15=mark2
new_mark1 = [ int(i*2**14) for i in mark1[step_index] ]
new_mark2 = [ int(i*2**15) for i in mark2[step_index] ]
binary_pat = np.array([ round(2**12 *val + 8191.5) for val in channel[step_index] ])
binary_pat = binary_pat.clip(0, 2**14-1)
binary_pat += new_mark1
binary_pat += new_mark2
binary_seq.append(binary_pat.astype('uint16'))
return binary_seq
#END write_sequence
def load_sequence(self, instr_addr, binary_seq):
'''
DESCRIPTION: loads multi channel INPUT:
OUTPUT:
TODO:
'''
file_length = self.sequence_length
num_steps = self.num_steps
# Reading the wave data from .npy file
waveforms = [[ None, ] * num_steps for _ in self.channel_list]
for ch_index, _ in enumerate(self.channel_list):
ch_name = "ch" + str(ch_index+1)
print("loading "+ch_name)
for step_index, binary_pat in enumerate(binary_seq):
waveforms[ch_index][step_index] = binary_pat
# Initializing the instrument
inst = tewx.TEWXAwg(instr_addr, paranoia_level=1)
inst.send_cmd('*CLS') # Clear errors
inst.send_cmd('*RST') # Reset the device #need to add several commands to set up device to use markers and other configurations
inst.send_cmd(':OUTP:ALL 0')
seg_quantum = inst.get_dev_property('seg_quantum', 16)
# Setting up the markers
# Downloading the wave data
seg_len = np.ones(num_steps, dtype=np.uint32) * file_length
pseudo_seg_len = num_steps * file_length + (num_steps - 1) * seg_quantum
wav_dat = np.zeros(2 * pseudo_seg_len, 'uint16')
for ch_index, _ in enumerate(self.channel_list):
if ch_index % 2:
continue
offs = 0
for step_index in range(self.num_steps):
wav1 = waveforms[ch_index][step_index]
wav2 = waveforms[ch_index + 1][step_index]
offs = inst.make_combined_wave(wav1, wav2, wav_dat, dest_array_offset=offs, add_idle_pts=(0!=offs))
# select channel:
inst.send_cmd(':INST:SEL {0}'.format(ch_index+1))
inst.send_cmd('MARK:SEL 1')
inst.send_cmd('MARK:SOUR USER')
inst.send_cmd('MARK:STAT ON')
inst.send_cmd('MARK:SEL 2')
inst.send_cmd('MARK:SOUR USER')
inst.send_cmd('MARK:STAT ON')
# select user-mode (arbitrary-wave):
inst.send_cmd(':FUNC:MODE FIX')
# delete all segments (just to be sure):
inst.send_cmd(':TRAC:DEL:ALL')
inst.send_cmd('SEQ:DEL:ALL')
# set combined wave-downloading-mode:
inst.send_cmd(':TRAC:MODE COMB')
# define the pseudo segment:
inst.send_cmd(':TRAC:DEF 1,{0}'.format(np.uint32(pseudo_seg_len)))
# select segment 1:
inst.send_cmd(':TRAC:SEL 1')
# download binary data:
inst.send_binary_data(':TRAC:DATA', wav_dat)
# ---------------------------------------------------------------------
# Write the *appropriate* segment-table
# (array of 'uint32' values holding the segments lengths)
# ---------------------------------------------------------------------
inst.send_binary_data(':SEGM:DATA', seg_len)
# Setting up sequence mode
for step in range(1, num_steps + 1):
inst.send_cmd(':SEQ:DEF {},{},1,0'.format(step, step))
inst.send_cmd(':FUNC:MODE SEQ')
inst.send_cmd(':SEQ:ADV STEP')
# Setting up the triggers
inst.send_cmd(':TRIG:SOUR EVEN')
inst.send_cmd(':TRIG:COUN 1')
# Turn channels on:
inst.send_cmd(':INIT:CONT 0')
# Setting up amplitudes and offsets
amp = [1.5, 1.5, 1.5, 1.5]
offset = [-0.03, -0.049, -0.033, -0.025]
for ch_index, _ in enumerate(self.channel_list):
inst.send_cmd(':INST:SEL {0}'.format(ch_index+1))
inst.send_cmd(':VOLT {}'.format(amp[ch_index]))
inst.send_cmd(':VOLT:OFFS {}'.format(offset[ch_index]))
inst.send_cmd(':INST:COUP:STAT ON')
inst.send_cmd(':OUTP:ALL 1')
# query system error
syst_err = inst.send_query(':SYST:ERR?')
print(syst_err)
inst.close()
def load_sequence_CSV(self, instr_addr, base_name='foo', file_path=os.getcwd(), num_offset=0):
'''
DESCRIPTION: loads multi channel INPUT:
OUTPUT:
TODO:
'''
file_length = self.sequence_length
num_steps = self.num_steps
if not file_path.endswith("\\"): file_path+= "\\"
print("loading {}".format(file_path))
# Reading the wave data from .npy file
waveforms = [[ None, ] * num_steps for _ in self.channel_list]
for ch_index, _ in enumerate(self.channel_list):
ch_name = "ch" + str(ch_index+1)
print("loading "+ch_name)
for step_index in range(num_steps):
file_name = file_path+base_name+"_"+ch_name+"_{:d}.csv".format(step_index+num_offset)
waveforms[ch_index][step_index] = np.loadtxt(file_name,dtype=int,delimiter=', ',usecols=(1,))
# Initializing the instrument
inst = tewx.TEWXAwg(instr_addr, paranoia_level=1)
inst.send_cmd('*CLS') # Clear errors
inst.send_cmd('*RST') # Reset the device #need to add several commands to set up device to use markers and other configurations
inst.send_cmd(':OUTP:ALL 0')
seg_quantum = inst.get_dev_property('seg_quantum', 16)
# Setting up the markers
# Downloading the wave data
seg_len = np.ones(num_steps, dtype=np.uint32) * file_length
pseudo_seg_len = num_steps * file_length + (num_steps - 1) * seg_quantum
wav_dat = np.zeros(2 * pseudo_seg_len, 'uint16')
for ch_index, _ in enumerate(self.channel_list):
if ch_index % 2:
continue
offs = 0
for step_index in range(self.num_steps):
wav1 = waveforms[ch_index][step_index]
wav2 = waveforms[ch_index + 1][step_index]
offs = inst.make_combined_wave(wav1, wav2, wav_dat, dest_array_offset=offs, add_idle_pts=(0!=offs))
# select channel:
inst.send_cmd(':INST:SEL {0}'.format(ch_index+1))
inst.send_cmd('MARK:SEL 1')
inst.send_cmd('MARK:SOUR USER')
inst.send_cmd('MARK:STAT ON')
inst.send_cmd('MARK:SEL 2')
inst.send_cmd('MARK:SOUR USER')
inst.send_cmd('MARK:STAT ON')
# select user-mode (arbitrary-wave):
inst.send_cmd(':FUNC:MODE FIX')
# delete all segments (just to be sure):
inst.send_cmd(':TRAC:DEL:ALL')
inst.send_cmd('SEQ:DEL:ALL')
# set combined wave-downloading-mode:
inst.send_cmd(':TRAC:MODE COMB')
# define the pseudo segment:
inst.send_cmd(':TRAC:DEF 1,{0}'.format(np.uint32(pseudo_seg_len)))
# select segment 1:
inst.send_cmd(':TRAC:SEL 1')
# download binary data:
inst.send_binary_data(':TRAC:DATA', wav_dat)
# ---------------------------------------------------------------------
# Write the *appropriate* segment-table
# (array of 'uint32' values holding the segments lengths)
# ---------------------------------------------------------------------
inst.send_binary_data(':SEGM:DATA', seg_len)
# Setting up sequence mode
for step in range(1, num_steps + 1):
inst.send_cmd(':SEQ:DEF {},{},1,0'.format(step, step))
inst.send_cmd(':FUNC:MODE SEQ')
inst.send_cmd(':SEQ:ADV STEP')
# Setting up the triggers
inst.send_cmd(':TRIG:SOUR EVEN')
inst.send_cmd(':TRIG:COUN 1')
# Turn channels on:
inst.send_cmd(':INIT:CONT 0')
# Setting up amplitudes and offsets
amp = [1., 1., 1., 1.]
offset = [0., 0., 0., 0.]
for ch_index, _ in enumerate(self.channel_list):
inst.send_cmd(':INST:SEL {0}'.format(ch_index+1))
inst.send_cmd(':VOLT {}'.format(amp[ch_index]))
inst.send_cmd(':VOLT:OFFS {}'.format(offset[ch_index]))
inst.send_cmd(':INST:COUP:STAT ON')
inst.send_cmd(':OUTP:ALL 1')
# query system error
syst_err = inst.send_query(':SYST:ERR?')
print(syst_err)
inst.close()
def convert_to_tabor_format(self):
'''
DESCRIPTION: converts the sequence structure to a loadable format
INPUT: populated Sequence
OUTPUT: array of size [4, num_steps, sequence_length] in binarized form with markers
'''
tabor_format = np.zeros((4,self.num_steps, self.sequence_length))
for ch_index, (channel, mark1, mark2) in enumerate(self.channel_list):
## loop through ch 1-4
single_channel_binary = np.array(2**12 *channel,dtype='int')
single_channel_binary += np.array(2**14 *mark1,dtype='int')
single_channel_binary += np.array(2**15 *mark2,dtype='int')
tabor_format[ch_index] = single_channel_binary
##END loop through channels
return tabor_format
##END convert_to_tabor_format
##END Sequence
def gen_pulse(dest_wave, pulse):
## consider renaming to insert_pulse()
'''
DESCRIPTION: generates pulse on one wave
Note, this does not add constant pulese through all steps; that's handled by add_sweep('none')
INPUT:
Pulse object (contains start,duration, etc)
OUTPUT:
in-place adjustment to dest_wave
NOTES:
TODO:
'''
## Decompose pulse object
start = pulse.start
dur = pulse.duration
amp = pulse.amplitude
phase_ini = pulse.phase_ini
t_loop=pulse.t_loop
ff=pulse.ff
if dur <0:
dur = abs(dur)
start -= dur
if ff==None:
## Create output
if pulse.ssm_bool:
# ssm_freq = pulse.ssm_freq
# phase = pulse.phase
# # start times depend on start and duration because curves should pick up same absolute phase( may be shifted for cos/sin/etc), ie two pulses placed front to back should continue overall
# times = np.arange(start,start+dur)
# ang_freq = 2*np.pi*(ssm_freq*1E9)/SAMPLE_RATE # convert to units of SAMPLE_RATE
# phase_rad = phase/180.0*np.pi
# addition = amp*np.sin(ang_freq*times + phase_rad)
ssm_freq = pulse.ssm_freq
phase = pulse.phase
if pulse.clock_bool:
clock_freq = pulse.clock_freq
else:
clock_freq = ssm_freq
ang_freq_clock = 2*np.pi*(clock_freq*1E9)/SAMPLE_RATE
phase_rad_clock = ang_freq_clock*start
times = np.arange(0, dur)
ang_freq = 2*np.pi*(ssm_freq*1E9)/SAMPLE_RATE # convert to units of SAMPLE_RATE
phase_rad = phase/180.0*np.pi
addition = amp*np.sin(ang_freq*times + phase_rad + phase_rad_clock)
else:
addition = amp* np.ones(dur)
if pulse.gaussian_bool:
argument = -(times-start-dur/2)**2
argument /= 2*(dur*0.2)**2 # 0.847 gives Gauss(start +dur/2) = 0.5
gauss_envelope = np.exp(argument);
addition *= gauss_envelope
else:
if pulse.ssm_bool:
ssm_freq = pulse.ssm_freq
phase = pulse.phase
# start times depend on start and duration because curves should pick up same absolute phase( may be shifted for cos/sin/etc), ie two pulses placed front to back should continue overall
times = np.arange(start,start+dur)
ang_freq = 2*np.pi*(ssm_freq*1E9)/SAMPLE_RATE # convert to units of SAMPLE_RATE
phase_rad = phase/180.0*np.pi
ampfunc = np.cos(2*np.pi*(times-start)/t_loop+phase_ini)
# freqfunc= np.sin()
addition = ampfunc*amp*np.sin(ang_freq*times + phase_rad)
else:
addition = amp* np.ones(dur)
if pulse.gaussian_bool:
argument = -(times-start-dur/2)**2
argument /= 2*(dur*0.2)**2 # 0.847 gives Gauss(start +dur/2) = 0.5
gauss_envelope = np.exp(argument);
addition *= gauss_envelope
try:
dest_wave[start:start+dur] += addition
except ValueError:
print( "Over-extended pulse (ignored):\n {0}".format(pulse.toString()))
#END gen_pulse
def some_Fun():
'''
DESCRIPTION:
INPUT:
OUTPUT:
TODO:
'''
pass
'''
def rabi_seq():
file_length= 8000 # becomes global FILELENGTH
num_steps = 101# becomes global NUMSTEPS
#WAVE,MARK1, MARK2 = initialize(file_length, num_steps)
ALL_CHANNELS = initialize_wx(file_length, num_steps)
# ALL_CHANNELS is 4-array for Ch 1,2. Each elem is a tuple of (channel, M1,M2)
# each tuple elem. is a seq_len X num_samples matrix.
## channels
p = Pulse(start=5795, duration=0, amplitude=0.5, ssm_freq=0.200, phase=0)
add_sweep(ALL_CHANNELS, channel=1, sweep_name='width', start=0 , stop= 200, initial_pulse=p )
p.phase = 98.0
add_sweep(ALL_CHANNELS, channel=2, sweep_name='width', start=0 , stop= 200, initial_pulse=p )
readout = Pulse(start=6000,duration=1000,amplitude=1)
add_sweep(ALL_CHANNELS, channel=3, sweep_name='none',initial_pulse=readout)
## markers
gate = Pulse(start=5790, duration=10, amplitude=1)
add_sweep(ALL_CHANNELS, channel=1, marker=1, sweep_name='width', start=0, stop=220, initial_pulse=gate)
trigger = Pulse(start=2000, duration=1000, amplitude=1)
add_sweep(ALL_CHANNELS, channel=3, marker=1, sweep_name='none', initial_pulse=trigger)
return ALL_CHANNELS
## send to ARB
dir_name = r"C:\Arb Sequences\EUR_sequences\mixerOrthogonality_98deg\piTime_23ns\tmp"
write_sequence(ALL_CHANNELS, file_path=dir_name, use_range_01=False)
##END rabi_seq
'''
def create_gate(seq_matrix,width=5):
'''
DESCRIPTION: for all times (ts) and for all steps (ss): if any amplitude exists, extend in time by width
INPUT: seq_matrix of size [sequence_steps, samples]
OUTPUT: binary mask with same size as input
## KNOWN BUG: if pulse_end + width > num_samples will create error.
'''
mask_ss, mask_ts= np.where(seq_matrix != 0)
gate = seq_matrix.copy()
gate[ (mask_ss, mask_ts)] = 1
gate[ (mask_ss, mask_ts-width)] = 1
gate[ (mask_ss, mask_ts+width)] = 1
return gate
##END create_gate
| [
"55456910+xingrui-song@users.noreply.github.com"
] | 55456910+xingrui-song@users.noreply.github.com |
687f83de97a7d8de22247e2874d8e2f141b5d0e0 | 6bf8dd42f5ae15c65c6aec8900acfa665fa71568 | /src/main/python/views/time_series_integration_view.py | 0c7604c107caee0e02748b93ec64e3cc182806f8 | [] | no_license | craigdickinson/DataLab | e76cd70521acedba1c8d8174d94b82236fa5fd57 | 78cae181f85a3cd2b6b6c1f1a57f62bbe5fbbda4 | refs/heads/master | 2022-12-14T04:11:57.866884 | 2020-02-07T21:08:37 | 2020-02-07T21:08:37 | 216,533,209 | 1 | 0 | null | 2022-11-22T04:20:18 | 2019-10-21T09:47:13 | Python | UTF-8 | Python | false | false | 19,899 | py | """Acceleration and angular rate conversion to displacement and angle setup tab and edit dialog."""
__author__ = "Craig Dickinson"
import logging
import sys
from PyQt5 import QtWidgets
from core.control import Control
from core.logger_properties import LoggerProperties
class TimeSeriesIntegrationSetupTab(QtWidgets.QWidget):
"""Tab widget to present time series integration setup."""
def __init__(self, parent=None):
super(TimeSeriesIntegrationSetupTab, self).__init__(parent)
self.parent = parent
self.control = Control()
self.logger = LoggerProperties()
self._init_ui()
self._connect_signals()
def _init_ui(self):
"""Create widget layout."""
# WIDGETS
self.editButton = QtWidgets.QPushButton("Edit Data...")
self.editButton.setShortcut("Ctrl+E")
self.editButton.setToolTip("Ctrl+E")
self.processChkBox = QtWidgets.QCheckBox("Include in processing")
self.accXCol = QtWidgets.QLabel("-")
self.accYCol = QtWidgets.QLabel("-")
self.accZCol = QtWidgets.QLabel("-")
self.angRateXCol = QtWidgets.QLabel("-")
self.angRateYCol = QtWidgets.QLabel("-")
self.applyGCorr = QtWidgets.QLabel("-")
self.integrationFolder = QtWidgets.QLabel("-")
# Labels
self.lblAccX = QtWidgets.QLabel("Acceleration X:")
self.lblAccY = QtWidgets.QLabel("Acceleration Y:")
self.lblAccZ = QtWidgets.QLabel("Acceleration Z:")
self.lblAngRateX = QtWidgets.QLabel("Angular rate X:")
self.lblAngRateY = QtWidgets.QLabel("Angular rate Y:")
self.lblGCorr = QtWidgets.QLabel("Apply gravity correction:")
self.lblIntegrationFolder = QtWidgets.QLabel("Output folder:")
# CONTAINERS
self.setupGroup = QtWidgets.QGroupBox("Acceleration and Angular Rate Columns")
self.setupForm = QtWidgets.QFormLayout(self.setupGroup)
self.setupForm.addRow(self.lblAccX, self.accXCol)
self.setupForm.addRow(self.lblAccY, self.accYCol)
self.setupForm.addRow(self.lblAccZ, self.accZCol)
self.setupForm.addRow(self.lblAngRateX, self.angRateXCol)
self.setupForm.addRow(self.lblAngRateY, self.angRateYCol)
self.setupForm.addRow(self.lblGCorr, self.applyGCorr)
self.setupForm.addRow(self.lblIntegrationFolder, self.integrationFolder)
# LAYOUT
self.hboxControls = QtWidgets.QHBoxLayout()
self.hboxControls.addWidget(self.editButton)
self.hboxControls.addWidget(self.processChkBox)
self.hboxControls.addStretch()
self.vbox = QtWidgets.QVBoxLayout()
self.vbox.addLayout(self.hboxControls)
self.vbox.addWidget(self.setupGroup)
self.vbox.addStretch()
self.hbox = QtWidgets.QHBoxLayout(self)
self.hbox.addLayout(self.vbox)
self.hbox.addStretch()
def _connect_signals(self):
self.editButton.clicked.connect(self.on_edit_clicked)
self.processChkBox.toggled.connect(self.on_process_check_box_toggled)
def on_edit_clicked(self):
"""Open logger screening edit dialog."""
if self.parent is None:
return
if self.parent.loggerList.count() == 0:
msg = f"No loggers exist to edit. Add a logger first."
return QtWidgets.QMessageBox.information(
self, "Edit Time Series Integration Settings", msg
)
# Retrieve selected logger object
logger_idx = self.parent.loggerList.currentRow()
# Edit stats dialog class
editIntegrationSettings = EditIntegrationSetupDialog(self, self.control, logger_idx)
editIntegrationSettings.show()
def on_process_check_box_toggled(self):
"""Set include in processing state in logger object."""
if self.parent.loggerList.count() > 0:
self.logger.process_integration = self.processChkBox.isChecked()
def set_analysis_dashboard(self, logger):
"""Set dashboard with logger stats and spectral settings from logger object."""
self.logger = logger
# Process check state
self.processChkBox.setChecked(logger.process_integration)
# Columns
self.accXCol.setText(logger.acc_x_col)
self.accYCol.setText(logger.acc_y_col)
self.accZCol.setText(logger.acc_z_col)
self.angRateXCol.setText(logger.ang_rate_x_col)
self.angRateYCol.setText(logger.ang_rate_y_col)
self.integrationFolder.setText(self.control.integration_output_folder)
if logger.apply_gcorr:
self.applyGCorr.setText("Yes")
else:
self.applyGCorr.setText("No")
def clear_dashboard(self):
"""Initialise all values in stats and spectral analysis dashboard."""
self.accXCol.setText("-")
self.accYCol.setText("-")
self.accZCol.setText("-")
self.angRateXCol.setText("-")
self.angRateYCol.setText("-")
self.applyGCorr.setText("Yes")
self.integrationFolder.setText("Displacements and Angles")
class EditIntegrationSetupDialog(QtWidgets.QDialog):
def __init__(self, parent=None, control=Control(), logger_idx=0):
super(EditIntegrationSetupDialog, self).__init__(parent)
self.parent = parent
# Store control settings and selected logger properties objects
self.control = control
self.logger_idx = logger_idx
# Combobox lists
# Units
self.disp_units = ["-", "mm to m"]
self.angle_units = ["-", "rad to deg"]
try:
self.logger = control.loggers[logger_idx]
except IndexError:
self.logger = LoggerProperties()
self._init_ui()
self._connect_signals()
self._set_dialog_data(self.logger)
# Populate copy loggers combo box
self._set_copy_logger_combo()
def _init_ui(self):
self.setWindowTitle("Edit Time Series Integration Settings")
# self.setMinimumWidth(600)
# WIDGETS
self.copyLogger = QtWidgets.QComboBox()
self.copyLogger.setMinimumWidth(80)
self.copyLogger.addItem("-")
self.copyLoggerButton = QtWidgets.QPushButton("&Copy")
# Check boxes and output folder
self.applyGCorr = QtWidgets.QCheckBox("Apply gravity correction")
self.outputRMSSummary = QtWidgets.QCheckBox("Output logger RMS summary")
self.integrationFolder = QtWidgets.QLineEdit()
self.integrationFolder.setFixedWidth(200)
# Column selectors
self.accXCombo = QtWidgets.QComboBox()
self.accXCombo.setFixedWidth(200)
self.accYCombo = QtWidgets.QComboBox()
self.accYCombo.setFixedWidth(200)
self.accZCombo = QtWidgets.QComboBox()
self.accZCombo.setFixedWidth(200)
self.angRateXCombo = QtWidgets.QComboBox()
self.angRateXCombo.setFixedWidth(200)
self.angRateYCombo = QtWidgets.QComboBox()
self.angRateYCombo.setFixedWidth(200)
# Unit conversions
self.accXUnitConvCombo = QtWidgets.QComboBox()
self.accXUnitConvCombo.setFixedWidth(80)
self.accXUnitConvCombo.addItems(self.disp_units)
self.accYUnitConvCombo = QtWidgets.QComboBox()
self.accYUnitConvCombo.setFixedWidth(80)
self.accYUnitConvCombo.addItems(self.disp_units)
self.accZUnitConvCombo = QtWidgets.QComboBox()
self.accZUnitConvCombo.setFixedWidth(80)
self.accZUnitConvCombo.addItems(self.disp_units)
self.angRateXUnitConvCombo = QtWidgets.QComboBox()
self.angRateXUnitConvCombo.setFixedWidth(80)
self.angRateXUnitConvCombo.addItems(self.angle_units)
self.angRateYUnitConvCombo = QtWidgets.QComboBox()
self.angRateYUnitConvCombo.setFixedWidth(80)
self.angRateYUnitConvCombo.addItems(self.angle_units)
# Low cut-off frequencies
self.accXLowCutoff = QtWidgets.QLineEdit("0.25")
self.accXLowCutoff.setFixedWidth(40)
self.accYLowCutoff = QtWidgets.QLineEdit("0.25")
self.accYLowCutoff.setFixedWidth(40)
self.accZLowCutoff = QtWidgets.QLineEdit("0.25")
self.accZLowCutoff.setFixedWidth(40)
self.angRateXLowCutoff = QtWidgets.QLineEdit("0.25")
self.angRateXLowCutoff.setFixedWidth(40)
self.angRateYLowCutoff = QtWidgets.QLineEdit("0.25")
self.angRateYLowCutoff.setFixedWidth(40)
# High cut-off frequencies
self.accXHighCutoff = QtWidgets.QLineEdit("2.0")
self.accXHighCutoff.setFixedWidth(40)
self.accYHighCutoff = QtWidgets.QLineEdit("2.0")
self.accYHighCutoff.setFixedWidth(40)
self.accZHighCutoff = QtWidgets.QLineEdit("2.0")
self.accZHighCutoff.setFixedWidth(40)
self.angRateXHighCutoff = QtWidgets.QLineEdit("2.0")
self.angRateXHighCutoff.setFixedWidth(40)
self.angRateYHighCutoff = QtWidgets.QLineEdit("2.0")
self.angRateYHighCutoff.setFixedWidth(40)
# Labels
lblCopy = QtWidgets.QLabel("Logger settings to copy (optional):")
lblAccX = QtWidgets.QLabel("Acceleration X:")
lblAccY = QtWidgets.QLabel("Acceleration Y:")
lblAccZ = QtWidgets.QLabel("Acceleration Z:")
lblAngRateX = QtWidgets.QLabel("Angular rate X:")
lblAngRateY = QtWidgets.QLabel("Angular rate Y:")
lblIntegrationFolder = QtWidgets.QLabel("Output folder:")
# Header labels
lblChannel = QtWidgets.QLabel("Column")
lblUnitConv = QtWidgets.QLabel("Units Conversion")
lblCutoffFreqs = QtWidgets.QLabel("Cut-off Freqs (Hz)")
lblLowCutoff = QtWidgets.QLabel("Low")
lblHighCutoff = QtWidgets.QLabel("High")
# CONTAINERS
policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
# Copy logger group and output folder container
self.hboxCopy = QtWidgets.QHBoxLayout()
self.hboxCopy.addWidget(lblCopy)
self.hboxCopy.addWidget(self.copyLogger)
self.hboxCopy.addWidget(self.copyLoggerButton)
self.hboxCopy.addStretch()
# Columns to process settings group
self.setupGroup = QtWidgets.QGroupBox("Channel Settings to Convert to Displacements/Angles")
self.setupGroup.setSizePolicy(policy)
self.grid = QtWidgets.QGridLayout(self.setupGroup)
# Header row
self.grid.addWidget(self.applyGCorr, 0, 0, 1, 2)
self.grid.addWidget(lblCutoffFreqs, 0, 3, 1, 2)
self.grid.addWidget(lblChannel, 1, 1)
self.grid.addWidget(lblUnitConv, 1, 2)
self.grid.addWidget(lblLowCutoff, 1, 3)
self.grid.addWidget(lblHighCutoff, 1, 4)
# Col 1 - labels
self.grid.addWidget(lblAccX, 2, 0)
self.grid.addWidget(lblAccY, 3, 0)
self.grid.addWidget(lblAccZ, 4, 0)
self.grid.addWidget(lblAngRateX, 5, 0)
self.grid.addWidget(lblAngRateY, 6, 0)
# Col 2 - columns
self.grid.addWidget(self.accXCombo, 2, 1)
self.grid.addWidget(self.accYCombo, 3, 1)
self.grid.addWidget(self.accZCombo, 4, 1)
self.grid.addWidget(self.angRateXCombo, 5, 1)
self.grid.addWidget(self.angRateYCombo, 6, 1)
# Col 3 - unit conversions
self.grid.addWidget(self.accXUnitConvCombo, 2, 2)
self.grid.addWidget(self.accYUnitConvCombo, 3, 2)
self.grid.addWidget(self.accZUnitConvCombo, 4, 2)
self.grid.addWidget(self.angRateXUnitConvCombo, 5, 2)
self.grid.addWidget(self.angRateYUnitConvCombo, 6, 2)
# Col 4 - low cut-offs
self.grid.addWidget(self.accXLowCutoff, 2, 3)
self.grid.addWidget(self.accYLowCutoff, 3, 3)
self.grid.addWidget(self.accZLowCutoff, 4, 3)
self.grid.addWidget(self.angRateXLowCutoff, 5, 3)
self.grid.addWidget(self.angRateYLowCutoff, 6, 3)
# Col 5 - high cut-offs
self.grid.addWidget(self.accXHighCutoff, 2, 4)
self.grid.addWidget(self.accYHighCutoff, 3, 4)
self.grid.addWidget(self.accZHighCutoff, 4, 4)
self.grid.addWidget(self.angRateXHighCutoff, 5, 4)
self.grid.addWidget(self.angRateYHighCutoff, 6, 4)
self.setupForm = QtWidgets.QFormLayout()
self.setupForm.addRow(self.outputRMSSummary)
self.setupForm.addRow(lblIntegrationFolder, self.integrationFolder)
self.buttonBox = QtWidgets.QDialogButtonBox(
QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
)
# LAYOUT
# Horizontal groups
self.layout = QtWidgets.QVBoxLayout(self)
self.layout.addLayout(self.hboxCopy)
self.layout.addWidget(self.setupGroup)
self.layout.addLayout(self.setupForm)
self.layout.addStretch()
self.layout.addWidget(self.buttonBox)
self.setFixedSize(self.sizeHint())
def _connect_signals(self):
self.buttonBox.accepted.connect(self.on_ok_clicked)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.copyLoggerButton.clicked.connect(self.on_copy_logger_clicked)
def _set_dialog_data(self, logger):
"""Set dialog data with logger stats from control object."""
if not self.parent:
return
# Set gravity correction and output folder
self.applyGCorr.setChecked(logger.apply_gcorr)
self.outputRMSSummary.setChecked(logger.output_rms_summary)
self.integrationFolder.setText(self.control.integration_output_folder)
# Ned to clear combo boxes if copying settings from another logger
self.accXCombo.clear()
self.accYCombo.clear()
self.accZCombo.clear()
self.angRateXCombo.clear()
self.angRateYCombo.clear()
# Get combo columns
columns = ["Not used"] + logger.all_channel_names
# Populate channel section combo boxes
self.accXCombo.addItems(columns)
self.accYCombo.addItems(columns)
self.accZCombo.addItems(columns)
self.angRateXCombo.addItems(columns)
self.angRateYCombo.addItems(columns)
# Set channels to convert
self.accXCombo.setCurrentText(logger.acc_x_col)
self.accYCombo.setCurrentText(logger.acc_y_col)
self.accZCombo.setCurrentText(logger.acc_z_col)
self.angRateXCombo.setCurrentText(logger.ang_rate_x_col)
self.angRateYCombo.setCurrentText(logger.ang_rate_y_col)
# Set units conversion
self.accXUnitConvCombo.setCurrentText(logger.acc_x_units_conv)
self.accYUnitConvCombo.setCurrentText(logger.acc_y_units_conv)
self.accZUnitConvCombo.setCurrentText(logger.acc_z_units_conv)
self.angRateXUnitConvCombo.setCurrentText(logger.ang_rate_x_units_conv)
self.angRateYUnitConvCombo.setCurrentText(logger.ang_rate_y_units_conv)
# Set low cut-off frequencies
self.accXLowCutoff.setText(freq_val_to_str(logger.acc_x_low_cutoff))
self.accYLowCutoff.setText(freq_val_to_str(logger.acc_y_low_cutoff))
self.accZLowCutoff.setText(freq_val_to_str(logger.acc_z_low_cutoff))
self.angRateXLowCutoff.setText(freq_val_to_str(logger.ang_rate_x_low_cutoff))
self.angRateYLowCutoff.setText(freq_val_to_str(logger.ang_rate_y_low_cutoff))
# Set high cut-off frequencies
self.accXHighCutoff.setText(freq_val_to_str(logger.acc_x_high_cutoff))
self.accYHighCutoff.setText(freq_val_to_str(logger.acc_y_high_cutoff))
self.accZHighCutoff.setText(freq_val_to_str(logger.acc_z_high_cutoff))
self.angRateXHighCutoff.setText(freq_val_to_str(logger.ang_rate_x_high_cutoff))
self.angRateYHighCutoff.setText(freq_val_to_str(logger.ang_rate_y_high_cutoff))
def _set_copy_logger_combo(self):
"""Set the copy screening settings combo box with list of available loggers, excluding the current one."""
# Get list of available loggers to copy
loggers_to_copy = [i for i in self.control.logger_ids if i != self.logger.logger_id]
self.copyLogger.addItems(loggers_to_copy)
def on_copy_logger_clicked(self):
"""Copy screening settings from another logger selected in the combo box."""
# Get logger to copy
ref_logger_id = self.copyLogger.currentText()
if ref_logger_id == "-":
return
# Create a temp logger to copy setting so that settings can be confirmed by the user
# before mapping to the control logger
temp_logger = LoggerProperties()
# Map integration settings from reference logger to active logger and update dialog properties
self.control.copy_logger_integration_settings(ref_logger_id, temp_logger)
# Set dialog with temp settings so they can confirmed by the user
self._set_dialog_data(temp_logger)
def on_ok_clicked(self):
"""Assign logger stats settings to the control object and update the dashboard."""
if self.parent is None:
return
self.logger = self._set_control_data()
self.parent.set_analysis_dashboard(self.logger)
def _set_control_data(self):
"""Assign values to the control object."""
# Retrieve control logger to map confirmed settings to
logger = self.control.loggers[self.logger_idx]
logger.apply_gcorr = self.applyGCorr.isChecked()
logger.output_rms_summary = self.outputRMSSummary.isChecked()
self.control.integration_output_folder = self.integrationFolder.text()
# Channels to convert
logger.acc_x_col = self.accXCombo.currentText()
logger.acc_y_col = self.accYCombo.currentText()
logger.acc_z_col = self.accZCombo.currentText()
logger.ang_rate_x_col = self.angRateXCombo.currentText()
logger.ang_rate_y_col = self.angRateYCombo.currentText()
# Units conversion
logger.acc_x_units_conv = self.accXUnitConvCombo.currentText()
logger.acc_y_units_conv = self.accYUnitConvCombo.currentText()
logger.acc_z_units_conv = self.accZUnitConvCombo.currentText()
logger.ang_rate_x_units_conv = self.angRateXUnitConvCombo.currentText()
logger.ang_rate_y_units_conv = self.angRateYUnitConvCombo.currentText()
# Low cut-off frequencies
logger.acc_x_low_cutoff = freq_str_to_val(self.accXLowCutoff.text())
logger.acc_y_low_cutoff = freq_str_to_val(self.accYLowCutoff.text())
logger.acc_z_low_cutoff = freq_str_to_val(self.accZLowCutoff.text())
logger.ang_rate_x_low_cutoff = freq_str_to_val(self.angRateXLowCutoff.text())
logger.ang_rate_y_low_cutoff = freq_str_to_val(self.angRateYLowCutoff.text())
# High cut-off frequencies
logger.acc_x_high_cutoff = freq_str_to_val(self.accXHighCutoff.text())
logger.acc_y_high_cutoff = freq_str_to_val(self.accYHighCutoff.text())
logger.acc_z_high_cutoff = freq_str_to_val(self.accZHighCutoff.text())
logger.ang_rate_x_high_cutoff = freq_str_to_val(self.angRateXHighCutoff.text())
logger.ang_rate_y_high_cutoff = freq_str_to_val(self.angRateYHighCutoff.text())
return logger
def freq_val_to_str(freq):
"""Convert logger frequency value to string to set to widget."""
if freq is None:
str_val = "None"
else:
str_val = f"{freq:.2f}"
return str_val
def freq_str_to_val(str_val):
"""Convert widget string input to frequency value."""
try:
freq = float(str_val)
if freq == 0:
freq = None
except ValueError:
freq = None
return freq
if __name__ == "__main__":
# For testing widget layout
app = QtWidgets.QApplication(sys.argv)
# win = TimeSeriesIntegrationSetupTab()
win = EditIntegrationSetupDialog()
win.show()
app.exit(app.exec_())
| [
"craig.dickinson@2hoffshore.com"
] | craig.dickinson@2hoffshore.com |
35d99c94d8fbf0df2eb3e6cc2c0ef0d44c95e3dd | 6b3e8b4291c67195ad51e356ba46602a15d5fe38 | /test_v2/core/test_config.py | 311cc073a68e5459dfd6c8c248fdf2f4f5fda633 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | csaybar/raster-vision | 4f5bb1125d4fb3ae5c455db603d8fb749221dd74 | 617ca15f64e3b8a391432306a743f7d0dfff352f | refs/heads/master | 2021-02-26T19:02:53.752971 | 2020-02-27T17:25:31 | 2020-02-27T17:25:31 | 245,547,406 | 2 | 1 | NOASSERTION | 2020-03-07T01:24:09 | 2020-03-07T01:24:08 | null | UTF-8 | Python | false | false | 3,493 | py | from typing import List
import unittest
import copy
from pydantic.error_wrappers import ValidationError
from rastervision2.pipeline.config import (Config, register_config, build_config,
upgrade_config, Upgrader)
class AConfig(Config):
x: str = 'x'
@register_config('asub1')
class ASub1Config(AConfig):
y: str = 'y'
@register_config('asub2')
class ASub2Config(AConfig):
y: str = 'y'
class BConfig(Config):
x: str = 'x'
class UpgradeC1(Upgrader):
def upgrade(self, cfg_dict):
cfg_dict = copy.deepcopy(cfg_dict)
cfg_dict['x'] = cfg_dict['y']
del cfg_dict['y']
return cfg_dict
@register_config('c', version=1, upgraders=[UpgradeC1()])
class CConfig(Config):
al: List[AConfig]
bl: List[BConfig]
a: AConfig
b: BConfig
x: str = 'x'
class TestConfig(unittest.TestCase):
def test_to_from(self):
cfg = CConfig(
al=[AConfig(), ASub1Config(),
ASub2Config()],
bl=[BConfig()],
a=ASub1Config(),
b=BConfig())
exp_dict = {
'type_hint':
'c',
'version':
1,
'a': {
'type_hint': 'asub1',
'x': 'x',
'y': 'y'
},
'al': [{
'x': 'x'
}, {
'type_hint': 'asub1',
'x': 'x',
'y': 'y'
}, {
'type_hint': 'asub2',
'x': 'x',
'y': 'y'
}],
'b': {
'x': 'x'
},
'bl': [{
'x': 'x'
}],
'x':
'x'
}
self.assertDictEqual(cfg.dict(), exp_dict)
self.assertEqual(build_config(exp_dict), cfg)
def test_no_extras(self):
with self.assertRaises(ValidationError):
BConfig(zz='abc')
def test_upgrade(self):
c_dict_v0 = {
'type_hint':
'c',
'version':
0,
'a': {
'type_hint': 'asub1',
'x': 'x',
'y': 'y'
},
'al': [{
'x': 'x'
}, {
'type_hint': 'asub1',
'x': 'x',
'y': 'y'
}, {
'type_hint': 'asub2',
'x': 'x',
'y': 'y'
}],
'b': {
'x': 'x'
},
'bl': [{
'x': 'x'
}],
'y':
'x'
}
c_dict_v1 = {
'type_hint':
'c',
'version':
1,
'a': {
'type_hint': 'asub1',
'x': 'x',
'y': 'y'
},
'al': [{
'x': 'x'
}, {
'type_hint': 'asub1',
'x': 'x',
'y': 'y'
}, {
'type_hint': 'asub2',
'x': 'x',
'y': 'y'
}],
'b': {
'x': 'x'
},
'bl': [{
'x': 'x'
}],
'x':
'x'
}
upgraded_c_dict = upgrade_config(c_dict_v0)
self.assertDictEqual(upgraded_c_dict, c_dict_v1)
if __name__ == '__main__':
unittest.main()
| [
"lewfish@gmail.com"
] | lewfish@gmail.com |
ce4380b5ead7baf3ced8900e300b1b950166c35e | d240c2790443f45de041ae25446997c5b84bae74 | /ppdai/ppdai_train_mlc.py | 023d8a612a2ffa91bb3875b8b9c61f2a89c090ad | [] | no_license | MingYates/QMATCH | 336ac89848830765ae05988e0aaed112d3951595 | 76b520ebbfce2b0c04a991480dfbb98025b9dbb4 | refs/heads/master | 2020-03-27T15:49:26.199647 | 2018-08-30T12:47:55 | 2018-08-30T12:47:55 | 146,741,804 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,955 | py | # -*- coding: utf-8 -*-
import numpy as np
import pickle
from ppdai_utils import *
# read train pair
data = []
import csv
trainfile = '/files/faust/COMPETITION/ppdai/train.csv'
with open(trainfile) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
data.append((row['q1'], row['q2'], row['label']))
if not row['q1'] == row['q2']:
data.append((row['q2'], row['q1'], row['label']))
print(len(data))
indim = len(wdict) + 1
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras import regularizers
model = Sequential()
model.add(Dense(units=2048, activation="tanh", input_dim=indim))
model.add(Dense(units=1024, activation="tanh"))
model.add(Dropout(0.5))
model.add(Dense(units=indim, activation="sigmoid", kernel_regularizer=regularizers.l1(0.001)))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['mse'])
## split train/test
import random
random.shuffle(data)
traindata = data[:int(len(data)*0.9)]
testdata = data[int(len(data)*0.9):]
print(len(traindata))
print(len(testdata))
## filter unmatch pairs
traindata_pos = [q for q in traindata if q[2] == '1']
testdata_pos = [q for q in testdata if q[2] == '1']
print(len(traindata_pos))
## add copy pair
qidlist = list(questions.keys())
qid_sample = random.sample(qidlist, len(traindata_pos))
traindata_copy = [(qid, qid, 1) for qid in qid_sample]
traindata_pos.extend(traindata_copy)
random.shuffle(traindata_pos)
print(len(traindata_pos))
## generate vector
train_x = np.array([getvector_with_id(q[0]) for q in traindata_copy])
train_y = np.array([getvector_with_id(q[1]) for q in traindata_copy])
test_x = np.array([getvector_with_id(q[0]) for q in testdata_pos])
test_y = np.array([getvector_with_id(q[1]) for q in testdata_pos])
EPOCH = 10
BATCH_SIZE = 128
model.fit(train_x, train_y, validation_data=(test_x, test_y), epochs=EPOCH, batch_size=BATCH_SIZE)
model.save('ppdai_mlc.model')
| [
"mingyates@163.com"
] | mingyates@163.com |
d992dc6e406ab8fbad3aebc90fc1b8a3592c3027 | 50948d4cb10dcb1cc9bc0355918478fb2841322a | /sdk/servicebus/azure-servicebus/examples/async_examples/example_queue_send_receive_batch_async.py | 2ae76d4e5a94a9d9b0c3c20ade55f474df3daa07 | [
"MIT"
] | permissive | xiafu-msft/azure-sdk-for-python | de9cd680b39962702b629a8e94726bb4ab261594 | 4d9560cfd519ee60667f3cc2f5295a58c18625db | refs/heads/master | 2023-08-12T20:36:24.284497 | 2019-05-22T00:55:16 | 2019-05-22T00:55:16 | 187,986,993 | 1 | 0 | MIT | 2020-10-02T01:17:02 | 2019-05-22T07:33:46 | Python | UTF-8 | Python | false | false | 1,914 | py | # ------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------
import asyncio
import conftest
from azure.servicebus.aio import ServiceBusClient, Message
from azure.servicebus.common.constants import ReceiveSettleMode
async def sample_queue_send_receive_batch_async(sb_config, queue):
client = ServiceBusClient(
service_namespace=sb_config['hostname'],
shared_access_key_name=sb_config['key_name'],
shared_access_key_value=sb_config['access_key'],
debug=True)
queue_client = client.get_queue(queue)
async with queue_client.get_sender() as sender:
for i in range(100):
message = Message("Sample message no. {}".format(i))
await sender.send(message)
await sender.send(Message("shutdown"))
async with queue_client.get_receiver(idle_timeout=1, mode=ReceiveSettleMode.PeekLock, prefetch=10) as receiver:
# Receive list of messages as a batch
batch = await receiver.fetch_next(max_batch_size=10)
await asyncio.gather(*[m.complete() for m in batch])
# Receive messages as a continuous generator
async for message in receiver:
print("Message: {}".format(message))
print("Sequence number: {}".format(message.sequence_number))
await message.complete()
if __name__ == '__main__':
live_config = conftest.get_live_servicebus_config()
queue_name = conftest.create_standard_queue(live_config)
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(sample_queue_send_receive_batch_async(live_config, queue_name))
finally:
conftest.cleanup_queue(live_config, queue_name)
| [
"lmazuel@microsoft.com"
] | lmazuel@microsoft.com |
cf64ede3ff33b6e4776e5e0b349c1111dd97ae1f | cb2ac8ecab578c52024b23934db7426299485a15 | /lostnotice/migrations/0001_initial.py | f81740a30623096a14a653d34eb796a7669cc253 | [] | no_license | spfrank01/lostNoticeApp | 2d074aee2f9fba9dfa02fef7a1e863c868ae4f1e | 04ac9da320196ac7397d907defaab172a5d64fd4 | refs/heads/master | 2019-04-09T04:34:32.359374 | 2017-07-10T17:23:48 | 2017-07-10T17:23:48 | 89,140,047 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,354 | py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-27 15:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='FindOwnerList',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200)),
('name_item', models.CharField(max_length=200)),
('time_found', models.CharField(max_length=200)),
('location_found', models.CharField(max_length=200)),
('detail', models.CharField(max_length=1000)),
('your_name', models.CharField(max_length=200)),
('your_email', models.CharField(max_length=200)),
('found_owner', models.BooleanField(default=False)),
('time_submit', models.DateTimeField(verbose_name='date published')),
],
),
migrations.CreateModel(
name='LostNoticeList',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200)),
('name_item', models.CharField(max_length=200)),
('time_lost', models.CharField(max_length=200)),
('location_lost', models.CharField(max_length=200)),
('detail', models.CharField(max_length=1000)),
('your_name', models.CharField(max_length=200)),
('your_email', models.CharField(max_length=200)),
('found_it', models.BooleanField(default=False)),
('time_submit', models.DateTimeField(verbose_name='date published')),
],
),
migrations.CreateModel(
name='userData',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('username', models.CharField(max_length=100)),
('email', models.CharField(max_length=100)),
('password', models.CharField(max_length=100)),
],
),
]
| [
"s5801012630149@email.kmutnb.ac.th"
] | s5801012630149@email.kmutnb.ac.th |
ec3a12aecc415b369b93adf89cec1892773eea61 | d592fe644a7b8f4903db8396778f5044d04b455d | /localllibrary/localllibrary/urls.py | cf1615061242f2c4e68bf2285d638d0b658922b4 | [] | no_license | asisgtm/django_projects | 5dfeee16403596b519fe0ed2e7f34c4ed78f83a8 | a5c25444f168c127bfe78959f5d90d4b50109511 | refs/heads/master | 2022-11-13T01:39:55.608196 | 2020-07-14T06:00:47 | 2020-07-14T06:00:47 | 276,322,228 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,074 | py | """localllibrary URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.views.generic import RedirectView
from django.urls import include
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('catalog/', include('catalog.urls')),
path('', RedirectView.as_view(url='catalog/')),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
| [
"mayakomantra@gmail.com"
] | mayakomantra@gmail.com |
672af7c8425274fa8e16002a8c1fe86797d349c2 | fa9d6939abdf7f37f344f2db897f1398f34def72 | /app/app/urls.py | e9f1bdcfca0fd171d83d1163d9477352bc65ac10 | [] | no_license | ManuelVict/pruebaBmovilHosptital | 2fc903b7e6f8de35bae49b9b32f042cbf60e2176 | 2bba55f6e6b3c7610e300fcc039fc2c63f00e1a7 | refs/heads/main | 2023-06-03T06:35:16.869945 | 2021-06-20T21:17:57 | 2021-06-20T21:17:57 | 378,738,412 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,864 | py | """app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.contrib.auth import login,logout
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.conf.urls.static import static
from rest_framework import routers
from chat import views
from chat.views import Login,logoutView,SendImages
urlpatterns = [
path('api/', include('chat.routers')),
path('admin/', admin.site.urls),
path('',include('chat.urls')),
path('',Login.as_view(),name='login'),
path('logout/',logoutView, name='logout'),
path('accounts/login/',Login.as_view(),name='required'),
path('index/', login_required(views.index), name="index"),
path('sendimage/',SendImages.as_view(),name="sendimage"),
path('chat/',login_required(views.chat), name='chat'),
path('<str:room>/',login_required(views.room), name='room'),
path('chat/checkview', login_required(views.checkview), name='checkview'),
path('send',views.send, name='send'),
path('getMessages/<str:room>/',views.getMessages, name='getMessages'),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT) | [
"manuelvictmont@gmail.com"
] | manuelvictmont@gmail.com |
ffbb2b82498d42910dd39e8bd061fbd2996a4e5f | 2e83e004d8a69a773d1e305152edd16e4ea35ed8 | /students/mgglez/lesson02/codingbat_exercises_not_graded/codingbat_list1.py | e258d0f76bf0c604cb1e98fa2b80ae820ff4594d | [] | no_license | UWPCE-PythonCert-ClassRepos/SP_Online_PY210 | 9b170efbab5efedaba8cf541e8fc42c5c8c0934d | 76224d0fb871d0bf0b838f3fccf01022edd70f82 | refs/heads/master | 2021-06-16T20:14:29.754453 | 2021-02-25T23:03:19 | 2021-02-25T23:03:19 | 161,077,720 | 19 | 182 | null | 2021-02-25T23:03:19 | 2018-12-09T20:18:25 | Python | UTF-8 | Python | false | false | 1,465 | py | # ---------------------------------------------------------------------------- #
# Title: Lesson 2
# Description: Python Push-ups Part 2 - Coding Bat List-1
# ChangeLog (Who,When,What):
# Mercedes Gonzalez Gonzalez,01-01-2021, Activity 2.1 - Python Push-ups Part 2
# ---------------------------------------------------------------------------- #
def first_last6(nums):
return nums[0] == 6 or nums[-1] == 6
def same_first_last(nums):
return len(nums) >= 1 and nums[0] == nums[-1]
def make_pi():
return [3,1,4]
def common_end(a, b):
return a[0] == b[0] or a[-1] == b[-1]
def sum3(nums):
sum = 0
for i in range(len(nums)):
sum += nums[i]
return sum
def rotate_left3(nums):
first = nums[0]
for i in range(1, len(nums)):
nums[i - 1] = nums[i]
nums[-1] = first
return nums
def reverse3(nums):
return nums[::-1]
def max_end3(nums):
max_value = max(nums[0], nums[-1])
for i in range(len(nums)):
nums[i] = max_value
return nums
def sum2(nums):
sum = 0
for i in range(len(nums)):
if i >= 2:
break
sum += nums[i]
return sum
def middle_way(a, b):
new_array = []
new_array.append(a[len(a)//2])
new_array.append(b[len(b)//2])
return new_array
def make_ends(nums):
return [nums[0], nums[-1]]
def has23(nums):
for i in range(len(nums)):
if nums[i] == 2 or nums[i] == 3:
return True
return False
| [
"mgglez@uw.edu"
] | mgglez@uw.edu |
7eda5a97fad289072f82478d7329261d232f6497 | d7587eab1e2ca838daad1ce1c8c58ed1ce9dd529 | /parse_database/viewparser.py | a85579fa62e6d0e505f9e88765d1d35c3751bf82 | [] | no_license | rcarbal/Log-Analysis | 6cce51464bba8cb76558f765790472a3a18ece5a | 8bacebbda009e79247f7ab19e1f3658d525aa3d6 | refs/heads/master | 2020-05-24T19:24:08.359852 | 2019-06-08T22:05:52 | 2019-06-08T22:05:52 | 187,433,173 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,286 | py | class View:
def print_parsed_data(self, data):
print(data)
def start_log_analisys(self):
print("\nStarting Log Analysis\n")
def finish_log_analisys(self):
print("Log Anaysis_Ended")
def print_top_articles(self, pop_articles):
print("\nThe most popular articles off all time, are:")
for index, article in enumerate(pop_articles):
if index == 0:
continue
pos = article[0].index('/', article[0].index('/') + 1)
print('\t"' + article[0][pos + 1:] + '" - {}'
.format(article[2]) + " views")
def show_get_most_popular_author(self, pop_authors):
print("\nThe most popular authors are:")
for author in pop_authors:
print('\t' + "{} - {} views".format(author[0], author[1]))
def show_days_with_most_error(self, error):
print('\nDays that had more than 1% erros:')
for day in error:
print('\t' + "{} {},{} - {}% errors".format(day[0].strftime("%B"),
day[0].strftime("%d"),
day[0].strftime("%Y"),
day[1]))
print('\n\n')
| [
"rcarbaleq2@gmail.com"
] | rcarbaleq2@gmail.com |
c902fa836f00dd2580c13082a26b279fe7eea3ac | e50a4781388ef7682a935986f2abae6fa85f879a | /MM2021/com-train/solution_ours/reno/run_all.py | 65fb1cffb7df772890b0ff1896c1de4bea648027 | [] | no_license | wojxhr/CG-trans-optimization | 2912156320db958e8aa6f797619acf59931be231 | 2b476b1291b972d22ec8e825eae21cbf4a597653 | refs/heads/master | 2023-08-24T23:05:31.526477 | 2021-10-22T03:01:29 | 2021-10-22T03:01:29 | 419,938,926 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,875 | py | from simple_emulator import SimpleEmulator, create_emulator
# We provided some function of plotting to make you analyze result easily in utils.py
from simple_emulator import analyze_emulator, plot_rate
from simple_emulator import constant
from simple_emulator import cal_qoe
import os
import importlib
import random
def path_cwd(traces_dir, blocks_dir):
traces_list = os.listdir(traces_dir)
for i in range(len(traces_list)):
traces_list[i] = traces_dir + '/' + traces_list[i]
blocks_list = os.listdir(blocks_dir)
for i in range(len(blocks_list)):
blocks_list[i] = blocks_dir + '/' + blocks_list[i]
return traces_list, blocks_list
def scenario_result(solution_file, path_dir, scenario):
qoe_sum = 0
random.seed(1)
solution = importlib.import_module(solution_file)
my_solution = solution.MySolution()
# select dataset
network_traces, block_traces = path_cwd(path_dir + scenario + "/networks", path_dir + scenario + "/blocks")
# The file path of packets' log
log_packet_file = "output/packet_log/packet-0.log"
# The first sender will use your solution, while the second sender will send the background traffic
# Set second_block_file=None if you want to evaluate your solution in situation of single flow
# Specify ENABLE_LOG to decide whether or not output the log of packets. ENABLE_LOG=True by default.
# You can get more information about parameters at https://github.com/AItransCompetition/simple_emulator/tree/master#constant
# The block files for the first sender
first_block_file = block_traces
# The block files for the second sender
second_block_file = [path_dir + "/background_traffic_traces/web.csv"]
# Create the emulator and evaluate your solution
for network_trace in network_traces:
emulator = create_emulator(
block_file=first_block_file,
second_block_file=second_block_file,
trace_file=network_trace,
solution=my_solution,
# enable logging packet. You can train faster if ENABLE_LOG=False
ENABLE_LOG=True
)
emulator.run_for_dur(15)
# emulator.print_debug()
# print(network_trace.split("/")[-1], "%.2f" % cal_qoe())
print("%.2f" % cal_qoe())
qoe_sum += cal_qoe()
print("%.2f" % qoe_sum)
# for scenario_1~scenario_3
if __name__ == '__main__':
# Select the solution file
# solution_file = 'test'
solution_file = 'solution_imp'
# solution_file = 'solution_ours.reno.method_3'
# solution_file = 'solution_ours.rl_Tensorflow.method_1.solution'
# solution_file = 'solution_ours.rl_Tensorflow.method_2.solution'
# set datasets path
path_dir = "./datasets/"
# select scenario
scenario = "scenario_1"
# print result
scenario_result(solution_file, path_dir, scenario)
| [
"391777866@qq.com"
] | 391777866@qq.com |
17462dd260e51ea711a24764afea07d4cfa5ac9d | 73dfbad8620dd50a7cf6929ab5d46533972e63e0 | /cern_pymad_io_tfs.py | 4fe226c4f2d32d21e5f5cde49f255220e80076eb | [] | no_license | TMsangohan/TimberExtraction | 4aa8f99c8d800ba4d50561ba748071e9c14af447 | e3c9319058133be4d57e3b622bbe571ab74ee7cf | refs/heads/master | 2020-12-24T20:52:29.108554 | 2016-06-06T15:55:27 | 2016-06-06T15:55:27 | 59,478,986 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,721 | py | import numpy
import os
from cern_pymad_domain_tfs import TfsTable, TfsSummary
import collections
def tfs(inputfile):
table,params=tfsDict(inputfile)
return TfsTable(table), TfsSummary(params)
def tfsDict(inputfile):
'''
.. py:function:: tfsDict(inputfile)
Read a tfs table and returns table/summary info
The function takes in a tfs file. It will add
all parameters into one dictionary, and the table
into another dictionary.
:param string inputfile: tfs file, full path
:raises ValueError: In case file path is not found
:rtype: tuple containing dictionaries (tfs table , summary)
See also: :mod:`pymad.domain.tfs`
'''
# params={}
params = collections.OrderedDict()
if not os.path.isfile(inputfile):
if os.path.isfile(inputfile+'.tfs'):
inputfile+='.tfs'
elif os.path.isfile(inputfile+'.TFS'):
inputfile+='.TFS'
else:
raise ValueError("ERROR: "+inputfile+" is not a valid file path")
f=file(inputfile,'r')
l=f.readline()
while(l):
if l.strip()[0]=='@':
_addParameter(params,l)
if l.strip()[0]=='*': # beginning of vector list...
names=l.split()[1:]
table=_read_table(f,names)
l=f.readline()
return table, params
##
# Add parameter to object
#
# Any line starting with an @ is a parameter.
# If that is found, this function should be called and given the line
#
# @param line The line from the file that should be added
def _addParameter(params,line):
lname=line.split()[1].lower()
if line.split()[2]=='%le':
params[lname]=float(line.split()[3])
if line.split()[2][-1]=='s':
params[lname]=line.split('"')[1]
if line.split()[2]=='%d':
params[lname]=int(line.split()[3])
##
# Reads in a table in tfs format.
# Input the file stream at the location
# where the names of the columns have just been read.
def _read_table(fstream,names):
l=fstream.readline()
types=[]
# table={}
table=collections.OrderedDict()
for n in names:
table[n.lower()]=[]
while(l):
if l.strip()[0]=='$':
types=l.split()[1:]
else:
for n,el in zip(names,l.split()):
table[n.lower()].append(el)
l=fstream.readline()
for n,typ in zip(names,types):
if typ=='%le':
table[n.lower()]=numpy.array(table[n.lower()],dtype=float)
elif typ=='%d':
table[n.lower()]=numpy.array(table[n.lower()],dtype=int)
elif typ=='%s':
for k in xrange(len(table[n.lower()])):
table[n.lower()][k]=table[n.lower()][k].split('"')[1]
return table
| [
"tomtommertens2@gmail.com"
] | tomtommertens2@gmail.com |
675f1e36ac0bfd64eeaaf88e02f30302b153caa7 | f090176c40a451bb7fd1ff1b74b2201d4fd1674e | /Lab2_Section_Body_Rotation/venv/Scripts/rst2html.py | 0f553ff15595435d5f142e86292bbd0afc65cb77 | [] | no_license | Zhavoronkova-Alina/CS_Labs_SPBPU_2019 | da9078a4817cfc1148d1b2187e01866f42c3322d | 22c16785f7fbd493a1a3ebd7671b34a4e3f4692c | refs/heads/master | 2022-04-09T19:08:03.297712 | 2020-03-13T22:20:51 | 2020-03-13T22:20:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 673 | py | #!D:\alina\Documents\GitHub\CS_Labs_SPBPU_2019\Lab2_Section_Body_Rotation\venv\Scripts\python.exe
# $Id: rst2html.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing HTML.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates (X)HTML documents from standalone reStructuredText '
'sources. ' + default_description)
publish_cmdline(writer_name='html', description=description)
| [
"alina010299@mail.ru"
] | alina010299@mail.ru |
827a73252485f27fc102934828a12fce3417fcd8 | 3007aa870cf7d61b97a2e473a0b0f0288acffdbc | /src/backend/tests/test_auth.py | b57bf25407158ca8fe989eaf08b25485f58dba07 | [] | no_license | svetazol/online-store | b2e26c86c7c9b649c921fec167e2887fb15736cf | 6f9d55e2c4268e1d64687ac4b54b7cdf1d1557ff | refs/heads/master | 2023-04-27T00:30:11.159047 | 2021-05-29T13:20:38 | 2021-05-29T13:20:38 | 338,033,732 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,799 | py | from aiohttp.test_utils import TestClient as _TestClient
async def test_signup_view(database, client: _TestClient):
valid_form = {
'login': 'Joe',
'password': '123',
'confirmed_password': '123'
}
resp = await client.post('/signup', data=valid_form)
assert resp.status == 200
invalid_form = {
'login': 'Sam',
'password': '123',
'confirmed_password': '1234'
}
resp = await client.post('/signup', data=invalid_form)
assert {'status': 'error', 'reason': 'Bad Request'} == await resp.json()
assert resp.status == 400
# todo process repeating error
resp = await client.post('/signup', data=valid_form)
assert resp.status == 500
resp = await resp.json()
assert resp["status"] == "failed"
async def test_login(database, client: _TestClient):
valid_form = {
'login': 'Adam',
'password': 'adam',
'confirmed_password': 'adam'
}
resp = await client.post('/signup', data=valid_form)
assert resp.status == 200
del valid_form["confirmed_password"]
resp = await client.post('/login', data=valid_form)
assert resp.status == 200
invalid_form = {
'login': 'Adam',
'password': 'adam_Wrong'
}
resp = await client.post('/login', data=invalid_form)
assert resp.status == 401
async def test_logout(database, client: _TestClient):
valid_form = {
'login': 'Adam',
'password': 'adam',
'confirmed_password': 'adam'
}
resp = await client.post('/signup', data=valid_form)
assert resp.status == 200
del valid_form["confirmed_password"]
resp = await client.post('/login', data=valid_form)
assert resp.status == 200
resp = await client.get('/logout')
assert resp.status == 200
| [
"s_zolotorevich@wargaming.net"
] | s_zolotorevich@wargaming.net |
52558978759df376076b22883319d8630be32cd7 | 0daacf3275ec3a3af6f6a93cc17694ee2d869c0e | /day_6_part_2/day_6_part_2.py | 95ef1c93e0f5ca773cb95663da077f7c3203c31f | [] | no_license | garethellis0/Advent-Of-Code | 9cb2cc1db71d30278010cb26a7fd79842b85d82a | 125729362c0207ec4ec39a98bb9d68837b5ff517 | refs/heads/master | 2020-12-25T15:09:09.612053 | 2016-06-12T21:45:58 | 2016-06-12T21:45:58 | 60,990,606 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,471 | py | class Instruction:
def __init__(self, command, x1, y1, x2, y2):
self.command = command
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
def toggle_light_state(lights, x, y):
# Toggles the light state of a light at a given coordinate
lights[x][y] += 2
return lights
def toggle_lights_state(lights, x1, y1, x2, y2):
for x in range(x1, x2+1):
for y in range(y1, y2+1):
lights = toggle_light_state(lights, x, y)
return lights
def change_lights_state(lights, x1, y1, x2, y2, state):
for x in range(x1, x2+1):
for y in range(y1, y2+1):
if state == 0 and lights[x][y] > 0:
lights[x][y] -= 1
if state == 1:
lights[x][y] += 1
return lights
def format_instruction(raw_instruction):
instruction1 = raw_instruction.replace(',', ' ').split(' ')
instruction1 = [x.strip('\n') for x in instruction1]
if instruction1[0] == 'turn':
command = ' '.join(instruction1[0:2])
x1 = int(instruction1[2])
y1 = int(instruction1[3])
x2 = int(instruction1[5])
y2 = int(instruction1[6])
else:
command = instruction1[0]
x1 = int(instruction1[1])
y1 = int(instruction1[2])
x2 = int(instruction1[4])
y2 = int(instruction1[5])
return Instruction(command, x1, y1, x2, y2)
# An array of [x, y] coordinates, representing all lights on
lights = [[0 for x in range(0, 1000)] for y in range(0, 1000)]
raw_instructions = open('data', 'r')
raw_instructions = list(raw_instructions)
instructions = [format_instruction(instruction) for instruction in raw_instructions[0:len(list(raw_instructions)) - 1]]
for instruction in instructions:
print(instruction.command)
print(instruction.x1)
print(instruction.y1)
print(instruction.x2)
print(instruction.y2)
if instruction.command == 'toggle':
lights = toggle_lights_state(lights, instruction.x1, instruction.y1, instruction.x2, instruction.y2)
elif instruction.command == 'turn on':
lights = change_lights_state(lights, instruction.x1, instruction.y1, instruction.x2, instruction.y2, 1)
elif instruction.command == 'turn off':
lights = change_lights_state(lights, instruction.x1, instruction.y1, instruction.x2, instruction.y2, 0)
ticker = 0
for row in lights:
print(row)
for light in row:
ticker += light
print(ticker) | [
"gareth.ellis0@gmail.com"
] | gareth.ellis0@gmail.com |
460b37b52c5f3a1e2be60fa83d12adf3397830e8 | f3609fab850acec9926588f212f175c52efab9e9 | /cubeapp/migrations/0003_realobject_description.py | 12c532fec9988088496d8fb8dd94369f1355bbfa | [] | no_license | adamchainz/cubeapp | ced6d3e92e7eb3284343684c8daf4ad6672acd99 | 6790f66b64a90924c96189b0f618767592bdfa30 | refs/heads/master | 2023-07-07T14:43:50.140164 | 2018-10-22T07:26:14 | 2018-10-22T07:26:14 | 158,301,814 | 0 | 0 | null | 2018-11-19T23:09:33 | 2018-11-19T23:09:32 | null | UTF-8 | Python | false | false | 442 | py | # Generated by Django 2.1.2 on 2018-10-15 07:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cubeapp', '0002_auto_20181014_1933'),
]
operations = [
migrations.AddField(
model_name='realobject',
name='description',
field=models.CharField(default='', max_length=200),
preserve_default=False,
),
]
| [
"adamurban98@gmail.com"
] | adamurban98@gmail.com |
42c5306ecf2da84b440acd121e8c105de69c03a1 | 5543e3958dcd258e1409333fd5ca62f53ebb9238 | /python_challenges/reverse_string.py | 19f7e24c0dd5a2a59a977b9b9e0a54cb0fb62f4e | [
"MIT"
] | permissive | bruckhaus/challenges | 3c1bb61673bbaf3882b98413f873cfa0f5831572 | c53d13fa89bd5ac0436310a6cfe82cfc3b2d122f | refs/heads/master | 2021-05-24T04:03:21.813428 | 2020-11-28T09:29:39 | 2020-11-28T09:29:39 | 20,837,063 | 3 | 2 | MIT | 2020-11-28T09:29:40 | 2014-06-14T17:01:57 | Java | UTF-8 | Python | false | false | 253 | py | __author__ = 'tilmannbruckhaus'
def reverse_string(input_string):
output = input_string[::-1]
return output
if __name__ == '__main__':
s = 'This is my TEST String!'
print "The reverse of string [", s, "] is [", reverse_string(s), "]"
| [
"Tilmann.Bruckhaus@gmail.com"
] | Tilmann.Bruckhaus@gmail.com |
3f6fcd229481fd294d13fb14d270eb7d6b8ed24d | d39fc7d274d7ee32984bfc66215767ab9d45e540 | /PyBank/main.py | 837ae834c6e15ac2f10e939202e14fbf36e29ef9 | [] | no_license | rayraysheng/python-challenge | 72f679abc18646f900d7f54fd9625b9aa8bfc63c | 1f7973c59ba6b65ab8468d9947ffa7576a6e70f5 | refs/heads/master | 2021-08-22T05:49:11.778081 | 2017-11-29T11:57:05 | 2017-11-29T11:57:05 | 111,487,321 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,306 | py | import os
import csv
# I've set up an input_files folder and an output_files folder
# The input_files folder will hold the input .csv files
# The program will create a summary with each input file
# The summary .txt files will be written to the output_files folder
# Work on each file in the input_files folder
for filename in os.listdir("input_files"):
csv_path = os.path.join("input_files", filename)
with open(csv_path, newline="") as csv_file:
# Turn the .csv file into a csv reader
file_reader = csv.reader(csv_file, delimiter=",")
# Skip header row
next(file_reader)
# I haven't found a way to work with index of rows in a csv reader
# So I will convert the csv reader to a list of lists to work on it
working_file = list(file_reader)
# Keep running tallies of summary values
total_months = 0
total_rev = 0
greatest_inc = 0
greatest_dec = 0
# Record the revenue changes in a list to calculate average
delta_rev = []
for item in working_file:
# Update tallies of months and revenue
total_months += 1
total_rev += float(item[1])
# Record the monthly change for each month
# Update monthly change list, but no for the first month
(working_file.index(item) + 1)
if working_file.index(item) == 0:
item.append(0)
else:
item.append(float(item[1]) - float(working_file[working_file.index(item) - 1][1]))
delta_rev.append(item[2])
# Check to see if the month's change is the new greatest increase
# If it is, update it
if float(item[2]) > greatest_inc:
inc_summary = item[0] + " ($" + str(item[2])
# Check to see if the month's change is the new greatest decrease
# If it is, update it
if float(item[2]) < greatest_dec:
dec_summary = item[0] + " ($" + str(item[2])
# Calculate the average revenue change
avg_rev_change = sum(delta_rev)/len(delta_rev)
# Now print everything
print("Financial Analysis")
print("-------------------------------")
print("Total Months: " + str(total_months))
print("Total Revenue: $" + str(total_rev))
print("Average Revenue Change: $" + str(avg_rev_change))
print("Greatest Increase in Revenue: " + inc_summary + ")")
print("Greatest Decrease in Revenue: " + dec_summary + ")")
print("")
print("")
# Write the output .txt file for each input file
output_file_name = filename + "_summary.txt"
output_path = os.path.join("output_files", output_file_name)
summary_file = open(output_path, "w")
summary_file.write(
"Financial Analysis" + "\n"
+ "-------------------------------" + "\n"
+ "Total Months: " + str(total_months) + "\n"
+ "Total Revenue: $" + str(total_rev) + "\n"
+ "Average Revenue Change: $" + str(avg_rev_change) + "\n"
+ "Greatest Increase in Revenue: " + inc_summary + ")" + "\n"
+ "Greatest Decrease in Revenue: " + dec_summary + ")"
)
summary_file.close() | [
"shengyumeng@gmail.com"
] | shengyumeng@gmail.com |
ea008a111eb96f82d895e7a7759d586f208564d1 | cfdd6d24f7139d057d13afe32f1dc1de64b33c3f | /src/pyglow/hwm.py | e22259c414fd80d93573e3a9615abd94fc3376fd | [
"MIT"
] | permissive | timduly4/pyglow | cec15d7afe7f90dc5f2f019626f63622da4c3de0 | 1988757f3b6a4bd5ed98266a3fb1dc64f2513fc5 | refs/heads/master | 2023-05-10T19:02:52.777677 | 2023-05-02T19:07:51 | 2023-05-02T19:07:51 | 12,006,247 | 105 | 60 | MIT | 2023-05-02T19:09:55 | 2013-08-09T17:06:55 | Fortran | UTF-8 | Python | false | false | 5,426 | py | import os
import numpy as np
from .constants import DIR_FILE, nan
from hwm93py import gws5 as hwm93
from hwm07py import hwmqt as hwm07
from hwm14py import hwm14
class HWM(object):
def __init__(self):
""" Constructor for HWM representation """
self.u = nan
self.v = nan
self.hwm_version = None
self.hwm_dwm = None
# Data path:
self.data_path_stub = DIR_FILE
self.testing_data_stub = False
# Override if using local source (typically for testing):
if 'src' in self.data_path_stub:
self.data_path_stub = "src/pyglow/models/dl_models"
self.testing_data_stub = True
def run(self, location_time, version, dwm = 'on',
f107=None, f107a=None, ap=None, ap_daily=None, ap1 = None):
"""
Wrapper to call various HWM models
:param location_time: Instance of LocationTime
:param version: Version of HWM to run
:param dwm: How to do DWM -> 'on','off',interpolated
:param f107: f107 indice (used for 93, 07)
:param f107a: f107a indice (used for 93, 07)
:param ap: ap indice (used for 07, 14)
:param ap_daily: ap_daily indice (used for 93)
"""
if dwm == 'off':
ap = -1
elif dwm == 'on':
ap = ap
elif dwm == 'smooth':
ap = ap1
self.hwm_dwm = dwm
# HWM93:
if version == 1993:
if not f107 or not f107a or not ap_daily:
raise ValueError(
"Must supply f107, f107a, and ap_daily for HWM93"
)
self._run_hwm93(location_time, f107, f107a, ap_daily)
# HWM07:
elif version == 2007:
if not f107 or not f107a or not ap:
raise ValueError(
"Must supply f107, f107a, and ap for HWM07"
)
self._run_hwm07(location_time, f107, f107a, ap)
# HWM14:
elif version == 2014:
if not ap:
raise ValueError(
"Must supply ap for HWM14"
)
self._run_hwm14(location_time, ap)
# Unknown version:
else:
raise ValueError(
"Invalid version of {} for HWM.\n".format(version) +
"Either 2014, 2007, or 1993 is valid."
)
return self
def _run_hwm93(self, location_time, f107, f107a, ap_daily):
"""
HWM 1993 Climatological model.
:param location_time: Instance of LocationTime
:param f107: f107 indice
:param f107a: f107a indice
:param ap_daily: ap_daily indice
"""
# Call HWM93 wrapper:
w = hwm93(
location_time.iyd,
location_time.utc_sec,
location_time.alt,
location_time.lat,
np.mod(location_time.lon, 360),
location_time.slt_hour,
f107a,
f107,
ap_daily,
)
self.v = w[0]
self.u = w[1]
self.hwm_version = '93'
return self
def _run_hwm07(self, location_time, f107, f107a, ap):
"""
HWM 2007 Climatological model.
:param location_time: Instance of LocationTime
:param f107: f107 indice
:param f107a: f107a indice
:param ap: ap indice
"""
# Grab current directory:
my_pwd = os.getcwd()
# Figure out HWM07 data folder:
if self.testing_data_stub:
folder = "hwm07"
else:
folder = "hwm07_data"
hwm07_data_path = os.path.join(
self.data_path_stub,
folder,
)
# Change directory to HWM07 data path:
os.chdir(hwm07_data_path)
# Call HWM07 wrapper:
w = hwm07(
location_time.iyd,
location_time.utc_sec,
location_time.alt,
location_time.lat,
np.mod(location_time.lon, 360),
location_time.slt_hour,
f107a,
f107,
[nan, ap],
)
# Change back to original directory:
os.chdir(my_pwd)
# Assign outputs:
self.v = w[0]
self.u = w[1]
self.hwm_version = '07'
return self
def _run_hwm14(self, location_time, ap):
"""
HWM 2014 Climatological model.
:param location_time: Instance of LocationTime
:param ap: ap indice
"""
# Grab current directory:
my_pwd = os.getcwd()
# Figure out HWM14 data folder:
if self.testing_data_stub:
folder = "hwm14"
else:
folder = "hwm14_data"
hwm14_data_path = os.path.join(
self.data_path_stub,
folder,
)
# Change directory to HWM14 data path:
os.chdir(hwm14_data_path)
# Call HWM14 wrapper:
v, u = hwm14(
location_time.iyd,
location_time.utc_sec,
location_time.alt,
location_time.lat,
np.mod(location_time.lon, 360),
nan,
nan,
nan,
[nan, ap],
)
# Change back to original directory:
os.chdir(my_pwd)
# Assign outputs:
self.v = v
self.u = u
self.hwm_version = '14'
return self
| [
"noreply@github.com"
] | noreply@github.com |
178d236b16edb59773f2d956483fddf3e8aea02a | 08b97fb36469978c7fe8042f37d77add1503a4bf | /bin/ipython3 | 5e70a0f960220ac17440af5655a3e51b24b6f38f | [] | no_license | paulo123araujo/analise-dados-enem-2018 | 8f4ca2337ef2d4adcf4af9aead86e15a72727d66 | f9a7e69f393270bfcc62fd45bd4ef474689734cd | refs/heads/master | 2022-10-31T08:37:02.317217 | 2020-06-20T01:34:51 | 2020-06-20T01:34:51 | 273,607,627 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 276 | #!/home/paulo/Desktop/data-science/analise-dados-enem-2018/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from IPython import start_ipython
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(start_ipython())
| [
"paulofelipe_jau7654@hotmail.com"
] | paulofelipe_jau7654@hotmail.com | |
1914279c444a4989c7875067c4cd3578efa327a8 | 2af7c00dc2c5cea5de7b84d3f171377b4fdf736f | /python/filip/filip.py | 61aa69edb66b737e96a71c84c658746ab8c2e1f2 | [] | no_license | theteamaker/kattis | cdd7af11210aa4969a79cd1b04a94b66a396e9bd | 23af278618df6ab538a6df66268d0a2925b0e01b | refs/heads/master | 2020-12-18T18:07:59.611355 | 2020-12-07T02:22:27 | 2020-12-07T02:22:27 | 235,479,435 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 502 | py | import sys
inputList = []
compareList = []
while len(inputList) < 1:
for i in sys.stdin:
inputList = i.split(" ")
inputList = [s.rstrip() for s in inputList]
break
def numReverser(ogNumber):
listOfNumbers = []
for i in range(len(ogNumber)):
listOfNumbers.append(ogNumber[i])
return (listOfNumbers[2] + listOfNumbers[1] + listOfNumbers[0])
for i in range(len(inputList)):
compareList.append(int(numReverser(inputList[i])))
print(max(compareList)) | [
"kingwashboard@gmail.com"
] | kingwashboard@gmail.com |
39f6bbe448e0b702e4d457126f98b9c0d32f2f15 | 0ca1701a601c88bc9ff8fc3a70f814364ab8d7e3 | /python_workflow/python/client/tests/test_filter.py | bfbcebbbd4b43dce22d1ccfd9ecb11d087474ef6 | [] | no_license | lmichel/vodml-lite-mapping | fb56c6877c7bff1894c3e8d8add9a2357b33cb35 | 90cbfa6ece8d96b32c43351b4e3609e337a98ec0 | refs/heads/master | 2021-07-08T20:49:51.788080 | 2020-07-15T09:51:03 | 2020-07-15T09:51:03 | 155,096,857 | 0 | 1 | null | 2020-07-15T09:24:18 | 2018-10-28T17:28:38 | Python | UTF-8 | Python | false | false | 1,438 | py | '''
Created on 22 juin 2020
@author: laurentmichel
'''
import unittest
import os
import json
from client.translator.json_mapping_builder import JsonMappingBuilder
from client.translator.instance_from_votable import InstanceFromVotable
from client.tests import logger
from utils.dict_utils import DictUtils
class TestInstance(unittest.TestCase):
def test_1(self):
self.maxDiff = None
data_path = os.path.dirname(os.path.realpath(__file__))
votable_path = os.path.join(data_path, "./data/test_filter.xml")
json_ref_path = os.path.join(data_path, "./data/test_filter_1.json")
logger.info("extract vodml block from %s", votable_path)
instanceFromVotable = InstanceFromVotable(votable_path)
instanceFromVotable._extract_vodml_block()
instanceFromVotable._validate_vodml_block()
builder = JsonMappingBuilder(json_dict=instanceFromVotable.json_block)
#builder.revert_array()
builder.revert_compositions("COLLECTION")
builder.revert_templates()
builder.revert_elements("INSTANCE")
builder.revert_elements("ATTRIBUTE")
self.assertDictEqual(json.loads(json.dumps(builder.json))
, DictUtils.read_dict_from_file(json_ref_path)
, "=======")
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.main() | [
"laurent.michel@astro.unistra.fr"
] | laurent.michel@astro.unistra.fr |
f2746e2381a95d740cf3cd4036e8a08a7bb02ad3 | eefb06b0d8c8c98c1e9cfc4c3852d5c453eb5429 | /data/input/aldryn/django-simple-sso/simple_sso/sso_server/server.py | aa568278cfa75a6e2015dc8bf8be3712ae4e86da | [] | no_license | bopopescu/pythonanalyzer | db839453bde13bf9157b76e54735f11c2262593a | 8390a0139137574ab237b3ff5fe8ea61e8a0b76b | refs/heads/master | 2022-11-22T02:13:52.949119 | 2019-05-07T18:42:52 | 2019-05-07T18:42:52 | 282,079,884 | 0 | 0 | null | 2020-07-23T23:46:09 | 2020-07-23T23:46:08 | null | UTF-8 | Python | false | false | 6,308 | py | # -*- coding: utf-8 -*-
import urlparse
from django.conf.urls import patterns, url
from django.contrib import admin
from django.contrib.admin.options import ModelAdmin
from django.core.urlresolvers import reverse
from django.http import (HttpResponseForbidden, HttpResponseBadRequest, HttpResponseRedirect, QueryDict)
from django.utils import timezone
from django.views.generic.base import View
from itsdangerous import URLSafeTimedSerializer
from simple_sso.sso_server.models import Token, Consumer
import datetime
import urllib
from webservices.models import Provider
from webservices.sync import provider_for_django
class BaseProvider(Provider):
max_age = 5
def __init__(self, server):
self.server = server
def get_private_key(self, public_key):
try:
self.consumer = Consumer.objects.get(public_key=public_key)
except Consumer.DoesNotExist:
return None
return self.consumer.private_key
class RequestTokenProvider(BaseProvider):
def provide(self, data):
redirect_to = data['redirect_to']
token = Token.objects.create(consumer=self.consumer, redirect_to=redirect_to)
return {'request_token': token.request_token}
class AuthorizeView(View):
"""
The client get's redirected to this view with the `request_token` obtained
by the Request Token Request by the client application beforehand.
This view checks if the user is logged in on the server application and if
that user has the necessary rights.
If the user is not logged in, the user is prompted to log in.
"""
server = None
def get(self, request):
request_token = request.GET.get('token', None)
if not request_token:
return self.missing_token_argument()
try:
self.token = Token.objects.select_related('consumer').get(request_token=request_token)
except Token.DoesNotExist:
return self.token_not_found()
if not self.check_token_timeout():
return self.token_timeout()
self.token.refresh()
if request.user.is_authenticated():
return self.handle_authenticated_user()
else:
return self.handle_unauthenticated_user()
def missing_token_argument(self):
return HttpResponseBadRequest('Token missing')
def token_not_found(self):
return HttpResponseForbidden('Token not found')
def token_timeout(self):
return HttpResponseForbidden('Token timed out')
def check_token_timeout(self):
delta = timezone.now() - self.token.timestamp
if delta > self.server.token_timeout:
self.token.delete()
return False
else:
return True
def handle_authenticated_user(self):
if self.server.has_access(self.request.user, self.token.consumer):
return self.success()
else:
return self.access_denied()
def handle_unauthenticated_user(self):
next = '%s?%s' % (self.request.path, urllib.urlencode([('token', self.token.request_token)]))
url = '%s?%s' % (reverse(self.server.auth_view_name), urllib.urlencode([('next', next)]))
return HttpResponseRedirect(url)
def access_denied(self):
return HttpResponseForbidden("Access denied")
def success(self):
self.token.user = self.request.user
self.token.save()
serializer = URLSafeTimedSerializer(self.token.consumer.private_key)
parse_result = urlparse.urlparse(self.token.redirect_to)
query_dict = QueryDict(parse_result.query, mutable=True)
query_dict['access_token'] = serializer.dumps(self.token.access_token)
url = urlparse.urlunparse((parse_result.scheme, parse_result.netloc, parse_result.path, '', query_dict.urlencode(), ''))
return HttpResponseRedirect(url)
class VerificationProvider(BaseProvider, AuthorizeView):
def provide(self, data):
token = data['access_token']
try:
self.token = Token.objects.select_related('user').get(access_token=token, consumer=self.consumer)
except Token.DoesNotExist:
return self.token_not_found()
if not self.check_token_timeout():
return self.token_timeout()
if not self.token.user:
return self.token_not_bound()
extra_data = data.get('extra_data', None)
return self.server.get_user_data(
self.token.user, self.consumer, extra_data=extra_data)
def token_not_bound(self):
return HttpResponseForbidden("Invalid token")
class ConsumerAdmin(ModelAdmin):
readonly_fields = ['public_key', 'private_key']
class Server(object):
request_token_provider = RequestTokenProvider
authorize_view = AuthorizeView
verification_provider = VerificationProvider
token_timeout = datetime.timedelta(minutes=5)
client_admin = ConsumerAdmin
auth_view_name = 'django.contrib.auth.views.login'
def __init__(self, **kwargs):
for key, value in kwargs.items():
setattr(self, key, value)
self.register_admin()
def register_admin(self):
admin.site.register(Consumer, self.client_admin)
def has_access(self, user, consumer):
return True
def get_user_extra_data(self, user, consumer, extra_data):
raise NotImplementedError()
def get_user_data(self, user, consumer, extra_data=None):
user_data = {
'username': user.username,
'email': user.email,
'first_name': user.first_name,
'last_name': user.last_name,
'is_staff': False,
'is_superuser': False,
'is_active': user.is_active,
}
if extra_data:
user_data['extra_data'] = self.get_user_extra_data(
user, consumer, extra_data)
return user_data
def get_urls(self):
return patterns('',
url(r'^request-token/$', provider_for_django(self.request_token_provider(server=self)), name='simple-sso-request-token'),
url(r'^authorize/$', self.authorize_view.as_view(server=self), name='simple-sso-authorize'),
url(r'^verify/$', provider_for_django(self.verification_provider(server=self)), name='simple-sso-verify'),
)
| [
"rares.begu@gmail.com"
] | rares.begu@gmail.com |
9b8431d7737cacffa0ed1d8e3cddda206887f45a | a730c7082485faa77aacd7d65f667b03d9cae2b1 | /migrations/versions/820433883d5d_.py | 63dd84bbea0c6e1d0253706f49f0bc62b24e0dc5 | [] | no_license | perwagner/pwn_gameoflife | 852332bc5c8bc383056b56442be0f8c0ec5e82de | 2176865fa38d4cde5bb1002d1dd28c60712e08bc | refs/heads/master | 2022-10-03T09:19:36.646410 | 2020-10-10T07:36:51 | 2020-10-10T07:36:51 | 216,119,425 | 0 | 0 | null | 2022-09-16T18:11:12 | 2019-10-18T23:04:55 | Python | UTF-8 | Python | false | false | 671 | py | """empty message
Revision ID: 820433883d5d
Revises: 2ec3f4bbf368
Create Date: 2019-10-20 11:02:30.558409
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '820433883d5d'
down_revision = '2ec3f4bbf368'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('password_hash', sa.String(length=128), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('user', 'password_hash')
# ### end Alembic commands ###
| [
"perwagnernielsen@gmail.com"
] | perwagnernielsen@gmail.com |
164e5493f6758c339a9e2ad856a3766537c455d0 | ac5e52a3fc52dde58d208746cddabef2e378119e | /exps-sblp-obt/sblp_ut=3.5_rd=1_rw=0.06_rn=4_u=0.075-0.325_p=harmonic-2/sched=RUN_trial=65/params.py | 1784956005fe6b3ad3c6eecf934f47a007d14984 | [] | no_license | ricardobtxr/experiment-scripts | 1e2abfcd94fb0ef5a56c5d7dffddfe814752eef1 | 7bcebff7ac2f2822423f211f1162cd017a18babb | refs/heads/master | 2023-04-09T02:37:41.466794 | 2021-04-25T03:27:16 | 2021-04-25T03:27:16 | 358,926,457 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 248 | py | {'cpus': 4,
'duration': 30,
'final_util': '3.662643',
'max_util': '3.5',
'periods': 'harmonic-2',
'release_master': False,
'res_distr': '1',
'res_nmb': '4',
'res_weight': '0.06',
'scheduler': 'RUN',
'trial': 65,
'utils': 'uni-medium-3'}
| [
"ricardo.btxr@gmail.com"
] | ricardo.btxr@gmail.com |
d32be4c5c1aa79bae358160228b4b8ad3f289a4f | 28ef7c65a5cb1291916c768a0c2468a91770bc12 | /configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/mobilenetv2_coco_384x288.py | b7b54f086ffee4d0e83d3a2fe04f5cf10f68a7ec | [
"Apache-2.0"
] | permissive | bit-scientist/mmpose | 57464aae1ca87faf5a4669991ae1ea4347e41900 | 9671a12caf63ae5d15a9bebc66a9a2e7a3ce617e | refs/heads/master | 2023-08-03T17:18:27.413286 | 2021-09-29T03:48:37 | 2021-09-29T03:48:37 | 411,549,076 | 0 | 0 | Apache-2.0 | 2021-09-29T06:01:27 | 2021-09-29T06:01:26 | null | UTF-8 | Python | false | false | 4,196 | py | _base_ = ['../../../../_base_/datasets/coco.py']
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=10)
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[170, 200])
total_epochs = 210
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
])
channel_cfg = dict(
num_output_channels=17,
dataset_joints=17,
dataset_channel=[
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
],
inference_channel=[
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
])
# model settings
model = dict(
type='TopDown',
pretrained='mmcls://mobilenet_v2',
backbone=dict(type='MobileNetV2', widen_factor=1., out_indices=(7, )),
keypoint_head=dict(
type='TopdownHeatmapSimpleHead',
in_channels=1280,
out_channels=channel_cfg['num_output_channels'],
loss_keypoint=dict(type='JointsMSELoss', use_target_weight=True)),
train_cfg=dict(),
test_cfg=dict(
flip_test=True,
post_process='default',
shift_heatmap=True,
modulate_kernel=11))
data_cfg = dict(
image_size=[288, 384],
heatmap_size=[72, 96],
num_output_channels=channel_cfg['num_output_channels'],
num_joints=channel_cfg['dataset_joints'],
dataset_channel=channel_cfg['dataset_channel'],
inference_channel=channel_cfg['inference_channel'],
soft_nms=False,
nms_thr=1.0,
oks_thr=0.9,
vis_thr=0.2,
use_gt_bbox=False,
det_bbox_thr=0.0,
bbox_file='data/coco/person_detection_results/'
'COCO_val2017_detections_AP_H_56_person.json',
)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='TopDownRandomFlip', flip_prob=0.5),
dict(
type='TopDownHalfBodyTransform',
num_joints_half_body=8,
prob_half_body=0.3),
dict(
type='TopDownGetRandomScaleRotation', rot_factor=40, scale_factor=0.5),
dict(type='TopDownAffine'),
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
dict(type='TopDownGenerateTarget', sigma=3),
dict(
type='Collect',
keys=['img', 'target', 'target_weight'],
meta_keys=[
'image_file', 'joints_3d', 'joints_3d_visible', 'center', 'scale',
'rotation', 'bbox_score', 'flip_pairs'
]),
]
val_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='TopDownAffine'),
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
dict(
type='Collect',
keys=['img'],
meta_keys=[
'image_file', 'center', 'scale', 'rotation', 'bbox_score',
'flip_pairs'
]),
]
test_pipeline = val_pipeline
data_root = 'data/coco'
data = dict(
samples_per_gpu=64,
workers_per_gpu=2,
val_dataloader=dict(samples_per_gpu=32),
test_dataloader=dict(samples_per_gpu=32),
train=dict(
type='TopDownCocoDataset',
ann_file=f'{data_root}/annotations/person_keypoints_train2017.json',
img_prefix=f'{data_root}/train2017/',
data_cfg=data_cfg,
pipeline=train_pipeline,
dataset_info={{_base_.dataset_info}}),
val=dict(
type='TopDownCocoDataset',
ann_file=f'{data_root}/annotations/person_keypoints_val2017.json',
img_prefix=f'{data_root}/val2017/',
data_cfg=data_cfg,
pipeline=val_pipeline,
dataset_info={{_base_.dataset_info}}),
test=dict(
type='TopDownCocoDataset',
ann_file=f'{data_root}/annotations/person_keypoints_val2017.json',
img_prefix=f'{data_root}/val2017/',
data_cfg=data_cfg,
pipeline=val_pipeline,
dataset_info={{_base_.dataset_info}}),
)
| [
"noreply@github.com"
] | noreply@github.com |
1d29dee387b69c8558912e9c4fd3c2013e88be9a | 15f321878face2af9317363c5f6de1e5ddd9b749 | /solutions_python/Problem_118/2550.py | 28c00dfbc78318b375a16931dd8cc2af6d52486d | [] | no_license | dr-dos-ok/Code_Jam_Webscraper | c06fd59870842664cd79c41eb460a09553e1c80a | 26a35bf114a3aa30fc4c677ef069d95f41665cc0 | refs/heads/master | 2020-04-06T08:17:40.938460 | 2018-10-14T10:12:47 | 2018-10-14T10:12:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 512 | py | #!/usr/bin/env python
import sys
from math import sqrt
def pal(x):
x = str(x)
return x == x[::-1]
if __name__ == "__main__":
t = int(sys.stdin.readline())
for case in range(1, t+1):
count = 0
i, j = [long(c) for c in sys.stdin.readline().split(" ")]
for n in range(i, j+1):
r = sqrt(n)
if r - int(r) != 0.0:
continue
if pal(n) and pal(int(r)):
count += 1
print "Case #%d: %d" % (case, count)
| [
"miliar1732@gmail.com"
] | miliar1732@gmail.com |
4a2ded5c95ba70c01e2a765d8b3d8926f8c3fe29 | 5b6540708f15b2bf4dea0def02616e8e2ffa3959 | /10_passwordGenerator/passwordGenerator.py | 82b96467b4f6fca40590f0ee90a4f768fb2a207d | [] | no_license | raufkarakas/PythonExercises | dbb6f26c73cde76affdd5a0e12108b9764f2c3b4 | df435c9f3b7d21cb7d89be9093636b156f2217b8 | refs/heads/master | 2016-09-11T13:00:04.116415 | 2015-07-14T20:48:25 | 2015-07-14T20:48:25 | 38,538,747 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 791 | py | __author__ = 'rkarakas'
import random
import string
def passwordGenerator(length, method):
password = ""
characterPool = string.ascii_letters
if method == 1:
characterPool += string.digits
elif method == 2:
characterPool += string.digits
characterPool += string.punctuation
else:
print("Invalid option. Considered as option 0")
for i in range(length):
password += characterPool[random.randint(0, len(characterPool))]
return password
print("Method 0: Uppercase and lowercase letters.")
print("Method 1: Uppercase & lowercase letters and digits.")
print("Method 2: Uppercase & lowercase letters, digits, and punctuations.")
print(passwordGenerator(int(input("Length of the password? -> ")), int(input("Method? ->"))))
| [
"raufkarakas@gmail.com"
] | raufkarakas@gmail.com |
14397fd7d43c0fec589ab90b3be4cf83ca04e4fb | 5ab4ed1e8eb7f942db03eb06a56f2dc0fb8056f8 | /code/process_results/2020/05/7_8_finetune_sparse_facto_grid_lr.py | d90ab7d2fb6fdab6387af977bfd1f0472876558a | [
"MIT"
] | permissive | lucgiffon/psm-nets | b4f443ff47f4b423c3494ff944ef0dae68badd9d | dec43c26281febf6e5c8b8f42bfb78098ae7101d | refs/heads/main | 2023-05-04T17:56:11.122144 | 2021-05-28T16:31:34 | 2021-05-28T16:31:34 | 337,717,248 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 21,794 | py | from collections import defaultdict
import keras.backend as K
import pickle
import pathlib
import pandas as pd
import scipy.special
import scipy.stats
from keras.models import Model
import gc
import palmnet.hunt
from palmnet.core.faustizer import Faustizer
from palmnet.core.layer_replacer_faust import LayerReplacerFaust
from palmnet.core.layer_replacer_palm import LayerReplacerPalm
from palmnet.data import param_training, image_data_generator_cifar_svhn, image_data_generator_mnist
from palmnet.experiments.utils import get_line_of_interest, ParameterManager
from palmnet.utils import get_sparsity_pattern, get_nb_learnable_weights, get_nb_learnable_weights_from_model
from palmnet.visualization.utils import get_palminized_model_and_df, get_df
import numpy as np
import logging
from palmnet.core import palminizable
from palmnet.core.palminizer import Palminizer
palminizable.Palminizer = Palminizer
import sys
sys.modules["palmnet.core.palminize"] = palminizable
from skluc.utils import logger, log_memory_usage
import keras
mpl_logger = logging.getLogger('matplotlib')
mpl_logger.setLevel(logging.ERROR)
logger.setLevel(logging.DEBUG)
def get_singular_values_info(matrix):
U, S, V = np.linalg.svd(matrix)
mean_sv = np.mean(S)
softmax_S = scipy.special.softmax(S)
entropy_S = scipy.stats.entropy(softmax_S)
entropy_sv = entropy_S
nb_sv = len(S)
entropy_sv_normalized = entropy_S / scipy.stats.entropy(scipy.special.softmax(np.ones(len(S))))
percent_sv_above_mean = np.sum(S > mean_sv) / len(S)
return entropy_sv, nb_sv, entropy_sv_normalized, percent_sv_above_mean
def get_df_from_expe_path(expe_path):
src_dir = root_source_dir / expe_path
df = get_df(src_dir)
df = df.assign(results_dir=[str(src_dir.absolute())] * len(df))
df = df.rename(columns={"--tol": "--delta-threshold"})
return df
columns_not_to_num = ['hash', 'output_file_csvcbprinter', "--use-clr",
"--input-dir", "input_model_path", "output_file_csvcvprinter",
"output_file_finishedprinter", "output_file_layerbylayer",
"output_file_modelprinter", "output_file_notfinishedprinter",
"output_file_resprinter", "output_file_tensorboardprinter", "results_dir"]
def cast_to_num(df):
for col in df.columns.difference(columns_not_to_num):
if col in df.columns.values:
df.loc[:, col] = df.loc[:, col].apply(pd.to_numeric, errors='coerce')
return df
if __name__ == "__main__":
root_source_dir = pathlib.Path("/home/luc/PycharmProjects/palmnet/results/")
expe_path = "2020/05/7_8_finetune_sparse_facto_not_log_all_grid_lr"
lst_path_finetune = [
"2020/05/7_8_finetune_sparse_facto_not_log_all_grid_lr",
"2020/05/7_8_finetune_sparse_facto_not_log_all_grid_lr_only_mask",
"2020/05/11_12_finetune_sparse_facto_resnet_grid_lr",
"2020/05/11_12_finetune_sparse_facto_not_log_resnet_not_only_mask_grid_lr",
"2020/07/11_12_finetune_fix_only_mask_grid_lr"
]
lst_path_compression = [
"2020/05/3_4_compression_palm_not_log_all",
]
df_finetune = pd.concat(list(map(get_df_from_expe_path, lst_path_finetune)))
# df_finetune = get_df_from_expe_path(lst_path_finetune[0])
df_finetune = df_finetune.dropna(subset=["failure"])
df_finetune = df_finetune[df_finetune["failure"] == False]
df_finetune = df_finetune.drop(columns="oar_id").drop_duplicates()
df_finetune = cast_to_num(df_finetune)
df_finetune = df_finetune[~df_finetune["test_accuracy_finetuned_model"].isnull()]
df_compression = pd.concat(list(map(get_df_from_expe_path, lst_path_compression)))
# df_compression = get_df_from_expe_path(lst_path_compression[0])
df_compression = cast_to_num(df_compression)
root_output_dir = pathlib.Path("/home/luc/PycharmProjects/palmnet/results/processed/")
output_dir = root_output_dir / expe_path
output_dir.mkdir(parents=True, exist_ok=True)
dct_attributes = defaultdict(lambda: [])
dct_results_matrices = defaultdict(lambda: [])
length_df = len(df_finetune)
for idx, (_, row) in enumerate(df_finetune.iterrows()):
# if df_results_tmp is not None and row["hash"] in df_results_tmp["hash"].values:
# continue
if np.isnan(row["test_loss_finetuned_model"]):
continue
log_memory_usage("Start loop")
print("row {}/{}".format(idx, length_df))
dct_attributes["idx-expe"].append(idx)
dct_attributes["hash"].append(row["hash"])
# get corresponding row in the palminize results directory #
keys_of_interest = ['--cifar10',
'--cifar10-vgg19',
'--cifar100',
'--cifar100-vgg19',
'--delta-threshold',
'--hierarchical',
'--mnist',
'--mnist-lenet',
'--nb-iteration-palm',
'--sparsity-factor',
'--svhn',
'--svhn-vgg19',
'--test-data',
'--test-model',
"--nb-factor"
]
if row["--cifar100-resnet50"] or row["--cifar100-resnet20"]:
keys_of_interest.extend([
'--cifar100-resnet50',
'--cifar100-resnet20',
])
row_before_finetune = get_line_of_interest(df_compression, keys_of_interest, row).iloc[0]
# this is the row of results for the model before finetuning
############################################
# Global informations about the experiment #
############################################
if row["--cifar10"]:
dct_attributes["dataset"].append("cifar10")
elif row["--cifar100"]:
dct_attributes["dataset"].append("cifar100")
elif row["--mnist"]:
dct_attributes["dataset"].append("mnist")
elif row["--svhn"]:
dct_attributes["dataset"].append("svhn")
else:
raise ValueError("Unknown dataset")
if row["--cifar100-vgg19"] or row["--cifar10-vgg19"] or row["--svhn-vgg19"]:
dct_attributes["model"].append("vgg19")
elif row["--mnist-lenet"]:
dct_attributes["model"].append("lenet")
elif row["--mnist-500"]:
dct_attributes["model"].append("fc500")
elif row["--cifar100-resnet20"]:
dct_attributes["model"].append("resnet20")
elif row["--cifar100-resnet50"]:
dct_attributes["model"].append("resnet50")
elif row["--cifar100-resnet20-new"]:
dct_attributes["model"].append("resnet20")
elif row["--cifar100-resnet50-new"]:
dct_attributes["model"].append("resnet50")
else:
raise ValueError("Unknown model")
if row["faust"]:
dct_attributes["method"].append("faust")
elif row["palm"]:
dct_attributes["method"].append("pyqalm")
else:
raise NotImplementedError
# palm informations #
dct_attributes["delta-threshold"].append(float(row["--delta-threshold"]))
dct_attributes["hierarchical"].append(bool(row["--hierarchical"]))
dct_attributes["nb-factor"].append(int(row["--nb-factor"]) if not np.isnan(row["--nb-factor"]) else np.nan)
dct_attributes["nb-iteration-palm"].append(int(row["--nb-iteration-palm"]))
dct_attributes["sparsity-factor"].append(int(row["--sparsity-factor"]))
# finetuning informations
dct_attributes["use-clr"].append(row["--use-clr"]) # this must be first because used in other attributes
dct_attributes["only-mask"].append(bool(row["--only-mask"]))
dct_attributes["keep-last-layer"].append(bool(row["--keep-last-layer"]))
dct_attributes["keep-first-layer"].append(bool(row["--keep-first-layer"]))
dct_attributes["only-dense"].append(bool(row["--only-dense"]))
# beware of this line here because the params_optimizer may change between experiments
dct_attributes["epoch-step-size"].append(float(row["--epoch-step-size"]) if dct_attributes["use-clr"][-1] else np.nan)
dct_attributes["actual-batch-size"].append(int(row["actual-batch-size"]) if row["actual-batch-size"] is not None else None)
dct_attributes["actual-nb-epochs"].append(int(row["actual-nb-epochs"]) if row["actual-nb-epochs"] is not None else None)
dct_attributes["actual-min-lr"].append(float(row["actual-min-lr"]) if row["actual-min-lr"] is not None else None)
dct_attributes["actual-max-lr"].append(float(row["actual-max-lr"]) if row["actual-max-lr"] is not None else None)
dct_attributes["actual-lr"].append(float(row["actual-lr"]) if row["actual-lr"] is not None else None)
# score informations
dct_attributes["base-model-score"].append(float(row["test_accuracy_base_model"]))
dct_attributes["before-finetune-score"].append(float(row["test_accuracy_compressed_model"]))
dct_attributes["finetuned-score"].append(float(row["test_accuracy_finetuned_model"]))
dct_attributes["base-model-loss"].append(float(row["test_loss_base_model"]))
dct_attributes["before-finetune-loss"].append(float(row["test_loss_compressed_model"]))
dct_attributes["finetuned-loss"].append(float(row["test_loss_finetuned_model"]))
dct_attributes["finetuned-score-val"].append(float(row["val_accuracy_finetuned_model"]))
# store path informations
path_model_compressed = pathlib.Path(row_before_finetune["results_dir"]) / row_before_finetune["output_file_modelprinter"]
path_history = pathlib.Path(row["results_dir"]) / row["output_file_csvcbprinter"]
dct_attributes["path-learning-history"].append(path_history)
dct_attributes["path-model-compressed"].append(path_model_compressed)
##############################
# Layer by Layer information #
##############################
nb_param_dense_base = 0
nb_param_dense_compressed = 0
nb_param_conv_base = 0
nb_param_conv_compressed = 0
if type(row["output_file_layerbylayer"]) == str:
dct_attributes["nb-param-base-total"].append(int(row["base_model_nb_param"]))
dct_attributes["nb-param-compressed-total"].append(int(row["new_model_nb_param"]))
dct_attributes["param-compression-rate-total"].append(row["base_model_nb_param"]/row["new_model_nb_param"])
path_layer_by_layer = pathlib.Path(row["results_dir"]) / row["output_file_layerbylayer"]
df_csv_layerbylayer = pd.read_csv(str(path_layer_by_layer))
for idx_row_layer, row_layer in df_csv_layerbylayer.iterrows():
dct_results_matrices["idx-expe"].append(idx)
dct_results_matrices["model"].append(dct_attributes["model"][-1])
layer_name_compressed = row_layer["layer-name-compressed"]
is_dense = "sparse_factorisation_dense" in layer_name_compressed
dct_results_matrices["layer-name-base"].append(row_layer["layer-name-base"])
dct_results_matrices["layer-name-compressed"].append(row_layer["layer-name-compressed"])
dct_results_matrices["idx-layer"].append(row_layer["idx-layer"])
dct_results_matrices["data"].append(dct_attributes["dataset"][-1])
dct_results_matrices["keep-last-layer"].append(dct_attributes["keep-last-layer"][-1])
dct_results_matrices["use-clr"].append(dct_attributes["use-clr"][-1])
dct_results_matrices["diff-approx"].append(row_layer["diff-approx"])
# get nb val base layer and comrpessed layer
dct_results_matrices["nb-non-zero-base"].append(row_layer["nb-non-zero-base"])
dct_results_matrices["nb-non-zero-compressed"].append(row_layer["nb-non-zero-compressed"])
dct_results_matrices["nb-non-zero-compression-rate"].append(row_layer["nb-non-zero-compression-rate"])
if is_dense:
nb_param_dense_base += row_layer["nb-non-zero-base"]
nb_param_dense_compressed += row_layer["nb-non-zero-compressed"]
else:
nb_param_conv_base += row_layer["nb-non-zero-base"]
nb_param_conv_compressed += row_layer["nb-non-zero-compressed"]
# get palm setting options
dct_results_matrices["nb-factor-param"].append(dct_attributes["nb-factor"][-1])
# dct_results_matrices["nb-factor-actual"].append(len(sparsity_patterns))
dct_results_matrices["sparsity-factor"].append(dct_attributes["sparsity-factor"][-1])
dct_results_matrices["hierarchical"].append(dct_attributes["hierarchical"][-1])
else:
# continue
palmnet.hunt.show_most_common_types(limit=20)
log_memory_usage("Before pickle")
layer_replacer = LayerReplacerFaust(only_mask=False, keep_last_layer=dct_attributes["keep-last-layer"][-1], path_checkpoint_file=path_model_compressed, sparse_factorizer=Faustizer())
layer_replacer.load_dct_name_compression()
log_memory_usage("After pickle")
paraman = ParameterManager(row.to_dict())
base_model = paraman.get_model()
palmnet.hunt.show_most_common_types(limit=20)
compressed_model = layer_replacer.transform(base_model)
palmnet.hunt.show_most_common_types(limit=20)
log_memory_usage("After transform")
if len(base_model.layers) < len(compressed_model.layers):
base_model = Model(inputs=base_model.inputs, outputs=base_model.outputs)
assert len(base_model.layers) == len(compressed_model.layers)
# model complexity informations obtained from the reconstructed model
nb_learnable_weights_base_model = get_nb_learnable_weights_from_model(base_model)
nb_learnable_weights_compressed_model = get_nb_learnable_weights_from_model(compressed_model)
dct_attributes["nb-param-base-total"].append(int(nb_learnable_weights_base_model))
dct_attributes["nb-param-compressed-total"].append(int(nb_learnable_weights_compressed_model))
dct_attributes["param-compression-rate-total"].append(nb_learnable_weights_base_model/nb_learnable_weights_compressed_model)
dct_name_facto = None
dct_name_facto = layer_replacer.dct_name_compression
for idx_layer, base_layer in enumerate(base_model.layers):
log_memory_usage("Start secondary loop")
sparse_factorization = dct_name_facto.get(base_layer.name, (None, None))
if sparse_factorization != (None, None) and sparse_factorization != None:
print(base_layer.name)
compressed_layer = None
compressed_layer = compressed_model.layers[idx_layer]
# get informations to identify the layer (and do cross references)
dct_results_matrices["idx-expe"].append(idx)
dct_results_matrices["model"].append(dct_attributes["model"][-1])
dct_results_matrices["layer-name-base"].append(base_layer.name)
layer_name_compressed = compressed_layer.name
is_dense = "sparse_factorisation_dense" in layer_name_compressed
dct_results_matrices["layer-name-compressed"].append(compressed_layer.name)
dct_results_matrices["idx-layer"].append(idx_layer)
dct_results_matrices["data"].append(dct_attributes["dataset"][-1])
dct_results_matrices["keep-last-layer"].append(dct_attributes["keep-last-layer"][-1])
dct_results_matrices["use-clr"].append(dct_attributes["use-clr"][-1])
# get sparse factorization
scaling = sparse_factorization['lambda']
factors = Faustizer.get_factors_from_op_sparsefacto(sparse_factorization['sparse_factors'])
sparsity_patterns = [get_sparsity_pattern(w) for w in factors]
factor_data = factors
# rebuild full matrix to allow comparisons
reconstructed_matrix = np.linalg.multi_dot(factors) * scaling
base_matrix = np.reshape(base_layer.get_weights()[0], reconstructed_matrix.shape)
# normalized approximation errors
diff = np.linalg.norm(base_matrix - reconstructed_matrix) / np.linalg.norm(base_matrix)
dct_results_matrices["diff-approx"].append(diff)
# # measures "singular values" #
# # base matrix
# base_entropy_sv, base_nb_sv, base_entropy_sv_normalized, base_percent_sv_above_mean = get_singular_values_info(base_matrix)
# dct_results_matrices["entropy-base-sv"].append(base_entropy_sv)
# dct_results_matrices["nb-sv-base"].append(base_nb_sv)
# dct_results_matrices["entropy-base-sv-normalized"].append(base_entropy_sv_normalized)
# dct_results_matrices["percent-sv-base-above-mean"].append(base_percent_sv_above_mean)
# # reconstructed matrix
# recons_entropy_sv, recons_nb_sv, recons_entropy_sv_normalized, recons_percent_sv_above_mean = get_singular_values_info(reconstructed_matrix)
# dct_results_matrices["entropy-recons-sv"].append(recons_entropy_sv)
# dct_results_matrices["nb-sv-recons"].append(recons_nb_sv)
# dct_results_matrices["entropy-recons-sv-normalized"].append(recons_entropy_sv_normalized)
# dct_results_matrices["percent-sv-recons-above-mean"].append(recons_percent_sv_above_mean)
# complexity analysis #
# get nb val of the full reconstructed matrix
sparsity_pattern_reconstructed = get_sparsity_pattern(reconstructed_matrix)
nb_non_zero = int(np.sum(sparsity_pattern_reconstructed))
size_bias = len(base_layer.get_weights()[-1]) if base_layer.use_bias else 0
# dct_results_matrices["nb-non-zero-reconstructed"].append(nb_non_zero + size_bias)
# get nb val base layer and comrpessed layers
nb_weights_base_layer = get_nb_learnable_weights(base_layer)
dct_results_matrices["nb-non-zero-base"].append(nb_weights_base_layer)
nb_weights_compressed_layer = get_nb_learnable_weights(compressed_layer)
dct_results_matrices["nb-non-zero-compressed"].append(nb_weights_compressed_layer)
dct_results_matrices["nb-non-zero-compression-rate"].append(nb_weights_base_layer/nb_weights_compressed_layer)
if is_dense:
nb_param_dense_base += nb_weights_base_layer
nb_param_dense_compressed += nb_weights_compressed_layer
else:
nb_param_conv_base += nb_weights_base_layer
nb_param_conv_compressed += nb_weights_compressed_layer
# get palm setting options
dct_results_matrices["nb-factor-param"].append(dct_attributes["nb-factor"][-1])
# dct_results_matrices["nb-factor-actual"].append(len(sparsity_patterns))
dct_results_matrices["sparsity-factor"].append(dct_attributes["sparsity-factor"][-1])
dct_results_matrices["hierarchical"].append(dct_attributes["hierarchical"][-1])
gc.collect()
palmnet.hunt.show_most_common_types(limit=20)
log_memory_usage("Before dels")
del dct_name_facto
del base_model
del compressed_model
del base_layer
del compressed_layer
del sparse_factorization
K.clear_session()
gc.collect()
log_memory_usage("After dels")
palmnet.hunt.show_most_common_types(limit=20)
dct_attributes["nb-param-base-dense"].append(int(nb_param_dense_base))
dct_attributes["nb-param-base-conv"].append(int(nb_param_conv_base))
dct_attributes["nb-param-compressed-dense"].append(int(nb_param_dense_compressed))
dct_attributes["nb-param-compressed-conv"].append(int(nb_param_conv_compressed))
dct_attributes["nb-param-compression-rate-dense"].append(dct_attributes["nb-param-base-dense"][-1] / dct_attributes["nb-param-compressed-dense"][-1])
try:
dct_attributes["nb-param-compression-rate-conv"].append(dct_attributes["nb-param-base-conv"][-1] / dct_attributes["nb-param-compressed-conv"][-1])
except ZeroDivisionError:
dct_attributes["nb-param-compression-rate-conv"].append(np.nan)
df_results = pd.DataFrame.from_dict(dct_attributes)
# if df_results_tmp is not None:
# df_results = pd.concat([df_results, df_results_tmp])
df_results.to_csv(output_dir / "results.csv")
df_results_layers = pd.DataFrame.from_dict(dct_results_matrices)
# if df_results_layers_tmp is not None:
# df_results_layers = pd.concat([df_results_layers, df_results_layers_tmp])
df_results_layers.to_csv(output_dir / "results_layers.csv")
| [
"luc.giffon@lis-lab.fr"
] | luc.giffon@lis-lab.fr |
8a21d26e76fc837d84efc579c3770b2126f1f6af | d5ebbe11f62578af92cc2657df41ded5f59a2fb0 | /myFrame/test.py | 49d4f813dc816074ef13f9619c4739d93339bbf4 | [] | no_license | yiique/myFrame | c9c14681ec292cf5db129365145b56ff7d57f443 | 3f3dbe9b340859387a8714b5a98dcb6806d60076 | refs/heads/master | 2020-12-24T12:47:15.818803 | 2016-11-07T05:37:30 | 2016-11-07T05:37:30 | 67,511,907 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 165 | py | def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
#return [b"Hello World"] # python3
return ["Hello World"]
| [
"liushuman@liushumandeMBP.lan"
] | liushuman@liushumandeMBP.lan |
def81b4bb2ba8dff9ad51d114552a52a85046402 | b3f6d423a058dbf5c2bcb88eec4036e9ccede35e | /venv_old/Lib/site-packages/pymavlink/dialects/v20/autoquad.py | 0a67a6ded54e153458bba2b01e77ca43a6e6d6fc | [] | no_license | ERicBastida/BEcopter | 8fe4f35724dfcf585dc058af0bdf22b62fca5dc3 | e6071fb29feb86d0732a932c45d38532129ecbbe | refs/heads/master | 2020-03-18T01:50:23.923440 | 2018-10-25T14:56:06 | 2018-10-25T14:56:06 | 134,162,181 | 0 | 0 | null | 2018-10-24T16:22:02 | 2018-05-20T15:24:27 | null | UTF-8 | Python | false | false | 992,779 | py | '''
MAVLink protocol implementation (auto-generated by mavgen.py)
Generated from: autoquad.xml,common.xml
Note: this file has been auto-generated. DO NOT EDIT
'''
from __future__ import print_function
from builtins import range
from builtins import object
import struct, array, time, json, os, sys, platform
from ...generator.mavcrc import x25crc
import hashlib
WIRE_PROTOCOL_VERSION = '2.0'
DIALECT = 'autoquad'
PROTOCOL_MARKER_V1 = 0xFE
PROTOCOL_MARKER_V2 = 0xFD
HEADER_LEN_V1 = 6
HEADER_LEN_V2 = 10
MAVLINK_SIGNATURE_BLOCK_LEN = 13
MAVLINK_IFLAG_SIGNED = 0x01
native_supported = platform.system() != 'Windows' # Not yet supported on other dialects
native_force = 'MAVNATIVE_FORCE' in os.environ # Will force use of native code regardless of what client app wants
native_testing = 'MAVNATIVE_TESTING' in os.environ # Will force both native and legacy code to be used and their results compared
if native_supported and float(WIRE_PROTOCOL_VERSION) <= 1:
try:
import mavnative
except ImportError:
print('ERROR LOADING MAVNATIVE - falling back to python implementation')
native_supported = False
else:
# mavnative isn't supported for MAVLink2 yet
native_supported = False
# some base types from mavlink_types.h
MAVLINK_TYPE_CHAR = 0
MAVLINK_TYPE_UINT8_T = 1
MAVLINK_TYPE_INT8_T = 2
MAVLINK_TYPE_UINT16_T = 3
MAVLINK_TYPE_INT16_T = 4
MAVLINK_TYPE_UINT32_T = 5
MAVLINK_TYPE_INT32_T = 6
MAVLINK_TYPE_UINT64_T = 7
MAVLINK_TYPE_INT64_T = 8
MAVLINK_TYPE_FLOAT = 9
MAVLINK_TYPE_DOUBLE = 10
class MAVLink_header(object):
'''MAVLink message header'''
def __init__(self, msgId, incompat_flags=0, compat_flags=0, mlen=0, seq=0, srcSystem=0, srcComponent=0):
self.mlen = mlen
self.seq = seq
self.srcSystem = srcSystem
self.srcComponent = srcComponent
self.msgId = msgId
self.incompat_flags = incompat_flags
self.compat_flags = compat_flags
def pack(self, force_mavlink1=False):
if WIRE_PROTOCOL_VERSION == '2.0' and not force_mavlink1:
return struct.pack('<BBBBBBBHB', 253, self.mlen,
self.incompat_flags, self.compat_flags,
self.seq, self.srcSystem, self.srcComponent,
self.msgId&0xFFFF, self.msgId>>16)
return struct.pack('<BBBBBB', PROTOCOL_MARKER_V1, self.mlen, self.seq,
self.srcSystem, self.srcComponent, self.msgId)
class MAVLink_message(object):
'''base MAVLink message class'''
def __init__(self, msgId, name):
self._header = MAVLink_header(msgId)
self._payload = None
self._msgbuf = None
self._crc = None
self._fieldnames = []
self._type = name
self._signed = False
self._link_id = None
def format_attr(self, field):
'''override field getter'''
raw_attr = getattr(self,field)
if isinstance(raw_attr, bytes):
raw_attr = raw_attr.decode("utf-8").rstrip("\00")
return raw_attr
def get_msgbuf(self):
if isinstance(self._msgbuf, bytearray):
return self._msgbuf
return bytearray(self._msgbuf)
def get_header(self):
return self._header
def get_payload(self):
return self._payload
def get_crc(self):
return self._crc
def get_fieldnames(self):
return self._fieldnames
def get_type(self):
return self._type
def get_msgId(self):
return self._header.msgId
def get_srcSystem(self):
return self._header.srcSystem
def get_srcComponent(self):
return self._header.srcComponent
def get_seq(self):
return self._header.seq
def get_signed(self):
return self._signed
def get_link_id(self):
return self._link_id
def __str__(self):
ret = '%s {' % self._type
for a in self._fieldnames:
v = self.format_attr(a)
ret += '%s : %s, ' % (a, v)
ret = ret[0:-2] + '}'
return ret
def __ne__(self, other):
return not self.__eq__(other)
def __eq__(self, other):
if other == None:
return False
if self.get_type() != other.get_type():
return False
# We do not compare CRC because native code doesn't provide it
#if self.get_crc() != other.get_crc():
# return False
if self.get_seq() != other.get_seq():
return False
if self.get_srcSystem() != other.get_srcSystem():
return False
if self.get_srcComponent() != other.get_srcComponent():
return False
for a in self._fieldnames:
if self.format_attr(a) != other.format_attr(a):
return False
return True
def to_dict(self):
d = dict({})
d['mavpackettype'] = self._type
for a in self._fieldnames:
d[a] = self.format_attr(a)
return d
def to_json(self):
return json.dumps(self.to_dict())
def sign_packet(self, mav):
h = hashlib.new('sha256')
self._msgbuf += struct.pack('<BQ', mav.signing.link_id, mav.signing.timestamp)[:7]
h.update(mav.signing.secret_key)
h.update(self._msgbuf)
sig = h.digest()[:6]
self._msgbuf += sig
mav.signing.timestamp += 1
def pack(self, mav, crc_extra, payload, force_mavlink1=False):
plen = len(payload)
if WIRE_PROTOCOL_VERSION != '1.0' and not force_mavlink1:
# in MAVLink2 we can strip trailing zeros off payloads. This allows for simple
# variable length arrays and smaller packets
while plen > 1 and payload[plen-1] == chr(0):
plen -= 1
self._payload = payload[:plen]
incompat_flags = 0
if mav.signing.sign_outgoing:
incompat_flags |= MAVLINK_IFLAG_SIGNED
self._header = MAVLink_header(self._header.msgId,
incompat_flags=incompat_flags, compat_flags=0,
mlen=len(self._payload), seq=mav.seq,
srcSystem=mav.srcSystem, srcComponent=mav.srcComponent)
self._msgbuf = self._header.pack(force_mavlink1=force_mavlink1) + self._payload
crc = x25crc(self._msgbuf[1:])
if True: # using CRC extra
crc.accumulate_str(struct.pack('B', crc_extra))
self._crc = crc.crc
self._msgbuf += struct.pack('<H', self._crc)
if mav.signing.sign_outgoing and not force_mavlink1:
self.sign_packet(mav)
return self._msgbuf
# enums
class EnumEntry(object):
def __init__(self, name, description):
self.name = name
self.description = description
self.param = {}
enums = {}
# AUTOQUAD_MAVLINK_DEFS_VERSION
enums['AUTOQUAD_MAVLINK_DEFS_VERSION'] = {}
AQ_MAVLINK_DEFS_VERSION_1 = 1 #
enums['AUTOQUAD_MAVLINK_DEFS_VERSION'][1] = EnumEntry('AQ_MAVLINK_DEFS_VERSION_1', '''''')
AUTOQUAD_MAVLINK_DEFS_VERSION_ENUM_END = 2 #
enums['AUTOQUAD_MAVLINK_DEFS_VERSION'][2] = EnumEntry('AUTOQUAD_MAVLINK_DEFS_VERSION_ENUM_END', '''''')
# AUTOQUAD_NAV_STATUS
enums['AUTOQUAD_NAV_STATUS'] = {}
AQ_NAV_STATUS_INIT = 0 # System is initializing
enums['AUTOQUAD_NAV_STATUS'][0] = EnumEntry('AQ_NAV_STATUS_INIT', '''System is initializing''')
AQ_NAV_STATUS_STANDBY = 1 # System is *armed* and standing by, with no throttle input and no
# autonomous mode
enums['AUTOQUAD_NAV_STATUS'][1] = EnumEntry('AQ_NAV_STATUS_STANDBY', '''System is *armed* and standing by, with no throttle input and no autonomous mode''')
AQ_NAV_STATUS_MANUAL = 2 # Flying (throttle input detected), assumed under manual control unless
# other mode bits are set
enums['AUTOQUAD_NAV_STATUS'][2] = EnumEntry('AQ_NAV_STATUS_MANUAL', '''Flying (throttle input detected), assumed under manual control unless other mode bits are set''')
AQ_NAV_STATUS_ALTHOLD = 4 # Altitude hold engaged
enums['AUTOQUAD_NAV_STATUS'][4] = EnumEntry('AQ_NAV_STATUS_ALTHOLD', '''Altitude hold engaged''')
AQ_NAV_STATUS_POSHOLD = 8 # Position hold engaged
enums['AUTOQUAD_NAV_STATUS'][8] = EnumEntry('AQ_NAV_STATUS_POSHOLD', '''Position hold engaged''')
AQ_NAV_STATUS_GUIDED = 16 # Externally-guided (eg. GCS) navigation mode
enums['AUTOQUAD_NAV_STATUS'][16] = EnumEntry('AQ_NAV_STATUS_GUIDED', '''Externally-guided (eg. GCS) navigation mode''')
AQ_NAV_STATUS_MISSION = 32 # Autonomous mission execution mode
enums['AUTOQUAD_NAV_STATUS'][32] = EnumEntry('AQ_NAV_STATUS_MISSION', '''Autonomous mission execution mode''')
AQ_NAV_STATUS_READY = 256 # Ready but *not armed*
enums['AUTOQUAD_NAV_STATUS'][256] = EnumEntry('AQ_NAV_STATUS_READY', '''Ready but *not armed*''')
AQ_NAV_STATUS_CALIBRATING = 512 # Calibration mode active
enums['AUTOQUAD_NAV_STATUS'][512] = EnumEntry('AQ_NAV_STATUS_CALIBRATING', '''Calibration mode active''')
AQ_NAV_STATUS_NO_RC = 4096 # No valid control input (eg. no radio link)
enums['AUTOQUAD_NAV_STATUS'][4096] = EnumEntry('AQ_NAV_STATUS_NO_RC', '''No valid control input (eg. no radio link)''')
AQ_NAV_STATUS_FUEL_LOW = 8192 # Battery is low (stage 1 warning)
enums['AUTOQUAD_NAV_STATUS'][8192] = EnumEntry('AQ_NAV_STATUS_FUEL_LOW', '''Battery is low (stage 1 warning)''')
AQ_NAV_STATUS_FUEL_CRITICAL = 16384 # Battery is depleted (stage 2 warning)
enums['AUTOQUAD_NAV_STATUS'][16384] = EnumEntry('AQ_NAV_STATUS_FUEL_CRITICAL', '''Battery is depleted (stage 2 warning)''')
AQ_NAV_STATUS_DVH = 16777216 # Dynamic Velocity Hold is active (PH with proportional manual direction
# override)
enums['AUTOQUAD_NAV_STATUS'][16777216] = EnumEntry('AQ_NAV_STATUS_DVH', '''Dynamic Velocity Hold is active (PH with proportional manual direction override)''')
AQ_NAV_STATUS_DAO = 33554432 # ynamic Altitude Override is active (AH with proportional manual
# adjustment)
enums['AUTOQUAD_NAV_STATUS'][33554432] = EnumEntry('AQ_NAV_STATUS_DAO', '''ynamic Altitude Override is active (AH with proportional manual adjustment)''')
AQ_NAV_STATUS_CEILING_REACHED = 67108864 # Craft is at ceiling altitude
enums['AUTOQUAD_NAV_STATUS'][67108864] = EnumEntry('AQ_NAV_STATUS_CEILING_REACHED', '''Craft is at ceiling altitude''')
AQ_NAV_STATUS_CEILING = 134217728 # Ceiling altitude is set
enums['AUTOQUAD_NAV_STATUS'][134217728] = EnumEntry('AQ_NAV_STATUS_CEILING', '''Ceiling altitude is set''')
AQ_NAV_STATUS_HF_DYNAMIC = 268435456 # Heading-Free dynamic mode active
enums['AUTOQUAD_NAV_STATUS'][268435456] = EnumEntry('AQ_NAV_STATUS_HF_DYNAMIC', '''Heading-Free dynamic mode active''')
AQ_NAV_STATUS_HF_LOCKED = 536870912 # Heading-Free locked mode active
enums['AUTOQUAD_NAV_STATUS'][536870912] = EnumEntry('AQ_NAV_STATUS_HF_LOCKED', '''Heading-Free locked mode active''')
AQ_NAV_STATUS_RTH = 1073741824 # Automatic Return to Home is active
enums['AUTOQUAD_NAV_STATUS'][1073741824] = EnumEntry('AQ_NAV_STATUS_RTH', '''Automatic Return to Home is active''')
AQ_NAV_STATUS_FAILSAFE = 2147483648 # System is in failsafe recovery mode
enums['AUTOQUAD_NAV_STATUS'][2147483648] = EnumEntry('AQ_NAV_STATUS_FAILSAFE', '''System is in failsafe recovery mode''')
AUTOQUAD_NAV_STATUS_ENUM_END = 2147483649 #
enums['AUTOQUAD_NAV_STATUS'][2147483649] = EnumEntry('AUTOQUAD_NAV_STATUS_ENUM_END', '''''')
# MAV_CMD
enums['MAV_CMD'] = {}
MAV_CMD_AQ_NAV_LEG_ORBIT = 1 # Orbit a waypoint.
enums['MAV_CMD'][1] = EnumEntry('MAV_CMD_AQ_NAV_LEG_ORBIT', '''Orbit a waypoint.''')
enums['MAV_CMD'][1].param[1] = '''Orbit radius in meters'''
enums['MAV_CMD'][1].param[2] = '''Loiter time in decimal seconds'''
enums['MAV_CMD'][1].param[3] = '''Maximum horizontal speed in m/s'''
enums['MAV_CMD'][1].param[4] = '''Desired yaw angle at waypoint'''
enums['MAV_CMD'][1].param[5] = '''Latitude'''
enums['MAV_CMD'][1].param[6] = '''Longitude'''
enums['MAV_CMD'][1].param[7] = '''Altitude'''
MAV_CMD_AQ_TELEMETRY = 2 # Start/stop AutoQuad telemetry values stream.
enums['MAV_CMD'][2] = EnumEntry('MAV_CMD_AQ_TELEMETRY', '''Start/stop AutoQuad telemetry values stream.''')
enums['MAV_CMD'][2].param[1] = '''Start or stop (1 or 0)'''
enums['MAV_CMD'][2].param[2] = '''Stream frequency in us'''
enums['MAV_CMD'][2].param[3] = '''Dataset ID (refer to aq_mavlink.h::mavlinkCustomDataSets enum in AQ flight controller code)'''
enums['MAV_CMD'][2].param[4] = '''Empty'''
enums['MAV_CMD'][2].param[5] = '''Empty'''
enums['MAV_CMD'][2].param[6] = '''Empty'''
enums['MAV_CMD'][2].param[7] = '''Empty'''
MAV_CMD_AQ_REQUEST_VERSION = 4 # Request AutoQuad firmware version number.
enums['MAV_CMD'][4] = EnumEntry('MAV_CMD_AQ_REQUEST_VERSION', '''Request AutoQuad firmware version number.''')
enums['MAV_CMD'][4].param[1] = '''Empty'''
enums['MAV_CMD'][4].param[2] = '''Empty'''
enums['MAV_CMD'][4].param[3] = '''Empty'''
enums['MAV_CMD'][4].param[4] = '''Empty'''
enums['MAV_CMD'][4].param[5] = '''Empty'''
enums['MAV_CMD'][4].param[6] = '''Empty'''
enums['MAV_CMD'][4].param[7] = '''Empty'''
MAV_CMD_NAV_WAYPOINT = 16 # Navigate to waypoint.
enums['MAV_CMD'][16] = EnumEntry('MAV_CMD_NAV_WAYPOINT', '''Navigate to waypoint.''')
enums['MAV_CMD'][16].param[1] = '''Hold time in decimal seconds. (ignored by fixed wing, time to stay at waypoint for rotary wing)'''
enums['MAV_CMD'][16].param[2] = '''Acceptance radius in meters (if the sphere with this radius is hit, the waypoint counts as reached)'''
enums['MAV_CMD'][16].param[3] = '''0 to pass through the WP, if > 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.'''
enums['MAV_CMD'][16].param[4] = '''Desired yaw angle at waypoint (rotary wing). NaN for unchanged.'''
enums['MAV_CMD'][16].param[5] = '''Latitude'''
enums['MAV_CMD'][16].param[6] = '''Longitude'''
enums['MAV_CMD'][16].param[7] = '''Altitude'''
MAV_CMD_NAV_LOITER_UNLIM = 17 # Loiter around this waypoint an unlimited amount of time
enums['MAV_CMD'][17] = EnumEntry('MAV_CMD_NAV_LOITER_UNLIM', '''Loiter around this waypoint an unlimited amount of time''')
enums['MAV_CMD'][17].param[1] = '''Empty'''
enums['MAV_CMD'][17].param[2] = '''Empty'''
enums['MAV_CMD'][17].param[3] = '''Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise'''
enums['MAV_CMD'][17].param[4] = '''Desired yaw angle.'''
enums['MAV_CMD'][17].param[5] = '''Latitude'''
enums['MAV_CMD'][17].param[6] = '''Longitude'''
enums['MAV_CMD'][17].param[7] = '''Altitude'''
MAV_CMD_NAV_LOITER_TURNS = 18 # Loiter around this waypoint for X turns
enums['MAV_CMD'][18] = EnumEntry('MAV_CMD_NAV_LOITER_TURNS', '''Loiter around this waypoint for X turns''')
enums['MAV_CMD'][18].param[1] = '''Turns'''
enums['MAV_CMD'][18].param[2] = '''Empty'''
enums['MAV_CMD'][18].param[3] = '''Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise'''
enums['MAV_CMD'][18].param[4] = '''Forward moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location. Else, this is desired yaw angle'''
enums['MAV_CMD'][18].param[5] = '''Latitude'''
enums['MAV_CMD'][18].param[6] = '''Longitude'''
enums['MAV_CMD'][18].param[7] = '''Altitude'''
MAV_CMD_NAV_LOITER_TIME = 19 # Loiter around this waypoint for X seconds
enums['MAV_CMD'][19] = EnumEntry('MAV_CMD_NAV_LOITER_TIME', '''Loiter around this waypoint for X seconds''')
enums['MAV_CMD'][19].param[1] = '''Seconds (decimal)'''
enums['MAV_CMD'][19].param[2] = '''Empty'''
enums['MAV_CMD'][19].param[3] = '''Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise'''
enums['MAV_CMD'][19].param[4] = '''Forward moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location. Else, this is desired yaw angle'''
enums['MAV_CMD'][19].param[5] = '''Latitude'''
enums['MAV_CMD'][19].param[6] = '''Longitude'''
enums['MAV_CMD'][19].param[7] = '''Altitude'''
MAV_CMD_NAV_RETURN_TO_LAUNCH = 20 # Return to launch location
enums['MAV_CMD'][20] = EnumEntry('MAV_CMD_NAV_RETURN_TO_LAUNCH', '''Return to launch location''')
enums['MAV_CMD'][20].param[1] = '''Empty'''
enums['MAV_CMD'][20].param[2] = '''Empty'''
enums['MAV_CMD'][20].param[3] = '''Empty'''
enums['MAV_CMD'][20].param[4] = '''Empty'''
enums['MAV_CMD'][20].param[5] = '''Empty'''
enums['MAV_CMD'][20].param[6] = '''Empty'''
enums['MAV_CMD'][20].param[7] = '''Empty'''
MAV_CMD_NAV_LAND = 21 # Land at location
enums['MAV_CMD'][21] = EnumEntry('MAV_CMD_NAV_LAND', '''Land at location''')
enums['MAV_CMD'][21].param[1] = '''Abort Alt'''
enums['MAV_CMD'][21].param[2] = '''Empty'''
enums['MAV_CMD'][21].param[3] = '''Empty'''
enums['MAV_CMD'][21].param[4] = '''Desired yaw angle. NaN for unchanged.'''
enums['MAV_CMD'][21].param[5] = '''Latitude'''
enums['MAV_CMD'][21].param[6] = '''Longitude'''
enums['MAV_CMD'][21].param[7] = '''Altitude (ground level)'''
MAV_CMD_NAV_TAKEOFF = 22 # Takeoff from ground / hand
enums['MAV_CMD'][22] = EnumEntry('MAV_CMD_NAV_TAKEOFF', '''Takeoff from ground / hand''')
enums['MAV_CMD'][22].param[1] = '''Minimum pitch (if airspeed sensor present), desired pitch without sensor'''
enums['MAV_CMD'][22].param[2] = '''Empty'''
enums['MAV_CMD'][22].param[3] = '''Empty'''
enums['MAV_CMD'][22].param[4] = '''Yaw angle (if magnetometer present), ignored without magnetometer. NaN for unchanged.'''
enums['MAV_CMD'][22].param[5] = '''Latitude'''
enums['MAV_CMD'][22].param[6] = '''Longitude'''
enums['MAV_CMD'][22].param[7] = '''Altitude'''
MAV_CMD_NAV_LAND_LOCAL = 23 # Land at local position (local frame only)
enums['MAV_CMD'][23] = EnumEntry('MAV_CMD_NAV_LAND_LOCAL', '''Land at local position (local frame only)''')
enums['MAV_CMD'][23].param[1] = '''Landing target number (if available)'''
enums['MAV_CMD'][23].param[2] = '''Maximum accepted offset from desired landing position [m] - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land'''
enums['MAV_CMD'][23].param[3] = '''Landing descend rate [ms^-1]'''
enums['MAV_CMD'][23].param[4] = '''Desired yaw angle [rad]'''
enums['MAV_CMD'][23].param[5] = '''Y-axis position [m]'''
enums['MAV_CMD'][23].param[6] = '''X-axis position [m]'''
enums['MAV_CMD'][23].param[7] = '''Z-axis / ground level position [m]'''
MAV_CMD_NAV_TAKEOFF_LOCAL = 24 # Takeoff from local position (local frame only)
enums['MAV_CMD'][24] = EnumEntry('MAV_CMD_NAV_TAKEOFF_LOCAL', '''Takeoff from local position (local frame only)''')
enums['MAV_CMD'][24].param[1] = '''Minimum pitch (if airspeed sensor present), desired pitch without sensor [rad]'''
enums['MAV_CMD'][24].param[2] = '''Empty'''
enums['MAV_CMD'][24].param[3] = '''Takeoff ascend rate [ms^-1]'''
enums['MAV_CMD'][24].param[4] = '''Yaw angle [rad] (if magnetometer or another yaw estimation source present), ignored without one of these'''
enums['MAV_CMD'][24].param[5] = '''Y-axis position [m]'''
enums['MAV_CMD'][24].param[6] = '''X-axis position [m]'''
enums['MAV_CMD'][24].param[7] = '''Z-axis position [m]'''
MAV_CMD_NAV_FOLLOW = 25 # Vehicle following, i.e. this waypoint represents the position of a
# moving vehicle
enums['MAV_CMD'][25] = EnumEntry('MAV_CMD_NAV_FOLLOW', '''Vehicle following, i.e. this waypoint represents the position of a moving vehicle''')
enums['MAV_CMD'][25].param[1] = '''Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation'''
enums['MAV_CMD'][25].param[2] = '''Ground speed of vehicle to be followed'''
enums['MAV_CMD'][25].param[3] = '''Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise'''
enums['MAV_CMD'][25].param[4] = '''Desired yaw angle.'''
enums['MAV_CMD'][25].param[5] = '''Latitude'''
enums['MAV_CMD'][25].param[6] = '''Longitude'''
enums['MAV_CMD'][25].param[7] = '''Altitude'''
MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT = 30 # Continue on the current course and climb/descend to specified
# altitude. When the altitude is reached
# continue to the next command (i.e., don't
# proceed to the next command until the
# desired altitude is reached.
enums['MAV_CMD'][30] = EnumEntry('MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT', '''Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached.''')
enums['MAV_CMD'][30].param[1] = '''Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude. '''
enums['MAV_CMD'][30].param[2] = '''Empty'''
enums['MAV_CMD'][30].param[3] = '''Empty'''
enums['MAV_CMD'][30].param[4] = '''Empty'''
enums['MAV_CMD'][30].param[5] = '''Empty'''
enums['MAV_CMD'][30].param[6] = '''Empty'''
enums['MAV_CMD'][30].param[7] = '''Desired altitude in meters'''
MAV_CMD_NAV_LOITER_TO_ALT = 31 # Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0,
# then loiter at the current position. Don't
# consider the navigation command complete
# (don't leave loiter) until the altitude has
# been reached. Additionally, if the Heading
# Required parameter is non-zero the aircraft
# will not leave the loiter until heading
# toward the next waypoint.
enums['MAV_CMD'][31] = EnumEntry('MAV_CMD_NAV_LOITER_TO_ALT', '''Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. ''')
enums['MAV_CMD'][31].param[1] = '''Heading Required (0 = False)'''
enums['MAV_CMD'][31].param[2] = '''Radius in meters. If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter.'''
enums['MAV_CMD'][31].param[3] = '''Empty'''
enums['MAV_CMD'][31].param[4] = '''Forward moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location'''
enums['MAV_CMD'][31].param[5] = '''Latitude'''
enums['MAV_CMD'][31].param[6] = '''Longitude'''
enums['MAV_CMD'][31].param[7] = '''Altitude'''
MAV_CMD_DO_FOLLOW = 32 # Being following a target
enums['MAV_CMD'][32] = EnumEntry('MAV_CMD_DO_FOLLOW', '''Being following a target''')
enums['MAV_CMD'][32].param[1] = '''System ID (the system ID of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode'''
enums['MAV_CMD'][32].param[2] = '''RESERVED'''
enums['MAV_CMD'][32].param[3] = '''RESERVED'''
enums['MAV_CMD'][32].param[4] = '''altitude flag: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home'''
enums['MAV_CMD'][32].param[5] = '''altitude'''
enums['MAV_CMD'][32].param[6] = '''RESERVED'''
enums['MAV_CMD'][32].param[7] = '''TTL in seconds in which the MAV should go to the default position hold mode after a message rx timeout'''
MAV_CMD_DO_FOLLOW_REPOSITION = 33 # Reposition the MAV after a follow target command has been sent
enums['MAV_CMD'][33] = EnumEntry('MAV_CMD_DO_FOLLOW_REPOSITION', '''Reposition the MAV after a follow target command has been sent''')
enums['MAV_CMD'][33].param[1] = '''Camera q1 (where 0 is on the ray from the camera to the tracking device)'''
enums['MAV_CMD'][33].param[2] = '''Camera q2'''
enums['MAV_CMD'][33].param[3] = '''Camera q3'''
enums['MAV_CMD'][33].param[4] = '''Camera q4'''
enums['MAV_CMD'][33].param[5] = '''altitude offset from target (m)'''
enums['MAV_CMD'][33].param[6] = '''X offset from target (m)'''
enums['MAV_CMD'][33].param[7] = '''Y offset from target (m)'''
MAV_CMD_NAV_ROI = 80 # THIS INTERFACE IS DEPRECATED AS OF JANUARY 2018. Please use
# MAV_CMD_DO_SET_ROI_* messages instead. Sets
# the region of interest (ROI) for a sensor
# set or the vehicle itself. This can then be
# used by the vehicles control system to
# control the vehicle attitude and the
# attitude of various sensors such as cameras.
enums['MAV_CMD'][80] = EnumEntry('MAV_CMD_NAV_ROI', '''THIS INTERFACE IS DEPRECATED AS OF JANUARY 2018. Please use MAV_CMD_DO_SET_ROI_* messages instead. Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras.''')
enums['MAV_CMD'][80].param[1] = '''Region of intereset mode. (see MAV_ROI enum)'''
enums['MAV_CMD'][80].param[2] = '''Waypoint index/ target ID. (see MAV_ROI enum)'''
enums['MAV_CMD'][80].param[3] = '''ROI index (allows a vehicle to manage multiple ROI's)'''
enums['MAV_CMD'][80].param[4] = '''Empty'''
enums['MAV_CMD'][80].param[5] = '''x the location of the fixed ROI (see MAV_FRAME)'''
enums['MAV_CMD'][80].param[6] = '''y'''
enums['MAV_CMD'][80].param[7] = '''z'''
MAV_CMD_NAV_PATHPLANNING = 81 # Control autonomous path planning on the MAV.
enums['MAV_CMD'][81] = EnumEntry('MAV_CMD_NAV_PATHPLANNING', '''Control autonomous path planning on the MAV.''')
enums['MAV_CMD'][81].param[1] = '''0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning'''
enums['MAV_CMD'][81].param[2] = '''0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid'''
enums['MAV_CMD'][81].param[3] = '''Empty'''
enums['MAV_CMD'][81].param[4] = '''Yaw angle at goal, in compass degrees, [0..360]'''
enums['MAV_CMD'][81].param[5] = '''Latitude/X of goal'''
enums['MAV_CMD'][81].param[6] = '''Longitude/Y of goal'''
enums['MAV_CMD'][81].param[7] = '''Altitude/Z of goal'''
MAV_CMD_NAV_SPLINE_WAYPOINT = 82 # Navigate to waypoint using a spline path.
enums['MAV_CMD'][82] = EnumEntry('MAV_CMD_NAV_SPLINE_WAYPOINT', '''Navigate to waypoint using a spline path.''')
enums['MAV_CMD'][82].param[1] = '''Hold time in decimal seconds. (ignored by fixed wing, time to stay at waypoint for rotary wing)'''
enums['MAV_CMD'][82].param[2] = '''Empty'''
enums['MAV_CMD'][82].param[3] = '''Empty'''
enums['MAV_CMD'][82].param[4] = '''Empty'''
enums['MAV_CMD'][82].param[5] = '''Latitude/X of goal'''
enums['MAV_CMD'][82].param[6] = '''Longitude/Y of goal'''
enums['MAV_CMD'][82].param[7] = '''Altitude/Z of goal'''
MAV_CMD_NAV_VTOL_TAKEOFF = 84 # Takeoff from ground using VTOL mode
enums['MAV_CMD'][84] = EnumEntry('MAV_CMD_NAV_VTOL_TAKEOFF', '''Takeoff from ground using VTOL mode''')
enums['MAV_CMD'][84].param[1] = '''Empty'''
enums['MAV_CMD'][84].param[2] = '''Front transition heading, see VTOL_TRANSITION_HEADING enum.'''
enums['MAV_CMD'][84].param[3] = '''Empty'''
enums['MAV_CMD'][84].param[4] = '''Yaw angle in degrees. NaN for unchanged.'''
enums['MAV_CMD'][84].param[5] = '''Latitude'''
enums['MAV_CMD'][84].param[6] = '''Longitude'''
enums['MAV_CMD'][84].param[7] = '''Altitude'''
MAV_CMD_NAV_VTOL_LAND = 85 # Land using VTOL mode
enums['MAV_CMD'][85] = EnumEntry('MAV_CMD_NAV_VTOL_LAND', '''Land using VTOL mode''')
enums['MAV_CMD'][85].param[1] = '''Empty'''
enums['MAV_CMD'][85].param[2] = '''Empty'''
enums['MAV_CMD'][85].param[3] = '''Approach altitude (with the same reference as the Altitude field). NaN if unspecified.'''
enums['MAV_CMD'][85].param[4] = '''Yaw angle in degrees. NaN for unchanged.'''
enums['MAV_CMD'][85].param[5] = '''Latitude'''
enums['MAV_CMD'][85].param[6] = '''Longitude'''
enums['MAV_CMD'][85].param[7] = '''Altitude (ground level)'''
MAV_CMD_NAV_GUIDED_ENABLE = 92 # hand control over to an external controller
enums['MAV_CMD'][92] = EnumEntry('MAV_CMD_NAV_GUIDED_ENABLE', '''hand control over to an external controller''')
enums['MAV_CMD'][92].param[1] = '''On / Off (> 0.5f on)'''
enums['MAV_CMD'][92].param[2] = '''Empty'''
enums['MAV_CMD'][92].param[3] = '''Empty'''
enums['MAV_CMD'][92].param[4] = '''Empty'''
enums['MAV_CMD'][92].param[5] = '''Empty'''
enums['MAV_CMD'][92].param[6] = '''Empty'''
enums['MAV_CMD'][92].param[7] = '''Empty'''
MAV_CMD_NAV_DELAY = 93 # Delay the next navigation command a number of seconds or until a
# specified time
enums['MAV_CMD'][93] = EnumEntry('MAV_CMD_NAV_DELAY', '''Delay the next navigation command a number of seconds or until a specified time''')
enums['MAV_CMD'][93].param[1] = '''Delay in seconds (decimal, -1 to enable time-of-day fields)'''
enums['MAV_CMD'][93].param[2] = '''hour (24h format, UTC, -1 to ignore)'''
enums['MAV_CMD'][93].param[3] = '''minute (24h format, UTC, -1 to ignore)'''
enums['MAV_CMD'][93].param[4] = '''second (24h format, UTC)'''
enums['MAV_CMD'][93].param[5] = '''Empty'''
enums['MAV_CMD'][93].param[6] = '''Empty'''
enums['MAV_CMD'][93].param[7] = '''Empty'''
MAV_CMD_NAV_PAYLOAD_PLACE = 94 # Descend and place payload. Vehicle descends until it detects a
# hanging payload has reached the ground, the
# gripper is opened to release the payload
enums['MAV_CMD'][94] = EnumEntry('MAV_CMD_NAV_PAYLOAD_PLACE', '''Descend and place payload. Vehicle descends until it detects a hanging payload has reached the ground, the gripper is opened to release the payload''')
enums['MAV_CMD'][94].param[1] = '''Maximum distance to descend (meters)'''
enums['MAV_CMD'][94].param[2] = '''Empty'''
enums['MAV_CMD'][94].param[3] = '''Empty'''
enums['MAV_CMD'][94].param[4] = '''Empty'''
enums['MAV_CMD'][94].param[5] = '''Latitude (deg * 1E7)'''
enums['MAV_CMD'][94].param[6] = '''Longitude (deg * 1E7)'''
enums['MAV_CMD'][94].param[7] = '''Altitude (meters)'''
MAV_CMD_NAV_LAST = 95 # NOP - This command is only used to mark the upper limit of the
# NAV/ACTION commands in the enumeration
enums['MAV_CMD'][95] = EnumEntry('MAV_CMD_NAV_LAST', '''NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration''')
enums['MAV_CMD'][95].param[1] = '''Empty'''
enums['MAV_CMD'][95].param[2] = '''Empty'''
enums['MAV_CMD'][95].param[3] = '''Empty'''
enums['MAV_CMD'][95].param[4] = '''Empty'''
enums['MAV_CMD'][95].param[5] = '''Empty'''
enums['MAV_CMD'][95].param[6] = '''Empty'''
enums['MAV_CMD'][95].param[7] = '''Empty'''
MAV_CMD_CONDITION_DELAY = 112 # Delay mission state machine.
enums['MAV_CMD'][112] = EnumEntry('MAV_CMD_CONDITION_DELAY', '''Delay mission state machine.''')
enums['MAV_CMD'][112].param[1] = '''Delay in seconds (decimal)'''
enums['MAV_CMD'][112].param[2] = '''Empty'''
enums['MAV_CMD'][112].param[3] = '''Empty'''
enums['MAV_CMD'][112].param[4] = '''Empty'''
enums['MAV_CMD'][112].param[5] = '''Empty'''
enums['MAV_CMD'][112].param[6] = '''Empty'''
enums['MAV_CMD'][112].param[7] = '''Empty'''
MAV_CMD_CONDITION_CHANGE_ALT = 113 # Ascend/descend at rate. Delay mission state machine until desired
# altitude reached.
enums['MAV_CMD'][113] = EnumEntry('MAV_CMD_CONDITION_CHANGE_ALT', '''Ascend/descend at rate. Delay mission state machine until desired altitude reached.''')
enums['MAV_CMD'][113].param[1] = '''Descent / Ascend rate (m/s)'''
enums['MAV_CMD'][113].param[2] = '''Empty'''
enums['MAV_CMD'][113].param[3] = '''Empty'''
enums['MAV_CMD'][113].param[4] = '''Empty'''
enums['MAV_CMD'][113].param[5] = '''Empty'''
enums['MAV_CMD'][113].param[6] = '''Empty'''
enums['MAV_CMD'][113].param[7] = '''Finish Altitude'''
MAV_CMD_CONDITION_DISTANCE = 114 # Delay mission state machine until within desired distance of next NAV
# point.
enums['MAV_CMD'][114] = EnumEntry('MAV_CMD_CONDITION_DISTANCE', '''Delay mission state machine until within desired distance of next NAV point.''')
enums['MAV_CMD'][114].param[1] = '''Distance (meters)'''
enums['MAV_CMD'][114].param[2] = '''Empty'''
enums['MAV_CMD'][114].param[3] = '''Empty'''
enums['MAV_CMD'][114].param[4] = '''Empty'''
enums['MAV_CMD'][114].param[5] = '''Empty'''
enums['MAV_CMD'][114].param[6] = '''Empty'''
enums['MAV_CMD'][114].param[7] = '''Empty'''
MAV_CMD_CONDITION_YAW = 115 # Reach a certain target angle.
enums['MAV_CMD'][115] = EnumEntry('MAV_CMD_CONDITION_YAW', '''Reach a certain target angle.''')
enums['MAV_CMD'][115].param[1] = '''target angle: [0-360], 0 is north'''
enums['MAV_CMD'][115].param[2] = '''speed during yaw change:[deg per second]'''
enums['MAV_CMD'][115].param[3] = '''direction: negative: counter clockwise, positive: clockwise [-1,1]'''
enums['MAV_CMD'][115].param[4] = '''relative offset or absolute angle: [ 1,0]'''
enums['MAV_CMD'][115].param[5] = '''Empty'''
enums['MAV_CMD'][115].param[6] = '''Empty'''
enums['MAV_CMD'][115].param[7] = '''Empty'''
MAV_CMD_CONDITION_LAST = 159 # NOP - This command is only used to mark the upper limit of the
# CONDITION commands in the enumeration
enums['MAV_CMD'][159] = EnumEntry('MAV_CMD_CONDITION_LAST', '''NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration''')
enums['MAV_CMD'][159].param[1] = '''Empty'''
enums['MAV_CMD'][159].param[2] = '''Empty'''
enums['MAV_CMD'][159].param[3] = '''Empty'''
enums['MAV_CMD'][159].param[4] = '''Empty'''
enums['MAV_CMD'][159].param[5] = '''Empty'''
enums['MAV_CMD'][159].param[6] = '''Empty'''
enums['MAV_CMD'][159].param[7] = '''Empty'''
MAV_CMD_DO_SET_MODE = 176 # Set system mode.
enums['MAV_CMD'][176] = EnumEntry('MAV_CMD_DO_SET_MODE', '''Set system mode.''')
enums['MAV_CMD'][176].param[1] = '''Mode, as defined by ENUM MAV_MODE'''
enums['MAV_CMD'][176].param[2] = '''Custom mode - this is system specific, please refer to the individual autopilot specifications for details.'''
enums['MAV_CMD'][176].param[3] = '''Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details.'''
enums['MAV_CMD'][176].param[4] = '''Empty'''
enums['MAV_CMD'][176].param[5] = '''Empty'''
enums['MAV_CMD'][176].param[6] = '''Empty'''
enums['MAV_CMD'][176].param[7] = '''Empty'''
MAV_CMD_DO_JUMP = 177 # Jump to the desired command in the mission list. Repeat this action
# only the specified number of times
enums['MAV_CMD'][177] = EnumEntry('MAV_CMD_DO_JUMP', '''Jump to the desired command in the mission list. Repeat this action only the specified number of times''')
enums['MAV_CMD'][177].param[1] = '''Sequence number'''
enums['MAV_CMD'][177].param[2] = '''Repeat count'''
enums['MAV_CMD'][177].param[3] = '''Empty'''
enums['MAV_CMD'][177].param[4] = '''Empty'''
enums['MAV_CMD'][177].param[5] = '''Empty'''
enums['MAV_CMD'][177].param[6] = '''Empty'''
enums['MAV_CMD'][177].param[7] = '''Empty'''
MAV_CMD_DO_CHANGE_SPEED = 178 # Change speed and/or throttle set points.
enums['MAV_CMD'][178] = EnumEntry('MAV_CMD_DO_CHANGE_SPEED', '''Change speed and/or throttle set points.''')
enums['MAV_CMD'][178].param[1] = '''Speed type (0=Airspeed, 1=Ground Speed)'''
enums['MAV_CMD'][178].param[2] = '''Speed (m/s, -1 indicates no change)'''
enums['MAV_CMD'][178].param[3] = '''Throttle ( Percent, -1 indicates no change)'''
enums['MAV_CMD'][178].param[4] = '''absolute or relative [0,1]'''
enums['MAV_CMD'][178].param[5] = '''Empty'''
enums['MAV_CMD'][178].param[6] = '''Empty'''
enums['MAV_CMD'][178].param[7] = '''Empty'''
MAV_CMD_DO_SET_HOME = 179 # Changes the home location either to the current location or a
# specified location.
enums['MAV_CMD'][179] = EnumEntry('MAV_CMD_DO_SET_HOME', '''Changes the home location either to the current location or a specified location.''')
enums['MAV_CMD'][179].param[1] = '''Use current (1=use current location, 0=use specified location)'''
enums['MAV_CMD'][179].param[2] = '''Empty'''
enums['MAV_CMD'][179].param[3] = '''Empty'''
enums['MAV_CMD'][179].param[4] = '''Empty'''
enums['MAV_CMD'][179].param[5] = '''Latitude'''
enums['MAV_CMD'][179].param[6] = '''Longitude'''
enums['MAV_CMD'][179].param[7] = '''Altitude'''
MAV_CMD_DO_SET_PARAMETER = 180 # Set a system parameter. Caution! Use of this command requires
# knowledge of the numeric enumeration value
# of the parameter.
enums['MAV_CMD'][180] = EnumEntry('MAV_CMD_DO_SET_PARAMETER', '''Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter.''')
enums['MAV_CMD'][180].param[1] = '''Parameter number'''
enums['MAV_CMD'][180].param[2] = '''Parameter value'''
enums['MAV_CMD'][180].param[3] = '''Empty'''
enums['MAV_CMD'][180].param[4] = '''Empty'''
enums['MAV_CMD'][180].param[5] = '''Empty'''
enums['MAV_CMD'][180].param[6] = '''Empty'''
enums['MAV_CMD'][180].param[7] = '''Empty'''
MAV_CMD_DO_SET_RELAY = 181 # Set a relay to a condition.
enums['MAV_CMD'][181] = EnumEntry('MAV_CMD_DO_SET_RELAY', '''Set a relay to a condition.''')
enums['MAV_CMD'][181].param[1] = '''Relay number'''
enums['MAV_CMD'][181].param[2] = '''Setting (1=on, 0=off, others possible depending on system hardware)'''
enums['MAV_CMD'][181].param[3] = '''Empty'''
enums['MAV_CMD'][181].param[4] = '''Empty'''
enums['MAV_CMD'][181].param[5] = '''Empty'''
enums['MAV_CMD'][181].param[6] = '''Empty'''
enums['MAV_CMD'][181].param[7] = '''Empty'''
MAV_CMD_DO_REPEAT_RELAY = 182 # Cycle a relay on and off for a desired number of cyles with a desired
# period.
enums['MAV_CMD'][182] = EnumEntry('MAV_CMD_DO_REPEAT_RELAY', '''Cycle a relay on and off for a desired number of cyles with a desired period.''')
enums['MAV_CMD'][182].param[1] = '''Relay number'''
enums['MAV_CMD'][182].param[2] = '''Cycle count'''
enums['MAV_CMD'][182].param[3] = '''Cycle time (seconds, decimal)'''
enums['MAV_CMD'][182].param[4] = '''Empty'''
enums['MAV_CMD'][182].param[5] = '''Empty'''
enums['MAV_CMD'][182].param[6] = '''Empty'''
enums['MAV_CMD'][182].param[7] = '''Empty'''
MAV_CMD_DO_SET_SERVO = 183 # Set a servo to a desired PWM value.
enums['MAV_CMD'][183] = EnumEntry('MAV_CMD_DO_SET_SERVO', '''Set a servo to a desired PWM value.''')
enums['MAV_CMD'][183].param[1] = '''Servo number'''
enums['MAV_CMD'][183].param[2] = '''PWM (microseconds, 1000 to 2000 typical)'''
enums['MAV_CMD'][183].param[3] = '''Empty'''
enums['MAV_CMD'][183].param[4] = '''Empty'''
enums['MAV_CMD'][183].param[5] = '''Empty'''
enums['MAV_CMD'][183].param[6] = '''Empty'''
enums['MAV_CMD'][183].param[7] = '''Empty'''
MAV_CMD_DO_REPEAT_SERVO = 184 # Cycle a between its nominal setting and a desired PWM for a desired
# number of cycles with a desired period.
enums['MAV_CMD'][184] = EnumEntry('MAV_CMD_DO_REPEAT_SERVO', '''Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period.''')
enums['MAV_CMD'][184].param[1] = '''Servo number'''
enums['MAV_CMD'][184].param[2] = '''PWM (microseconds, 1000 to 2000 typical)'''
enums['MAV_CMD'][184].param[3] = '''Cycle count'''
enums['MAV_CMD'][184].param[4] = '''Cycle time (seconds)'''
enums['MAV_CMD'][184].param[5] = '''Empty'''
enums['MAV_CMD'][184].param[6] = '''Empty'''
enums['MAV_CMD'][184].param[7] = '''Empty'''
MAV_CMD_DO_FLIGHTTERMINATION = 185 # Terminate flight immediately
enums['MAV_CMD'][185] = EnumEntry('MAV_CMD_DO_FLIGHTTERMINATION', '''Terminate flight immediately''')
enums['MAV_CMD'][185].param[1] = '''Flight termination activated if > 0.5'''
enums['MAV_CMD'][185].param[2] = '''Empty'''
enums['MAV_CMD'][185].param[3] = '''Empty'''
enums['MAV_CMD'][185].param[4] = '''Empty'''
enums['MAV_CMD'][185].param[5] = '''Empty'''
enums['MAV_CMD'][185].param[6] = '''Empty'''
enums['MAV_CMD'][185].param[7] = '''Empty'''
MAV_CMD_DO_CHANGE_ALTITUDE = 186 # Change altitude set point.
enums['MAV_CMD'][186] = EnumEntry('MAV_CMD_DO_CHANGE_ALTITUDE', '''Change altitude set point.''')
enums['MAV_CMD'][186].param[1] = '''Altitude in meters'''
enums['MAV_CMD'][186].param[2] = '''Mav frame of new altitude (see MAV_FRAME)'''
enums['MAV_CMD'][186].param[3] = '''Empty'''
enums['MAV_CMD'][186].param[4] = '''Empty'''
enums['MAV_CMD'][186].param[5] = '''Empty'''
enums['MAV_CMD'][186].param[6] = '''Empty'''
enums['MAV_CMD'][186].param[7] = '''Empty'''
MAV_CMD_DO_LAND_START = 189 # Mission command to perform a landing. This is used as a marker in a
# mission to tell the autopilot where a
# sequence of mission items that represents a
# landing starts. It may also be sent via a
# COMMAND_LONG to trigger a landing, in which
# case the nearest (geographically) landing
# sequence in the mission will be used. The
# Latitude/Longitude is optional, and may be
# set to 0 if not needed. If specified then it
# will be used to help find the closest
# landing sequence.
enums['MAV_CMD'][189] = EnumEntry('MAV_CMD_DO_LAND_START', '''Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0 if not needed. If specified then it will be used to help find the closest landing sequence.''')
enums['MAV_CMD'][189].param[1] = '''Empty'''
enums['MAV_CMD'][189].param[2] = '''Empty'''
enums['MAV_CMD'][189].param[3] = '''Empty'''
enums['MAV_CMD'][189].param[4] = '''Empty'''
enums['MAV_CMD'][189].param[5] = '''Latitude'''
enums['MAV_CMD'][189].param[6] = '''Longitude'''
enums['MAV_CMD'][189].param[7] = '''Empty'''
MAV_CMD_DO_RALLY_LAND = 190 # Mission command to perform a landing from a rally point.
enums['MAV_CMD'][190] = EnumEntry('MAV_CMD_DO_RALLY_LAND', '''Mission command to perform a landing from a rally point.''')
enums['MAV_CMD'][190].param[1] = '''Break altitude (meters)'''
enums['MAV_CMD'][190].param[2] = '''Landing speed (m/s)'''
enums['MAV_CMD'][190].param[3] = '''Empty'''
enums['MAV_CMD'][190].param[4] = '''Empty'''
enums['MAV_CMD'][190].param[5] = '''Empty'''
enums['MAV_CMD'][190].param[6] = '''Empty'''
enums['MAV_CMD'][190].param[7] = '''Empty'''
MAV_CMD_DO_GO_AROUND = 191 # Mission command to safely abort an autonmous landing.
enums['MAV_CMD'][191] = EnumEntry('MAV_CMD_DO_GO_AROUND', '''Mission command to safely abort an autonmous landing.''')
enums['MAV_CMD'][191].param[1] = '''Altitude (meters)'''
enums['MAV_CMD'][191].param[2] = '''Empty'''
enums['MAV_CMD'][191].param[3] = '''Empty'''
enums['MAV_CMD'][191].param[4] = '''Empty'''
enums['MAV_CMD'][191].param[5] = '''Empty'''
enums['MAV_CMD'][191].param[6] = '''Empty'''
enums['MAV_CMD'][191].param[7] = '''Empty'''
MAV_CMD_DO_REPOSITION = 192 # Reposition the vehicle to a specific WGS84 global position.
enums['MAV_CMD'][192] = EnumEntry('MAV_CMD_DO_REPOSITION', '''Reposition the vehicle to a specific WGS84 global position.''')
enums['MAV_CMD'][192].param[1] = '''Ground speed, less than 0 (-1) for default'''
enums['MAV_CMD'][192].param[2] = '''Bitmask of option flags, see the MAV_DO_REPOSITION_FLAGS enum.'''
enums['MAV_CMD'][192].param[3] = '''Reserved'''
enums['MAV_CMD'][192].param[4] = '''Yaw heading, NaN for unchanged. For planes indicates loiter direction (0: clockwise, 1: counter clockwise)'''
enums['MAV_CMD'][192].param[5] = '''Latitude (deg * 1E7)'''
enums['MAV_CMD'][192].param[6] = '''Longitude (deg * 1E7)'''
enums['MAV_CMD'][192].param[7] = '''Altitude (meters)'''
MAV_CMD_DO_PAUSE_CONTINUE = 193 # If in a GPS controlled position mode, hold the current position or
# continue.
enums['MAV_CMD'][193] = EnumEntry('MAV_CMD_DO_PAUSE_CONTINUE', '''If in a GPS controlled position mode, hold the current position or continue.''')
enums['MAV_CMD'][193].param[1] = '''0: Pause current mission or reposition command, hold current position. 1: Continue mission. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius.'''
enums['MAV_CMD'][193].param[2] = '''Reserved'''
enums['MAV_CMD'][193].param[3] = '''Reserved'''
enums['MAV_CMD'][193].param[4] = '''Reserved'''
enums['MAV_CMD'][193].param[5] = '''Reserved'''
enums['MAV_CMD'][193].param[6] = '''Reserved'''
enums['MAV_CMD'][193].param[7] = '''Reserved'''
MAV_CMD_DO_SET_REVERSE = 194 # Set moving direction to forward or reverse.
enums['MAV_CMD'][194] = EnumEntry('MAV_CMD_DO_SET_REVERSE', '''Set moving direction to forward or reverse.''')
enums['MAV_CMD'][194].param[1] = '''Direction (0=Forward, 1=Reverse)'''
enums['MAV_CMD'][194].param[2] = '''Empty'''
enums['MAV_CMD'][194].param[3] = '''Empty'''
enums['MAV_CMD'][194].param[4] = '''Empty'''
enums['MAV_CMD'][194].param[5] = '''Empty'''
enums['MAV_CMD'][194].param[6] = '''Empty'''
enums['MAV_CMD'][194].param[7] = '''Empty'''
MAV_CMD_DO_SET_ROI_LOCATION = 195 # Sets the region of interest (ROI) to a location. This can then be used
# by the vehicles control system to control
# the vehicle attitude and the attitude of
# various sensors such as cameras.
enums['MAV_CMD'][195] = EnumEntry('MAV_CMD_DO_SET_ROI_LOCATION', '''Sets the region of interest (ROI) to a location. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras.''')
enums['MAV_CMD'][195].param[1] = '''Empty'''
enums['MAV_CMD'][195].param[2] = '''Empty'''
enums['MAV_CMD'][195].param[3] = '''Empty'''
enums['MAV_CMD'][195].param[4] = '''Empty'''
enums['MAV_CMD'][195].param[5] = '''Latitude'''
enums['MAV_CMD'][195].param[6] = '''Longitude'''
enums['MAV_CMD'][195].param[7] = '''Altitude'''
MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET = 196 # Sets the region of interest (ROI) to be toward next waypoint, with
# optional pitch/roll/yaw offset. This can
# then be used by the vehicles control system
# to control the vehicle attitude and the
# attitude of various sensors such as cameras.
enums['MAV_CMD'][196] = EnumEntry('MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET', '''Sets the region of interest (ROI) to be toward next waypoint, with optional pitch/roll/yaw offset. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras.''')
enums['MAV_CMD'][196].param[1] = '''Empty'''
enums['MAV_CMD'][196].param[2] = '''Empty'''
enums['MAV_CMD'][196].param[3] = '''Empty'''
enums['MAV_CMD'][196].param[4] = '''Empty'''
enums['MAV_CMD'][196].param[5] = '''pitch offset from next waypoint'''
enums['MAV_CMD'][196].param[6] = '''roll offset from next waypoint'''
enums['MAV_CMD'][196].param[7] = '''yaw offset from next waypoint'''
MAV_CMD_DO_SET_ROI_NONE = 197 # Cancels any previous ROI command returning the vehicle/sensors to
# default flight characteristics. This can
# then be used by the vehicles control system
# to control the vehicle attitude and the
# attitude of various sensors such as cameras.
enums['MAV_CMD'][197] = EnumEntry('MAV_CMD_DO_SET_ROI_NONE', '''Cancels any previous ROI command returning the vehicle/sensors to default flight characteristics. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras.''')
enums['MAV_CMD'][197].param[1] = '''Empty'''
enums['MAV_CMD'][197].param[2] = '''Empty'''
enums['MAV_CMD'][197].param[3] = '''Empty'''
enums['MAV_CMD'][197].param[4] = '''Empty'''
enums['MAV_CMD'][197].param[5] = '''Empty'''
enums['MAV_CMD'][197].param[6] = '''Empty'''
enums['MAV_CMD'][197].param[7] = '''Empty'''
MAV_CMD_DO_CONTROL_VIDEO = 200 # Control onboard camera system.
enums['MAV_CMD'][200] = EnumEntry('MAV_CMD_DO_CONTROL_VIDEO', '''Control onboard camera system.''')
enums['MAV_CMD'][200].param[1] = '''Camera ID (-1 for all)'''
enums['MAV_CMD'][200].param[2] = '''Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw'''
enums['MAV_CMD'][200].param[3] = '''Transmission mode: 0: video stream, >0: single images every n seconds (decimal)'''
enums['MAV_CMD'][200].param[4] = '''Recording: 0: disabled, 1: enabled compressed, 2: enabled raw'''
enums['MAV_CMD'][200].param[5] = '''Empty'''
enums['MAV_CMD'][200].param[6] = '''Empty'''
enums['MAV_CMD'][200].param[7] = '''Empty'''
MAV_CMD_DO_SET_ROI = 201 # THIS INTERFACE IS DEPRECATED AS OF JANUARY 2018. Please use
# MAV_CMD_DO_SET_ROI_* messages instead. Sets
# the region of interest (ROI) for a sensor
# set or the vehicle itself. This can then be
# used by the vehicles control system to
# control the vehicle attitude and the
# attitude of various sensors such as cameras.
enums['MAV_CMD'][201] = EnumEntry('MAV_CMD_DO_SET_ROI', '''THIS INTERFACE IS DEPRECATED AS OF JANUARY 2018. Please use MAV_CMD_DO_SET_ROI_* messages instead. Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras.''')
enums['MAV_CMD'][201].param[1] = '''Region of intereset mode. (see MAV_ROI enum)'''
enums['MAV_CMD'][201].param[2] = '''Waypoint index/ target ID. (see MAV_ROI enum)'''
enums['MAV_CMD'][201].param[3] = '''ROI index (allows a vehicle to manage multiple ROI's)'''
enums['MAV_CMD'][201].param[4] = '''Empty'''
enums['MAV_CMD'][201].param[5] = '''x the location of the fixed ROI (see MAV_FRAME)'''
enums['MAV_CMD'][201].param[6] = '''y'''
enums['MAV_CMD'][201].param[7] = '''z'''
MAV_CMD_DO_DIGICAM_CONFIGURE = 202 # Mission command to configure an on-board camera controller system.
enums['MAV_CMD'][202] = EnumEntry('MAV_CMD_DO_DIGICAM_CONFIGURE', '''Mission command to configure an on-board camera controller system.''')
enums['MAV_CMD'][202].param[1] = '''Modes: P, TV, AV, M, Etc'''
enums['MAV_CMD'][202].param[2] = '''Shutter speed: Divisor number for one second'''
enums['MAV_CMD'][202].param[3] = '''Aperture: F stop number'''
enums['MAV_CMD'][202].param[4] = '''ISO number e.g. 80, 100, 200, Etc'''
enums['MAV_CMD'][202].param[5] = '''Exposure type enumerator'''
enums['MAV_CMD'][202].param[6] = '''Command Identity'''
enums['MAV_CMD'][202].param[7] = '''Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)'''
MAV_CMD_DO_DIGICAM_CONTROL = 203 # Mission command to control an on-board camera controller system.
enums['MAV_CMD'][203] = EnumEntry('MAV_CMD_DO_DIGICAM_CONTROL', '''Mission command to control an on-board camera controller system.''')
enums['MAV_CMD'][203].param[1] = '''Session control e.g. show/hide lens'''
enums['MAV_CMD'][203].param[2] = '''Zoom's absolute position'''
enums['MAV_CMD'][203].param[3] = '''Zooming step value to offset zoom from the current position'''
enums['MAV_CMD'][203].param[4] = '''Focus Locking, Unlocking or Re-locking'''
enums['MAV_CMD'][203].param[5] = '''Shooting Command'''
enums['MAV_CMD'][203].param[6] = '''Command Identity'''
enums['MAV_CMD'][203].param[7] = '''Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count.'''
MAV_CMD_DO_MOUNT_CONFIGURE = 204 # Mission command to configure a camera or antenna mount
enums['MAV_CMD'][204] = EnumEntry('MAV_CMD_DO_MOUNT_CONFIGURE', '''Mission command to configure a camera or antenna mount''')
enums['MAV_CMD'][204].param[1] = '''Mount operation mode (see MAV_MOUNT_MODE enum)'''
enums['MAV_CMD'][204].param[2] = '''stabilize roll? (1 = yes, 0 = no)'''
enums['MAV_CMD'][204].param[3] = '''stabilize pitch? (1 = yes, 0 = no)'''
enums['MAV_CMD'][204].param[4] = '''stabilize yaw? (1 = yes, 0 = no)'''
enums['MAV_CMD'][204].param[5] = '''Empty'''
enums['MAV_CMD'][204].param[6] = '''Empty'''
enums['MAV_CMD'][204].param[7] = '''Empty'''
MAV_CMD_DO_MOUNT_CONTROL = 205 # Mission command to control a camera or antenna mount
enums['MAV_CMD'][205] = EnumEntry('MAV_CMD_DO_MOUNT_CONTROL', '''Mission command to control a camera or antenna mount''')
enums['MAV_CMD'][205].param[1] = '''pitch (WIP: DEPRECATED: or lat in degrees) depending on mount mode.'''
enums['MAV_CMD'][205].param[2] = '''roll (WIP: DEPRECATED: or lon in degrees) depending on mount mode.'''
enums['MAV_CMD'][205].param[3] = '''yaw (WIP: DEPRECATED: or alt in meters) depending on mount mode.'''
enums['MAV_CMD'][205].param[4] = '''WIP: alt in meters depending on mount mode.'''
enums['MAV_CMD'][205].param[5] = '''WIP: latitude in degrees * 1E7, set if appropriate mount mode.'''
enums['MAV_CMD'][205].param[6] = '''WIP: longitude in degrees * 1E7, set if appropriate mount mode.'''
enums['MAV_CMD'][205].param[7] = '''MAV_MOUNT_MODE enum value'''
MAV_CMD_DO_SET_CAM_TRIGG_DIST = 206 # Mission command to set camera trigger distance for this flight. The
# camera is trigerred each time this distance
# is exceeded. This command can also be used
# to set the shutter integration time for the
# camera.
enums['MAV_CMD'][206] = EnumEntry('MAV_CMD_DO_SET_CAM_TRIGG_DIST', '''Mission command to set camera trigger distance for this flight. The camera is trigerred each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera.''')
enums['MAV_CMD'][206].param[1] = '''Camera trigger distance (meters). 0 to stop triggering.'''
enums['MAV_CMD'][206].param[2] = '''Camera shutter integration time (milliseconds). -1 or 0 to ignore'''
enums['MAV_CMD'][206].param[3] = '''Trigger camera once immediately. (0 = no trigger, 1 = trigger)'''
enums['MAV_CMD'][206].param[4] = '''Empty'''
enums['MAV_CMD'][206].param[5] = '''Empty'''
enums['MAV_CMD'][206].param[6] = '''Empty'''
enums['MAV_CMD'][206].param[7] = '''Empty'''
MAV_CMD_DO_FENCE_ENABLE = 207 # Mission command to enable the geofence
enums['MAV_CMD'][207] = EnumEntry('MAV_CMD_DO_FENCE_ENABLE', '''Mission command to enable the geofence''')
enums['MAV_CMD'][207].param[1] = '''enable? (0=disable, 1=enable, 2=disable_floor_only)'''
enums['MAV_CMD'][207].param[2] = '''Empty'''
enums['MAV_CMD'][207].param[3] = '''Empty'''
enums['MAV_CMD'][207].param[4] = '''Empty'''
enums['MAV_CMD'][207].param[5] = '''Empty'''
enums['MAV_CMD'][207].param[6] = '''Empty'''
enums['MAV_CMD'][207].param[7] = '''Empty'''
MAV_CMD_DO_PARACHUTE = 208 # Mission command to trigger a parachute
enums['MAV_CMD'][208] = EnumEntry('MAV_CMD_DO_PARACHUTE', '''Mission command to trigger a parachute''')
enums['MAV_CMD'][208].param[1] = '''action (0=disable, 1=enable, 2=release, for some systems see PARACHUTE_ACTION enum, not in general message set.)'''
enums['MAV_CMD'][208].param[2] = '''Empty'''
enums['MAV_CMD'][208].param[3] = '''Empty'''
enums['MAV_CMD'][208].param[4] = '''Empty'''
enums['MAV_CMD'][208].param[5] = '''Empty'''
enums['MAV_CMD'][208].param[6] = '''Empty'''
enums['MAV_CMD'][208].param[7] = '''Empty'''
MAV_CMD_DO_MOTOR_TEST = 209 # Mission command to perform motor test
enums['MAV_CMD'][209] = EnumEntry('MAV_CMD_DO_MOTOR_TEST', '''Mission command to perform motor test''')
enums['MAV_CMD'][209].param[1] = '''motor number (a number from 1 to max number of motors on the vehicle)'''
enums['MAV_CMD'][209].param[2] = '''throttle type (0=throttle percentage, 1=PWM, 2=pilot throttle channel pass-through. See MOTOR_TEST_THROTTLE_TYPE enum)'''
enums['MAV_CMD'][209].param[3] = '''throttle'''
enums['MAV_CMD'][209].param[4] = '''timeout (in seconds)'''
enums['MAV_CMD'][209].param[5] = '''motor count (number of motors to test to test in sequence, waiting for the timeout above between them; 0=1 motor, 1=1 motor, 2=2 motors...)'''
enums['MAV_CMD'][209].param[6] = '''motor test order (See MOTOR_TEST_ORDER enum)'''
enums['MAV_CMD'][209].param[7] = '''Empty'''
MAV_CMD_DO_INVERTED_FLIGHT = 210 # Change to/from inverted flight
enums['MAV_CMD'][210] = EnumEntry('MAV_CMD_DO_INVERTED_FLIGHT', '''Change to/from inverted flight''')
enums['MAV_CMD'][210].param[1] = '''inverted (0=normal, 1=inverted)'''
enums['MAV_CMD'][210].param[2] = '''Empty'''
enums['MAV_CMD'][210].param[3] = '''Empty'''
enums['MAV_CMD'][210].param[4] = '''Empty'''
enums['MAV_CMD'][210].param[5] = '''Empty'''
enums['MAV_CMD'][210].param[6] = '''Empty'''
enums['MAV_CMD'][210].param[7] = '''Empty'''
MAV_CMD_NAV_SET_YAW_SPEED = 213 # Sets a desired vehicle turn angle and speed change
enums['MAV_CMD'][213] = EnumEntry('MAV_CMD_NAV_SET_YAW_SPEED', '''Sets a desired vehicle turn angle and speed change''')
enums['MAV_CMD'][213].param[1] = '''yaw angle to adjust steering by in centidegress'''
enums['MAV_CMD'][213].param[2] = '''speed - normalized to 0 .. 1'''
enums['MAV_CMD'][213].param[3] = '''Empty'''
enums['MAV_CMD'][213].param[4] = '''Empty'''
enums['MAV_CMD'][213].param[5] = '''Empty'''
enums['MAV_CMD'][213].param[6] = '''Empty'''
enums['MAV_CMD'][213].param[7] = '''Empty'''
MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL = 214 # Mission command to set camera trigger interval for this flight. If
# triggering is enabled, the camera is
# triggered each time this interval expires.
# This command can also be used to set the
# shutter integration time for the camera.
enums['MAV_CMD'][214] = EnumEntry('MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL', '''Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera.''')
enums['MAV_CMD'][214].param[1] = '''Camera trigger cycle time (milliseconds). -1 or 0 to ignore.'''
enums['MAV_CMD'][214].param[2] = '''Camera shutter integration time (milliseconds). Should be less than trigger cycle time. -1 or 0 to ignore.'''
enums['MAV_CMD'][214].param[3] = '''Empty'''
enums['MAV_CMD'][214].param[4] = '''Empty'''
enums['MAV_CMD'][214].param[5] = '''Empty'''
enums['MAV_CMD'][214].param[6] = '''Empty'''
enums['MAV_CMD'][214].param[7] = '''Empty'''
MAV_CMD_DO_MOUNT_CONTROL_QUAT = 220 # Mission command to control a camera or antenna mount, using a
# quaternion as reference.
enums['MAV_CMD'][220] = EnumEntry('MAV_CMD_DO_MOUNT_CONTROL_QUAT', '''Mission command to control a camera or antenna mount, using a quaternion as reference.''')
enums['MAV_CMD'][220].param[1] = '''q1 - quaternion param #1, w (1 in null-rotation)'''
enums['MAV_CMD'][220].param[2] = '''q2 - quaternion param #2, x (0 in null-rotation)'''
enums['MAV_CMD'][220].param[3] = '''q3 - quaternion param #3, y (0 in null-rotation)'''
enums['MAV_CMD'][220].param[4] = '''q4 - quaternion param #4, z (0 in null-rotation)'''
enums['MAV_CMD'][220].param[5] = '''Empty'''
enums['MAV_CMD'][220].param[6] = '''Empty'''
enums['MAV_CMD'][220].param[7] = '''Empty'''
MAV_CMD_DO_GUIDED_MASTER = 221 # set id of master controller
enums['MAV_CMD'][221] = EnumEntry('MAV_CMD_DO_GUIDED_MASTER', '''set id of master controller''')
enums['MAV_CMD'][221].param[1] = '''System ID'''
enums['MAV_CMD'][221].param[2] = '''Component ID'''
enums['MAV_CMD'][221].param[3] = '''Empty'''
enums['MAV_CMD'][221].param[4] = '''Empty'''
enums['MAV_CMD'][221].param[5] = '''Empty'''
enums['MAV_CMD'][221].param[6] = '''Empty'''
enums['MAV_CMD'][221].param[7] = '''Empty'''
MAV_CMD_DO_GUIDED_LIMITS = 222 # set limits for external control
enums['MAV_CMD'][222] = EnumEntry('MAV_CMD_DO_GUIDED_LIMITS', '''set limits for external control''')
enums['MAV_CMD'][222].param[1] = '''timeout - maximum time (in seconds) that external controller will be allowed to control vehicle. 0 means no timeout'''
enums['MAV_CMD'][222].param[2] = '''absolute altitude min (in meters, AMSL) - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit'''
enums['MAV_CMD'][222].param[3] = '''absolute altitude max (in meters)- if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit'''
enums['MAV_CMD'][222].param[4] = '''horizontal move limit (in meters, AMSL) - if vehicle moves more than this distance from it's location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal altitude limit'''
enums['MAV_CMD'][222].param[5] = '''Empty'''
enums['MAV_CMD'][222].param[6] = '''Empty'''
enums['MAV_CMD'][222].param[7] = '''Empty'''
MAV_CMD_DO_ENGINE_CONTROL = 223 # Control vehicle engine. This is interpreted by the vehicles engine
# controller to change the target engine
# state. It is intended for vehicles with
# internal combustion engines
enums['MAV_CMD'][223] = EnumEntry('MAV_CMD_DO_ENGINE_CONTROL', '''Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines''')
enums['MAV_CMD'][223].param[1] = '''0: Stop engine, 1:Start Engine'''
enums['MAV_CMD'][223].param[2] = '''0: Warm start, 1:Cold start. Controls use of choke where applicable'''
enums['MAV_CMD'][223].param[3] = '''Height delay (meters). This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay.'''
enums['MAV_CMD'][223].param[4] = '''Empty'''
enums['MAV_CMD'][223].param[5] = '''Empty'''
enums['MAV_CMD'][223].param[5] = '''Empty'''
enums['MAV_CMD'][223].param[6] = '''Empty'''
enums['MAV_CMD'][223].param[7] = '''Empty'''
MAV_CMD_DO_LAST = 240 # NOP - This command is only used to mark the upper limit of the DO
# commands in the enumeration
enums['MAV_CMD'][240] = EnumEntry('MAV_CMD_DO_LAST', '''NOP - This command is only used to mark the upper limit of the DO commands in the enumeration''')
enums['MAV_CMD'][240].param[1] = '''Empty'''
enums['MAV_CMD'][240].param[2] = '''Empty'''
enums['MAV_CMD'][240].param[3] = '''Empty'''
enums['MAV_CMD'][240].param[4] = '''Empty'''
enums['MAV_CMD'][240].param[5] = '''Empty'''
enums['MAV_CMD'][240].param[6] = '''Empty'''
enums['MAV_CMD'][240].param[7] = '''Empty'''
MAV_CMD_PREFLIGHT_CALIBRATION = 241 # Trigger calibration. This command will be only accepted if in pre-
# flight mode. Except for Temperature
# Calibration, only one sensor should be set
# in a single message and all others should be
# zero.
enums['MAV_CMD'][241] = EnumEntry('MAV_CMD_PREFLIGHT_CALIBRATION', '''Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero.''')
enums['MAV_CMD'][241].param[1] = '''1: gyro calibration, 3: gyro temperature calibration'''
enums['MAV_CMD'][241].param[2] = '''1: magnetometer calibration'''
enums['MAV_CMD'][241].param[3] = '''1: ground pressure calibration'''
enums['MAV_CMD'][241].param[4] = '''1: radio RC calibration, 2: RC trim calibration'''
enums['MAV_CMD'][241].param[5] = '''1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration, 4: simple accelerometer calibration'''
enums['MAV_CMD'][241].param[6] = '''1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration'''
enums['MAV_CMD'][241].param[7] = '''1: ESC calibration, 3: barometer temperature calibration'''
MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS = 242 # Set sensor offsets. This command will be only accepted if in pre-
# flight mode.
enums['MAV_CMD'][242] = EnumEntry('MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS', '''Set sensor offsets. This command will be only accepted if in pre-flight mode.''')
enums['MAV_CMD'][242].param[1] = '''Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer'''
enums['MAV_CMD'][242].param[2] = '''X axis offset (or generic dimension 1), in the sensor's raw units'''
enums['MAV_CMD'][242].param[3] = '''Y axis offset (or generic dimension 2), in the sensor's raw units'''
enums['MAV_CMD'][242].param[4] = '''Z axis offset (or generic dimension 3), in the sensor's raw units'''
enums['MAV_CMD'][242].param[5] = '''Generic dimension 4, in the sensor's raw units'''
enums['MAV_CMD'][242].param[6] = '''Generic dimension 5, in the sensor's raw units'''
enums['MAV_CMD'][242].param[7] = '''Generic dimension 6, in the sensor's raw units'''
MAV_CMD_PREFLIGHT_UAVCAN = 243 # Trigger UAVCAN config. This command will be only accepted if in pre-
# flight mode.
enums['MAV_CMD'][243] = EnumEntry('MAV_CMD_PREFLIGHT_UAVCAN', '''Trigger UAVCAN config. This command will be only accepted if in pre-flight mode.''')
enums['MAV_CMD'][243].param[1] = '''1: Trigger actuator ID assignment and direction mapping.'''
enums['MAV_CMD'][243].param[2] = '''Reserved'''
enums['MAV_CMD'][243].param[3] = '''Reserved'''
enums['MAV_CMD'][243].param[4] = '''Reserved'''
enums['MAV_CMD'][243].param[5] = '''Reserved'''
enums['MAV_CMD'][243].param[6] = '''Reserved'''
enums['MAV_CMD'][243].param[7] = '''Reserved'''
MAV_CMD_PREFLIGHT_STORAGE = 245 # Request storage of different parameter values and logs. This command
# will be only accepted if in pre-flight mode.
enums['MAV_CMD'][245] = EnumEntry('MAV_CMD_PREFLIGHT_STORAGE', '''Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode.''')
enums['MAV_CMD'][245].param[1] = '''Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults'''
enums['MAV_CMD'][245].param[2] = '''Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults'''
enums['MAV_CMD'][245].param[3] = '''Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: start logging with rate of param 3 in Hz (e.g. set to 1000 for 1000 Hz logging)'''
enums['MAV_CMD'][245].param[4] = '''Reserved'''
enums['MAV_CMD'][245].param[5] = '''Empty'''
enums['MAV_CMD'][245].param[6] = '''Empty'''
enums['MAV_CMD'][245].param[7] = '''Empty'''
MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN = 246 # Request the reboot or shutdown of system components.
enums['MAV_CMD'][246] = EnumEntry('MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN', '''Request the reboot or shutdown of system components.''')
enums['MAV_CMD'][246].param[1] = '''0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot, 3: Reboot autopilot and keep it in the bootloader until upgraded.'''
enums['MAV_CMD'][246].param[2] = '''0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer, 3: Reboot onboard computer and keep it in the bootloader until upgraded.'''
enums['MAV_CMD'][246].param[3] = '''WIP: 0: Do nothing for camera, 1: Reboot onboard camera, 2: Shutdown onboard camera, 3: Reboot onboard camera and keep it in the bootloader until upgraded'''
enums['MAV_CMD'][246].param[4] = '''WIP: 0: Do nothing for mount (e.g. gimbal), 1: Reboot mount, 2: Shutdown mount, 3: Reboot mount and keep it in the bootloader until upgraded'''
enums['MAV_CMD'][246].param[5] = '''Reserved, send 0'''
enums['MAV_CMD'][246].param[6] = '''Reserved, send 0'''
enums['MAV_CMD'][246].param[7] = '''WIP: ID (e.g. camera ID -1 for all IDs)'''
MAV_CMD_OVERRIDE_GOTO = 252 # Hold / continue the current action
enums['MAV_CMD'][252] = EnumEntry('MAV_CMD_OVERRIDE_GOTO', '''Hold / continue the current action''')
enums['MAV_CMD'][252].param[1] = '''MAV_GOTO_DO_HOLD: hold MAV_GOTO_DO_CONTINUE: continue with next item in mission plan'''
enums['MAV_CMD'][252].param[2] = '''MAV_GOTO_HOLD_AT_CURRENT_POSITION: Hold at current position MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position'''
enums['MAV_CMD'][252].param[3] = '''MAV_FRAME coordinate frame of hold point'''
enums['MAV_CMD'][252].param[4] = '''Desired yaw angle in degrees'''
enums['MAV_CMD'][252].param[5] = '''Latitude / X position'''
enums['MAV_CMD'][252].param[6] = '''Longitude / Y position'''
enums['MAV_CMD'][252].param[7] = '''Altitude / Z position'''
MAV_CMD_MISSION_START = 300 # start running a mission
enums['MAV_CMD'][300] = EnumEntry('MAV_CMD_MISSION_START', '''start running a mission''')
enums['MAV_CMD'][300].param[1] = '''first_item: the first mission item to run'''
enums['MAV_CMD'][300].param[2] = '''last_item: the last mission item to run (after this item is run, the mission ends)'''
MAV_CMD_COMPONENT_ARM_DISARM = 400 # Arms / Disarms a component
enums['MAV_CMD'][400] = EnumEntry('MAV_CMD_COMPONENT_ARM_DISARM', '''Arms / Disarms a component''')
enums['MAV_CMD'][400].param[1] = '''1 to arm, 0 to disarm'''
MAV_CMD_GET_HOME_POSITION = 410 # Request the home position from the vehicle.
enums['MAV_CMD'][410] = EnumEntry('MAV_CMD_GET_HOME_POSITION', '''Request the home position from the vehicle.''')
enums['MAV_CMD'][410].param[1] = '''Reserved'''
enums['MAV_CMD'][410].param[2] = '''Reserved'''
enums['MAV_CMD'][410].param[3] = '''Reserved'''
enums['MAV_CMD'][410].param[4] = '''Reserved'''
enums['MAV_CMD'][410].param[5] = '''Reserved'''
enums['MAV_CMD'][410].param[6] = '''Reserved'''
enums['MAV_CMD'][410].param[7] = '''Reserved'''
MAV_CMD_START_RX_PAIR = 500 # Starts receiver pairing
enums['MAV_CMD'][500] = EnumEntry('MAV_CMD_START_RX_PAIR', '''Starts receiver pairing''')
enums['MAV_CMD'][500].param[1] = '''0:Spektrum'''
enums['MAV_CMD'][500].param[2] = '''RC type (see RC_TYPE enum)'''
MAV_CMD_GET_MESSAGE_INTERVAL = 510 # Request the interval between messages for a particular MAVLink message
# ID
enums['MAV_CMD'][510] = EnumEntry('MAV_CMD_GET_MESSAGE_INTERVAL', '''Request the interval between messages for a particular MAVLink message ID''')
enums['MAV_CMD'][510].param[1] = '''The MAVLink message ID'''
MAV_CMD_SET_MESSAGE_INTERVAL = 511 # Request the interval between messages for a particular MAVLink message
# ID. This interface replaces
# REQUEST_DATA_STREAM
enums['MAV_CMD'][511] = EnumEntry('MAV_CMD_SET_MESSAGE_INTERVAL', '''Request the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM''')
enums['MAV_CMD'][511].param[1] = '''The MAVLink message ID'''
enums['MAV_CMD'][511].param[2] = '''The interval between two messages, in microseconds. Set to -1 to disable and 0 to request default rate.'''
MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES = 520 # Request autopilot capabilities
enums['MAV_CMD'][520] = EnumEntry('MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES', '''Request autopilot capabilities''')
enums['MAV_CMD'][520].param[1] = '''1: Request autopilot version'''
enums['MAV_CMD'][520].param[2] = '''Reserved (all remaining params)'''
MAV_CMD_REQUEST_CAMERA_INFORMATION = 521 # WIP: Request camera information (CAMERA_INFORMATION)
enums['MAV_CMD'][521] = EnumEntry('MAV_CMD_REQUEST_CAMERA_INFORMATION', '''WIP: Request camera information (CAMERA_INFORMATION)''')
enums['MAV_CMD'][521].param[1] = '''1: Request camera capabilities'''
enums['MAV_CMD'][521].param[2] = '''Camera ID'''
enums['MAV_CMD'][521].param[3] = '''Reserved (all remaining params)'''
MAV_CMD_REQUEST_CAMERA_SETTINGS = 522 # WIP: Request camera settings (CAMERA_SETTINGS)
enums['MAV_CMD'][522] = EnumEntry('MAV_CMD_REQUEST_CAMERA_SETTINGS', '''WIP: Request camera settings (CAMERA_SETTINGS)''')
enums['MAV_CMD'][522].param[1] = '''1: Request camera settings'''
enums['MAV_CMD'][522].param[2] = '''Camera ID'''
enums['MAV_CMD'][522].param[3] = '''Reserved (all remaining params)'''
MAV_CMD_SET_CAMERA_SETTINGS_1 = 523 # WIP: Set the camera settings part 1 (CAMERA_SETTINGS)
enums['MAV_CMD'][523] = EnumEntry('MAV_CMD_SET_CAMERA_SETTINGS_1', '''WIP: Set the camera settings part 1 (CAMERA_SETTINGS)''')
enums['MAV_CMD'][523].param[1] = '''Camera ID'''
enums['MAV_CMD'][523].param[2] = '''Aperture (1/value)'''
enums['MAV_CMD'][523].param[3] = '''Aperture locked (0: auto, 1: locked)'''
enums['MAV_CMD'][523].param[4] = '''Shutter speed in s'''
enums['MAV_CMD'][523].param[5] = '''Shutter speed locked (0: auto, 1: locked)'''
enums['MAV_CMD'][523].param[6] = '''ISO sensitivity'''
enums['MAV_CMD'][523].param[7] = '''ISO sensitivity locked (0: auto, 1: locked)'''
MAV_CMD_SET_CAMERA_SETTINGS_2 = 524 # WIP: Set the camera settings part 2 (CAMERA_SETTINGS)
enums['MAV_CMD'][524] = EnumEntry('MAV_CMD_SET_CAMERA_SETTINGS_2', '''WIP: Set the camera settings part 2 (CAMERA_SETTINGS)''')
enums['MAV_CMD'][524].param[1] = '''Camera ID'''
enums['MAV_CMD'][524].param[2] = '''White balance locked (0: auto, 1: locked)'''
enums['MAV_CMD'][524].param[3] = '''White balance (color temperature in K)'''
enums['MAV_CMD'][524].param[4] = '''Reserved for camera mode ID'''
enums['MAV_CMD'][524].param[5] = '''Reserved for color mode ID'''
enums['MAV_CMD'][524].param[6] = '''Reserved for image format ID'''
enums['MAV_CMD'][524].param[7] = '''Reserved'''
MAV_CMD_REQUEST_STORAGE_INFORMATION = 525 # WIP: Request storage information (STORAGE_INFORMATION)
enums['MAV_CMD'][525] = EnumEntry('MAV_CMD_REQUEST_STORAGE_INFORMATION', '''WIP: Request storage information (STORAGE_INFORMATION)''')
enums['MAV_CMD'][525].param[1] = '''1: Request storage information'''
enums['MAV_CMD'][525].param[2] = '''Storage ID'''
enums['MAV_CMD'][525].param[3] = '''Reserved (all remaining params)'''
MAV_CMD_STORAGE_FORMAT = 526 # WIP: Format a storage medium
enums['MAV_CMD'][526] = EnumEntry('MAV_CMD_STORAGE_FORMAT', '''WIP: Format a storage medium''')
enums['MAV_CMD'][526].param[1] = '''1: Format storage'''
enums['MAV_CMD'][526].param[2] = '''Storage ID'''
enums['MAV_CMD'][526].param[3] = '''Reserved (all remaining params)'''
MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS = 527 # WIP: Request camera capture status (CAMERA_CAPTURE_STATUS)
enums['MAV_CMD'][527] = EnumEntry('MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS', '''WIP: Request camera capture status (CAMERA_CAPTURE_STATUS)''')
enums['MAV_CMD'][527].param[1] = '''1: Request camera capture status'''
enums['MAV_CMD'][527].param[2] = '''Camera ID'''
enums['MAV_CMD'][527].param[3] = '''Reserved (all remaining params)'''
MAV_CMD_REQUEST_FLIGHT_INFORMATION = 528 # WIP: Request flight information (FLIGHT_INFORMATION)
enums['MAV_CMD'][528] = EnumEntry('MAV_CMD_REQUEST_FLIGHT_INFORMATION', '''WIP: Request flight information (FLIGHT_INFORMATION)''')
enums['MAV_CMD'][528].param[1] = '''1: Request flight information'''
enums['MAV_CMD'][528].param[2] = '''Reserved (all remaining params)'''
MAV_CMD_SET_CAMERA_MODE = 530 # Set camera running mode. Use NAN for reserved values.
enums['MAV_CMD'][530] = EnumEntry('MAV_CMD_SET_CAMERA_MODE', '''Set camera running mode. Use NAN for reserved values.''')
enums['MAV_CMD'][530].param[1] = '''Reserved (Set to 0)'''
enums['MAV_CMD'][530].param[2] = '''Camera mode (see CAMERA_MODE enum)'''
enums['MAV_CMD'][530].param[3] = '''Reserved (all remaining params)'''
MAV_CMD_IMAGE_START_CAPTURE = 2000 # Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each
# capture. Use NAN for reserved values.
enums['MAV_CMD'][2000] = EnumEntry('MAV_CMD_IMAGE_START_CAPTURE', '''Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each capture. Use NAN for reserved values.''')
enums['MAV_CMD'][2000].param[1] = '''Reserved (Set to 0)'''
enums['MAV_CMD'][2000].param[2] = '''Duration between two consecutive pictures (in seconds)'''
enums['MAV_CMD'][2000].param[3] = '''Number of images to capture total - 0 for unlimited capture'''
enums['MAV_CMD'][2000].param[4] = '''Capture sequence (ID to prevent double captures when a command is retransmitted, 0: unused, >= 1: used)'''
enums['MAV_CMD'][2000].param[5] = '''Reserved (all remaining params)'''
MAV_CMD_IMAGE_STOP_CAPTURE = 2001 # Stop image capture sequence
enums['MAV_CMD'][2001] = EnumEntry('MAV_CMD_IMAGE_STOP_CAPTURE', '''Stop image capture sequence''')
enums['MAV_CMD'][2001].param[1] = '''Camera ID'''
enums['MAV_CMD'][2001].param[2] = '''Reserved'''
MAV_CMD_DO_TRIGGER_CONTROL = 2003 # Enable or disable on-board camera triggering system.
enums['MAV_CMD'][2003] = EnumEntry('MAV_CMD_DO_TRIGGER_CONTROL', '''Enable or disable on-board camera triggering system.''')
enums['MAV_CMD'][2003].param[1] = '''Trigger enable/disable (0 for disable, 1 for start), -1 to ignore'''
enums['MAV_CMD'][2003].param[2] = '''1 to reset the trigger sequence, -1 or 0 to ignore'''
enums['MAV_CMD'][2003].param[3] = '''1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore'''
MAV_CMD_VIDEO_START_CAPTURE = 2500 # Starts video capture (recording)
enums['MAV_CMD'][2500] = EnumEntry('MAV_CMD_VIDEO_START_CAPTURE', '''Starts video capture (recording)''')
enums['MAV_CMD'][2500].param[1] = '''Camera ID (0 for all cameras), 1 for first, 2 for second, etc.'''
enums['MAV_CMD'][2500].param[2] = '''Frames per second, set to -1 for highest framerate possible.'''
enums['MAV_CMD'][2500].param[3] = '''Resolution in megapixels (0.3 for 640x480, 1.3 for 1280x720, etc), set to 0 if param 4/5 are used, set to -1 for highest resolution possible.'''
enums['MAV_CMD'][2500].param[4] = '''WIP: Resolution horizontal in pixels'''
enums['MAV_CMD'][2500].param[5] = '''WIP: Resolution horizontal in pixels'''
enums['MAV_CMD'][2500].param[6] = '''WIP: Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise time in Hz)'''
MAV_CMD_VIDEO_STOP_CAPTURE = 2501 # Stop the current video capture (recording)
enums['MAV_CMD'][2501] = EnumEntry('MAV_CMD_VIDEO_STOP_CAPTURE', '''Stop the current video capture (recording)''')
enums['MAV_CMD'][2501].param[1] = '''WIP: Camera ID'''
enums['MAV_CMD'][2501].param[2] = '''Reserved'''
MAV_CMD_LOGGING_START = 2510 # Request to start streaming logging data over MAVLink (see also
# LOGGING_DATA message)
enums['MAV_CMD'][2510] = EnumEntry('MAV_CMD_LOGGING_START', '''Request to start streaming logging data over MAVLink (see also LOGGING_DATA message)''')
enums['MAV_CMD'][2510].param[1] = '''Format: 0: ULog'''
enums['MAV_CMD'][2510].param[2] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2510].param[3] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2510].param[4] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2510].param[5] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2510].param[6] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2510].param[7] = '''Reserved (set to 0)'''
MAV_CMD_LOGGING_STOP = 2511 # Request to stop streaming log data over MAVLink
enums['MAV_CMD'][2511] = EnumEntry('MAV_CMD_LOGGING_STOP', '''Request to stop streaming log data over MAVLink''')
enums['MAV_CMD'][2511].param[1] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2511].param[2] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2511].param[3] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2511].param[4] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2511].param[5] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2511].param[6] = '''Reserved (set to 0)'''
enums['MAV_CMD'][2511].param[7] = '''Reserved (set to 0)'''
MAV_CMD_AIRFRAME_CONFIGURATION = 2520 #
enums['MAV_CMD'][2520] = EnumEntry('MAV_CMD_AIRFRAME_CONFIGURATION', '''''')
enums['MAV_CMD'][2520].param[1] = '''Landing gear ID (default: 0, -1 for all)'''
enums['MAV_CMD'][2520].param[2] = '''Landing gear position (Down: 0, Up: 1, NAN for no change)'''
enums['MAV_CMD'][2520].param[3] = '''Reserved, set to NAN'''
enums['MAV_CMD'][2520].param[4] = '''Reserved, set to NAN'''
enums['MAV_CMD'][2520].param[5] = '''Reserved, set to NAN'''
enums['MAV_CMD'][2520].param[6] = '''Reserved, set to NAN'''
enums['MAV_CMD'][2520].param[7] = '''Reserved, set to NAN'''
MAV_CMD_CONTROL_HIGH_LATENCY = 2600 # Request to start/stop transmitting over the high latency telemetry
enums['MAV_CMD'][2600] = EnumEntry('MAV_CMD_CONTROL_HIGH_LATENCY', '''Request to start/stop transmitting over the high latency telemetry''')
enums['MAV_CMD'][2600].param[1] = '''Control transmittion over high latency telemetry (0: stop, 1: start)'''
enums['MAV_CMD'][2600].param[2] = '''Empty'''
enums['MAV_CMD'][2600].param[3] = '''Empty'''
enums['MAV_CMD'][2600].param[4] = '''Empty'''
enums['MAV_CMD'][2600].param[5] = '''Empty'''
enums['MAV_CMD'][2600].param[6] = '''Empty'''
enums['MAV_CMD'][2600].param[7] = '''Empty'''
MAV_CMD_PANORAMA_CREATE = 2800 # Create a panorama at the current position
enums['MAV_CMD'][2800] = EnumEntry('MAV_CMD_PANORAMA_CREATE', '''Create a panorama at the current position''')
enums['MAV_CMD'][2800].param[1] = '''Viewing angle horizontal of the panorama (in degrees, +- 0.5 the total angle)'''
enums['MAV_CMD'][2800].param[2] = '''Viewing angle vertical of panorama (in degrees)'''
enums['MAV_CMD'][2800].param[3] = '''Speed of the horizontal rotation (in degrees per second)'''
enums['MAV_CMD'][2800].param[4] = '''Speed of the vertical rotation (in degrees per second)'''
MAV_CMD_DO_VTOL_TRANSITION = 3000 # Request VTOL transition
enums['MAV_CMD'][3000] = EnumEntry('MAV_CMD_DO_VTOL_TRANSITION', '''Request VTOL transition''')
enums['MAV_CMD'][3000].param[1] = '''The target VTOL state, as defined by ENUM MAV_VTOL_STATE. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.'''
MAV_CMD_ARM_AUTHORIZATION_REQUEST = 3001 # Request authorization to arm the vehicle to a external entity, the arm
# authorizer is resposible to request all data
# that is needs from the vehicle before
# authorize or deny the request. If approved
# the progress of command_ack message should
# be set with period of time that this
# authorization is valid in seconds or in case
# it was denied it should be set with one of
# the reasons in ARM_AUTH_DENIED_REASON.
enums['MAV_CMD'][3001] = EnumEntry('MAV_CMD_ARM_AUTHORIZATION_REQUEST', '''Request authorization to arm the vehicle to a external entity, the arm authorizer is resposible to request all data that is needs from the vehicle before authorize or deny the request. If approved the progress of command_ack message should be set with period of time that this authorization is valid in seconds or in case it was denied it should be set with one of the reasons in ARM_AUTH_DENIED_REASON.
''')
enums['MAV_CMD'][3001].param[1] = '''Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle'''
MAV_CMD_SET_GUIDED_SUBMODE_STANDARD = 4000 # This command sets the submode to standard guided when vehicle is in
# guided mode. The vehicle holds position and
# altitude and the user can input the desired
# velocites along all three axes.
enums['MAV_CMD'][4000] = EnumEntry('MAV_CMD_SET_GUIDED_SUBMODE_STANDARD', '''This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocites along all three axes.
''')
MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE = 4001 # This command sets submode circle when vehicle is in guided mode.
# Vehicle flies along a circle facing the
# center of the circle. The user can input the
# velocity along the circle and change the
# radius. If no input is given the vehicle
# will hold position.
enums['MAV_CMD'][4001] = EnumEntry('MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE', '''This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position.
''')
enums['MAV_CMD'][4001].param[1] = '''Radius of desired circle in CIRCLE_MODE'''
enums['MAV_CMD'][4001].param[2] = '''User defined'''
enums['MAV_CMD'][4001].param[3] = '''User defined'''
enums['MAV_CMD'][4001].param[4] = '''User defined'''
enums['MAV_CMD'][4001].param[5] = '''Unscaled target latitude of center of circle in CIRCLE_MODE'''
enums['MAV_CMD'][4001].param[6] = '''Unscaled target longitude of center of circle in CIRCLE_MODE'''
MAV_CMD_NAV_FENCE_RETURN_POINT = 5000 # Fence return point. There can only be one fence return point.
enums['MAV_CMD'][5000] = EnumEntry('MAV_CMD_NAV_FENCE_RETURN_POINT', '''Fence return point. There can only be one fence return point.
''')
enums['MAV_CMD'][5000].param[1] = '''Reserved'''
enums['MAV_CMD'][5000].param[2] = '''Reserved'''
enums['MAV_CMD'][5000].param[3] = '''Reserved'''
enums['MAV_CMD'][5000].param[4] = '''Reserved'''
enums['MAV_CMD'][5000].param[5] = '''Latitude'''
enums['MAV_CMD'][5000].param[6] = '''Longitude'''
enums['MAV_CMD'][5000].param[7] = '''Altitude'''
MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION = 5001 # Fence vertex for an inclusion polygon (the polygon must not be self-
# intersecting). The vehicle must stay within
# this area. Minimum of 3 vertices required.
enums['MAV_CMD'][5001] = EnumEntry('MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION', '''Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required.
''')
enums['MAV_CMD'][5001].param[1] = '''Polygon vertex count'''
enums['MAV_CMD'][5001].param[2] = '''Reserved'''
enums['MAV_CMD'][5001].param[3] = '''Reserved'''
enums['MAV_CMD'][5001].param[4] = '''Reserved'''
enums['MAV_CMD'][5001].param[5] = '''Latitude'''
enums['MAV_CMD'][5001].param[6] = '''Longitude'''
enums['MAV_CMD'][5001].param[7] = '''Reserved'''
MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION = 5002 # Fence vertex for an exclusion polygon (the polygon must not be self-
# intersecting). The vehicle must stay outside
# this area. Minimum of 3 vertices required.
enums['MAV_CMD'][5002] = EnumEntry('MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION', '''Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required.
''')
enums['MAV_CMD'][5002].param[1] = '''Polygon vertex count'''
enums['MAV_CMD'][5002].param[2] = '''Reserved'''
enums['MAV_CMD'][5002].param[3] = '''Reserved'''
enums['MAV_CMD'][5002].param[4] = '''Reserved'''
enums['MAV_CMD'][5002].param[5] = '''Latitude'''
enums['MAV_CMD'][5002].param[6] = '''Longitude'''
enums['MAV_CMD'][5002].param[7] = '''Reserved'''
MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION = 5003 # Circular fence area. The vehicle must stay inside this area.
enums['MAV_CMD'][5003] = EnumEntry('MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION', '''Circular fence area. The vehicle must stay inside this area.
''')
enums['MAV_CMD'][5003].param[1] = '''radius in meters'''
enums['MAV_CMD'][5003].param[2] = '''Reserved'''
enums['MAV_CMD'][5003].param[3] = '''Reserved'''
enums['MAV_CMD'][5003].param[4] = '''Reserved'''
enums['MAV_CMD'][5003].param[5] = '''Latitude'''
enums['MAV_CMD'][5003].param[6] = '''Longitude'''
enums['MAV_CMD'][5003].param[7] = '''Reserved'''
MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION = 5004 # Circular fence area. The vehicle must stay outside this area.
enums['MAV_CMD'][5004] = EnumEntry('MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION', '''Circular fence area. The vehicle must stay outside this area.
''')
enums['MAV_CMD'][5004].param[1] = '''radius in meters'''
enums['MAV_CMD'][5004].param[2] = '''Reserved'''
enums['MAV_CMD'][5004].param[3] = '''Reserved'''
enums['MAV_CMD'][5004].param[4] = '''Reserved'''
enums['MAV_CMD'][5004].param[5] = '''Latitude'''
enums['MAV_CMD'][5004].param[6] = '''Longitude'''
enums['MAV_CMD'][5004].param[7] = '''Reserved'''
MAV_CMD_NAV_RALLY_POINT = 5100 # Rally point. You can have multiple rally points defined.
enums['MAV_CMD'][5100] = EnumEntry('MAV_CMD_NAV_RALLY_POINT', '''Rally point. You can have multiple rally points defined.
''')
enums['MAV_CMD'][5100].param[1] = '''Reserved'''
enums['MAV_CMD'][5100].param[2] = '''Reserved'''
enums['MAV_CMD'][5100].param[3] = '''Reserved'''
enums['MAV_CMD'][5100].param[4] = '''Reserved'''
enums['MAV_CMD'][5100].param[5] = '''Latitude'''
enums['MAV_CMD'][5100].param[6] = '''Longitude'''
enums['MAV_CMD'][5100].param[7] = '''Altitude'''
MAV_CMD_UAVCAN_GET_NODE_INFO = 5200 # Commands the vehicle to respond with a sequence of messages
# UAVCAN_NODE_INFO, one message per every
# UAVCAN node that is online. Note that some
# of the response messages can be lost, which
# the receiver can detect easily by checking
# whether every received UAVCAN_NODE_STATUS
# has a matching message UAVCAN_NODE_INFO
# received earlier; if not, this command
# should be sent again in order to request re-
# transmission of the node information
# messages.
enums['MAV_CMD'][5200] = EnumEntry('MAV_CMD_UAVCAN_GET_NODE_INFO', '''Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages.''')
enums['MAV_CMD'][5200].param[1] = '''Reserved (set to 0)'''
enums['MAV_CMD'][5200].param[2] = '''Reserved (set to 0)'''
enums['MAV_CMD'][5200].param[3] = '''Reserved (set to 0)'''
enums['MAV_CMD'][5200].param[4] = '''Reserved (set to 0)'''
enums['MAV_CMD'][5200].param[5] = '''Reserved (set to 0)'''
enums['MAV_CMD'][5200].param[6] = '''Reserved (set to 0)'''
enums['MAV_CMD'][5200].param[7] = '''Reserved (set to 0)'''
MAV_CMD_PAYLOAD_PREPARE_DEPLOY = 30001 # Deploy payload on a Lat / Lon / Alt position. This includes the
# navigation to reach the required release
# position and velocity.
enums['MAV_CMD'][30001] = EnumEntry('MAV_CMD_PAYLOAD_PREPARE_DEPLOY', '''Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity.''')
enums['MAV_CMD'][30001].param[1] = '''Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.'''
enums['MAV_CMD'][30001].param[2] = '''Desired approach vector in degrees compass heading (0..360). A negative value indicates the system can define the approach vector at will.'''
enums['MAV_CMD'][30001].param[3] = '''Desired ground speed at release time. This can be overriden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.'''
enums['MAV_CMD'][30001].param[4] = '''Minimum altitude clearance to the release position in meters. A negative value indicates the system can define the clearance at will.'''
enums['MAV_CMD'][30001].param[5] = '''Latitude unscaled for MISSION_ITEM or in 1e7 degrees for MISSION_ITEM_INT'''
enums['MAV_CMD'][30001].param[6] = '''Longitude unscaled for MISSION_ITEM or in 1e7 degrees for MISSION_ITEM_INT'''
enums['MAV_CMD'][30001].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_PAYLOAD_CONTROL_DEPLOY = 30002 # Control the payload deployment.
enums['MAV_CMD'][30002] = EnumEntry('MAV_CMD_PAYLOAD_CONTROL_DEPLOY', '''Control the payload deployment.''')
enums['MAV_CMD'][30002].param[1] = '''Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deploment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests.'''
enums['MAV_CMD'][30002].param[2] = '''Reserved'''
enums['MAV_CMD'][30002].param[3] = '''Reserved'''
enums['MAV_CMD'][30002].param[4] = '''Reserved'''
enums['MAV_CMD'][30002].param[5] = '''Reserved'''
enums['MAV_CMD'][30002].param[6] = '''Reserved'''
enums['MAV_CMD'][30002].param[7] = '''Reserved'''
MAV_CMD_WAYPOINT_USER_1 = 31000 # User defined waypoint item. Ground Station will show the Vehicle as
# flying through this item.
enums['MAV_CMD'][31000] = EnumEntry('MAV_CMD_WAYPOINT_USER_1', '''User defined waypoint item. Ground Station will show the Vehicle as flying through this item.''')
enums['MAV_CMD'][31000].param[1] = '''User defined'''
enums['MAV_CMD'][31000].param[2] = '''User defined'''
enums['MAV_CMD'][31000].param[3] = '''User defined'''
enums['MAV_CMD'][31000].param[4] = '''User defined'''
enums['MAV_CMD'][31000].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31000].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31000].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_WAYPOINT_USER_2 = 31001 # User defined waypoint item. Ground Station will show the Vehicle as
# flying through this item.
enums['MAV_CMD'][31001] = EnumEntry('MAV_CMD_WAYPOINT_USER_2', '''User defined waypoint item. Ground Station will show the Vehicle as flying through this item.''')
enums['MAV_CMD'][31001].param[1] = '''User defined'''
enums['MAV_CMD'][31001].param[2] = '''User defined'''
enums['MAV_CMD'][31001].param[3] = '''User defined'''
enums['MAV_CMD'][31001].param[4] = '''User defined'''
enums['MAV_CMD'][31001].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31001].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31001].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_WAYPOINT_USER_3 = 31002 # User defined waypoint item. Ground Station will show the Vehicle as
# flying through this item.
enums['MAV_CMD'][31002] = EnumEntry('MAV_CMD_WAYPOINT_USER_3', '''User defined waypoint item. Ground Station will show the Vehicle as flying through this item.''')
enums['MAV_CMD'][31002].param[1] = '''User defined'''
enums['MAV_CMD'][31002].param[2] = '''User defined'''
enums['MAV_CMD'][31002].param[3] = '''User defined'''
enums['MAV_CMD'][31002].param[4] = '''User defined'''
enums['MAV_CMD'][31002].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31002].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31002].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_WAYPOINT_USER_4 = 31003 # User defined waypoint item. Ground Station will show the Vehicle as
# flying through this item.
enums['MAV_CMD'][31003] = EnumEntry('MAV_CMD_WAYPOINT_USER_4', '''User defined waypoint item. Ground Station will show the Vehicle as flying through this item.''')
enums['MAV_CMD'][31003].param[1] = '''User defined'''
enums['MAV_CMD'][31003].param[2] = '''User defined'''
enums['MAV_CMD'][31003].param[3] = '''User defined'''
enums['MAV_CMD'][31003].param[4] = '''User defined'''
enums['MAV_CMD'][31003].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31003].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31003].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_WAYPOINT_USER_5 = 31004 # User defined waypoint item. Ground Station will show the Vehicle as
# flying through this item.
enums['MAV_CMD'][31004] = EnumEntry('MAV_CMD_WAYPOINT_USER_5', '''User defined waypoint item. Ground Station will show the Vehicle as flying through this item.''')
enums['MAV_CMD'][31004].param[1] = '''User defined'''
enums['MAV_CMD'][31004].param[2] = '''User defined'''
enums['MAV_CMD'][31004].param[3] = '''User defined'''
enums['MAV_CMD'][31004].param[4] = '''User defined'''
enums['MAV_CMD'][31004].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31004].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31004].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_SPATIAL_USER_1 = 31005 # User defined spatial item. Ground Station will not show the Vehicle as
# flying through this item. Example: ROI item.
enums['MAV_CMD'][31005] = EnumEntry('MAV_CMD_SPATIAL_USER_1', '''User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item.''')
enums['MAV_CMD'][31005].param[1] = '''User defined'''
enums['MAV_CMD'][31005].param[2] = '''User defined'''
enums['MAV_CMD'][31005].param[3] = '''User defined'''
enums['MAV_CMD'][31005].param[4] = '''User defined'''
enums['MAV_CMD'][31005].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31005].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31005].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_SPATIAL_USER_2 = 31006 # User defined spatial item. Ground Station will not show the Vehicle as
# flying through this item. Example: ROI item.
enums['MAV_CMD'][31006] = EnumEntry('MAV_CMD_SPATIAL_USER_2', '''User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item.''')
enums['MAV_CMD'][31006].param[1] = '''User defined'''
enums['MAV_CMD'][31006].param[2] = '''User defined'''
enums['MAV_CMD'][31006].param[3] = '''User defined'''
enums['MAV_CMD'][31006].param[4] = '''User defined'''
enums['MAV_CMD'][31006].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31006].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31006].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_SPATIAL_USER_3 = 31007 # User defined spatial item. Ground Station will not show the Vehicle as
# flying through this item. Example: ROI item.
enums['MAV_CMD'][31007] = EnumEntry('MAV_CMD_SPATIAL_USER_3', '''User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item.''')
enums['MAV_CMD'][31007].param[1] = '''User defined'''
enums['MAV_CMD'][31007].param[2] = '''User defined'''
enums['MAV_CMD'][31007].param[3] = '''User defined'''
enums['MAV_CMD'][31007].param[4] = '''User defined'''
enums['MAV_CMD'][31007].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31007].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31007].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_SPATIAL_USER_4 = 31008 # User defined spatial item. Ground Station will not show the Vehicle as
# flying through this item. Example: ROI item.
enums['MAV_CMD'][31008] = EnumEntry('MAV_CMD_SPATIAL_USER_4', '''User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item.''')
enums['MAV_CMD'][31008].param[1] = '''User defined'''
enums['MAV_CMD'][31008].param[2] = '''User defined'''
enums['MAV_CMD'][31008].param[3] = '''User defined'''
enums['MAV_CMD'][31008].param[4] = '''User defined'''
enums['MAV_CMD'][31008].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31008].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31008].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_SPATIAL_USER_5 = 31009 # User defined spatial item. Ground Station will not show the Vehicle as
# flying through this item. Example: ROI item.
enums['MAV_CMD'][31009] = EnumEntry('MAV_CMD_SPATIAL_USER_5', '''User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item.''')
enums['MAV_CMD'][31009].param[1] = '''User defined'''
enums['MAV_CMD'][31009].param[2] = '''User defined'''
enums['MAV_CMD'][31009].param[3] = '''User defined'''
enums['MAV_CMD'][31009].param[4] = '''User defined'''
enums['MAV_CMD'][31009].param[5] = '''Latitude unscaled'''
enums['MAV_CMD'][31009].param[6] = '''Longitude unscaled'''
enums['MAV_CMD'][31009].param[7] = '''Altitude, in meters AMSL'''
MAV_CMD_USER_1 = 31010 # User defined command. Ground Station will not show the Vehicle as
# flying through this item. Example:
# MAV_CMD_DO_SET_PARAMETER item.
enums['MAV_CMD'][31010] = EnumEntry('MAV_CMD_USER_1', '''User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item.''')
enums['MAV_CMD'][31010].param[1] = '''User defined'''
enums['MAV_CMD'][31010].param[2] = '''User defined'''
enums['MAV_CMD'][31010].param[3] = '''User defined'''
enums['MAV_CMD'][31010].param[4] = '''User defined'''
enums['MAV_CMD'][31010].param[5] = '''User defined'''
enums['MAV_CMD'][31010].param[6] = '''User defined'''
enums['MAV_CMD'][31010].param[7] = '''User defined'''
MAV_CMD_USER_2 = 31011 # User defined command. Ground Station will not show the Vehicle as
# flying through this item. Example:
# MAV_CMD_DO_SET_PARAMETER item.
enums['MAV_CMD'][31011] = EnumEntry('MAV_CMD_USER_2', '''User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item.''')
enums['MAV_CMD'][31011].param[1] = '''User defined'''
enums['MAV_CMD'][31011].param[2] = '''User defined'''
enums['MAV_CMD'][31011].param[3] = '''User defined'''
enums['MAV_CMD'][31011].param[4] = '''User defined'''
enums['MAV_CMD'][31011].param[5] = '''User defined'''
enums['MAV_CMD'][31011].param[6] = '''User defined'''
enums['MAV_CMD'][31011].param[7] = '''User defined'''
MAV_CMD_USER_3 = 31012 # User defined command. Ground Station will not show the Vehicle as
# flying through this item. Example:
# MAV_CMD_DO_SET_PARAMETER item.
enums['MAV_CMD'][31012] = EnumEntry('MAV_CMD_USER_3', '''User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item.''')
enums['MAV_CMD'][31012].param[1] = '''User defined'''
enums['MAV_CMD'][31012].param[2] = '''User defined'''
enums['MAV_CMD'][31012].param[3] = '''User defined'''
enums['MAV_CMD'][31012].param[4] = '''User defined'''
enums['MAV_CMD'][31012].param[5] = '''User defined'''
enums['MAV_CMD'][31012].param[6] = '''User defined'''
enums['MAV_CMD'][31012].param[7] = '''User defined'''
MAV_CMD_USER_4 = 31013 # User defined command. Ground Station will not show the Vehicle as
# flying through this item. Example:
# MAV_CMD_DO_SET_PARAMETER item.
enums['MAV_CMD'][31013] = EnumEntry('MAV_CMD_USER_4', '''User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item.''')
enums['MAV_CMD'][31013].param[1] = '''User defined'''
enums['MAV_CMD'][31013].param[2] = '''User defined'''
enums['MAV_CMD'][31013].param[3] = '''User defined'''
enums['MAV_CMD'][31013].param[4] = '''User defined'''
enums['MAV_CMD'][31013].param[5] = '''User defined'''
enums['MAV_CMD'][31013].param[6] = '''User defined'''
enums['MAV_CMD'][31013].param[7] = '''User defined'''
MAV_CMD_USER_5 = 31014 # User defined command. Ground Station will not show the Vehicle as
# flying through this item. Example:
# MAV_CMD_DO_SET_PARAMETER item.
enums['MAV_CMD'][31014] = EnumEntry('MAV_CMD_USER_5', '''User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item.''')
enums['MAV_CMD'][31014].param[1] = '''User defined'''
enums['MAV_CMD'][31014].param[2] = '''User defined'''
enums['MAV_CMD'][31014].param[3] = '''User defined'''
enums['MAV_CMD'][31014].param[4] = '''User defined'''
enums['MAV_CMD'][31014].param[5] = '''User defined'''
enums['MAV_CMD'][31014].param[6] = '''User defined'''
enums['MAV_CMD'][31014].param[7] = '''User defined'''
MAV_CMD_ENUM_END = 31015 #
enums['MAV_CMD'][31015] = EnumEntry('MAV_CMD_ENUM_END', '''''')
# MAV_DATA_STREAM
enums['MAV_DATA_STREAM'] = {}
MAV_DATA_STREAM_ALL = 0 # Enable all data streams
enums['MAV_DATA_STREAM'][0] = EnumEntry('MAV_DATA_STREAM_ALL', '''Enable all data streams''')
MAV_DATA_STREAM_RAW_SENSORS = 1 # Enable IMU_RAW, GPS_RAW, GPS_STATUS packets.
enums['MAV_DATA_STREAM'][1] = EnumEntry('MAV_DATA_STREAM_RAW_SENSORS', '''Enable IMU_RAW, GPS_RAW, GPS_STATUS packets.''')
MAV_DATA_STREAM_EXTENDED_STATUS = 2 # Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS
enums['MAV_DATA_STREAM'][2] = EnumEntry('MAV_DATA_STREAM_EXTENDED_STATUS', '''Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS''')
MAV_DATA_STREAM_RC_CHANNELS = 3 # Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW
enums['MAV_DATA_STREAM'][3] = EnumEntry('MAV_DATA_STREAM_RC_CHANNELS', '''Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW''')
MAV_DATA_STREAM_RAW_CONTROLLER = 4 # Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT,
# NAV_CONTROLLER_OUTPUT.
enums['MAV_DATA_STREAM'][4] = EnumEntry('MAV_DATA_STREAM_RAW_CONTROLLER', '''Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT.''')
MAV_DATA_STREAM_POSITION = 6 # Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages.
enums['MAV_DATA_STREAM'][6] = EnumEntry('MAV_DATA_STREAM_POSITION', '''Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages.''')
MAV_DATA_STREAM_EXTRA1 = 10 # Dependent on the autopilot
enums['MAV_DATA_STREAM'][10] = EnumEntry('MAV_DATA_STREAM_EXTRA1', '''Dependent on the autopilot''')
MAV_DATA_STREAM_EXTRA2 = 11 # Dependent on the autopilot
enums['MAV_DATA_STREAM'][11] = EnumEntry('MAV_DATA_STREAM_EXTRA2', '''Dependent on the autopilot''')
MAV_DATA_STREAM_EXTRA3 = 12 # Dependent on the autopilot
enums['MAV_DATA_STREAM'][12] = EnumEntry('MAV_DATA_STREAM_EXTRA3', '''Dependent on the autopilot''')
MAV_DATA_STREAM_PROPULSION = 13 # Motor/ESC telemetry data.
enums['MAV_DATA_STREAM'][13] = EnumEntry('MAV_DATA_STREAM_PROPULSION', '''Motor/ESC telemetry data.''')
MAV_DATA_STREAM_ENUM_END = 14 #
enums['MAV_DATA_STREAM'][14] = EnumEntry('MAV_DATA_STREAM_ENUM_END', '''''')
# MAV_AUTOPILOT
enums['MAV_AUTOPILOT'] = {}
MAV_AUTOPILOT_GENERIC = 0 # Generic autopilot, full support for everything
enums['MAV_AUTOPILOT'][0] = EnumEntry('MAV_AUTOPILOT_GENERIC', '''Generic autopilot, full support for everything''')
MAV_AUTOPILOT_RESERVED = 1 # Reserved for future use.
enums['MAV_AUTOPILOT'][1] = EnumEntry('MAV_AUTOPILOT_RESERVED', '''Reserved for future use.''')
MAV_AUTOPILOT_SLUGS = 2 # SLUGS autopilot, http://slugsuav.soe.ucsc.edu
enums['MAV_AUTOPILOT'][2] = EnumEntry('MAV_AUTOPILOT_SLUGS', '''SLUGS autopilot, http://slugsuav.soe.ucsc.edu''')
MAV_AUTOPILOT_ARDUPILOTMEGA = 3 # ArduPilotMega / ArduCopter, http://diydrones.com
enums['MAV_AUTOPILOT'][3] = EnumEntry('MAV_AUTOPILOT_ARDUPILOTMEGA', '''ArduPilotMega / ArduCopter, http://diydrones.com''')
MAV_AUTOPILOT_OPENPILOT = 4 # OpenPilot, http://openpilot.org
enums['MAV_AUTOPILOT'][4] = EnumEntry('MAV_AUTOPILOT_OPENPILOT', '''OpenPilot, http://openpilot.org''')
MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY = 5 # Generic autopilot only supporting simple waypoints
enums['MAV_AUTOPILOT'][5] = EnumEntry('MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY', '''Generic autopilot only supporting simple waypoints''')
MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY = 6 # Generic autopilot supporting waypoints and other simple navigation
# commands
enums['MAV_AUTOPILOT'][6] = EnumEntry('MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY', '''Generic autopilot supporting waypoints and other simple navigation commands''')
MAV_AUTOPILOT_GENERIC_MISSION_FULL = 7 # Generic autopilot supporting the full mission command set
enums['MAV_AUTOPILOT'][7] = EnumEntry('MAV_AUTOPILOT_GENERIC_MISSION_FULL', '''Generic autopilot supporting the full mission command set''')
MAV_AUTOPILOT_INVALID = 8 # No valid autopilot, e.g. a GCS or other MAVLink component
enums['MAV_AUTOPILOT'][8] = EnumEntry('MAV_AUTOPILOT_INVALID', '''No valid autopilot, e.g. a GCS or other MAVLink component''')
MAV_AUTOPILOT_PPZ = 9 # PPZ UAV - http://nongnu.org/paparazzi
enums['MAV_AUTOPILOT'][9] = EnumEntry('MAV_AUTOPILOT_PPZ', '''PPZ UAV - http://nongnu.org/paparazzi''')
MAV_AUTOPILOT_UDB = 10 # UAV Dev Board
enums['MAV_AUTOPILOT'][10] = EnumEntry('MAV_AUTOPILOT_UDB', '''UAV Dev Board''')
MAV_AUTOPILOT_FP = 11 # FlexiPilot
enums['MAV_AUTOPILOT'][11] = EnumEntry('MAV_AUTOPILOT_FP', '''FlexiPilot''')
MAV_AUTOPILOT_PX4 = 12 # PX4 Autopilot - http://pixhawk.ethz.ch/px4/
enums['MAV_AUTOPILOT'][12] = EnumEntry('MAV_AUTOPILOT_PX4', '''PX4 Autopilot - http://pixhawk.ethz.ch/px4/''')
MAV_AUTOPILOT_SMACCMPILOT = 13 # SMACCMPilot - http://smaccmpilot.org
enums['MAV_AUTOPILOT'][13] = EnumEntry('MAV_AUTOPILOT_SMACCMPILOT', '''SMACCMPilot - http://smaccmpilot.org''')
MAV_AUTOPILOT_AUTOQUAD = 14 # AutoQuad -- http://autoquad.org
enums['MAV_AUTOPILOT'][14] = EnumEntry('MAV_AUTOPILOT_AUTOQUAD', '''AutoQuad -- http://autoquad.org''')
MAV_AUTOPILOT_ARMAZILA = 15 # Armazila -- http://armazila.com
enums['MAV_AUTOPILOT'][15] = EnumEntry('MAV_AUTOPILOT_ARMAZILA', '''Armazila -- http://armazila.com''')
MAV_AUTOPILOT_AEROB = 16 # Aerob -- http://aerob.ru
enums['MAV_AUTOPILOT'][16] = EnumEntry('MAV_AUTOPILOT_AEROB', '''Aerob -- http://aerob.ru''')
MAV_AUTOPILOT_ASLUAV = 17 # ASLUAV autopilot -- http://www.asl.ethz.ch
enums['MAV_AUTOPILOT'][17] = EnumEntry('MAV_AUTOPILOT_ASLUAV', '''ASLUAV autopilot -- http://www.asl.ethz.ch''')
MAV_AUTOPILOT_SMARTAP = 18 # SmartAP Autopilot - http://sky-drones.com
enums['MAV_AUTOPILOT'][18] = EnumEntry('MAV_AUTOPILOT_SMARTAP', '''SmartAP Autopilot - http://sky-drones.com''')
MAV_AUTOPILOT_AIRRAILS = 19 # AirRails - http://uaventure.com
enums['MAV_AUTOPILOT'][19] = EnumEntry('MAV_AUTOPILOT_AIRRAILS', '''AirRails - http://uaventure.com''')
MAV_AUTOPILOT_ENUM_END = 20 #
enums['MAV_AUTOPILOT'][20] = EnumEntry('MAV_AUTOPILOT_ENUM_END', '''''')
# MAV_TYPE
enums['MAV_TYPE'] = {}
MAV_TYPE_GENERIC = 0 # Generic micro air vehicle.
enums['MAV_TYPE'][0] = EnumEntry('MAV_TYPE_GENERIC', '''Generic micro air vehicle.''')
MAV_TYPE_FIXED_WING = 1 # Fixed wing aircraft.
enums['MAV_TYPE'][1] = EnumEntry('MAV_TYPE_FIXED_WING', '''Fixed wing aircraft.''')
MAV_TYPE_QUADROTOR = 2 # Quadrotor
enums['MAV_TYPE'][2] = EnumEntry('MAV_TYPE_QUADROTOR', '''Quadrotor''')
MAV_TYPE_COAXIAL = 3 # Coaxial helicopter
enums['MAV_TYPE'][3] = EnumEntry('MAV_TYPE_COAXIAL', '''Coaxial helicopter''')
MAV_TYPE_HELICOPTER = 4 # Normal helicopter with tail rotor.
enums['MAV_TYPE'][4] = EnumEntry('MAV_TYPE_HELICOPTER', '''Normal helicopter with tail rotor.''')
MAV_TYPE_ANTENNA_TRACKER = 5 # Ground installation
enums['MAV_TYPE'][5] = EnumEntry('MAV_TYPE_ANTENNA_TRACKER', '''Ground installation''')
MAV_TYPE_GCS = 6 # Operator control unit / ground control station
enums['MAV_TYPE'][6] = EnumEntry('MAV_TYPE_GCS', '''Operator control unit / ground control station''')
MAV_TYPE_AIRSHIP = 7 # Airship, controlled
enums['MAV_TYPE'][7] = EnumEntry('MAV_TYPE_AIRSHIP', '''Airship, controlled''')
MAV_TYPE_FREE_BALLOON = 8 # Free balloon, uncontrolled
enums['MAV_TYPE'][8] = EnumEntry('MAV_TYPE_FREE_BALLOON', '''Free balloon, uncontrolled''')
MAV_TYPE_ROCKET = 9 # Rocket
enums['MAV_TYPE'][9] = EnumEntry('MAV_TYPE_ROCKET', '''Rocket''')
MAV_TYPE_GROUND_ROVER = 10 # Ground rover
enums['MAV_TYPE'][10] = EnumEntry('MAV_TYPE_GROUND_ROVER', '''Ground rover''')
MAV_TYPE_SURFACE_BOAT = 11 # Surface vessel, boat, ship
enums['MAV_TYPE'][11] = EnumEntry('MAV_TYPE_SURFACE_BOAT', '''Surface vessel, boat, ship''')
MAV_TYPE_SUBMARINE = 12 # Submarine
enums['MAV_TYPE'][12] = EnumEntry('MAV_TYPE_SUBMARINE', '''Submarine''')
MAV_TYPE_HEXAROTOR = 13 # Hexarotor
enums['MAV_TYPE'][13] = EnumEntry('MAV_TYPE_HEXAROTOR', '''Hexarotor''')
MAV_TYPE_OCTOROTOR = 14 # Octorotor
enums['MAV_TYPE'][14] = EnumEntry('MAV_TYPE_OCTOROTOR', '''Octorotor''')
MAV_TYPE_TRICOPTER = 15 # Tricopter
enums['MAV_TYPE'][15] = EnumEntry('MAV_TYPE_TRICOPTER', '''Tricopter''')
MAV_TYPE_FLAPPING_WING = 16 # Flapping wing
enums['MAV_TYPE'][16] = EnumEntry('MAV_TYPE_FLAPPING_WING', '''Flapping wing''')
MAV_TYPE_KITE = 17 # Kite
enums['MAV_TYPE'][17] = EnumEntry('MAV_TYPE_KITE', '''Kite''')
MAV_TYPE_ONBOARD_CONTROLLER = 18 # Onboard companion controller
enums['MAV_TYPE'][18] = EnumEntry('MAV_TYPE_ONBOARD_CONTROLLER', '''Onboard companion controller''')
MAV_TYPE_VTOL_DUOROTOR = 19 # Two-rotor VTOL using control surfaces in vertical operation in
# addition. Tailsitter.
enums['MAV_TYPE'][19] = EnumEntry('MAV_TYPE_VTOL_DUOROTOR', '''Two-rotor VTOL using control surfaces in vertical operation in addition. Tailsitter.''')
MAV_TYPE_VTOL_QUADROTOR = 20 # Quad-rotor VTOL using a V-shaped quad config in vertical operation.
# Tailsitter.
enums['MAV_TYPE'][20] = EnumEntry('MAV_TYPE_VTOL_QUADROTOR', '''Quad-rotor VTOL using a V-shaped quad config in vertical operation. Tailsitter.''')
MAV_TYPE_VTOL_TILTROTOR = 21 # Tiltrotor VTOL
enums['MAV_TYPE'][21] = EnumEntry('MAV_TYPE_VTOL_TILTROTOR', '''Tiltrotor VTOL''')
MAV_TYPE_VTOL_RESERVED2 = 22 # VTOL reserved 2
enums['MAV_TYPE'][22] = EnumEntry('MAV_TYPE_VTOL_RESERVED2', '''VTOL reserved 2''')
MAV_TYPE_VTOL_RESERVED3 = 23 # VTOL reserved 3
enums['MAV_TYPE'][23] = EnumEntry('MAV_TYPE_VTOL_RESERVED3', '''VTOL reserved 3''')
MAV_TYPE_VTOL_RESERVED4 = 24 # VTOL reserved 4
enums['MAV_TYPE'][24] = EnumEntry('MAV_TYPE_VTOL_RESERVED4', '''VTOL reserved 4''')
MAV_TYPE_VTOL_RESERVED5 = 25 # VTOL reserved 5
enums['MAV_TYPE'][25] = EnumEntry('MAV_TYPE_VTOL_RESERVED5', '''VTOL reserved 5''')
MAV_TYPE_GIMBAL = 26 # Onboard gimbal
enums['MAV_TYPE'][26] = EnumEntry('MAV_TYPE_GIMBAL', '''Onboard gimbal''')
MAV_TYPE_ADSB = 27 # Onboard ADSB peripheral
enums['MAV_TYPE'][27] = EnumEntry('MAV_TYPE_ADSB', '''Onboard ADSB peripheral''')
MAV_TYPE_PARAFOIL = 28 # Steerable, nonrigid airfoil
enums['MAV_TYPE'][28] = EnumEntry('MAV_TYPE_PARAFOIL', '''Steerable, nonrigid airfoil''')
MAV_TYPE_DODECAROTOR = 29 # Dodecarotor
enums['MAV_TYPE'][29] = EnumEntry('MAV_TYPE_DODECAROTOR', '''Dodecarotor''')
MAV_TYPE_CAMERA = 30 # Camera
enums['MAV_TYPE'][30] = EnumEntry('MAV_TYPE_CAMERA', '''Camera''')
MAV_TYPE_CHARGING_STATION = 31 # Charging station
enums['MAV_TYPE'][31] = EnumEntry('MAV_TYPE_CHARGING_STATION', '''Charging station''')
MAV_TYPE_FLARM = 32 # Onboard FLARM collision avoidance system
enums['MAV_TYPE'][32] = EnumEntry('MAV_TYPE_FLARM', '''Onboard FLARM collision avoidance system''')
MAV_TYPE_ENUM_END = 33 #
enums['MAV_TYPE'][33] = EnumEntry('MAV_TYPE_ENUM_END', '''''')
# FIRMWARE_VERSION_TYPE
enums['FIRMWARE_VERSION_TYPE'] = {}
FIRMWARE_VERSION_TYPE_DEV = 0 # development release
enums['FIRMWARE_VERSION_TYPE'][0] = EnumEntry('FIRMWARE_VERSION_TYPE_DEV', '''development release''')
FIRMWARE_VERSION_TYPE_ALPHA = 64 # alpha release
enums['FIRMWARE_VERSION_TYPE'][64] = EnumEntry('FIRMWARE_VERSION_TYPE_ALPHA', '''alpha release''')
FIRMWARE_VERSION_TYPE_BETA = 128 # beta release
enums['FIRMWARE_VERSION_TYPE'][128] = EnumEntry('FIRMWARE_VERSION_TYPE_BETA', '''beta release''')
FIRMWARE_VERSION_TYPE_RC = 192 # release candidate
enums['FIRMWARE_VERSION_TYPE'][192] = EnumEntry('FIRMWARE_VERSION_TYPE_RC', '''release candidate''')
FIRMWARE_VERSION_TYPE_OFFICIAL = 255 # official stable release
enums['FIRMWARE_VERSION_TYPE'][255] = EnumEntry('FIRMWARE_VERSION_TYPE_OFFICIAL', '''official stable release''')
FIRMWARE_VERSION_TYPE_ENUM_END = 256 #
enums['FIRMWARE_VERSION_TYPE'][256] = EnumEntry('FIRMWARE_VERSION_TYPE_ENUM_END', '''''')
# MAV_MODE_FLAG
enums['MAV_MODE_FLAG'] = {}
MAV_MODE_FLAG_CUSTOM_MODE_ENABLED = 1 # 0b00000001 Reserved for future use.
enums['MAV_MODE_FLAG'][1] = EnumEntry('MAV_MODE_FLAG_CUSTOM_MODE_ENABLED', '''0b00000001 Reserved for future use.''')
MAV_MODE_FLAG_TEST_ENABLED = 2 # 0b00000010 system has a test mode enabled. This flag is intended for
# temporary system tests and should not be
# used for stable implementations.
enums['MAV_MODE_FLAG'][2] = EnumEntry('MAV_MODE_FLAG_TEST_ENABLED', '''0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations.''')
MAV_MODE_FLAG_AUTO_ENABLED = 4 # 0b00000100 autonomous mode enabled, system finds its own goal
# positions. Guided flag can be set or not,
# depends on the actual implementation.
enums['MAV_MODE_FLAG'][4] = EnumEntry('MAV_MODE_FLAG_AUTO_ENABLED', '''0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation.''')
MAV_MODE_FLAG_GUIDED_ENABLED = 8 # 0b00001000 guided mode enabled, system flies waypoints / mission
# items.
enums['MAV_MODE_FLAG'][8] = EnumEntry('MAV_MODE_FLAG_GUIDED_ENABLED', '''0b00001000 guided mode enabled, system flies waypoints / mission items.''')
MAV_MODE_FLAG_STABILIZE_ENABLED = 16 # 0b00010000 system stabilizes electronically its attitude (and
# optionally position). It needs however
# further control inputs to move around.
enums['MAV_MODE_FLAG'][16] = EnumEntry('MAV_MODE_FLAG_STABILIZE_ENABLED', '''0b00010000 system stabilizes electronically its attitude (and optionally position). It needs however further control inputs to move around.''')
MAV_MODE_FLAG_HIL_ENABLED = 32 # 0b00100000 hardware in the loop simulation. All motors / actuators are
# blocked, but internal software is full
# operational.
enums['MAV_MODE_FLAG'][32] = EnumEntry('MAV_MODE_FLAG_HIL_ENABLED', '''0b00100000 hardware in the loop simulation. All motors / actuators are blocked, but internal software is full operational.''')
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED = 64 # 0b01000000 remote control input is enabled.
enums['MAV_MODE_FLAG'][64] = EnumEntry('MAV_MODE_FLAG_MANUAL_INPUT_ENABLED', '''0b01000000 remote control input is enabled.''')
MAV_MODE_FLAG_SAFETY_ARMED = 128 # 0b10000000 MAV safety set to armed. Motors are enabled / running / can
# start. Ready to fly. Additional note: this
# flag is to be ignore when sent in the
# command MAV_CMD_DO_SET_MODE and
# MAV_CMD_COMPONENT_ARM_DISARM shall be used
# instead. The flag can still be used to
# report the armed state.
enums['MAV_MODE_FLAG'][128] = EnumEntry('MAV_MODE_FLAG_SAFETY_ARMED', '''0b10000000 MAV safety set to armed. Motors are enabled / running / can start. Ready to fly. Additional note: this flag is to be ignore when sent in the command MAV_CMD_DO_SET_MODE and MAV_CMD_COMPONENT_ARM_DISARM shall be used instead. The flag can still be used to report the armed state.''')
MAV_MODE_FLAG_ENUM_END = 129 #
enums['MAV_MODE_FLAG'][129] = EnumEntry('MAV_MODE_FLAG_ENUM_END', '''''')
# MAV_MODE_FLAG_DECODE_POSITION
enums['MAV_MODE_FLAG_DECODE_POSITION'] = {}
MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE = 1 # Eighth bit: 00000001
enums['MAV_MODE_FLAG_DECODE_POSITION'][1] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE', '''Eighth bit: 00000001''')
MAV_MODE_FLAG_DECODE_POSITION_TEST = 2 # Seventh bit: 00000010
enums['MAV_MODE_FLAG_DECODE_POSITION'][2] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_TEST', '''Seventh bit: 00000010''')
MAV_MODE_FLAG_DECODE_POSITION_AUTO = 4 # Sixt bit: 00000100
enums['MAV_MODE_FLAG_DECODE_POSITION'][4] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_AUTO', '''Sixt bit: 00000100''')
MAV_MODE_FLAG_DECODE_POSITION_GUIDED = 8 # Fifth bit: 00001000
enums['MAV_MODE_FLAG_DECODE_POSITION'][8] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_GUIDED', '''Fifth bit: 00001000''')
MAV_MODE_FLAG_DECODE_POSITION_STABILIZE = 16 # Fourth bit: 00010000
enums['MAV_MODE_FLAG_DECODE_POSITION'][16] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_STABILIZE', '''Fourth bit: 00010000''')
MAV_MODE_FLAG_DECODE_POSITION_HIL = 32 # Third bit: 00100000
enums['MAV_MODE_FLAG_DECODE_POSITION'][32] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_HIL', '''Third bit: 00100000''')
MAV_MODE_FLAG_DECODE_POSITION_MANUAL = 64 # Second bit: 01000000
enums['MAV_MODE_FLAG_DECODE_POSITION'][64] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_MANUAL', '''Second bit: 01000000''')
MAV_MODE_FLAG_DECODE_POSITION_SAFETY = 128 # First bit: 10000000
enums['MAV_MODE_FLAG_DECODE_POSITION'][128] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_SAFETY', '''First bit: 10000000''')
MAV_MODE_FLAG_DECODE_POSITION_ENUM_END = 129 #
enums['MAV_MODE_FLAG_DECODE_POSITION'][129] = EnumEntry('MAV_MODE_FLAG_DECODE_POSITION_ENUM_END', '''''')
# MAV_GOTO
enums['MAV_GOTO'] = {}
MAV_GOTO_DO_HOLD = 0 # Hold at the current position.
enums['MAV_GOTO'][0] = EnumEntry('MAV_GOTO_DO_HOLD', '''Hold at the current position.''')
MAV_GOTO_DO_CONTINUE = 1 # Continue with the next item in mission execution.
enums['MAV_GOTO'][1] = EnumEntry('MAV_GOTO_DO_CONTINUE', '''Continue with the next item in mission execution.''')
MAV_GOTO_HOLD_AT_CURRENT_POSITION = 2 # Hold at the current position of the system
enums['MAV_GOTO'][2] = EnumEntry('MAV_GOTO_HOLD_AT_CURRENT_POSITION', '''Hold at the current position of the system''')
MAV_GOTO_HOLD_AT_SPECIFIED_POSITION = 3 # Hold at the position specified in the parameters of the DO_HOLD action
enums['MAV_GOTO'][3] = EnumEntry('MAV_GOTO_HOLD_AT_SPECIFIED_POSITION', '''Hold at the position specified in the parameters of the DO_HOLD action''')
MAV_GOTO_ENUM_END = 4 #
enums['MAV_GOTO'][4] = EnumEntry('MAV_GOTO_ENUM_END', '''''')
# MAV_MODE
enums['MAV_MODE'] = {}
MAV_MODE_PREFLIGHT = 0 # System is not ready to fly, booting, calibrating, etc. No flag is set.
enums['MAV_MODE'][0] = EnumEntry('MAV_MODE_PREFLIGHT', '''System is not ready to fly, booting, calibrating, etc. No flag is set.''')
MAV_MODE_MANUAL_DISARMED = 64 # System is allowed to be active, under manual (RC) control, no
# stabilization
enums['MAV_MODE'][64] = EnumEntry('MAV_MODE_MANUAL_DISARMED', '''System is allowed to be active, under manual (RC) control, no stabilization''')
MAV_MODE_TEST_DISARMED = 66 # UNDEFINED mode. This solely depends on the autopilot - use with
# caution, intended for developers only.
enums['MAV_MODE'][66] = EnumEntry('MAV_MODE_TEST_DISARMED', '''UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only.''')
MAV_MODE_STABILIZE_DISARMED = 80 # System is allowed to be active, under assisted RC control.
enums['MAV_MODE'][80] = EnumEntry('MAV_MODE_STABILIZE_DISARMED', '''System is allowed to be active, under assisted RC control.''')
MAV_MODE_GUIDED_DISARMED = 88 # System is allowed to be active, under autonomous control, manual
# setpoint
enums['MAV_MODE'][88] = EnumEntry('MAV_MODE_GUIDED_DISARMED', '''System is allowed to be active, under autonomous control, manual setpoint''')
MAV_MODE_AUTO_DISARMED = 92 # System is allowed to be active, under autonomous control and
# navigation (the trajectory is decided
# onboard and not pre-programmed by waypoints)
enums['MAV_MODE'][92] = EnumEntry('MAV_MODE_AUTO_DISARMED', '''System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by waypoints)''')
MAV_MODE_MANUAL_ARMED = 192 # System is allowed to be active, under manual (RC) control, no
# stabilization
enums['MAV_MODE'][192] = EnumEntry('MAV_MODE_MANUAL_ARMED', '''System is allowed to be active, under manual (RC) control, no stabilization''')
MAV_MODE_TEST_ARMED = 194 # UNDEFINED mode. This solely depends on the autopilot - use with
# caution, intended for developers only.
enums['MAV_MODE'][194] = EnumEntry('MAV_MODE_TEST_ARMED', '''UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only.''')
MAV_MODE_STABILIZE_ARMED = 208 # System is allowed to be active, under assisted RC control.
enums['MAV_MODE'][208] = EnumEntry('MAV_MODE_STABILIZE_ARMED', '''System is allowed to be active, under assisted RC control.''')
MAV_MODE_GUIDED_ARMED = 216 # System is allowed to be active, under autonomous control, manual
# setpoint
enums['MAV_MODE'][216] = EnumEntry('MAV_MODE_GUIDED_ARMED', '''System is allowed to be active, under autonomous control, manual setpoint''')
MAV_MODE_AUTO_ARMED = 220 # System is allowed to be active, under autonomous control and
# navigation (the trajectory is decided
# onboard and not pre-programmed by waypoints)
enums['MAV_MODE'][220] = EnumEntry('MAV_MODE_AUTO_ARMED', '''System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by waypoints)''')
MAV_MODE_ENUM_END = 221 #
enums['MAV_MODE'][221] = EnumEntry('MAV_MODE_ENUM_END', '''''')
# MAV_STATE
enums['MAV_STATE'] = {}
MAV_STATE_UNINIT = 0 # Uninitialized system, state is unknown.
enums['MAV_STATE'][0] = EnumEntry('MAV_STATE_UNINIT', '''Uninitialized system, state is unknown.''')
MAV_STATE_BOOT = 1 # System is booting up.
enums['MAV_STATE'][1] = EnumEntry('MAV_STATE_BOOT', '''System is booting up.''')
MAV_STATE_CALIBRATING = 2 # System is calibrating and not flight-ready.
enums['MAV_STATE'][2] = EnumEntry('MAV_STATE_CALIBRATING', '''System is calibrating and not flight-ready.''')
MAV_STATE_STANDBY = 3 # System is grounded and on standby. It can be launched any time.
enums['MAV_STATE'][3] = EnumEntry('MAV_STATE_STANDBY', '''System is grounded and on standby. It can be launched any time.''')
MAV_STATE_ACTIVE = 4 # System is active and might be already airborne. Motors are engaged.
enums['MAV_STATE'][4] = EnumEntry('MAV_STATE_ACTIVE', '''System is active and might be already airborne. Motors are engaged.''')
MAV_STATE_CRITICAL = 5 # System is in a non-normal flight mode. It can however still navigate.
enums['MAV_STATE'][5] = EnumEntry('MAV_STATE_CRITICAL', '''System is in a non-normal flight mode. It can however still navigate.''')
MAV_STATE_EMERGENCY = 6 # System is in a non-normal flight mode. It lost control over parts or
# over the whole airframe. It is in mayday and
# going down.
enums['MAV_STATE'][6] = EnumEntry('MAV_STATE_EMERGENCY', '''System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down.''')
MAV_STATE_POWEROFF = 7 # System just initialized its power-down sequence, will shut down now.
enums['MAV_STATE'][7] = EnumEntry('MAV_STATE_POWEROFF', '''System just initialized its power-down sequence, will shut down now.''')
MAV_STATE_FLIGHT_TERMINATION = 8 # System is terminating itself.
enums['MAV_STATE'][8] = EnumEntry('MAV_STATE_FLIGHT_TERMINATION', '''System is terminating itself.''')
MAV_STATE_ENUM_END = 9 #
enums['MAV_STATE'][9] = EnumEntry('MAV_STATE_ENUM_END', '''''')
# MAV_COMPONENT
enums['MAV_COMPONENT'] = {}
MAV_COMP_ID_ALL = 0 #
enums['MAV_COMPONENT'][0] = EnumEntry('MAV_COMP_ID_ALL', '''''')
MAV_COMP_ID_AUTOPILOT1 = 1 #
enums['MAV_COMPONENT'][1] = EnumEntry('MAV_COMP_ID_AUTOPILOT1', '''''')
MAV_COMP_ID_CAMERA = 100 #
enums['MAV_COMPONENT'][100] = EnumEntry('MAV_COMP_ID_CAMERA', '''''')
MAV_COMP_ID_SERVO1 = 140 #
enums['MAV_COMPONENT'][140] = EnumEntry('MAV_COMP_ID_SERVO1', '''''')
MAV_COMP_ID_SERVO2 = 141 #
enums['MAV_COMPONENT'][141] = EnumEntry('MAV_COMP_ID_SERVO2', '''''')
MAV_COMP_ID_SERVO3 = 142 #
enums['MAV_COMPONENT'][142] = EnumEntry('MAV_COMP_ID_SERVO3', '''''')
MAV_COMP_ID_SERVO4 = 143 #
enums['MAV_COMPONENT'][143] = EnumEntry('MAV_COMP_ID_SERVO4', '''''')
MAV_COMP_ID_SERVO5 = 144 #
enums['MAV_COMPONENT'][144] = EnumEntry('MAV_COMP_ID_SERVO5', '''''')
MAV_COMP_ID_SERVO6 = 145 #
enums['MAV_COMPONENT'][145] = EnumEntry('MAV_COMP_ID_SERVO6', '''''')
MAV_COMP_ID_SERVO7 = 146 #
enums['MAV_COMPONENT'][146] = EnumEntry('MAV_COMP_ID_SERVO7', '''''')
MAV_COMP_ID_SERVO8 = 147 #
enums['MAV_COMPONENT'][147] = EnumEntry('MAV_COMP_ID_SERVO8', '''''')
MAV_COMP_ID_SERVO9 = 148 #
enums['MAV_COMPONENT'][148] = EnumEntry('MAV_COMP_ID_SERVO9', '''''')
MAV_COMP_ID_SERVO10 = 149 #
enums['MAV_COMPONENT'][149] = EnumEntry('MAV_COMP_ID_SERVO10', '''''')
MAV_COMP_ID_SERVO11 = 150 #
enums['MAV_COMPONENT'][150] = EnumEntry('MAV_COMP_ID_SERVO11', '''''')
MAV_COMP_ID_SERVO12 = 151 #
enums['MAV_COMPONENT'][151] = EnumEntry('MAV_COMP_ID_SERVO12', '''''')
MAV_COMP_ID_SERVO13 = 152 #
enums['MAV_COMPONENT'][152] = EnumEntry('MAV_COMP_ID_SERVO13', '''''')
MAV_COMP_ID_SERVO14 = 153 #
enums['MAV_COMPONENT'][153] = EnumEntry('MAV_COMP_ID_SERVO14', '''''')
MAV_COMP_ID_GIMBAL = 154 #
enums['MAV_COMPONENT'][154] = EnumEntry('MAV_COMP_ID_GIMBAL', '''''')
MAV_COMP_ID_LOG = 155 #
enums['MAV_COMPONENT'][155] = EnumEntry('MAV_COMP_ID_LOG', '''''')
MAV_COMP_ID_ADSB = 156 #
enums['MAV_COMPONENT'][156] = EnumEntry('MAV_COMP_ID_ADSB', '''''')
MAV_COMP_ID_OSD = 157 # On Screen Display (OSD) devices for video links
enums['MAV_COMPONENT'][157] = EnumEntry('MAV_COMP_ID_OSD', '''On Screen Display (OSD) devices for video links''')
MAV_COMP_ID_PERIPHERAL = 158 # Generic autopilot peripheral component ID. Meant for devices that do
# not implement the parameter sub-protocol
enums['MAV_COMPONENT'][158] = EnumEntry('MAV_COMP_ID_PERIPHERAL', '''Generic autopilot peripheral component ID. Meant for devices that do not implement the parameter sub-protocol''')
MAV_COMP_ID_QX1_GIMBAL = 159 #
enums['MAV_COMPONENT'][159] = EnumEntry('MAV_COMP_ID_QX1_GIMBAL', '''''')
MAV_COMP_ID_FLARM = 160 #
enums['MAV_COMPONENT'][160] = EnumEntry('MAV_COMP_ID_FLARM', '''''')
MAV_COMP_ID_MAPPER = 180 #
enums['MAV_COMPONENT'][180] = EnumEntry('MAV_COMP_ID_MAPPER', '''''')
MAV_COMP_ID_MISSIONPLANNER = 190 #
enums['MAV_COMPONENT'][190] = EnumEntry('MAV_COMP_ID_MISSIONPLANNER', '''''')
MAV_COMP_ID_PATHPLANNER = 195 #
enums['MAV_COMPONENT'][195] = EnumEntry('MAV_COMP_ID_PATHPLANNER', '''''')
MAV_COMP_ID_IMU = 200 #
enums['MAV_COMPONENT'][200] = EnumEntry('MAV_COMP_ID_IMU', '''''')
MAV_COMP_ID_IMU_2 = 201 #
enums['MAV_COMPONENT'][201] = EnumEntry('MAV_COMP_ID_IMU_2', '''''')
MAV_COMP_ID_IMU_3 = 202 #
enums['MAV_COMPONENT'][202] = EnumEntry('MAV_COMP_ID_IMU_3', '''''')
MAV_COMP_ID_GPS = 220 #
enums['MAV_COMPONENT'][220] = EnumEntry('MAV_COMP_ID_GPS', '''''')
MAV_COMP_ID_GPS2 = 221 #
enums['MAV_COMPONENT'][221] = EnumEntry('MAV_COMP_ID_GPS2', '''''')
MAV_COMP_ID_UDP_BRIDGE = 240 #
enums['MAV_COMPONENT'][240] = EnumEntry('MAV_COMP_ID_UDP_BRIDGE', '''''')
MAV_COMP_ID_UART_BRIDGE = 241 #
enums['MAV_COMPONENT'][241] = EnumEntry('MAV_COMP_ID_UART_BRIDGE', '''''')
MAV_COMP_ID_SYSTEM_CONTROL = 250 #
enums['MAV_COMPONENT'][250] = EnumEntry('MAV_COMP_ID_SYSTEM_CONTROL', '''''')
MAV_COMPONENT_ENUM_END = 251 #
enums['MAV_COMPONENT'][251] = EnumEntry('MAV_COMPONENT_ENUM_END', '''''')
# MAV_SYS_STATUS_SENSOR
enums['MAV_SYS_STATUS_SENSOR'] = {}
MAV_SYS_STATUS_SENSOR_3D_GYRO = 1 # 0x01 3D gyro
enums['MAV_SYS_STATUS_SENSOR'][1] = EnumEntry('MAV_SYS_STATUS_SENSOR_3D_GYRO', '''0x01 3D gyro''')
MAV_SYS_STATUS_SENSOR_3D_ACCEL = 2 # 0x02 3D accelerometer
enums['MAV_SYS_STATUS_SENSOR'][2] = EnumEntry('MAV_SYS_STATUS_SENSOR_3D_ACCEL', '''0x02 3D accelerometer''')
MAV_SYS_STATUS_SENSOR_3D_MAG = 4 # 0x04 3D magnetometer
enums['MAV_SYS_STATUS_SENSOR'][4] = EnumEntry('MAV_SYS_STATUS_SENSOR_3D_MAG', '''0x04 3D magnetometer''')
MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE = 8 # 0x08 absolute pressure
enums['MAV_SYS_STATUS_SENSOR'][8] = EnumEntry('MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE', '''0x08 absolute pressure''')
MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE = 16 # 0x10 differential pressure
enums['MAV_SYS_STATUS_SENSOR'][16] = EnumEntry('MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE', '''0x10 differential pressure''')
MAV_SYS_STATUS_SENSOR_GPS = 32 # 0x20 GPS
enums['MAV_SYS_STATUS_SENSOR'][32] = EnumEntry('MAV_SYS_STATUS_SENSOR_GPS', '''0x20 GPS''')
MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW = 64 # 0x40 optical flow
enums['MAV_SYS_STATUS_SENSOR'][64] = EnumEntry('MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW', '''0x40 optical flow''')
MAV_SYS_STATUS_SENSOR_VISION_POSITION = 128 # 0x80 computer vision position
enums['MAV_SYS_STATUS_SENSOR'][128] = EnumEntry('MAV_SYS_STATUS_SENSOR_VISION_POSITION', '''0x80 computer vision position''')
MAV_SYS_STATUS_SENSOR_LASER_POSITION = 256 # 0x100 laser based position
enums['MAV_SYS_STATUS_SENSOR'][256] = EnumEntry('MAV_SYS_STATUS_SENSOR_LASER_POSITION', '''0x100 laser based position''')
MAV_SYS_STATUS_SENSOR_EXTERNAL_GROUND_TRUTH = 512 # 0x200 external ground truth (Vicon or Leica)
enums['MAV_SYS_STATUS_SENSOR'][512] = EnumEntry('MAV_SYS_STATUS_SENSOR_EXTERNAL_GROUND_TRUTH', '''0x200 external ground truth (Vicon or Leica)''')
MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL = 1024 # 0x400 3D angular rate control
enums['MAV_SYS_STATUS_SENSOR'][1024] = EnumEntry('MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL', '''0x400 3D angular rate control''')
MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION = 2048 # 0x800 attitude stabilization
enums['MAV_SYS_STATUS_SENSOR'][2048] = EnumEntry('MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION', '''0x800 attitude stabilization''')
MAV_SYS_STATUS_SENSOR_YAW_POSITION = 4096 # 0x1000 yaw position
enums['MAV_SYS_STATUS_SENSOR'][4096] = EnumEntry('MAV_SYS_STATUS_SENSOR_YAW_POSITION', '''0x1000 yaw position''')
MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL = 8192 # 0x2000 z/altitude control
enums['MAV_SYS_STATUS_SENSOR'][8192] = EnumEntry('MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL', '''0x2000 z/altitude control''')
MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL = 16384 # 0x4000 x/y position control
enums['MAV_SYS_STATUS_SENSOR'][16384] = EnumEntry('MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL', '''0x4000 x/y position control''')
MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS = 32768 # 0x8000 motor outputs / control
enums['MAV_SYS_STATUS_SENSOR'][32768] = EnumEntry('MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS', '''0x8000 motor outputs / control''')
MAV_SYS_STATUS_SENSOR_RC_RECEIVER = 65536 # 0x10000 rc receiver
enums['MAV_SYS_STATUS_SENSOR'][65536] = EnumEntry('MAV_SYS_STATUS_SENSOR_RC_RECEIVER', '''0x10000 rc receiver''')
MAV_SYS_STATUS_SENSOR_3D_GYRO2 = 131072 # 0x20000 2nd 3D gyro
enums['MAV_SYS_STATUS_SENSOR'][131072] = EnumEntry('MAV_SYS_STATUS_SENSOR_3D_GYRO2', '''0x20000 2nd 3D gyro''')
MAV_SYS_STATUS_SENSOR_3D_ACCEL2 = 262144 # 0x40000 2nd 3D accelerometer
enums['MAV_SYS_STATUS_SENSOR'][262144] = EnumEntry('MAV_SYS_STATUS_SENSOR_3D_ACCEL2', '''0x40000 2nd 3D accelerometer''')
MAV_SYS_STATUS_SENSOR_3D_MAG2 = 524288 # 0x80000 2nd 3D magnetometer
enums['MAV_SYS_STATUS_SENSOR'][524288] = EnumEntry('MAV_SYS_STATUS_SENSOR_3D_MAG2', '''0x80000 2nd 3D magnetometer''')
MAV_SYS_STATUS_GEOFENCE = 1048576 # 0x100000 geofence
enums['MAV_SYS_STATUS_SENSOR'][1048576] = EnumEntry('MAV_SYS_STATUS_GEOFENCE', '''0x100000 geofence''')
MAV_SYS_STATUS_AHRS = 2097152 # 0x200000 AHRS subsystem health
enums['MAV_SYS_STATUS_SENSOR'][2097152] = EnumEntry('MAV_SYS_STATUS_AHRS', '''0x200000 AHRS subsystem health''')
MAV_SYS_STATUS_TERRAIN = 4194304 # 0x400000 Terrain subsystem health
enums['MAV_SYS_STATUS_SENSOR'][4194304] = EnumEntry('MAV_SYS_STATUS_TERRAIN', '''0x400000 Terrain subsystem health''')
MAV_SYS_STATUS_REVERSE_MOTOR = 8388608 # 0x800000 Motors are reversed
enums['MAV_SYS_STATUS_SENSOR'][8388608] = EnumEntry('MAV_SYS_STATUS_REVERSE_MOTOR', '''0x800000 Motors are reversed''')
MAV_SYS_STATUS_LOGGING = 16777216 # 0x1000000 Logging
enums['MAV_SYS_STATUS_SENSOR'][16777216] = EnumEntry('MAV_SYS_STATUS_LOGGING', '''0x1000000 Logging''')
MAV_SYS_STATUS_SENSOR_BATTERY = 33554432 # 0x2000000 Battery
enums['MAV_SYS_STATUS_SENSOR'][33554432] = EnumEntry('MAV_SYS_STATUS_SENSOR_BATTERY', '''0x2000000 Battery''')
MAV_SYS_STATUS_SENSOR_PROXIMITY = 67108864 # 0x4000000 Proximity
enums['MAV_SYS_STATUS_SENSOR'][67108864] = EnumEntry('MAV_SYS_STATUS_SENSOR_PROXIMITY', '''0x4000000 Proximity''')
MAV_SYS_STATUS_SENSOR_ENUM_END = 67108865 #
enums['MAV_SYS_STATUS_SENSOR'][67108865] = EnumEntry('MAV_SYS_STATUS_SENSOR_ENUM_END', '''''')
# MAV_FRAME
enums['MAV_FRAME'] = {}
MAV_FRAME_GLOBAL = 0 # Global coordinate frame, WGS84 coordinate system. First value / x:
# latitude, second value / y: longitude, third
# value / z: positive altitude over mean sea
# level (MSL).
enums['MAV_FRAME'][0] = EnumEntry('MAV_FRAME_GLOBAL', '''Global coordinate frame, WGS84 coordinate system. First value / x: latitude, second value / y: longitude, third value / z: positive altitude over mean sea level (MSL).''')
MAV_FRAME_LOCAL_NED = 1 # Local coordinate frame, Z-down (x: north, y: east, z: down).
enums['MAV_FRAME'][1] = EnumEntry('MAV_FRAME_LOCAL_NED', '''Local coordinate frame, Z-down (x: north, y: east, z: down).''')
MAV_FRAME_MISSION = 2 # NOT a coordinate frame, indicates a mission command.
enums['MAV_FRAME'][2] = EnumEntry('MAV_FRAME_MISSION', '''NOT a coordinate frame, indicates a mission command.''')
MAV_FRAME_GLOBAL_RELATIVE_ALT = 3 # Global coordinate frame, WGS84 coordinate system, relative altitude
# over ground with respect to the home
# position. First value / x: latitude, second
# value / y: longitude, third value / z:
# positive altitude with 0 being at the
# altitude of the home location.
enums['MAV_FRAME'][3] = EnumEntry('MAV_FRAME_GLOBAL_RELATIVE_ALT', '''Global coordinate frame, WGS84 coordinate system, relative altitude over ground with respect to the home position. First value / x: latitude, second value / y: longitude, third value / z: positive altitude with 0 being at the altitude of the home location.''')
MAV_FRAME_LOCAL_ENU = 4 # Local coordinate frame, Z-up (x: east, y: north, z: up).
enums['MAV_FRAME'][4] = EnumEntry('MAV_FRAME_LOCAL_ENU', '''Local coordinate frame, Z-up (x: east, y: north, z: up).''')
MAV_FRAME_GLOBAL_INT = 5 # Global coordinate frame, WGS84 coordinate system. First value / x:
# latitude in degrees*1.0e-7, second value /
# y: longitude in degrees*1.0e-7, third value
# / z: positive altitude over mean sea level
# (MSL).
enums['MAV_FRAME'][5] = EnumEntry('MAV_FRAME_GLOBAL_INT', '''Global coordinate frame, WGS84 coordinate system. First value / x: latitude in degrees*1.0e-7, second value / y: longitude in degrees*1.0e-7, third value / z: positive altitude over mean sea level (MSL).''')
MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6 # Global coordinate frame, WGS84 coordinate system, relative altitude
# over ground with respect to the home
# position. First value / x: latitude in
# degrees*10e-7, second value / y: longitude
# in degrees*10e-7, third value / z: positive
# altitude with 0 being at the altitude of the
# home location.
enums['MAV_FRAME'][6] = EnumEntry('MAV_FRAME_GLOBAL_RELATIVE_ALT_INT', '''Global coordinate frame, WGS84 coordinate system, relative altitude over ground with respect to the home position. First value / x: latitude in degrees*10e-7, second value / y: longitude in degrees*10e-7, third value / z: positive altitude with 0 being at the altitude of the home location.''')
MAV_FRAME_LOCAL_OFFSET_NED = 7 # Offset to the current local frame. Anything expressed in this frame
# should be added to the current local frame
# position.
enums['MAV_FRAME'][7] = EnumEntry('MAV_FRAME_LOCAL_OFFSET_NED', '''Offset to the current local frame. Anything expressed in this frame should be added to the current local frame position.''')
MAV_FRAME_BODY_NED = 8 # Setpoint in body NED frame. This makes sense if all position control
# is externalized - e.g. useful to command 2
# m/s^2 acceleration to the right.
enums['MAV_FRAME'][8] = EnumEntry('MAV_FRAME_BODY_NED', '''Setpoint in body NED frame. This makes sense if all position control is externalized - e.g. useful to command 2 m/s^2 acceleration to the right.''')
MAV_FRAME_BODY_OFFSET_NED = 9 # Offset in body NED frame. This makes sense if adding setpoints to the
# current flight path, to avoid an obstacle -
# e.g. useful to command 2 m/s^2 acceleration
# to the east.
enums['MAV_FRAME'][9] = EnumEntry('MAV_FRAME_BODY_OFFSET_NED', '''Offset in body NED frame. This makes sense if adding setpoints to the current flight path, to avoid an obstacle - e.g. useful to command 2 m/s^2 acceleration to the east.''')
MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 # Global coordinate frame with above terrain level altitude. WGS84
# coordinate system, relative altitude over
# terrain with respect to the waypoint
# coordinate. First value / x: latitude in
# degrees, second value / y: longitude in
# degrees, third value / z: positive altitude
# in meters with 0 being at ground level in
# terrain model.
enums['MAV_FRAME'][10] = EnumEntry('MAV_FRAME_GLOBAL_TERRAIN_ALT', '''Global coordinate frame with above terrain level altitude. WGS84 coordinate system, relative altitude over terrain with respect to the waypoint coordinate. First value / x: latitude in degrees, second value / y: longitude in degrees, third value / z: positive altitude in meters with 0 being at ground level in terrain model.''')
MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 # Global coordinate frame with above terrain level altitude. WGS84
# coordinate system, relative altitude over
# terrain with respect to the waypoint
# coordinate. First value / x: latitude in
# degrees*10e-7, second value / y: longitude
# in degrees*10e-7, third value / z: positive
# altitude in meters with 0 being at ground
# level in terrain model.
enums['MAV_FRAME'][11] = EnumEntry('MAV_FRAME_GLOBAL_TERRAIN_ALT_INT', '''Global coordinate frame with above terrain level altitude. WGS84 coordinate system, relative altitude over terrain with respect to the waypoint coordinate. First value / x: latitude in degrees*10e-7, second value / y: longitude in degrees*10e-7, third value / z: positive altitude in meters with 0 being at ground level in terrain model.''')
MAV_FRAME_BODY_FRD = 12 # Body fixed frame of reference, Z-down (x: forward, y: right, z: down).
enums['MAV_FRAME'][12] = EnumEntry('MAV_FRAME_BODY_FRD', '''Body fixed frame of reference, Z-down (x: forward, y: right, z: down).''')
MAV_FRAME_BODY_FLU = 13 # Body fixed frame of reference, Z-up (x: forward, y: left, z: up).
enums['MAV_FRAME'][13] = EnumEntry('MAV_FRAME_BODY_FLU', '''Body fixed frame of reference, Z-up (x: forward, y: left, z: up).''')
MAV_FRAME_MOCAP_NED = 14 # Odometry local coordinate frame of data given by a motion capture
# system, Z-down (x: north, y: east, z: down).
enums['MAV_FRAME'][14] = EnumEntry('MAV_FRAME_MOCAP_NED', '''Odometry local coordinate frame of data given by a motion capture system, Z-down (x: north, y: east, z: down).''')
MAV_FRAME_MOCAP_ENU = 15 # Odometry local coordinate frame of data given by a motion capture
# system, Z-up (x: east, y: north, z: up).
enums['MAV_FRAME'][15] = EnumEntry('MAV_FRAME_MOCAP_ENU', '''Odometry local coordinate frame of data given by a motion capture system, Z-up (x: east, y: north, z: up).''')
MAV_FRAME_VISION_NED = 16 # Odometry local coordinate frame of data given by a vision estimation
# system, Z-down (x: north, y: east, z: down).
enums['MAV_FRAME'][16] = EnumEntry('MAV_FRAME_VISION_NED', '''Odometry local coordinate frame of data given by a vision estimation system, Z-down (x: north, y: east, z: down).''')
MAV_FRAME_VISION_ENU = 17 # Odometry local coordinate frame of data given by a vision estimation
# system, Z-up (x: east, y: north, z: up).
enums['MAV_FRAME'][17] = EnumEntry('MAV_FRAME_VISION_ENU', '''Odometry local coordinate frame of data given by a vision estimation system, Z-up (x: east, y: north, z: up).''')
MAV_FRAME_ESTIM_NED = 18 # Odometry local coordinate frame of data given by an estimator running
# onboard the vehicle, Z-down (x: north, y:
# east, z: down).
enums['MAV_FRAME'][18] = EnumEntry('MAV_FRAME_ESTIM_NED', '''Odometry local coordinate frame of data given by an estimator running onboard the vehicle, Z-down (x: north, y: east, z: down).''')
MAV_FRAME_ESTIM_ENU = 19 # Odometry local coordinate frame of data given by an estimator running
# onboard the vehicle, Z-up (x: east, y: noth,
# z: up).
enums['MAV_FRAME'][19] = EnumEntry('MAV_FRAME_ESTIM_ENU', '''Odometry local coordinate frame of data given by an estimator running onboard the vehicle, Z-up (x: east, y: noth, z: up).''')
MAV_FRAME_ENUM_END = 20 #
enums['MAV_FRAME'][20] = EnumEntry('MAV_FRAME_ENUM_END', '''''')
# MAVLINK_DATA_STREAM_TYPE
enums['MAVLINK_DATA_STREAM_TYPE'] = {}
MAVLINK_DATA_STREAM_IMG_JPEG = 1 #
enums['MAVLINK_DATA_STREAM_TYPE'][1] = EnumEntry('MAVLINK_DATA_STREAM_IMG_JPEG', '''''')
MAVLINK_DATA_STREAM_IMG_BMP = 2 #
enums['MAVLINK_DATA_STREAM_TYPE'][2] = EnumEntry('MAVLINK_DATA_STREAM_IMG_BMP', '''''')
MAVLINK_DATA_STREAM_IMG_RAW8U = 3 #
enums['MAVLINK_DATA_STREAM_TYPE'][3] = EnumEntry('MAVLINK_DATA_STREAM_IMG_RAW8U', '''''')
MAVLINK_DATA_STREAM_IMG_RAW32U = 4 #
enums['MAVLINK_DATA_STREAM_TYPE'][4] = EnumEntry('MAVLINK_DATA_STREAM_IMG_RAW32U', '''''')
MAVLINK_DATA_STREAM_IMG_PGM = 5 #
enums['MAVLINK_DATA_STREAM_TYPE'][5] = EnumEntry('MAVLINK_DATA_STREAM_IMG_PGM', '''''')
MAVLINK_DATA_STREAM_IMG_PNG = 6 #
enums['MAVLINK_DATA_STREAM_TYPE'][6] = EnumEntry('MAVLINK_DATA_STREAM_IMG_PNG', '''''')
MAVLINK_DATA_STREAM_TYPE_ENUM_END = 7 #
enums['MAVLINK_DATA_STREAM_TYPE'][7] = EnumEntry('MAVLINK_DATA_STREAM_TYPE_ENUM_END', '''''')
# FENCE_ACTION
enums['FENCE_ACTION'] = {}
FENCE_ACTION_NONE = 0 # Disable fenced mode
enums['FENCE_ACTION'][0] = EnumEntry('FENCE_ACTION_NONE', '''Disable fenced mode''')
FENCE_ACTION_GUIDED = 1 # Switched to guided mode to return point (fence point 0)
enums['FENCE_ACTION'][1] = EnumEntry('FENCE_ACTION_GUIDED', '''Switched to guided mode to return point (fence point 0)''')
FENCE_ACTION_REPORT = 2 # Report fence breach, but don't take action
enums['FENCE_ACTION'][2] = EnumEntry('FENCE_ACTION_REPORT', '''Report fence breach, but don't take action''')
FENCE_ACTION_GUIDED_THR_PASS = 3 # Switched to guided mode to return point (fence point 0) with manual
# throttle control
enums['FENCE_ACTION'][3] = EnumEntry('FENCE_ACTION_GUIDED_THR_PASS', '''Switched to guided mode to return point (fence point 0) with manual throttle control''')
FENCE_ACTION_RTL = 4 # Switch to RTL (return to launch) mode and head for the return point.
enums['FENCE_ACTION'][4] = EnumEntry('FENCE_ACTION_RTL', '''Switch to RTL (return to launch) mode and head for the return point.''')
FENCE_ACTION_ENUM_END = 5 #
enums['FENCE_ACTION'][5] = EnumEntry('FENCE_ACTION_ENUM_END', '''''')
# FENCE_BREACH
enums['FENCE_BREACH'] = {}
FENCE_BREACH_NONE = 0 # No last fence breach
enums['FENCE_BREACH'][0] = EnumEntry('FENCE_BREACH_NONE', '''No last fence breach''')
FENCE_BREACH_MINALT = 1 # Breached minimum altitude
enums['FENCE_BREACH'][1] = EnumEntry('FENCE_BREACH_MINALT', '''Breached minimum altitude''')
FENCE_BREACH_MAXALT = 2 # Breached maximum altitude
enums['FENCE_BREACH'][2] = EnumEntry('FENCE_BREACH_MAXALT', '''Breached maximum altitude''')
FENCE_BREACH_BOUNDARY = 3 # Breached fence boundary
enums['FENCE_BREACH'][3] = EnumEntry('FENCE_BREACH_BOUNDARY', '''Breached fence boundary''')
FENCE_BREACH_ENUM_END = 4 #
enums['FENCE_BREACH'][4] = EnumEntry('FENCE_BREACH_ENUM_END', '''''')
# MAV_MOUNT_MODE
enums['MAV_MOUNT_MODE'] = {}
MAV_MOUNT_MODE_RETRACT = 0 # Load and keep safe position (Roll,Pitch,Yaw) from permant memory and
# stop stabilization
enums['MAV_MOUNT_MODE'][0] = EnumEntry('MAV_MOUNT_MODE_RETRACT', '''Load and keep safe position (Roll,Pitch,Yaw) from permant memory and stop stabilization''')
MAV_MOUNT_MODE_NEUTRAL = 1 # Load and keep neutral position (Roll,Pitch,Yaw) from permanent memory.
enums['MAV_MOUNT_MODE'][1] = EnumEntry('MAV_MOUNT_MODE_NEUTRAL', '''Load and keep neutral position (Roll,Pitch,Yaw) from permanent memory.''')
MAV_MOUNT_MODE_MAVLINK_TARGETING = 2 # Load neutral position and start MAVLink Roll,Pitch,Yaw control with
# stabilization
enums['MAV_MOUNT_MODE'][2] = EnumEntry('MAV_MOUNT_MODE_MAVLINK_TARGETING', '''Load neutral position and start MAVLink Roll,Pitch,Yaw control with stabilization''')
MAV_MOUNT_MODE_RC_TARGETING = 3 # Load neutral position and start RC Roll,Pitch,Yaw control with
# stabilization
enums['MAV_MOUNT_MODE'][3] = EnumEntry('MAV_MOUNT_MODE_RC_TARGETING', '''Load neutral position and start RC Roll,Pitch,Yaw control with stabilization''')
MAV_MOUNT_MODE_GPS_POINT = 4 # Load neutral position and start to point to Lat,Lon,Alt
enums['MAV_MOUNT_MODE'][4] = EnumEntry('MAV_MOUNT_MODE_GPS_POINT', '''Load neutral position and start to point to Lat,Lon,Alt''')
MAV_MOUNT_MODE_ENUM_END = 5 #
enums['MAV_MOUNT_MODE'][5] = EnumEntry('MAV_MOUNT_MODE_ENUM_END', '''''')
# UAVCAN_NODE_HEALTH
enums['UAVCAN_NODE_HEALTH'] = {}
UAVCAN_NODE_HEALTH_OK = 0 # The node is functioning properly.
enums['UAVCAN_NODE_HEALTH'][0] = EnumEntry('UAVCAN_NODE_HEALTH_OK', '''The node is functioning properly.''')
UAVCAN_NODE_HEALTH_WARNING = 1 # A critical parameter went out of range or the node has encountered a
# minor failure.
enums['UAVCAN_NODE_HEALTH'][1] = EnumEntry('UAVCAN_NODE_HEALTH_WARNING', '''A critical parameter went out of range or the node has encountered a minor failure.''')
UAVCAN_NODE_HEALTH_ERROR = 2 # The node has encountered a major failure.
enums['UAVCAN_NODE_HEALTH'][2] = EnumEntry('UAVCAN_NODE_HEALTH_ERROR', '''The node has encountered a major failure.''')
UAVCAN_NODE_HEALTH_CRITICAL = 3 # The node has suffered a fatal malfunction.
enums['UAVCAN_NODE_HEALTH'][3] = EnumEntry('UAVCAN_NODE_HEALTH_CRITICAL', '''The node has suffered a fatal malfunction.''')
UAVCAN_NODE_HEALTH_ENUM_END = 4 #
enums['UAVCAN_NODE_HEALTH'][4] = EnumEntry('UAVCAN_NODE_HEALTH_ENUM_END', '''''')
# UAVCAN_NODE_MODE
enums['UAVCAN_NODE_MODE'] = {}
UAVCAN_NODE_MODE_OPERATIONAL = 0 # The node is performing its primary functions.
enums['UAVCAN_NODE_MODE'][0] = EnumEntry('UAVCAN_NODE_MODE_OPERATIONAL', '''The node is performing its primary functions.''')
UAVCAN_NODE_MODE_INITIALIZATION = 1 # The node is initializing; this mode is entered immediately after
# startup.
enums['UAVCAN_NODE_MODE'][1] = EnumEntry('UAVCAN_NODE_MODE_INITIALIZATION', '''The node is initializing; this mode is entered immediately after startup.''')
UAVCAN_NODE_MODE_MAINTENANCE = 2 # The node is under maintenance.
enums['UAVCAN_NODE_MODE'][2] = EnumEntry('UAVCAN_NODE_MODE_MAINTENANCE', '''The node is under maintenance.''')
UAVCAN_NODE_MODE_SOFTWARE_UPDATE = 3 # The node is in the process of updating its software.
enums['UAVCAN_NODE_MODE'][3] = EnumEntry('UAVCAN_NODE_MODE_SOFTWARE_UPDATE', '''The node is in the process of updating its software.''')
UAVCAN_NODE_MODE_OFFLINE = 7 # The node is no longer available online.
enums['UAVCAN_NODE_MODE'][7] = EnumEntry('UAVCAN_NODE_MODE_OFFLINE', '''The node is no longer available online.''')
UAVCAN_NODE_MODE_ENUM_END = 8 #
enums['UAVCAN_NODE_MODE'][8] = EnumEntry('UAVCAN_NODE_MODE_ENUM_END', '''''')
# MAV_ROI
enums['MAV_ROI'] = {}
MAV_ROI_NONE = 0 # No region of interest.
enums['MAV_ROI'][0] = EnumEntry('MAV_ROI_NONE', '''No region of interest.''')
MAV_ROI_WPNEXT = 1 # Point toward next waypoint.
enums['MAV_ROI'][1] = EnumEntry('MAV_ROI_WPNEXT', '''Point toward next waypoint.''')
MAV_ROI_WPINDEX = 2 # Point toward given waypoint.
enums['MAV_ROI'][2] = EnumEntry('MAV_ROI_WPINDEX', '''Point toward given waypoint.''')
MAV_ROI_LOCATION = 3 # Point toward fixed location.
enums['MAV_ROI'][3] = EnumEntry('MAV_ROI_LOCATION', '''Point toward fixed location.''')
MAV_ROI_TARGET = 4 # Point toward of given id.
enums['MAV_ROI'][4] = EnumEntry('MAV_ROI_TARGET', '''Point toward of given id.''')
MAV_ROI_ENUM_END = 5 #
enums['MAV_ROI'][5] = EnumEntry('MAV_ROI_ENUM_END', '''''')
# MAV_CMD_ACK
enums['MAV_CMD_ACK'] = {}
MAV_CMD_ACK_OK = 1 # Command / mission item is ok.
enums['MAV_CMD_ACK'][1] = EnumEntry('MAV_CMD_ACK_OK', '''Command / mission item is ok.''')
MAV_CMD_ACK_ERR_FAIL = 2 # Generic error message if none of the other reasons fails or if no
# detailed error reporting is implemented.
enums['MAV_CMD_ACK'][2] = EnumEntry('MAV_CMD_ACK_ERR_FAIL', '''Generic error message if none of the other reasons fails or if no detailed error reporting is implemented.''')
MAV_CMD_ACK_ERR_ACCESS_DENIED = 3 # The system is refusing to accept this command from this source /
# communication partner.
enums['MAV_CMD_ACK'][3] = EnumEntry('MAV_CMD_ACK_ERR_ACCESS_DENIED', '''The system is refusing to accept this command from this source / communication partner.''')
MAV_CMD_ACK_ERR_NOT_SUPPORTED = 4 # Command or mission item is not supported, other commands would be
# accepted.
enums['MAV_CMD_ACK'][4] = EnumEntry('MAV_CMD_ACK_ERR_NOT_SUPPORTED', '''Command or mission item is not supported, other commands would be accepted.''')
MAV_CMD_ACK_ERR_COORDINATE_FRAME_NOT_SUPPORTED = 5 # The coordinate frame of this command / mission item is not supported.
enums['MAV_CMD_ACK'][5] = EnumEntry('MAV_CMD_ACK_ERR_COORDINATE_FRAME_NOT_SUPPORTED', '''The coordinate frame of this command / mission item is not supported.''')
MAV_CMD_ACK_ERR_COORDINATES_OUT_OF_RANGE = 6 # The coordinate frame of this command is ok, but he coordinate values
# exceed the safety limits of this system.
# This is a generic error, please use the more
# specific error messages below if possible.
enums['MAV_CMD_ACK'][6] = EnumEntry('MAV_CMD_ACK_ERR_COORDINATES_OUT_OF_RANGE', '''The coordinate frame of this command is ok, but he coordinate values exceed the safety limits of this system. This is a generic error, please use the more specific error messages below if possible.''')
MAV_CMD_ACK_ERR_X_LAT_OUT_OF_RANGE = 7 # The X or latitude value is out of range.
enums['MAV_CMD_ACK'][7] = EnumEntry('MAV_CMD_ACK_ERR_X_LAT_OUT_OF_RANGE', '''The X or latitude value is out of range.''')
MAV_CMD_ACK_ERR_Y_LON_OUT_OF_RANGE = 8 # The Y or longitude value is out of range.
enums['MAV_CMD_ACK'][8] = EnumEntry('MAV_CMD_ACK_ERR_Y_LON_OUT_OF_RANGE', '''The Y or longitude value is out of range.''')
MAV_CMD_ACK_ERR_Z_ALT_OUT_OF_RANGE = 9 # The Z or altitude value is out of range.
enums['MAV_CMD_ACK'][9] = EnumEntry('MAV_CMD_ACK_ERR_Z_ALT_OUT_OF_RANGE', '''The Z or altitude value is out of range.''')
MAV_CMD_ACK_ENUM_END = 10 #
enums['MAV_CMD_ACK'][10] = EnumEntry('MAV_CMD_ACK_ENUM_END', '''''')
# MAV_PARAM_TYPE
enums['MAV_PARAM_TYPE'] = {}
MAV_PARAM_TYPE_UINT8 = 1 # 8-bit unsigned integer
enums['MAV_PARAM_TYPE'][1] = EnumEntry('MAV_PARAM_TYPE_UINT8', '''8-bit unsigned integer''')
MAV_PARAM_TYPE_INT8 = 2 # 8-bit signed integer
enums['MAV_PARAM_TYPE'][2] = EnumEntry('MAV_PARAM_TYPE_INT8', '''8-bit signed integer''')
MAV_PARAM_TYPE_UINT16 = 3 # 16-bit unsigned integer
enums['MAV_PARAM_TYPE'][3] = EnumEntry('MAV_PARAM_TYPE_UINT16', '''16-bit unsigned integer''')
MAV_PARAM_TYPE_INT16 = 4 # 16-bit signed integer
enums['MAV_PARAM_TYPE'][4] = EnumEntry('MAV_PARAM_TYPE_INT16', '''16-bit signed integer''')
MAV_PARAM_TYPE_UINT32 = 5 # 32-bit unsigned integer
enums['MAV_PARAM_TYPE'][5] = EnumEntry('MAV_PARAM_TYPE_UINT32', '''32-bit unsigned integer''')
MAV_PARAM_TYPE_INT32 = 6 # 32-bit signed integer
enums['MAV_PARAM_TYPE'][6] = EnumEntry('MAV_PARAM_TYPE_INT32', '''32-bit signed integer''')
MAV_PARAM_TYPE_UINT64 = 7 # 64-bit unsigned integer
enums['MAV_PARAM_TYPE'][7] = EnumEntry('MAV_PARAM_TYPE_UINT64', '''64-bit unsigned integer''')
MAV_PARAM_TYPE_INT64 = 8 # 64-bit signed integer
enums['MAV_PARAM_TYPE'][8] = EnumEntry('MAV_PARAM_TYPE_INT64', '''64-bit signed integer''')
MAV_PARAM_TYPE_REAL32 = 9 # 32-bit floating-point
enums['MAV_PARAM_TYPE'][9] = EnumEntry('MAV_PARAM_TYPE_REAL32', '''32-bit floating-point''')
MAV_PARAM_TYPE_REAL64 = 10 # 64-bit floating-point
enums['MAV_PARAM_TYPE'][10] = EnumEntry('MAV_PARAM_TYPE_REAL64', '''64-bit floating-point''')
MAV_PARAM_TYPE_ENUM_END = 11 #
enums['MAV_PARAM_TYPE'][11] = EnumEntry('MAV_PARAM_TYPE_ENUM_END', '''''')
# MAV_RESULT
enums['MAV_RESULT'] = {}
MAV_RESULT_ACCEPTED = 0 # Command ACCEPTED and EXECUTED
enums['MAV_RESULT'][0] = EnumEntry('MAV_RESULT_ACCEPTED', '''Command ACCEPTED and EXECUTED''')
MAV_RESULT_TEMPORARILY_REJECTED = 1 # Command TEMPORARY REJECTED/DENIED
enums['MAV_RESULT'][1] = EnumEntry('MAV_RESULT_TEMPORARILY_REJECTED', '''Command TEMPORARY REJECTED/DENIED''')
MAV_RESULT_DENIED = 2 # Command PERMANENTLY DENIED
enums['MAV_RESULT'][2] = EnumEntry('MAV_RESULT_DENIED', '''Command PERMANENTLY DENIED''')
MAV_RESULT_UNSUPPORTED = 3 # Command UNKNOWN/UNSUPPORTED
enums['MAV_RESULT'][3] = EnumEntry('MAV_RESULT_UNSUPPORTED', '''Command UNKNOWN/UNSUPPORTED''')
MAV_RESULT_FAILED = 4 # Command executed, but failed
enums['MAV_RESULT'][4] = EnumEntry('MAV_RESULT_FAILED', '''Command executed, but failed''')
MAV_RESULT_ENUM_END = 5 #
enums['MAV_RESULT'][5] = EnumEntry('MAV_RESULT_ENUM_END', '''''')
# MAV_MISSION_RESULT
enums['MAV_MISSION_RESULT'] = {}
MAV_MISSION_ACCEPTED = 0 # mission accepted OK
enums['MAV_MISSION_RESULT'][0] = EnumEntry('MAV_MISSION_ACCEPTED', '''mission accepted OK''')
MAV_MISSION_ERROR = 1 # generic error / not accepting mission commands at all right now
enums['MAV_MISSION_RESULT'][1] = EnumEntry('MAV_MISSION_ERROR', '''generic error / not accepting mission commands at all right now''')
MAV_MISSION_UNSUPPORTED_FRAME = 2 # coordinate frame is not supported
enums['MAV_MISSION_RESULT'][2] = EnumEntry('MAV_MISSION_UNSUPPORTED_FRAME', '''coordinate frame is not supported''')
MAV_MISSION_UNSUPPORTED = 3 # command is not supported
enums['MAV_MISSION_RESULT'][3] = EnumEntry('MAV_MISSION_UNSUPPORTED', '''command is not supported''')
MAV_MISSION_NO_SPACE = 4 # mission item exceeds storage space
enums['MAV_MISSION_RESULT'][4] = EnumEntry('MAV_MISSION_NO_SPACE', '''mission item exceeds storage space''')
MAV_MISSION_INVALID = 5 # one of the parameters has an invalid value
enums['MAV_MISSION_RESULT'][5] = EnumEntry('MAV_MISSION_INVALID', '''one of the parameters has an invalid value''')
MAV_MISSION_INVALID_PARAM1 = 6 # param1 has an invalid value
enums['MAV_MISSION_RESULT'][6] = EnumEntry('MAV_MISSION_INVALID_PARAM1', '''param1 has an invalid value''')
MAV_MISSION_INVALID_PARAM2 = 7 # param2 has an invalid value
enums['MAV_MISSION_RESULT'][7] = EnumEntry('MAV_MISSION_INVALID_PARAM2', '''param2 has an invalid value''')
MAV_MISSION_INVALID_PARAM3 = 8 # param3 has an invalid value
enums['MAV_MISSION_RESULT'][8] = EnumEntry('MAV_MISSION_INVALID_PARAM3', '''param3 has an invalid value''')
MAV_MISSION_INVALID_PARAM4 = 9 # param4 has an invalid value
enums['MAV_MISSION_RESULT'][9] = EnumEntry('MAV_MISSION_INVALID_PARAM4', '''param4 has an invalid value''')
MAV_MISSION_INVALID_PARAM5_X = 10 # x/param5 has an invalid value
enums['MAV_MISSION_RESULT'][10] = EnumEntry('MAV_MISSION_INVALID_PARAM5_X', '''x/param5 has an invalid value''')
MAV_MISSION_INVALID_PARAM6_Y = 11 # y/param6 has an invalid value
enums['MAV_MISSION_RESULT'][11] = EnumEntry('MAV_MISSION_INVALID_PARAM6_Y', '''y/param6 has an invalid value''')
MAV_MISSION_INVALID_PARAM7 = 12 # param7 has an invalid value
enums['MAV_MISSION_RESULT'][12] = EnumEntry('MAV_MISSION_INVALID_PARAM7', '''param7 has an invalid value''')
MAV_MISSION_INVALID_SEQUENCE = 13 # received waypoint out of sequence
enums['MAV_MISSION_RESULT'][13] = EnumEntry('MAV_MISSION_INVALID_SEQUENCE', '''received waypoint out of sequence''')
MAV_MISSION_DENIED = 14 # not accepting any mission commands from this communication partner
enums['MAV_MISSION_RESULT'][14] = EnumEntry('MAV_MISSION_DENIED', '''not accepting any mission commands from this communication partner''')
MAV_MISSION_RESULT_ENUM_END = 15 #
enums['MAV_MISSION_RESULT'][15] = EnumEntry('MAV_MISSION_RESULT_ENUM_END', '''''')
# MAV_SEVERITY
enums['MAV_SEVERITY'] = {}
MAV_SEVERITY_EMERGENCY = 0 # System is unusable. This is a "panic" condition.
enums['MAV_SEVERITY'][0] = EnumEntry('MAV_SEVERITY_EMERGENCY', '''System is unusable. This is a "panic" condition.''')
MAV_SEVERITY_ALERT = 1 # Action should be taken immediately. Indicates error in non-critical
# systems.
enums['MAV_SEVERITY'][1] = EnumEntry('MAV_SEVERITY_ALERT', '''Action should be taken immediately. Indicates error in non-critical systems.''')
MAV_SEVERITY_CRITICAL = 2 # Action must be taken immediately. Indicates failure in a primary
# system.
enums['MAV_SEVERITY'][2] = EnumEntry('MAV_SEVERITY_CRITICAL', '''Action must be taken immediately. Indicates failure in a primary system.''')
MAV_SEVERITY_ERROR = 3 # Indicates an error in secondary/redundant systems.
enums['MAV_SEVERITY'][3] = EnumEntry('MAV_SEVERITY_ERROR', '''Indicates an error in secondary/redundant systems.''')
MAV_SEVERITY_WARNING = 4 # Indicates about a possible future error if this is not resolved within
# a given timeframe. Example would be a low
# battery warning.
enums['MAV_SEVERITY'][4] = EnumEntry('MAV_SEVERITY_WARNING', '''Indicates about a possible future error if this is not resolved within a given timeframe. Example would be a low battery warning.''')
MAV_SEVERITY_NOTICE = 5 # An unusual event has occured, though not an error condition. This
# should be investigated for the root cause.
enums['MAV_SEVERITY'][5] = EnumEntry('MAV_SEVERITY_NOTICE', '''An unusual event has occured, though not an error condition. This should be investigated for the root cause.''')
MAV_SEVERITY_INFO = 6 # Normal operational messages. Useful for logging. No action is required
# for these messages.
enums['MAV_SEVERITY'][6] = EnumEntry('MAV_SEVERITY_INFO', '''Normal operational messages. Useful for logging. No action is required for these messages.''')
MAV_SEVERITY_DEBUG = 7 # Useful non-operational messages that can assist in debugging. These
# should not occur during normal operation.
enums['MAV_SEVERITY'][7] = EnumEntry('MAV_SEVERITY_DEBUG', '''Useful non-operational messages that can assist in debugging. These should not occur during normal operation.''')
MAV_SEVERITY_ENUM_END = 8 #
enums['MAV_SEVERITY'][8] = EnumEntry('MAV_SEVERITY_ENUM_END', '''''')
# MAV_POWER_STATUS
enums['MAV_POWER_STATUS'] = {}
MAV_POWER_STATUS_BRICK_VALID = 1 # main brick power supply valid
enums['MAV_POWER_STATUS'][1] = EnumEntry('MAV_POWER_STATUS_BRICK_VALID', '''main brick power supply valid''')
MAV_POWER_STATUS_SERVO_VALID = 2 # main servo power supply valid for FMU
enums['MAV_POWER_STATUS'][2] = EnumEntry('MAV_POWER_STATUS_SERVO_VALID', '''main servo power supply valid for FMU''')
MAV_POWER_STATUS_USB_CONNECTED = 4 # USB power is connected
enums['MAV_POWER_STATUS'][4] = EnumEntry('MAV_POWER_STATUS_USB_CONNECTED', '''USB power is connected''')
MAV_POWER_STATUS_PERIPH_OVERCURRENT = 8 # peripheral supply is in over-current state
enums['MAV_POWER_STATUS'][8] = EnumEntry('MAV_POWER_STATUS_PERIPH_OVERCURRENT', '''peripheral supply is in over-current state''')
MAV_POWER_STATUS_PERIPH_HIPOWER_OVERCURRENT = 16 # hi-power peripheral supply is in over-current state
enums['MAV_POWER_STATUS'][16] = EnumEntry('MAV_POWER_STATUS_PERIPH_HIPOWER_OVERCURRENT', '''hi-power peripheral supply is in over-current state''')
MAV_POWER_STATUS_CHANGED = 32 # Power status has changed since boot
enums['MAV_POWER_STATUS'][32] = EnumEntry('MAV_POWER_STATUS_CHANGED', '''Power status has changed since boot''')
MAV_POWER_STATUS_ENUM_END = 33 #
enums['MAV_POWER_STATUS'][33] = EnumEntry('MAV_POWER_STATUS_ENUM_END', '''''')
# SERIAL_CONTROL_DEV
enums['SERIAL_CONTROL_DEV'] = {}
SERIAL_CONTROL_DEV_TELEM1 = 0 # First telemetry port
enums['SERIAL_CONTROL_DEV'][0] = EnumEntry('SERIAL_CONTROL_DEV_TELEM1', '''First telemetry port''')
SERIAL_CONTROL_DEV_TELEM2 = 1 # Second telemetry port
enums['SERIAL_CONTROL_DEV'][1] = EnumEntry('SERIAL_CONTROL_DEV_TELEM2', '''Second telemetry port''')
SERIAL_CONTROL_DEV_GPS1 = 2 # First GPS port
enums['SERIAL_CONTROL_DEV'][2] = EnumEntry('SERIAL_CONTROL_DEV_GPS1', '''First GPS port''')
SERIAL_CONTROL_DEV_GPS2 = 3 # Second GPS port
enums['SERIAL_CONTROL_DEV'][3] = EnumEntry('SERIAL_CONTROL_DEV_GPS2', '''Second GPS port''')
SERIAL_CONTROL_DEV_SHELL = 10 # system shell
enums['SERIAL_CONTROL_DEV'][10] = EnumEntry('SERIAL_CONTROL_DEV_SHELL', '''system shell''')
SERIAL_CONTROL_DEV_ENUM_END = 11 #
enums['SERIAL_CONTROL_DEV'][11] = EnumEntry('SERIAL_CONTROL_DEV_ENUM_END', '''''')
# SERIAL_CONTROL_FLAG
enums['SERIAL_CONTROL_FLAG'] = {}
SERIAL_CONTROL_FLAG_REPLY = 1 # Set if this is a reply
enums['SERIAL_CONTROL_FLAG'][1] = EnumEntry('SERIAL_CONTROL_FLAG_REPLY', '''Set if this is a reply''')
SERIAL_CONTROL_FLAG_RESPOND = 2 # Set if the sender wants the receiver to send a response as another
# SERIAL_CONTROL message
enums['SERIAL_CONTROL_FLAG'][2] = EnumEntry('SERIAL_CONTROL_FLAG_RESPOND', '''Set if the sender wants the receiver to send a response as another SERIAL_CONTROL message''')
SERIAL_CONTROL_FLAG_EXCLUSIVE = 4 # Set if access to the serial port should be removed from whatever
# driver is currently using it, giving
# exclusive access to the SERIAL_CONTROL
# protocol. The port can be handed back by
# sending a request without this flag set
enums['SERIAL_CONTROL_FLAG'][4] = EnumEntry('SERIAL_CONTROL_FLAG_EXCLUSIVE', '''Set if access to the serial port should be removed from whatever driver is currently using it, giving exclusive access to the SERIAL_CONTROL protocol. The port can be handed back by sending a request without this flag set''')
SERIAL_CONTROL_FLAG_BLOCKING = 8 # Block on writes to the serial port
enums['SERIAL_CONTROL_FLAG'][8] = EnumEntry('SERIAL_CONTROL_FLAG_BLOCKING', '''Block on writes to the serial port''')
SERIAL_CONTROL_FLAG_MULTI = 16 # Send multiple replies until port is drained
enums['SERIAL_CONTROL_FLAG'][16] = EnumEntry('SERIAL_CONTROL_FLAG_MULTI', '''Send multiple replies until port is drained''')
SERIAL_CONTROL_FLAG_ENUM_END = 17 #
enums['SERIAL_CONTROL_FLAG'][17] = EnumEntry('SERIAL_CONTROL_FLAG_ENUM_END', '''''')
# MAV_DISTANCE_SENSOR
enums['MAV_DISTANCE_SENSOR'] = {}
MAV_DISTANCE_SENSOR_LASER = 0 # Laser rangefinder, e.g. LightWare SF02/F or PulsedLight units
enums['MAV_DISTANCE_SENSOR'][0] = EnumEntry('MAV_DISTANCE_SENSOR_LASER', '''Laser rangefinder, e.g. LightWare SF02/F or PulsedLight units''')
MAV_DISTANCE_SENSOR_ULTRASOUND = 1 # Ultrasound rangefinder, e.g. MaxBotix units
enums['MAV_DISTANCE_SENSOR'][1] = EnumEntry('MAV_DISTANCE_SENSOR_ULTRASOUND', '''Ultrasound rangefinder, e.g. MaxBotix units''')
MAV_DISTANCE_SENSOR_INFRARED = 2 # Infrared rangefinder, e.g. Sharp units
enums['MAV_DISTANCE_SENSOR'][2] = EnumEntry('MAV_DISTANCE_SENSOR_INFRARED', '''Infrared rangefinder, e.g. Sharp units''')
MAV_DISTANCE_SENSOR_RADAR = 3 # Radar type, e.g. uLanding units
enums['MAV_DISTANCE_SENSOR'][3] = EnumEntry('MAV_DISTANCE_SENSOR_RADAR', '''Radar type, e.g. uLanding units''')
MAV_DISTANCE_SENSOR_UNKNOWN = 4 # Broken or unknown type, e.g. analog units
enums['MAV_DISTANCE_SENSOR'][4] = EnumEntry('MAV_DISTANCE_SENSOR_UNKNOWN', '''Broken or unknown type, e.g. analog units''')
MAV_DISTANCE_SENSOR_ENUM_END = 5 #
enums['MAV_DISTANCE_SENSOR'][5] = EnumEntry('MAV_DISTANCE_SENSOR_ENUM_END', '''''')
# MAV_SENSOR_ORIENTATION
enums['MAV_SENSOR_ORIENTATION'] = {}
MAV_SENSOR_ROTATION_NONE = 0 # Roll: 0, Pitch: 0, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][0] = EnumEntry('MAV_SENSOR_ROTATION_NONE', '''Roll: 0, Pitch: 0, Yaw: 0''')
MAV_SENSOR_ROTATION_YAW_45 = 1 # Roll: 0, Pitch: 0, Yaw: 45
enums['MAV_SENSOR_ORIENTATION'][1] = EnumEntry('MAV_SENSOR_ROTATION_YAW_45', '''Roll: 0, Pitch: 0, Yaw: 45''')
MAV_SENSOR_ROTATION_YAW_90 = 2 # Roll: 0, Pitch: 0, Yaw: 90
enums['MAV_SENSOR_ORIENTATION'][2] = EnumEntry('MAV_SENSOR_ROTATION_YAW_90', '''Roll: 0, Pitch: 0, Yaw: 90''')
MAV_SENSOR_ROTATION_YAW_135 = 3 # Roll: 0, Pitch: 0, Yaw: 135
enums['MAV_SENSOR_ORIENTATION'][3] = EnumEntry('MAV_SENSOR_ROTATION_YAW_135', '''Roll: 0, Pitch: 0, Yaw: 135''')
MAV_SENSOR_ROTATION_YAW_180 = 4 # Roll: 0, Pitch: 0, Yaw: 180
enums['MAV_SENSOR_ORIENTATION'][4] = EnumEntry('MAV_SENSOR_ROTATION_YAW_180', '''Roll: 0, Pitch: 0, Yaw: 180''')
MAV_SENSOR_ROTATION_YAW_225 = 5 # Roll: 0, Pitch: 0, Yaw: 225
enums['MAV_SENSOR_ORIENTATION'][5] = EnumEntry('MAV_SENSOR_ROTATION_YAW_225', '''Roll: 0, Pitch: 0, Yaw: 225''')
MAV_SENSOR_ROTATION_YAW_270 = 6 # Roll: 0, Pitch: 0, Yaw: 270
enums['MAV_SENSOR_ORIENTATION'][6] = EnumEntry('MAV_SENSOR_ROTATION_YAW_270', '''Roll: 0, Pitch: 0, Yaw: 270''')
MAV_SENSOR_ROTATION_YAW_315 = 7 # Roll: 0, Pitch: 0, Yaw: 315
enums['MAV_SENSOR_ORIENTATION'][7] = EnumEntry('MAV_SENSOR_ROTATION_YAW_315', '''Roll: 0, Pitch: 0, Yaw: 315''')
MAV_SENSOR_ROTATION_ROLL_180 = 8 # Roll: 180, Pitch: 0, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][8] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180', '''Roll: 180, Pitch: 0, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_180_YAW_45 = 9 # Roll: 180, Pitch: 0, Yaw: 45
enums['MAV_SENSOR_ORIENTATION'][9] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180_YAW_45', '''Roll: 180, Pitch: 0, Yaw: 45''')
MAV_SENSOR_ROTATION_ROLL_180_YAW_90 = 10 # Roll: 180, Pitch: 0, Yaw: 90
enums['MAV_SENSOR_ORIENTATION'][10] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180_YAW_90', '''Roll: 180, Pitch: 0, Yaw: 90''')
MAV_SENSOR_ROTATION_ROLL_180_YAW_135 = 11 # Roll: 180, Pitch: 0, Yaw: 135
enums['MAV_SENSOR_ORIENTATION'][11] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180_YAW_135', '''Roll: 180, Pitch: 0, Yaw: 135''')
MAV_SENSOR_ROTATION_PITCH_180 = 12 # Roll: 0, Pitch: 180, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][12] = EnumEntry('MAV_SENSOR_ROTATION_PITCH_180', '''Roll: 0, Pitch: 180, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_180_YAW_225 = 13 # Roll: 180, Pitch: 0, Yaw: 225
enums['MAV_SENSOR_ORIENTATION'][13] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180_YAW_225', '''Roll: 180, Pitch: 0, Yaw: 225''')
MAV_SENSOR_ROTATION_ROLL_180_YAW_270 = 14 # Roll: 180, Pitch: 0, Yaw: 270
enums['MAV_SENSOR_ORIENTATION'][14] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180_YAW_270', '''Roll: 180, Pitch: 0, Yaw: 270''')
MAV_SENSOR_ROTATION_ROLL_180_YAW_315 = 15 # Roll: 180, Pitch: 0, Yaw: 315
enums['MAV_SENSOR_ORIENTATION'][15] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180_YAW_315', '''Roll: 180, Pitch: 0, Yaw: 315''')
MAV_SENSOR_ROTATION_ROLL_90 = 16 # Roll: 90, Pitch: 0, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][16] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90', '''Roll: 90, Pitch: 0, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_90_YAW_45 = 17 # Roll: 90, Pitch: 0, Yaw: 45
enums['MAV_SENSOR_ORIENTATION'][17] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90_YAW_45', '''Roll: 90, Pitch: 0, Yaw: 45''')
MAV_SENSOR_ROTATION_ROLL_90_YAW_90 = 18 # Roll: 90, Pitch: 0, Yaw: 90
enums['MAV_SENSOR_ORIENTATION'][18] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90_YAW_90', '''Roll: 90, Pitch: 0, Yaw: 90''')
MAV_SENSOR_ROTATION_ROLL_90_YAW_135 = 19 # Roll: 90, Pitch: 0, Yaw: 135
enums['MAV_SENSOR_ORIENTATION'][19] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90_YAW_135', '''Roll: 90, Pitch: 0, Yaw: 135''')
MAV_SENSOR_ROTATION_ROLL_270 = 20 # Roll: 270, Pitch: 0, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][20] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_270', '''Roll: 270, Pitch: 0, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_270_YAW_45 = 21 # Roll: 270, Pitch: 0, Yaw: 45
enums['MAV_SENSOR_ORIENTATION'][21] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_270_YAW_45', '''Roll: 270, Pitch: 0, Yaw: 45''')
MAV_SENSOR_ROTATION_ROLL_270_YAW_90 = 22 # Roll: 270, Pitch: 0, Yaw: 90
enums['MAV_SENSOR_ORIENTATION'][22] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_270_YAW_90', '''Roll: 270, Pitch: 0, Yaw: 90''')
MAV_SENSOR_ROTATION_ROLL_270_YAW_135 = 23 # Roll: 270, Pitch: 0, Yaw: 135
enums['MAV_SENSOR_ORIENTATION'][23] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_270_YAW_135', '''Roll: 270, Pitch: 0, Yaw: 135''')
MAV_SENSOR_ROTATION_PITCH_90 = 24 # Roll: 0, Pitch: 90, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][24] = EnumEntry('MAV_SENSOR_ROTATION_PITCH_90', '''Roll: 0, Pitch: 90, Yaw: 0''')
MAV_SENSOR_ROTATION_PITCH_270 = 25 # Roll: 0, Pitch: 270, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][25] = EnumEntry('MAV_SENSOR_ROTATION_PITCH_270', '''Roll: 0, Pitch: 270, Yaw: 0''')
MAV_SENSOR_ROTATION_PITCH_180_YAW_90 = 26 # Roll: 0, Pitch: 180, Yaw: 90
enums['MAV_SENSOR_ORIENTATION'][26] = EnumEntry('MAV_SENSOR_ROTATION_PITCH_180_YAW_90', '''Roll: 0, Pitch: 180, Yaw: 90''')
MAV_SENSOR_ROTATION_PITCH_180_YAW_270 = 27 # Roll: 0, Pitch: 180, Yaw: 270
enums['MAV_SENSOR_ORIENTATION'][27] = EnumEntry('MAV_SENSOR_ROTATION_PITCH_180_YAW_270', '''Roll: 0, Pitch: 180, Yaw: 270''')
MAV_SENSOR_ROTATION_ROLL_90_PITCH_90 = 28 # Roll: 90, Pitch: 90, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][28] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90_PITCH_90', '''Roll: 90, Pitch: 90, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_180_PITCH_90 = 29 # Roll: 180, Pitch: 90, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][29] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180_PITCH_90', '''Roll: 180, Pitch: 90, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_270_PITCH_90 = 30 # Roll: 270, Pitch: 90, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][30] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_270_PITCH_90', '''Roll: 270, Pitch: 90, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_90_PITCH_180 = 31 # Roll: 90, Pitch: 180, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][31] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90_PITCH_180', '''Roll: 90, Pitch: 180, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_270_PITCH_180 = 32 # Roll: 270, Pitch: 180, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][32] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_270_PITCH_180', '''Roll: 270, Pitch: 180, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_90_PITCH_270 = 33 # Roll: 90, Pitch: 270, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][33] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90_PITCH_270', '''Roll: 90, Pitch: 270, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_180_PITCH_270 = 34 # Roll: 180, Pitch: 270, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][34] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_180_PITCH_270', '''Roll: 180, Pitch: 270, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_270_PITCH_270 = 35 # Roll: 270, Pitch: 270, Yaw: 0
enums['MAV_SENSOR_ORIENTATION'][35] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_270_PITCH_270', '''Roll: 270, Pitch: 270, Yaw: 0''')
MAV_SENSOR_ROTATION_ROLL_90_PITCH_180_YAW_90 = 36 # Roll: 90, Pitch: 180, Yaw: 90
enums['MAV_SENSOR_ORIENTATION'][36] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90_PITCH_180_YAW_90', '''Roll: 90, Pitch: 180, Yaw: 90''')
MAV_SENSOR_ROTATION_ROLL_90_YAW_270 = 37 # Roll: 90, Pitch: 0, Yaw: 270
enums['MAV_SENSOR_ORIENTATION'][37] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_90_YAW_270', '''Roll: 90, Pitch: 0, Yaw: 270''')
MAV_SENSOR_ROTATION_ROLL_315_PITCH_315_YAW_315 = 38 # Roll: 315, Pitch: 315, Yaw: 315
enums['MAV_SENSOR_ORIENTATION'][38] = EnumEntry('MAV_SENSOR_ROTATION_ROLL_315_PITCH_315_YAW_315', '''Roll: 315, Pitch: 315, Yaw: 315''')
MAV_SENSOR_ORIENTATION_ENUM_END = 39 #
enums['MAV_SENSOR_ORIENTATION'][39] = EnumEntry('MAV_SENSOR_ORIENTATION_ENUM_END', '''''')
# MAV_PROTOCOL_CAPABILITY
enums['MAV_PROTOCOL_CAPABILITY'] = {}
MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT = 1 # Autopilot supports MISSION float message type.
enums['MAV_PROTOCOL_CAPABILITY'][1] = EnumEntry('MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT', '''Autopilot supports MISSION float message type.''')
MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT = 2 # Autopilot supports the new param float message type.
enums['MAV_PROTOCOL_CAPABILITY'][2] = EnumEntry('MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT', '''Autopilot supports the new param float message type.''')
MAV_PROTOCOL_CAPABILITY_MISSION_INT = 4 # Autopilot supports MISSION_INT scaled integer message type.
enums['MAV_PROTOCOL_CAPABILITY'][4] = EnumEntry('MAV_PROTOCOL_CAPABILITY_MISSION_INT', '''Autopilot supports MISSION_INT scaled integer message type.''')
MAV_PROTOCOL_CAPABILITY_COMMAND_INT = 8 # Autopilot supports COMMAND_INT scaled integer message type.
enums['MAV_PROTOCOL_CAPABILITY'][8] = EnumEntry('MAV_PROTOCOL_CAPABILITY_COMMAND_INT', '''Autopilot supports COMMAND_INT scaled integer message type.''')
MAV_PROTOCOL_CAPABILITY_PARAM_UNION = 16 # Autopilot supports the new param union message type.
enums['MAV_PROTOCOL_CAPABILITY'][16] = EnumEntry('MAV_PROTOCOL_CAPABILITY_PARAM_UNION', '''Autopilot supports the new param union message type.''')
MAV_PROTOCOL_CAPABILITY_FTP = 32 # Autopilot supports the new FILE_TRANSFER_PROTOCOL message type.
enums['MAV_PROTOCOL_CAPABILITY'][32] = EnumEntry('MAV_PROTOCOL_CAPABILITY_FTP', '''Autopilot supports the new FILE_TRANSFER_PROTOCOL message type.''')
MAV_PROTOCOL_CAPABILITY_SET_ATTITUDE_TARGET = 64 # Autopilot supports commanding attitude offboard.
enums['MAV_PROTOCOL_CAPABILITY'][64] = EnumEntry('MAV_PROTOCOL_CAPABILITY_SET_ATTITUDE_TARGET', '''Autopilot supports commanding attitude offboard.''')
MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED = 128 # Autopilot supports commanding position and velocity targets in local
# NED frame.
enums['MAV_PROTOCOL_CAPABILITY'][128] = EnumEntry('MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED', '''Autopilot supports commanding position and velocity targets in local NED frame.''')
MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT = 256 # Autopilot supports commanding position and velocity targets in global
# scaled integers.
enums['MAV_PROTOCOL_CAPABILITY'][256] = EnumEntry('MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT', '''Autopilot supports commanding position and velocity targets in global scaled integers.''')
MAV_PROTOCOL_CAPABILITY_TERRAIN = 512 # Autopilot supports terrain protocol / data handling.
enums['MAV_PROTOCOL_CAPABILITY'][512] = EnumEntry('MAV_PROTOCOL_CAPABILITY_TERRAIN', '''Autopilot supports terrain protocol / data handling.''')
MAV_PROTOCOL_CAPABILITY_SET_ACTUATOR_TARGET = 1024 # Autopilot supports direct actuator control.
enums['MAV_PROTOCOL_CAPABILITY'][1024] = EnumEntry('MAV_PROTOCOL_CAPABILITY_SET_ACTUATOR_TARGET', '''Autopilot supports direct actuator control.''')
MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION = 2048 # Autopilot supports the flight termination command.
enums['MAV_PROTOCOL_CAPABILITY'][2048] = EnumEntry('MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION', '''Autopilot supports the flight termination command.''')
MAV_PROTOCOL_CAPABILITY_COMPASS_CALIBRATION = 4096 # Autopilot supports onboard compass calibration.
enums['MAV_PROTOCOL_CAPABILITY'][4096] = EnumEntry('MAV_PROTOCOL_CAPABILITY_COMPASS_CALIBRATION', '''Autopilot supports onboard compass calibration.''')
MAV_PROTOCOL_CAPABILITY_MAVLINK2 = 8192 # Autopilot supports mavlink version 2.
enums['MAV_PROTOCOL_CAPABILITY'][8192] = EnumEntry('MAV_PROTOCOL_CAPABILITY_MAVLINK2', '''Autopilot supports mavlink version 2.''')
MAV_PROTOCOL_CAPABILITY_MISSION_FENCE = 16384 # Autopilot supports mission fence protocol.
enums['MAV_PROTOCOL_CAPABILITY'][16384] = EnumEntry('MAV_PROTOCOL_CAPABILITY_MISSION_FENCE', '''Autopilot supports mission fence protocol.''')
MAV_PROTOCOL_CAPABILITY_MISSION_RALLY = 32768 # Autopilot supports mission rally point protocol.
enums['MAV_PROTOCOL_CAPABILITY'][32768] = EnumEntry('MAV_PROTOCOL_CAPABILITY_MISSION_RALLY', '''Autopilot supports mission rally point protocol.''')
MAV_PROTOCOL_CAPABILITY_FLIGHT_INFORMATION = 65536 # Autopilot supports the flight information protocol.
enums['MAV_PROTOCOL_CAPABILITY'][65536] = EnumEntry('MAV_PROTOCOL_CAPABILITY_FLIGHT_INFORMATION', '''Autopilot supports the flight information protocol.''')
MAV_PROTOCOL_CAPABILITY_ENUM_END = 65537 #
enums['MAV_PROTOCOL_CAPABILITY'][65537] = EnumEntry('MAV_PROTOCOL_CAPABILITY_ENUM_END', '''''')
# MAV_MISSION_TYPE
enums['MAV_MISSION_TYPE'] = {}
MAV_MISSION_TYPE_MISSION = 0 # Items are mission commands for main mission.
enums['MAV_MISSION_TYPE'][0] = EnumEntry('MAV_MISSION_TYPE_MISSION', '''Items are mission commands for main mission.''')
MAV_MISSION_TYPE_FENCE = 1 # Specifies GeoFence area(s). Items are MAV_CMD_FENCE_ GeoFence items.
enums['MAV_MISSION_TYPE'][1] = EnumEntry('MAV_MISSION_TYPE_FENCE', '''Specifies GeoFence area(s). Items are MAV_CMD_FENCE_ GeoFence items.''')
MAV_MISSION_TYPE_RALLY = 2 # Specifies the rally points for the vehicle. Rally points are
# alternative RTL points. Items are
# MAV_CMD_RALLY_POINT rally point items.
enums['MAV_MISSION_TYPE'][2] = EnumEntry('MAV_MISSION_TYPE_RALLY', '''Specifies the rally points for the vehicle. Rally points are alternative RTL points. Items are MAV_CMD_RALLY_POINT rally point items.''')
MAV_MISSION_TYPE_ALL = 255 # Only used in MISSION_CLEAR_ALL to clear all mission types.
enums['MAV_MISSION_TYPE'][255] = EnumEntry('MAV_MISSION_TYPE_ALL', '''Only used in MISSION_CLEAR_ALL to clear all mission types.''')
MAV_MISSION_TYPE_ENUM_END = 256 #
enums['MAV_MISSION_TYPE'][256] = EnumEntry('MAV_MISSION_TYPE_ENUM_END', '''''')
# MAV_ESTIMATOR_TYPE
enums['MAV_ESTIMATOR_TYPE'] = {}
MAV_ESTIMATOR_TYPE_NAIVE = 1 # This is a naive estimator without any real covariance feedback.
enums['MAV_ESTIMATOR_TYPE'][1] = EnumEntry('MAV_ESTIMATOR_TYPE_NAIVE', '''This is a naive estimator without any real covariance feedback.''')
MAV_ESTIMATOR_TYPE_VISION = 2 # Computer vision based estimate. Might be up to scale.
enums['MAV_ESTIMATOR_TYPE'][2] = EnumEntry('MAV_ESTIMATOR_TYPE_VISION', '''Computer vision based estimate. Might be up to scale.''')
MAV_ESTIMATOR_TYPE_VIO = 3 # Visual-inertial estimate.
enums['MAV_ESTIMATOR_TYPE'][3] = EnumEntry('MAV_ESTIMATOR_TYPE_VIO', '''Visual-inertial estimate.''')
MAV_ESTIMATOR_TYPE_GPS = 4 # Plain GPS estimate.
enums['MAV_ESTIMATOR_TYPE'][4] = EnumEntry('MAV_ESTIMATOR_TYPE_GPS', '''Plain GPS estimate.''')
MAV_ESTIMATOR_TYPE_GPS_INS = 5 # Estimator integrating GPS and inertial sensing.
enums['MAV_ESTIMATOR_TYPE'][5] = EnumEntry('MAV_ESTIMATOR_TYPE_GPS_INS', '''Estimator integrating GPS and inertial sensing.''')
MAV_ESTIMATOR_TYPE_ENUM_END = 6 #
enums['MAV_ESTIMATOR_TYPE'][6] = EnumEntry('MAV_ESTIMATOR_TYPE_ENUM_END', '''''')
# MAV_BATTERY_TYPE
enums['MAV_BATTERY_TYPE'] = {}
MAV_BATTERY_TYPE_UNKNOWN = 0 # Not specified.
enums['MAV_BATTERY_TYPE'][0] = EnumEntry('MAV_BATTERY_TYPE_UNKNOWN', '''Not specified.''')
MAV_BATTERY_TYPE_LIPO = 1 # Lithium polymer battery
enums['MAV_BATTERY_TYPE'][1] = EnumEntry('MAV_BATTERY_TYPE_LIPO', '''Lithium polymer battery''')
MAV_BATTERY_TYPE_LIFE = 2 # Lithium-iron-phosphate battery
enums['MAV_BATTERY_TYPE'][2] = EnumEntry('MAV_BATTERY_TYPE_LIFE', '''Lithium-iron-phosphate battery''')
MAV_BATTERY_TYPE_LION = 3 # Lithium-ION battery
enums['MAV_BATTERY_TYPE'][3] = EnumEntry('MAV_BATTERY_TYPE_LION', '''Lithium-ION battery''')
MAV_BATTERY_TYPE_NIMH = 4 # Nickel metal hydride battery
enums['MAV_BATTERY_TYPE'][4] = EnumEntry('MAV_BATTERY_TYPE_NIMH', '''Nickel metal hydride battery''')
MAV_BATTERY_TYPE_ENUM_END = 5 #
enums['MAV_BATTERY_TYPE'][5] = EnumEntry('MAV_BATTERY_TYPE_ENUM_END', '''''')
# MAV_BATTERY_FUNCTION
enums['MAV_BATTERY_FUNCTION'] = {}
MAV_BATTERY_FUNCTION_UNKNOWN = 0 # Battery function is unknown
enums['MAV_BATTERY_FUNCTION'][0] = EnumEntry('MAV_BATTERY_FUNCTION_UNKNOWN', '''Battery function is unknown''')
MAV_BATTERY_FUNCTION_ALL = 1 # Battery supports all flight systems
enums['MAV_BATTERY_FUNCTION'][1] = EnumEntry('MAV_BATTERY_FUNCTION_ALL', '''Battery supports all flight systems''')
MAV_BATTERY_FUNCTION_PROPULSION = 2 # Battery for the propulsion system
enums['MAV_BATTERY_FUNCTION'][2] = EnumEntry('MAV_BATTERY_FUNCTION_PROPULSION', '''Battery for the propulsion system''')
MAV_BATTERY_FUNCTION_AVIONICS = 3 # Avionics battery
enums['MAV_BATTERY_FUNCTION'][3] = EnumEntry('MAV_BATTERY_FUNCTION_AVIONICS', '''Avionics battery''')
MAV_BATTERY_TYPE_PAYLOAD = 4 # Payload battery
enums['MAV_BATTERY_FUNCTION'][4] = EnumEntry('MAV_BATTERY_TYPE_PAYLOAD', '''Payload battery''')
MAV_BATTERY_FUNCTION_ENUM_END = 5 #
enums['MAV_BATTERY_FUNCTION'][5] = EnumEntry('MAV_BATTERY_FUNCTION_ENUM_END', '''''')
# MAV_BATTERY_CHARGE_STATE
enums['MAV_BATTERY_CHARGE_STATE'] = {}
MAV_BATTERY_CHARGE_STATE_UNDEFINED = 0 # Low battery state is not provided
enums['MAV_BATTERY_CHARGE_STATE'][0] = EnumEntry('MAV_BATTERY_CHARGE_STATE_UNDEFINED', '''Low battery state is not provided''')
MAV_BATTERY_CHARGE_STATE_OK = 1 # Battery is not in low state. Normal operation.
enums['MAV_BATTERY_CHARGE_STATE'][1] = EnumEntry('MAV_BATTERY_CHARGE_STATE_OK', '''Battery is not in low state. Normal operation.''')
MAV_BATTERY_CHARGE_STATE_LOW = 2 # Battery state is low, warn and monitor close.
enums['MAV_BATTERY_CHARGE_STATE'][2] = EnumEntry('MAV_BATTERY_CHARGE_STATE_LOW', '''Battery state is low, warn and monitor close.''')
MAV_BATTERY_CHARGE_STATE_CRITICAL = 3 # Battery state is critical, return or abort immediately.
enums['MAV_BATTERY_CHARGE_STATE'][3] = EnumEntry('MAV_BATTERY_CHARGE_STATE_CRITICAL', '''Battery state is critical, return or abort immediately.''')
MAV_BATTERY_CHARGE_STATE_EMERGENCY = 4 # Battery state is too low for ordinary abort sequence. Perform fastest
# possible emergency stop to prevent damage.
enums['MAV_BATTERY_CHARGE_STATE'][4] = EnumEntry('MAV_BATTERY_CHARGE_STATE_EMERGENCY', '''Battery state is too low for ordinary abort sequence. Perform fastest possible emergency stop to prevent damage.''')
MAV_BATTERY_CHARGE_STATE_FAILED = 5 # Battery failed, damage unavoidable.
enums['MAV_BATTERY_CHARGE_STATE'][5] = EnumEntry('MAV_BATTERY_CHARGE_STATE_FAILED', '''Battery failed, damage unavoidable.''')
MAV_BATTERY_CHARGE_STATE_UNHEALTHY = 6 # Battery is diagnosed to be defective or an error occurred, usage is
# discouraged / prohibited.
enums['MAV_BATTERY_CHARGE_STATE'][6] = EnumEntry('MAV_BATTERY_CHARGE_STATE_UNHEALTHY', '''Battery is diagnosed to be defective or an error occurred, usage is discouraged / prohibited.''')
MAV_BATTERY_CHARGE_STATE_ENUM_END = 7 #
enums['MAV_BATTERY_CHARGE_STATE'][7] = EnumEntry('MAV_BATTERY_CHARGE_STATE_ENUM_END', '''''')
# MAV_VTOL_STATE
enums['MAV_VTOL_STATE'] = {}
MAV_VTOL_STATE_UNDEFINED = 0 # MAV is not configured as VTOL
enums['MAV_VTOL_STATE'][0] = EnumEntry('MAV_VTOL_STATE_UNDEFINED', '''MAV is not configured as VTOL''')
MAV_VTOL_STATE_TRANSITION_TO_FW = 1 # VTOL is in transition from multicopter to fixed-wing
enums['MAV_VTOL_STATE'][1] = EnumEntry('MAV_VTOL_STATE_TRANSITION_TO_FW', '''VTOL is in transition from multicopter to fixed-wing''')
MAV_VTOL_STATE_TRANSITION_TO_MC = 2 # VTOL is in transition from fixed-wing to multicopter
enums['MAV_VTOL_STATE'][2] = EnumEntry('MAV_VTOL_STATE_TRANSITION_TO_MC', '''VTOL is in transition from fixed-wing to multicopter''')
MAV_VTOL_STATE_MC = 3 # VTOL is in multicopter state
enums['MAV_VTOL_STATE'][3] = EnumEntry('MAV_VTOL_STATE_MC', '''VTOL is in multicopter state''')
MAV_VTOL_STATE_FW = 4 # VTOL is in fixed-wing state
enums['MAV_VTOL_STATE'][4] = EnumEntry('MAV_VTOL_STATE_FW', '''VTOL is in fixed-wing state''')
MAV_VTOL_STATE_ENUM_END = 5 #
enums['MAV_VTOL_STATE'][5] = EnumEntry('MAV_VTOL_STATE_ENUM_END', '''''')
# MAV_LANDED_STATE
enums['MAV_LANDED_STATE'] = {}
MAV_LANDED_STATE_UNDEFINED = 0 # MAV landed state is unknown
enums['MAV_LANDED_STATE'][0] = EnumEntry('MAV_LANDED_STATE_UNDEFINED', '''MAV landed state is unknown''')
MAV_LANDED_STATE_ON_GROUND = 1 # MAV is landed (on ground)
enums['MAV_LANDED_STATE'][1] = EnumEntry('MAV_LANDED_STATE_ON_GROUND', '''MAV is landed (on ground)''')
MAV_LANDED_STATE_IN_AIR = 2 # MAV is in air
enums['MAV_LANDED_STATE'][2] = EnumEntry('MAV_LANDED_STATE_IN_AIR', '''MAV is in air''')
MAV_LANDED_STATE_TAKEOFF = 3 # MAV currently taking off
enums['MAV_LANDED_STATE'][3] = EnumEntry('MAV_LANDED_STATE_TAKEOFF', '''MAV currently taking off''')
MAV_LANDED_STATE_LANDING = 4 # MAV currently landing
enums['MAV_LANDED_STATE'][4] = EnumEntry('MAV_LANDED_STATE_LANDING', '''MAV currently landing''')
MAV_LANDED_STATE_ENUM_END = 5 #
enums['MAV_LANDED_STATE'][5] = EnumEntry('MAV_LANDED_STATE_ENUM_END', '''''')
# ADSB_ALTITUDE_TYPE
enums['ADSB_ALTITUDE_TYPE'] = {}
ADSB_ALTITUDE_TYPE_PRESSURE_QNH = 0 # Altitude reported from a Baro source using QNH reference
enums['ADSB_ALTITUDE_TYPE'][0] = EnumEntry('ADSB_ALTITUDE_TYPE_PRESSURE_QNH', '''Altitude reported from a Baro source using QNH reference''')
ADSB_ALTITUDE_TYPE_GEOMETRIC = 1 # Altitude reported from a GNSS source
enums['ADSB_ALTITUDE_TYPE'][1] = EnumEntry('ADSB_ALTITUDE_TYPE_GEOMETRIC', '''Altitude reported from a GNSS source''')
ADSB_ALTITUDE_TYPE_ENUM_END = 2 #
enums['ADSB_ALTITUDE_TYPE'][2] = EnumEntry('ADSB_ALTITUDE_TYPE_ENUM_END', '''''')
# ADSB_EMITTER_TYPE
enums['ADSB_EMITTER_TYPE'] = {}
ADSB_EMITTER_TYPE_NO_INFO = 0 #
enums['ADSB_EMITTER_TYPE'][0] = EnumEntry('ADSB_EMITTER_TYPE_NO_INFO', '''''')
ADSB_EMITTER_TYPE_LIGHT = 1 #
enums['ADSB_EMITTER_TYPE'][1] = EnumEntry('ADSB_EMITTER_TYPE_LIGHT', '''''')
ADSB_EMITTER_TYPE_SMALL = 2 #
enums['ADSB_EMITTER_TYPE'][2] = EnumEntry('ADSB_EMITTER_TYPE_SMALL', '''''')
ADSB_EMITTER_TYPE_LARGE = 3 #
enums['ADSB_EMITTER_TYPE'][3] = EnumEntry('ADSB_EMITTER_TYPE_LARGE', '''''')
ADSB_EMITTER_TYPE_HIGH_VORTEX_LARGE = 4 #
enums['ADSB_EMITTER_TYPE'][4] = EnumEntry('ADSB_EMITTER_TYPE_HIGH_VORTEX_LARGE', '''''')
ADSB_EMITTER_TYPE_HEAVY = 5 #
enums['ADSB_EMITTER_TYPE'][5] = EnumEntry('ADSB_EMITTER_TYPE_HEAVY', '''''')
ADSB_EMITTER_TYPE_HIGHLY_MANUV = 6 #
enums['ADSB_EMITTER_TYPE'][6] = EnumEntry('ADSB_EMITTER_TYPE_HIGHLY_MANUV', '''''')
ADSB_EMITTER_TYPE_ROTOCRAFT = 7 #
enums['ADSB_EMITTER_TYPE'][7] = EnumEntry('ADSB_EMITTER_TYPE_ROTOCRAFT', '''''')
ADSB_EMITTER_TYPE_UNASSIGNED = 8 #
enums['ADSB_EMITTER_TYPE'][8] = EnumEntry('ADSB_EMITTER_TYPE_UNASSIGNED', '''''')
ADSB_EMITTER_TYPE_GLIDER = 9 #
enums['ADSB_EMITTER_TYPE'][9] = EnumEntry('ADSB_EMITTER_TYPE_GLIDER', '''''')
ADSB_EMITTER_TYPE_LIGHTER_AIR = 10 #
enums['ADSB_EMITTER_TYPE'][10] = EnumEntry('ADSB_EMITTER_TYPE_LIGHTER_AIR', '''''')
ADSB_EMITTER_TYPE_PARACHUTE = 11 #
enums['ADSB_EMITTER_TYPE'][11] = EnumEntry('ADSB_EMITTER_TYPE_PARACHUTE', '''''')
ADSB_EMITTER_TYPE_ULTRA_LIGHT = 12 #
enums['ADSB_EMITTER_TYPE'][12] = EnumEntry('ADSB_EMITTER_TYPE_ULTRA_LIGHT', '''''')
ADSB_EMITTER_TYPE_UNASSIGNED2 = 13 #
enums['ADSB_EMITTER_TYPE'][13] = EnumEntry('ADSB_EMITTER_TYPE_UNASSIGNED2', '''''')
ADSB_EMITTER_TYPE_UAV = 14 #
enums['ADSB_EMITTER_TYPE'][14] = EnumEntry('ADSB_EMITTER_TYPE_UAV', '''''')
ADSB_EMITTER_TYPE_SPACE = 15 #
enums['ADSB_EMITTER_TYPE'][15] = EnumEntry('ADSB_EMITTER_TYPE_SPACE', '''''')
ADSB_EMITTER_TYPE_UNASSGINED3 = 16 #
enums['ADSB_EMITTER_TYPE'][16] = EnumEntry('ADSB_EMITTER_TYPE_UNASSGINED3', '''''')
ADSB_EMITTER_TYPE_EMERGENCY_SURFACE = 17 #
enums['ADSB_EMITTER_TYPE'][17] = EnumEntry('ADSB_EMITTER_TYPE_EMERGENCY_SURFACE', '''''')
ADSB_EMITTER_TYPE_SERVICE_SURFACE = 18 #
enums['ADSB_EMITTER_TYPE'][18] = EnumEntry('ADSB_EMITTER_TYPE_SERVICE_SURFACE', '''''')
ADSB_EMITTER_TYPE_POINT_OBSTACLE = 19 #
enums['ADSB_EMITTER_TYPE'][19] = EnumEntry('ADSB_EMITTER_TYPE_POINT_OBSTACLE', '''''')
ADSB_EMITTER_TYPE_ENUM_END = 20 #
enums['ADSB_EMITTER_TYPE'][20] = EnumEntry('ADSB_EMITTER_TYPE_ENUM_END', '''''')
# ADSB_FLAGS
enums['ADSB_FLAGS'] = {}
ADSB_FLAGS_VALID_COORDS = 1 #
enums['ADSB_FLAGS'][1] = EnumEntry('ADSB_FLAGS_VALID_COORDS', '''''')
ADSB_FLAGS_VALID_ALTITUDE = 2 #
enums['ADSB_FLAGS'][2] = EnumEntry('ADSB_FLAGS_VALID_ALTITUDE', '''''')
ADSB_FLAGS_VALID_HEADING = 4 #
enums['ADSB_FLAGS'][4] = EnumEntry('ADSB_FLAGS_VALID_HEADING', '''''')
ADSB_FLAGS_VALID_VELOCITY = 8 #
enums['ADSB_FLAGS'][8] = EnumEntry('ADSB_FLAGS_VALID_VELOCITY', '''''')
ADSB_FLAGS_VALID_CALLSIGN = 16 #
enums['ADSB_FLAGS'][16] = EnumEntry('ADSB_FLAGS_VALID_CALLSIGN', '''''')
ADSB_FLAGS_VALID_SQUAWK = 32 #
enums['ADSB_FLAGS'][32] = EnumEntry('ADSB_FLAGS_VALID_SQUAWK', '''''')
ADSB_FLAGS_SIMULATED = 64 #
enums['ADSB_FLAGS'][64] = EnumEntry('ADSB_FLAGS_SIMULATED', '''''')
ADSB_FLAGS_ENUM_END = 65 #
enums['ADSB_FLAGS'][65] = EnumEntry('ADSB_FLAGS_ENUM_END', '''''')
# MAV_DO_REPOSITION_FLAGS
enums['MAV_DO_REPOSITION_FLAGS'] = {}
MAV_DO_REPOSITION_FLAGS_CHANGE_MODE = 1 # The aircraft should immediately transition into guided. This should
# not be set for follow me applications
enums['MAV_DO_REPOSITION_FLAGS'][1] = EnumEntry('MAV_DO_REPOSITION_FLAGS_CHANGE_MODE', '''The aircraft should immediately transition into guided. This should not be set for follow me applications''')
MAV_DO_REPOSITION_FLAGS_ENUM_END = 2 #
enums['MAV_DO_REPOSITION_FLAGS'][2] = EnumEntry('MAV_DO_REPOSITION_FLAGS_ENUM_END', '''''')
# ESTIMATOR_STATUS_FLAGS
enums['ESTIMATOR_STATUS_FLAGS'] = {}
ESTIMATOR_ATTITUDE = 1 # True if the attitude estimate is good
enums['ESTIMATOR_STATUS_FLAGS'][1] = EnumEntry('ESTIMATOR_ATTITUDE', '''True if the attitude estimate is good''')
ESTIMATOR_VELOCITY_HORIZ = 2 # True if the horizontal velocity estimate is good
enums['ESTIMATOR_STATUS_FLAGS'][2] = EnumEntry('ESTIMATOR_VELOCITY_HORIZ', '''True if the horizontal velocity estimate is good''')
ESTIMATOR_VELOCITY_VERT = 4 # True if the vertical velocity estimate is good
enums['ESTIMATOR_STATUS_FLAGS'][4] = EnumEntry('ESTIMATOR_VELOCITY_VERT', '''True if the vertical velocity estimate is good''')
ESTIMATOR_POS_HORIZ_REL = 8 # True if the horizontal position (relative) estimate is good
enums['ESTIMATOR_STATUS_FLAGS'][8] = EnumEntry('ESTIMATOR_POS_HORIZ_REL', '''True if the horizontal position (relative) estimate is good''')
ESTIMATOR_POS_HORIZ_ABS = 16 # True if the horizontal position (absolute) estimate is good
enums['ESTIMATOR_STATUS_FLAGS'][16] = EnumEntry('ESTIMATOR_POS_HORIZ_ABS', '''True if the horizontal position (absolute) estimate is good''')
ESTIMATOR_POS_VERT_ABS = 32 # True if the vertical position (absolute) estimate is good
enums['ESTIMATOR_STATUS_FLAGS'][32] = EnumEntry('ESTIMATOR_POS_VERT_ABS', '''True if the vertical position (absolute) estimate is good''')
ESTIMATOR_POS_VERT_AGL = 64 # True if the vertical position (above ground) estimate is good
enums['ESTIMATOR_STATUS_FLAGS'][64] = EnumEntry('ESTIMATOR_POS_VERT_AGL', '''True if the vertical position (above ground) estimate is good''')
ESTIMATOR_CONST_POS_MODE = 128 # True if the EKF is in a constant position mode and is not using
# external measurements (eg GPS or optical
# flow)
enums['ESTIMATOR_STATUS_FLAGS'][128] = EnumEntry('ESTIMATOR_CONST_POS_MODE', '''True if the EKF is in a constant position mode and is not using external measurements (eg GPS or optical flow)''')
ESTIMATOR_PRED_POS_HORIZ_REL = 256 # True if the EKF has sufficient data to enter a mode that will provide
# a (relative) position estimate
enums['ESTIMATOR_STATUS_FLAGS'][256] = EnumEntry('ESTIMATOR_PRED_POS_HORIZ_REL', '''True if the EKF has sufficient data to enter a mode that will provide a (relative) position estimate''')
ESTIMATOR_PRED_POS_HORIZ_ABS = 512 # True if the EKF has sufficient data to enter a mode that will provide
# a (absolute) position estimate
enums['ESTIMATOR_STATUS_FLAGS'][512] = EnumEntry('ESTIMATOR_PRED_POS_HORIZ_ABS', '''True if the EKF has sufficient data to enter a mode that will provide a (absolute) position estimate''')
ESTIMATOR_GPS_GLITCH = 1024 # True if the EKF has detected a GPS glitch
enums['ESTIMATOR_STATUS_FLAGS'][1024] = EnumEntry('ESTIMATOR_GPS_GLITCH', '''True if the EKF has detected a GPS glitch''')
ESTIMATOR_ACCEL_ERROR = 2048 # True if the EKF has detected bad accelerometer data
enums['ESTIMATOR_STATUS_FLAGS'][2048] = EnumEntry('ESTIMATOR_ACCEL_ERROR', '''True if the EKF has detected bad accelerometer data''')
ESTIMATOR_STATUS_FLAGS_ENUM_END = 2049 #
enums['ESTIMATOR_STATUS_FLAGS'][2049] = EnumEntry('ESTIMATOR_STATUS_FLAGS_ENUM_END', '''''')
# MOTOR_TEST_ORDER
enums['MOTOR_TEST_ORDER'] = {}
MOTOR_TEST_ORDER_DEFAULT = 0 # default autopilot motor test method
enums['MOTOR_TEST_ORDER'][0] = EnumEntry('MOTOR_TEST_ORDER_DEFAULT', '''default autopilot motor test method''')
MOTOR_TEST_ORDER_SEQUENCE = 1 # motor numbers are specified as their index in a predefined vehicle-
# specific sequence
enums['MOTOR_TEST_ORDER'][1] = EnumEntry('MOTOR_TEST_ORDER_SEQUENCE', '''motor numbers are specified as their index in a predefined vehicle-specific sequence''')
MOTOR_TEST_ORDER_BOARD = 2 # motor numbers are specified as the output as labeled on the board
enums['MOTOR_TEST_ORDER'][2] = EnumEntry('MOTOR_TEST_ORDER_BOARD', '''motor numbers are specified as the output as labeled on the board''')
MOTOR_TEST_ORDER_ENUM_END = 3 #
enums['MOTOR_TEST_ORDER'][3] = EnumEntry('MOTOR_TEST_ORDER_ENUM_END', '''''')
# MOTOR_TEST_THROTTLE_TYPE
enums['MOTOR_TEST_THROTTLE_TYPE'] = {}
MOTOR_TEST_THROTTLE_PERCENT = 0 # throttle as a percentage from 0 ~ 100
enums['MOTOR_TEST_THROTTLE_TYPE'][0] = EnumEntry('MOTOR_TEST_THROTTLE_PERCENT', '''throttle as a percentage from 0 ~ 100''')
MOTOR_TEST_THROTTLE_PWM = 1 # throttle as an absolute PWM value (normally in range of 1000~2000)
enums['MOTOR_TEST_THROTTLE_TYPE'][1] = EnumEntry('MOTOR_TEST_THROTTLE_PWM', '''throttle as an absolute PWM value (normally in range of 1000~2000)''')
MOTOR_TEST_THROTTLE_PILOT = 2 # throttle pass-through from pilot's transmitter
enums['MOTOR_TEST_THROTTLE_TYPE'][2] = EnumEntry('MOTOR_TEST_THROTTLE_PILOT', '''throttle pass-through from pilot's transmitter''')
MOTOR_TEST_COMPASS_CAL = 3 # per-motor compass calibration test
enums['MOTOR_TEST_THROTTLE_TYPE'][3] = EnumEntry('MOTOR_TEST_COMPASS_CAL', '''per-motor compass calibration test''')
MOTOR_TEST_THROTTLE_TYPE_ENUM_END = 4 #
enums['MOTOR_TEST_THROTTLE_TYPE'][4] = EnumEntry('MOTOR_TEST_THROTTLE_TYPE_ENUM_END', '''''')
# GPS_INPUT_IGNORE_FLAGS
enums['GPS_INPUT_IGNORE_FLAGS'] = {}
GPS_INPUT_IGNORE_FLAG_ALT = 1 # ignore altitude field
enums['GPS_INPUT_IGNORE_FLAGS'][1] = EnumEntry('GPS_INPUT_IGNORE_FLAG_ALT', '''ignore altitude field''')
GPS_INPUT_IGNORE_FLAG_HDOP = 2 # ignore hdop field
enums['GPS_INPUT_IGNORE_FLAGS'][2] = EnumEntry('GPS_INPUT_IGNORE_FLAG_HDOP', '''ignore hdop field''')
GPS_INPUT_IGNORE_FLAG_VDOP = 4 # ignore vdop field
enums['GPS_INPUT_IGNORE_FLAGS'][4] = EnumEntry('GPS_INPUT_IGNORE_FLAG_VDOP', '''ignore vdop field''')
GPS_INPUT_IGNORE_FLAG_VEL_HORIZ = 8 # ignore horizontal velocity field (vn and ve)
enums['GPS_INPUT_IGNORE_FLAGS'][8] = EnumEntry('GPS_INPUT_IGNORE_FLAG_VEL_HORIZ', '''ignore horizontal velocity field (vn and ve)''')
GPS_INPUT_IGNORE_FLAG_VEL_VERT = 16 # ignore vertical velocity field (vd)
enums['GPS_INPUT_IGNORE_FLAGS'][16] = EnumEntry('GPS_INPUT_IGNORE_FLAG_VEL_VERT', '''ignore vertical velocity field (vd)''')
GPS_INPUT_IGNORE_FLAG_SPEED_ACCURACY = 32 # ignore speed accuracy field
enums['GPS_INPUT_IGNORE_FLAGS'][32] = EnumEntry('GPS_INPUT_IGNORE_FLAG_SPEED_ACCURACY', '''ignore speed accuracy field''')
GPS_INPUT_IGNORE_FLAG_HORIZONTAL_ACCURACY = 64 # ignore horizontal accuracy field
enums['GPS_INPUT_IGNORE_FLAGS'][64] = EnumEntry('GPS_INPUT_IGNORE_FLAG_HORIZONTAL_ACCURACY', '''ignore horizontal accuracy field''')
GPS_INPUT_IGNORE_FLAG_VERTICAL_ACCURACY = 128 # ignore vertical accuracy field
enums['GPS_INPUT_IGNORE_FLAGS'][128] = EnumEntry('GPS_INPUT_IGNORE_FLAG_VERTICAL_ACCURACY', '''ignore vertical accuracy field''')
GPS_INPUT_IGNORE_FLAGS_ENUM_END = 129 #
enums['GPS_INPUT_IGNORE_FLAGS'][129] = EnumEntry('GPS_INPUT_IGNORE_FLAGS_ENUM_END', '''''')
# MAV_COLLISION_ACTION
enums['MAV_COLLISION_ACTION'] = {}
MAV_COLLISION_ACTION_NONE = 0 # Ignore any potential collisions
enums['MAV_COLLISION_ACTION'][0] = EnumEntry('MAV_COLLISION_ACTION_NONE', '''Ignore any potential collisions''')
MAV_COLLISION_ACTION_REPORT = 1 # Report potential collision
enums['MAV_COLLISION_ACTION'][1] = EnumEntry('MAV_COLLISION_ACTION_REPORT', '''Report potential collision''')
MAV_COLLISION_ACTION_ASCEND_OR_DESCEND = 2 # Ascend or Descend to avoid threat
enums['MAV_COLLISION_ACTION'][2] = EnumEntry('MAV_COLLISION_ACTION_ASCEND_OR_DESCEND', '''Ascend or Descend to avoid threat''')
MAV_COLLISION_ACTION_MOVE_HORIZONTALLY = 3 # Move horizontally to avoid threat
enums['MAV_COLLISION_ACTION'][3] = EnumEntry('MAV_COLLISION_ACTION_MOVE_HORIZONTALLY', '''Move horizontally to avoid threat''')
MAV_COLLISION_ACTION_MOVE_PERPENDICULAR = 4 # Aircraft to move perpendicular to the collision's velocity vector
enums['MAV_COLLISION_ACTION'][4] = EnumEntry('MAV_COLLISION_ACTION_MOVE_PERPENDICULAR', '''Aircraft to move perpendicular to the collision's velocity vector''')
MAV_COLLISION_ACTION_RTL = 5 # Aircraft to fly directly back to its launch point
enums['MAV_COLLISION_ACTION'][5] = EnumEntry('MAV_COLLISION_ACTION_RTL', '''Aircraft to fly directly back to its launch point''')
MAV_COLLISION_ACTION_HOVER = 6 # Aircraft to stop in place
enums['MAV_COLLISION_ACTION'][6] = EnumEntry('MAV_COLLISION_ACTION_HOVER', '''Aircraft to stop in place''')
MAV_COLLISION_ACTION_ENUM_END = 7 #
enums['MAV_COLLISION_ACTION'][7] = EnumEntry('MAV_COLLISION_ACTION_ENUM_END', '''''')
# MAV_COLLISION_THREAT_LEVEL
enums['MAV_COLLISION_THREAT_LEVEL'] = {}
MAV_COLLISION_THREAT_LEVEL_NONE = 0 # Not a threat
enums['MAV_COLLISION_THREAT_LEVEL'][0] = EnumEntry('MAV_COLLISION_THREAT_LEVEL_NONE', '''Not a threat''')
MAV_COLLISION_THREAT_LEVEL_LOW = 1 # Craft is mildly concerned about this threat
enums['MAV_COLLISION_THREAT_LEVEL'][1] = EnumEntry('MAV_COLLISION_THREAT_LEVEL_LOW', '''Craft is mildly concerned about this threat''')
MAV_COLLISION_THREAT_LEVEL_HIGH = 2 # Craft is panicing, and may take actions to avoid threat
enums['MAV_COLLISION_THREAT_LEVEL'][2] = EnumEntry('MAV_COLLISION_THREAT_LEVEL_HIGH', '''Craft is panicing, and may take actions to avoid threat''')
MAV_COLLISION_THREAT_LEVEL_ENUM_END = 3 #
enums['MAV_COLLISION_THREAT_LEVEL'][3] = EnumEntry('MAV_COLLISION_THREAT_LEVEL_ENUM_END', '''''')
# MAV_COLLISION_SRC
enums['MAV_COLLISION_SRC'] = {}
MAV_COLLISION_SRC_ADSB = 0 # ID field references ADSB_VEHICLE packets
enums['MAV_COLLISION_SRC'][0] = EnumEntry('MAV_COLLISION_SRC_ADSB', '''ID field references ADSB_VEHICLE packets''')
MAV_COLLISION_SRC_MAVLINK_GPS_GLOBAL_INT = 1 # ID field references MAVLink SRC ID
enums['MAV_COLLISION_SRC'][1] = EnumEntry('MAV_COLLISION_SRC_MAVLINK_GPS_GLOBAL_INT', '''ID field references MAVLink SRC ID''')
MAV_COLLISION_SRC_ENUM_END = 2 #
enums['MAV_COLLISION_SRC'][2] = EnumEntry('MAV_COLLISION_SRC_ENUM_END', '''''')
# GPS_FIX_TYPE
enums['GPS_FIX_TYPE'] = {}
GPS_FIX_TYPE_NO_GPS = 0 # No GPS connected
enums['GPS_FIX_TYPE'][0] = EnumEntry('GPS_FIX_TYPE_NO_GPS', '''No GPS connected''')
GPS_FIX_TYPE_NO_FIX = 1 # No position information, GPS is connected
enums['GPS_FIX_TYPE'][1] = EnumEntry('GPS_FIX_TYPE_NO_FIX', '''No position information, GPS is connected''')
GPS_FIX_TYPE_2D_FIX = 2 # 2D position
enums['GPS_FIX_TYPE'][2] = EnumEntry('GPS_FIX_TYPE_2D_FIX', '''2D position''')
GPS_FIX_TYPE_3D_FIX = 3 # 3D position
enums['GPS_FIX_TYPE'][3] = EnumEntry('GPS_FIX_TYPE_3D_FIX', '''3D position''')
GPS_FIX_TYPE_DGPS = 4 # DGPS/SBAS aided 3D position
enums['GPS_FIX_TYPE'][4] = EnumEntry('GPS_FIX_TYPE_DGPS', '''DGPS/SBAS aided 3D position''')
GPS_FIX_TYPE_RTK_FLOAT = 5 # RTK float, 3D position
enums['GPS_FIX_TYPE'][5] = EnumEntry('GPS_FIX_TYPE_RTK_FLOAT', '''RTK float, 3D position''')
GPS_FIX_TYPE_RTK_FIXED = 6 # RTK Fixed, 3D position
enums['GPS_FIX_TYPE'][6] = EnumEntry('GPS_FIX_TYPE_RTK_FIXED', '''RTK Fixed, 3D position''')
GPS_FIX_TYPE_STATIC = 7 # Static fixed, typically used for base stations
enums['GPS_FIX_TYPE'][7] = EnumEntry('GPS_FIX_TYPE_STATIC', '''Static fixed, typically used for base stations''')
GPS_FIX_TYPE_PPP = 8 # PPP, 3D position.
enums['GPS_FIX_TYPE'][8] = EnumEntry('GPS_FIX_TYPE_PPP', '''PPP, 3D position.''')
GPS_FIX_TYPE_ENUM_END = 9 #
enums['GPS_FIX_TYPE'][9] = EnumEntry('GPS_FIX_TYPE_ENUM_END', '''''')
# RTK_BASELINE_COORDINATE_SYSTEM
enums['RTK_BASELINE_COORDINATE_SYSTEM'] = {}
RTK_BASELINE_COORDINATE_SYSTEM_ECEF = 0 # Earth-centered, Earth-fixed
enums['RTK_BASELINE_COORDINATE_SYSTEM'][0] = EnumEntry('RTK_BASELINE_COORDINATE_SYSTEM_ECEF', '''Earth-centered, Earth-fixed''')
RTK_BASELINE_COORDINATE_SYSTEM_NED = 1 # North, East, Down
enums['RTK_BASELINE_COORDINATE_SYSTEM'][1] = EnumEntry('RTK_BASELINE_COORDINATE_SYSTEM_NED', '''North, East, Down''')
RTK_BASELINE_COORDINATE_SYSTEM_ENUM_END = 2 #
enums['RTK_BASELINE_COORDINATE_SYSTEM'][2] = EnumEntry('RTK_BASELINE_COORDINATE_SYSTEM_ENUM_END', '''''')
# LANDING_TARGET_TYPE
enums['LANDING_TARGET_TYPE'] = {}
LANDING_TARGET_TYPE_LIGHT_BEACON = 0 # Landing target signaled by light beacon (ex: IR-LOCK)
enums['LANDING_TARGET_TYPE'][0] = EnumEntry('LANDING_TARGET_TYPE_LIGHT_BEACON', '''Landing target signaled by light beacon (ex: IR-LOCK)''')
LANDING_TARGET_TYPE_RADIO_BEACON = 1 # Landing target signaled by radio beacon (ex: ILS, NDB)
enums['LANDING_TARGET_TYPE'][1] = EnumEntry('LANDING_TARGET_TYPE_RADIO_BEACON', '''Landing target signaled by radio beacon (ex: ILS, NDB)''')
LANDING_TARGET_TYPE_VISION_FIDUCIAL = 2 # Landing target represented by a fiducial marker (ex: ARTag)
enums['LANDING_TARGET_TYPE'][2] = EnumEntry('LANDING_TARGET_TYPE_VISION_FIDUCIAL', '''Landing target represented by a fiducial marker (ex: ARTag)''')
LANDING_TARGET_TYPE_VISION_OTHER = 3 # Landing target represented by a pre-defined visual shape/feature (ex:
# X-marker, H-marker, square)
enums['LANDING_TARGET_TYPE'][3] = EnumEntry('LANDING_TARGET_TYPE_VISION_OTHER', '''Landing target represented by a pre-defined visual shape/feature (ex: X-marker, H-marker, square)''')
LANDING_TARGET_TYPE_ENUM_END = 4 #
enums['LANDING_TARGET_TYPE'][4] = EnumEntry('LANDING_TARGET_TYPE_ENUM_END', '''''')
# VTOL_TRANSITION_HEADING
enums['VTOL_TRANSITION_HEADING'] = {}
VTOL_TRANSITION_HEADING_VEHICLE_DEFAULT = 0 # Respect the heading configuration of the vehicle.
enums['VTOL_TRANSITION_HEADING'][0] = EnumEntry('VTOL_TRANSITION_HEADING_VEHICLE_DEFAULT', '''Respect the heading configuration of the vehicle.''')
VTOL_TRANSITION_HEADING_NEXT_WAYPOINT = 1 # Use the heading pointing towards the next waypoint.
enums['VTOL_TRANSITION_HEADING'][1] = EnumEntry('VTOL_TRANSITION_HEADING_NEXT_WAYPOINT', '''Use the heading pointing towards the next waypoint.''')
VTOL_TRANSITION_HEADING_TAKEOFF = 2 # Use the heading on takeoff (while sitting on the ground).
enums['VTOL_TRANSITION_HEADING'][2] = EnumEntry('VTOL_TRANSITION_HEADING_TAKEOFF', '''Use the heading on takeoff (while sitting on the ground).''')
VTOL_TRANSITION_HEADING_SPECIFIED = 3 # Use the specified heading in parameter 4.
enums['VTOL_TRANSITION_HEADING'][3] = EnumEntry('VTOL_TRANSITION_HEADING_SPECIFIED', '''Use the specified heading in parameter 4.''')
VTOL_TRANSITION_HEADING_ANY = 4 # Use the current heading when reaching takeoff altitude (potentially
# facing the wind when weather-vaning is
# active).
enums['VTOL_TRANSITION_HEADING'][4] = EnumEntry('VTOL_TRANSITION_HEADING_ANY', '''Use the current heading when reaching takeoff altitude (potentially facing the wind when weather-vaning is active).''')
VTOL_TRANSITION_HEADING_ENUM_END = 5 #
enums['VTOL_TRANSITION_HEADING'][5] = EnumEntry('VTOL_TRANSITION_HEADING_ENUM_END', '''''')
# CAMERA_MODE
enums['CAMERA_MODE'] = {}
CAMERA_MODE_IMAGE = 0 # Camera is in image/photo capture mode.
enums['CAMERA_MODE'][0] = EnumEntry('CAMERA_MODE_IMAGE', '''Camera is in image/photo capture mode.''')
CAMERA_MODE_VIDEO = 1 # Camera is in video capture mode.
enums['CAMERA_MODE'][1] = EnumEntry('CAMERA_MODE_VIDEO', '''Camera is in video capture mode.''')
CAMERA_MODE_IMAGE_SURVEY = 2 # Camera is in image survey capture mode. It allows for camera
# controller to do specific settings for
# surveys.
enums['CAMERA_MODE'][2] = EnumEntry('CAMERA_MODE_IMAGE_SURVEY', '''Camera is in image survey capture mode. It allows for camera controller to do specific settings for surveys.''')
CAMERA_MODE_ENUM_END = 3 #
enums['CAMERA_MODE'][3] = EnumEntry('CAMERA_MODE_ENUM_END', '''''')
# MAV_ARM_AUTH_DENIED_REASON
enums['MAV_ARM_AUTH_DENIED_REASON'] = {}
MAV_ARM_AUTH_DENIED_REASON_GENERIC = 0 # Not a specific reason
enums['MAV_ARM_AUTH_DENIED_REASON'][0] = EnumEntry('MAV_ARM_AUTH_DENIED_REASON_GENERIC', '''Not a specific reason''')
MAV_ARM_AUTH_DENIED_REASON_NONE = 1 # Authorizer will send the error as string to GCS
enums['MAV_ARM_AUTH_DENIED_REASON'][1] = EnumEntry('MAV_ARM_AUTH_DENIED_REASON_NONE', '''Authorizer will send the error as string to GCS''')
MAV_ARM_AUTH_DENIED_REASON_INVALID_WAYPOINT = 2 # At least one waypoint have a invalid value
enums['MAV_ARM_AUTH_DENIED_REASON'][2] = EnumEntry('MAV_ARM_AUTH_DENIED_REASON_INVALID_WAYPOINT', '''At least one waypoint have a invalid value''')
MAV_ARM_AUTH_DENIED_REASON_TIMEOUT = 3 # Timeout in the authorizer process(in case it depends on network)
enums['MAV_ARM_AUTH_DENIED_REASON'][3] = EnumEntry('MAV_ARM_AUTH_DENIED_REASON_TIMEOUT', '''Timeout in the authorizer process(in case it depends on network)''')
MAV_ARM_AUTH_DENIED_REASON_AIRSPACE_IN_USE = 4 # Airspace of the mission in use by another vehicle, second result
# parameter can have the waypoint id that
# caused it to be denied.
enums['MAV_ARM_AUTH_DENIED_REASON'][4] = EnumEntry('MAV_ARM_AUTH_DENIED_REASON_AIRSPACE_IN_USE', '''Airspace of the mission in use by another vehicle, second result parameter can have the waypoint id that caused it to be denied.''')
MAV_ARM_AUTH_DENIED_REASON_BAD_WEATHER = 5 # Weather is not good to fly
enums['MAV_ARM_AUTH_DENIED_REASON'][5] = EnumEntry('MAV_ARM_AUTH_DENIED_REASON_BAD_WEATHER', '''Weather is not good to fly''')
MAV_ARM_AUTH_DENIED_REASON_ENUM_END = 6 #
enums['MAV_ARM_AUTH_DENIED_REASON'][6] = EnumEntry('MAV_ARM_AUTH_DENIED_REASON_ENUM_END', '''''')
# RC_TYPE
enums['RC_TYPE'] = {}
RC_TYPE_SPEKTRUM_DSM2 = 0 # Spektrum DSM2
enums['RC_TYPE'][0] = EnumEntry('RC_TYPE_SPEKTRUM_DSM2', '''Spektrum DSM2''')
RC_TYPE_SPEKTRUM_DSMX = 1 # Spektrum DSMX
enums['RC_TYPE'][1] = EnumEntry('RC_TYPE_SPEKTRUM_DSMX', '''Spektrum DSMX''')
RC_TYPE_ENUM_END = 2 #
enums['RC_TYPE'][2] = EnumEntry('RC_TYPE_ENUM_END', '''''')
# message IDs
MAVLINK_MSG_ID_BAD_DATA = -1
MAVLINK_MSG_ID_AQ_TELEMETRY_F = 150
MAVLINK_MSG_ID_AQ_ESC_TELEMETRY = 152
MAVLINK_MSG_ID_HEARTBEAT = 0
MAVLINK_MSG_ID_SYS_STATUS = 1
MAVLINK_MSG_ID_SYSTEM_TIME = 2
MAVLINK_MSG_ID_PING = 4
MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL = 5
MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK = 6
MAVLINK_MSG_ID_AUTH_KEY = 7
MAVLINK_MSG_ID_SET_MODE = 11
MAVLINK_MSG_ID_PARAM_REQUEST_READ = 20
MAVLINK_MSG_ID_PARAM_REQUEST_LIST = 21
MAVLINK_MSG_ID_PARAM_VALUE = 22
MAVLINK_MSG_ID_PARAM_SET = 23
MAVLINK_MSG_ID_GPS_RAW_INT = 24
MAVLINK_MSG_ID_GPS_STATUS = 25
MAVLINK_MSG_ID_SCALED_IMU = 26
MAVLINK_MSG_ID_RAW_IMU = 27
MAVLINK_MSG_ID_RAW_PRESSURE = 28
MAVLINK_MSG_ID_SCALED_PRESSURE = 29
MAVLINK_MSG_ID_ATTITUDE = 30
MAVLINK_MSG_ID_ATTITUDE_QUATERNION = 31
MAVLINK_MSG_ID_LOCAL_POSITION_NED = 32
MAVLINK_MSG_ID_GLOBAL_POSITION_INT = 33
MAVLINK_MSG_ID_RC_CHANNELS_SCALED = 34
MAVLINK_MSG_ID_RC_CHANNELS_RAW = 35
MAVLINK_MSG_ID_SERVO_OUTPUT_RAW = 36
MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST = 37
MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST = 38
MAVLINK_MSG_ID_MISSION_ITEM = 39
MAVLINK_MSG_ID_MISSION_REQUEST = 40
MAVLINK_MSG_ID_MISSION_SET_CURRENT = 41
MAVLINK_MSG_ID_MISSION_CURRENT = 42
MAVLINK_MSG_ID_MISSION_REQUEST_LIST = 43
MAVLINK_MSG_ID_MISSION_COUNT = 44
MAVLINK_MSG_ID_MISSION_CLEAR_ALL = 45
MAVLINK_MSG_ID_MISSION_ITEM_REACHED = 46
MAVLINK_MSG_ID_MISSION_ACK = 47
MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN = 48
MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN = 49
MAVLINK_MSG_ID_PARAM_MAP_RC = 50
MAVLINK_MSG_ID_MISSION_REQUEST_INT = 51
MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA = 54
MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA = 55
MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV = 61
MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT = 62
MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV = 63
MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV = 64
MAVLINK_MSG_ID_RC_CHANNELS = 65
MAVLINK_MSG_ID_REQUEST_DATA_STREAM = 66
MAVLINK_MSG_ID_DATA_STREAM = 67
MAVLINK_MSG_ID_MANUAL_CONTROL = 69
MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE = 70
MAVLINK_MSG_ID_MISSION_ITEM_INT = 73
MAVLINK_MSG_ID_VFR_HUD = 74
MAVLINK_MSG_ID_COMMAND_INT = 75
MAVLINK_MSG_ID_COMMAND_LONG = 76
MAVLINK_MSG_ID_COMMAND_ACK = 77
MAVLINK_MSG_ID_MANUAL_SETPOINT = 81
MAVLINK_MSG_ID_SET_ATTITUDE_TARGET = 82
MAVLINK_MSG_ID_ATTITUDE_TARGET = 83
MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED = 84
MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED = 85
MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT = 86
MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT = 87
MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET = 89
MAVLINK_MSG_ID_HIL_STATE = 90
MAVLINK_MSG_ID_HIL_CONTROLS = 91
MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW = 92
MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS = 93
MAVLINK_MSG_ID_OPTICAL_FLOW = 100
MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE = 101
MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE = 102
MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE = 103
MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE = 104
MAVLINK_MSG_ID_HIGHRES_IMU = 105
MAVLINK_MSG_ID_OPTICAL_FLOW_RAD = 106
MAVLINK_MSG_ID_HIL_SENSOR = 107
MAVLINK_MSG_ID_SIM_STATE = 108
MAVLINK_MSG_ID_RADIO_STATUS = 109
MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL = 110
MAVLINK_MSG_ID_TIMESYNC = 111
MAVLINK_MSG_ID_CAMERA_TRIGGER = 112
MAVLINK_MSG_ID_HIL_GPS = 113
MAVLINK_MSG_ID_HIL_OPTICAL_FLOW = 114
MAVLINK_MSG_ID_HIL_STATE_QUATERNION = 115
MAVLINK_MSG_ID_SCALED_IMU2 = 116
MAVLINK_MSG_ID_LOG_REQUEST_LIST = 117
MAVLINK_MSG_ID_LOG_ENTRY = 118
MAVLINK_MSG_ID_LOG_REQUEST_DATA = 119
MAVLINK_MSG_ID_LOG_DATA = 120
MAVLINK_MSG_ID_LOG_ERASE = 121
MAVLINK_MSG_ID_LOG_REQUEST_END = 122
MAVLINK_MSG_ID_GPS_INJECT_DATA = 123
MAVLINK_MSG_ID_GPS2_RAW = 124
MAVLINK_MSG_ID_POWER_STATUS = 125
MAVLINK_MSG_ID_SERIAL_CONTROL = 126
MAVLINK_MSG_ID_GPS_RTK = 127
MAVLINK_MSG_ID_GPS2_RTK = 128
MAVLINK_MSG_ID_SCALED_IMU3 = 129
MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE = 130
MAVLINK_MSG_ID_ENCAPSULATED_DATA = 131
MAVLINK_MSG_ID_DISTANCE_SENSOR = 132
MAVLINK_MSG_ID_TERRAIN_REQUEST = 133
MAVLINK_MSG_ID_TERRAIN_DATA = 134
MAVLINK_MSG_ID_TERRAIN_CHECK = 135
MAVLINK_MSG_ID_TERRAIN_REPORT = 136
MAVLINK_MSG_ID_SCALED_PRESSURE2 = 137
MAVLINK_MSG_ID_ATT_POS_MOCAP = 138
MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET = 139
MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET = 140
MAVLINK_MSG_ID_ALTITUDE = 141
MAVLINK_MSG_ID_RESOURCE_REQUEST = 142
MAVLINK_MSG_ID_SCALED_PRESSURE3 = 143
MAVLINK_MSG_ID_FOLLOW_TARGET = 144
MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE = 146
MAVLINK_MSG_ID_BATTERY_STATUS = 147
MAVLINK_MSG_ID_AUTOPILOT_VERSION = 148
MAVLINK_MSG_ID_LANDING_TARGET = 149
MAVLINK_MSG_ID_ESTIMATOR_STATUS = 230
MAVLINK_MSG_ID_WIND_COV = 231
MAVLINK_MSG_ID_GPS_INPUT = 232
MAVLINK_MSG_ID_GPS_RTCM_DATA = 233
MAVLINK_MSG_ID_HIGH_LATENCY = 234
MAVLINK_MSG_ID_VIBRATION = 241
MAVLINK_MSG_ID_HOME_POSITION = 242
MAVLINK_MSG_ID_SET_HOME_POSITION = 243
MAVLINK_MSG_ID_MESSAGE_INTERVAL = 244
MAVLINK_MSG_ID_EXTENDED_SYS_STATE = 245
MAVLINK_MSG_ID_ADSB_VEHICLE = 246
MAVLINK_MSG_ID_COLLISION = 247
MAVLINK_MSG_ID_V2_EXTENSION = 248
MAVLINK_MSG_ID_MEMORY_VECT = 249
MAVLINK_MSG_ID_DEBUG_VECT = 250
MAVLINK_MSG_ID_NAMED_VALUE_FLOAT = 251
MAVLINK_MSG_ID_NAMED_VALUE_INT = 252
MAVLINK_MSG_ID_STATUSTEXT = 253
MAVLINK_MSG_ID_DEBUG = 254
MAVLINK_MSG_ID_SETUP_SIGNING = 256
MAVLINK_MSG_ID_BUTTON_CHANGE = 257
MAVLINK_MSG_ID_PLAY_TUNE = 258
MAVLINK_MSG_ID_CAMERA_INFORMATION = 259
MAVLINK_MSG_ID_CAMERA_SETTINGS = 260
MAVLINK_MSG_ID_STORAGE_INFORMATION = 261
MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS = 262
MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED = 263
MAVLINK_MSG_ID_FLIGHT_INFORMATION = 264
MAVLINK_MSG_ID_MOUNT_ORIENTATION = 265
MAVLINK_MSG_ID_LOGGING_DATA = 266
MAVLINK_MSG_ID_LOGGING_DATA_ACKED = 267
MAVLINK_MSG_ID_LOGGING_ACK = 268
MAVLINK_MSG_ID_WIFI_CONFIG_AP = 299
MAVLINK_MSG_ID_UAVCAN_NODE_STATUS = 310
MAVLINK_MSG_ID_UAVCAN_NODE_INFO = 311
MAVLINK_MSG_ID_OBSTACLE_DISTANCE = 330
MAVLINK_MSG_ID_ODOMETRY = 331
class MAVLink_aq_telemetry_f_message(MAVLink_message):
'''
Sends up to 20 raw float values.
'''
id = MAVLINK_MSG_ID_AQ_TELEMETRY_F
name = 'AQ_TELEMETRY_F'
fieldnames = ['Index', 'value1', 'value2', 'value3', 'value4', 'value5', 'value6', 'value7', 'value8', 'value9', 'value10', 'value11', 'value12', 'value13', 'value14', 'value15', 'value16', 'value17', 'value18', 'value19', 'value20']
ordered_fieldnames = [ 'value1', 'value2', 'value3', 'value4', 'value5', 'value6', 'value7', 'value8', 'value9', 'value10', 'value11', 'value12', 'value13', 'value14', 'value15', 'value16', 'value17', 'value18', 'value19', 'value20', 'Index' ]
format = '<ffffffffffffffffffffH'
native_format = bytearray('<ffffffffffffffffffffH', 'ascii')
orders = [20, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 241
def __init__(self, Index, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20):
MAVLink_message.__init__(self, MAVLink_aq_telemetry_f_message.id, MAVLink_aq_telemetry_f_message.name)
self._fieldnames = MAVLink_aq_telemetry_f_message.fieldnames
self.Index = Index
self.value1 = value1
self.value2 = value2
self.value3 = value3
self.value4 = value4
self.value5 = value5
self.value6 = value6
self.value7 = value7
self.value8 = value8
self.value9 = value9
self.value10 = value10
self.value11 = value11
self.value12 = value12
self.value13 = value13
self.value14 = value14
self.value15 = value15
self.value16 = value16
self.value17 = value17
self.value18 = value18
self.value19 = value19
self.value20 = value20
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 241, struct.pack('<ffffffffffffffffffffH', self.value1, self.value2, self.value3, self.value4, self.value5, self.value6, self.value7, self.value8, self.value9, self.value10, self.value11, self.value12, self.value13, self.value14, self.value15, self.value16, self.value17, self.value18, self.value19, self.value20, self.Index), force_mavlink1=force_mavlink1)
class MAVLink_aq_esc_telemetry_message(MAVLink_message):
'''
Sends ESC32 telemetry data for up to 4 motors. Multiple
messages may be sent in sequence when system has > 4 motors.
Data is described as follows:
// unsigned int state : 3; //
unsigned int vin : 12; // x 100
// unsigned int amps : 14; // x 100
// unsigned int rpm : 15;
// unsigned int duty : 8; // x (255/100)
// - Data Version 2 - //
unsigned int errors : 9; // Bad detects error count
// - Data Version 3 - //
unsigned int temp : 9; // (Deg C + 32) * 4
// unsigned int errCode : 3;
'''
id = MAVLINK_MSG_ID_AQ_ESC_TELEMETRY
name = 'AQ_ESC_TELEMETRY'
fieldnames = ['time_boot_ms', 'seq', 'num_motors', 'num_in_seq', 'escid', 'status_age', 'data_version', 'data0', 'data1']
ordered_fieldnames = [ 'time_boot_ms', 'data0', 'data1', 'status_age', 'seq', 'num_motors', 'num_in_seq', 'escid', 'data_version' ]
format = '<I4I4I4HBBB4B4B'
native_format = bytearray('<IIIHBBBBB', 'ascii')
orders = [0, 4, 5, 6, 7, 3, 8, 1, 2]
lengths = [1, 4, 4, 4, 1, 1, 1, 4, 4]
array_lengths = [0, 4, 4, 4, 0, 0, 0, 4, 4]
crc_extra = 115
def __init__(self, time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1):
MAVLink_message.__init__(self, MAVLink_aq_esc_telemetry_message.id, MAVLink_aq_esc_telemetry_message.name)
self._fieldnames = MAVLink_aq_esc_telemetry_message.fieldnames
self.time_boot_ms = time_boot_ms
self.seq = seq
self.num_motors = num_motors
self.num_in_seq = num_in_seq
self.escid = escid
self.status_age = status_age
self.data_version = data_version
self.data0 = data0
self.data1 = data1
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 115, struct.pack('<I4I4I4HBBB4B4B', self.time_boot_ms, self.data0[0], self.data0[1], self.data0[2], self.data0[3], self.data1[0], self.data1[1], self.data1[2], self.data1[3], self.status_age[0], self.status_age[1], self.status_age[2], self.status_age[3], self.seq, self.num_motors, self.num_in_seq, self.escid[0], self.escid[1], self.escid[2], self.escid[3], self.data_version[0], self.data_version[1], self.data_version[2], self.data_version[3]), force_mavlink1=force_mavlink1)
class MAVLink_heartbeat_message(MAVLink_message):
'''
The heartbeat message shows that a system is present and
responding. The type of the MAV and Autopilot hardware allow
the receiving system to treat further messages from this
system appropriate (e.g. by laying out the user interface
based on the autopilot).
'''
id = MAVLINK_MSG_ID_HEARTBEAT
name = 'HEARTBEAT'
fieldnames = ['type', 'autopilot', 'base_mode', 'custom_mode', 'system_status', 'mavlink_version']
ordered_fieldnames = [ 'custom_mode', 'type', 'autopilot', 'base_mode', 'system_status', 'mavlink_version' ]
format = '<IBBBBB'
native_format = bytearray('<IBBBBB', 'ascii')
orders = [1, 2, 3, 0, 4, 5]
lengths = [1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0]
crc_extra = 50
def __init__(self, type, autopilot, base_mode, custom_mode, system_status, mavlink_version):
MAVLink_message.__init__(self, MAVLink_heartbeat_message.id, MAVLink_heartbeat_message.name)
self._fieldnames = MAVLink_heartbeat_message.fieldnames
self.type = type
self.autopilot = autopilot
self.base_mode = base_mode
self.custom_mode = custom_mode
self.system_status = system_status
self.mavlink_version = mavlink_version
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 50, struct.pack('<IBBBBB', self.custom_mode, self.type, self.autopilot, self.base_mode, self.system_status, self.mavlink_version), force_mavlink1=force_mavlink1)
class MAVLink_sys_status_message(MAVLink_message):
'''
The general system state. If the system is following the
MAVLink standard, the system state is mainly defined by three
orthogonal states/modes: The system mode, which is either
LOCKED (motors shut down and locked), MANUAL (system under RC
control), GUIDED (system with autonomous position control,
position setpoint controlled manually) or AUTO (system guided
by path/waypoint planner). The NAV_MODE defined the current
flight state: LIFTOFF (often an open-loop maneuver), LANDING,
WAYPOINTS or VECTOR. This represents the internal navigation
state machine. The system status shows whether the system is
currently active or not and if an emergency occured. During
the CRITICAL and EMERGENCY states the MAV is still considered
to be active, but should start emergency procedures
autonomously. After a failure occured it should first move
from active to critical to allow manual intervention and then
move to emergency after a certain timeout.
'''
id = MAVLINK_MSG_ID_SYS_STATUS
name = 'SYS_STATUS'
fieldnames = ['onboard_control_sensors_present', 'onboard_control_sensors_enabled', 'onboard_control_sensors_health', 'load', 'voltage_battery', 'current_battery', 'battery_remaining', 'drop_rate_comm', 'errors_comm', 'errors_count1', 'errors_count2', 'errors_count3', 'errors_count4']
ordered_fieldnames = [ 'onboard_control_sensors_present', 'onboard_control_sensors_enabled', 'onboard_control_sensors_health', 'load', 'voltage_battery', 'current_battery', 'drop_rate_comm', 'errors_comm', 'errors_count1', 'errors_count2', 'errors_count3', 'errors_count4', 'battery_remaining' ]
format = '<IIIHHhHHHHHHb'
native_format = bytearray('<IIIHHhHHHHHHb', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 12, 6, 7, 8, 9, 10, 11]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 124
def __init__(self, onboard_control_sensors_present, onboard_control_sensors_enabled, onboard_control_sensors_health, load, voltage_battery, current_battery, battery_remaining, drop_rate_comm, errors_comm, errors_count1, errors_count2, errors_count3, errors_count4):
MAVLink_message.__init__(self, MAVLink_sys_status_message.id, MAVLink_sys_status_message.name)
self._fieldnames = MAVLink_sys_status_message.fieldnames
self.onboard_control_sensors_present = onboard_control_sensors_present
self.onboard_control_sensors_enabled = onboard_control_sensors_enabled
self.onboard_control_sensors_health = onboard_control_sensors_health
self.load = load
self.voltage_battery = voltage_battery
self.current_battery = current_battery
self.battery_remaining = battery_remaining
self.drop_rate_comm = drop_rate_comm
self.errors_comm = errors_comm
self.errors_count1 = errors_count1
self.errors_count2 = errors_count2
self.errors_count3 = errors_count3
self.errors_count4 = errors_count4
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 124, struct.pack('<IIIHHhHHHHHHb', self.onboard_control_sensors_present, self.onboard_control_sensors_enabled, self.onboard_control_sensors_health, self.load, self.voltage_battery, self.current_battery, self.drop_rate_comm, self.errors_comm, self.errors_count1, self.errors_count2, self.errors_count3, self.errors_count4, self.battery_remaining), force_mavlink1=force_mavlink1)
class MAVLink_system_time_message(MAVLink_message):
'''
The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
'''
id = MAVLINK_MSG_ID_SYSTEM_TIME
name = 'SYSTEM_TIME'
fieldnames = ['time_unix_usec', 'time_boot_ms']
ordered_fieldnames = [ 'time_unix_usec', 'time_boot_ms' ]
format = '<QI'
native_format = bytearray('<QI', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 137
def __init__(self, time_unix_usec, time_boot_ms):
MAVLink_message.__init__(self, MAVLink_system_time_message.id, MAVLink_system_time_message.name)
self._fieldnames = MAVLink_system_time_message.fieldnames
self.time_unix_usec = time_unix_usec
self.time_boot_ms = time_boot_ms
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 137, struct.pack('<QI', self.time_unix_usec, self.time_boot_ms), force_mavlink1=force_mavlink1)
class MAVLink_ping_message(MAVLink_message):
'''
A ping message either requesting or responding to a ping. This
allows to measure the system latencies, including serial port,
radio modem and UDP connections.
'''
id = MAVLINK_MSG_ID_PING
name = 'PING'
fieldnames = ['time_usec', 'seq', 'target_system', 'target_component']
ordered_fieldnames = [ 'time_usec', 'seq', 'target_system', 'target_component' ]
format = '<QIBB'
native_format = bytearray('<QIBB', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 237
def __init__(self, time_usec, seq, target_system, target_component):
MAVLink_message.__init__(self, MAVLink_ping_message.id, MAVLink_ping_message.name)
self._fieldnames = MAVLink_ping_message.fieldnames
self.time_usec = time_usec
self.seq = seq
self.target_system = target_system
self.target_component = target_component
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 237, struct.pack('<QIBB', self.time_usec, self.seq, self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_change_operator_control_message(MAVLink_message):
'''
Request to control this MAV
'''
id = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL
name = 'CHANGE_OPERATOR_CONTROL'
fieldnames = ['target_system', 'control_request', 'version', 'passkey']
ordered_fieldnames = [ 'target_system', 'control_request', 'version', 'passkey' ]
format = '<BBB25s'
native_format = bytearray('<BBBc', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 25]
crc_extra = 217
def __init__(self, target_system, control_request, version, passkey):
MAVLink_message.__init__(self, MAVLink_change_operator_control_message.id, MAVLink_change_operator_control_message.name)
self._fieldnames = MAVLink_change_operator_control_message.fieldnames
self.target_system = target_system
self.control_request = control_request
self.version = version
self.passkey = passkey
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 217, struct.pack('<BBB25s', self.target_system, self.control_request, self.version, self.passkey), force_mavlink1=force_mavlink1)
class MAVLink_change_operator_control_ack_message(MAVLink_message):
'''
Accept / deny control of this MAV
'''
id = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK
name = 'CHANGE_OPERATOR_CONTROL_ACK'
fieldnames = ['gcs_system_id', 'control_request', 'ack']
ordered_fieldnames = [ 'gcs_system_id', 'control_request', 'ack' ]
format = '<BBB'
native_format = bytearray('<BBB', 'ascii')
orders = [0, 1, 2]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 104
def __init__(self, gcs_system_id, control_request, ack):
MAVLink_message.__init__(self, MAVLink_change_operator_control_ack_message.id, MAVLink_change_operator_control_ack_message.name)
self._fieldnames = MAVLink_change_operator_control_ack_message.fieldnames
self.gcs_system_id = gcs_system_id
self.control_request = control_request
self.ack = ack
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 104, struct.pack('<BBB', self.gcs_system_id, self.control_request, self.ack), force_mavlink1=force_mavlink1)
class MAVLink_auth_key_message(MAVLink_message):
'''
Emit an encrypted signature / key identifying this system.
PLEASE NOTE: This protocol has been kept simple, so
transmitting the key requires an encrypted channel for true
safety.
'''
id = MAVLINK_MSG_ID_AUTH_KEY
name = 'AUTH_KEY'
fieldnames = ['key']
ordered_fieldnames = [ 'key' ]
format = '<32s'
native_format = bytearray('<c', 'ascii')
orders = [0]
lengths = [1]
array_lengths = [32]
crc_extra = 119
def __init__(self, key):
MAVLink_message.__init__(self, MAVLink_auth_key_message.id, MAVLink_auth_key_message.name)
self._fieldnames = MAVLink_auth_key_message.fieldnames
self.key = key
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 119, struct.pack('<32s', self.key), force_mavlink1=force_mavlink1)
class MAVLink_set_mode_message(MAVLink_message):
'''
THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as defined
by enum MAV_MODE. There is no target component id as the mode
is by definition for the overall aircraft, not only for one
component.
'''
id = MAVLINK_MSG_ID_SET_MODE
name = 'SET_MODE'
fieldnames = ['target_system', 'base_mode', 'custom_mode']
ordered_fieldnames = [ 'custom_mode', 'target_system', 'base_mode' ]
format = '<IBB'
native_format = bytearray('<IBB', 'ascii')
orders = [1, 2, 0]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 89
def __init__(self, target_system, base_mode, custom_mode):
MAVLink_message.__init__(self, MAVLink_set_mode_message.id, MAVLink_set_mode_message.name)
self._fieldnames = MAVLink_set_mode_message.fieldnames
self.target_system = target_system
self.base_mode = base_mode
self.custom_mode = custom_mode
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 89, struct.pack('<IBB', self.custom_mode, self.target_system, self.base_mode), force_mavlink1=force_mavlink1)
class MAVLink_param_request_read_message(MAVLink_message):
'''
Request to read the onboard parameter with the param_id string
id. Onboard parameters are stored as key[const char*] ->
value[float]. This allows to send a parameter to any other
component (such as the GCS) without the need of previous
knowledge of possible parameter names. Thus the same GCS can
store different parameters for different autopilots. See also
https://mavlink.io/en/protocol/parameter.html for a full
documentation of QGroundControl and IMU code.
'''
id = MAVLINK_MSG_ID_PARAM_REQUEST_READ
name = 'PARAM_REQUEST_READ'
fieldnames = ['target_system', 'target_component', 'param_id', 'param_index']
ordered_fieldnames = [ 'param_index', 'target_system', 'target_component', 'param_id' ]
format = '<hBB16s'
native_format = bytearray('<hBBc', 'ascii')
orders = [1, 2, 3, 0]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 16]
crc_extra = 214
def __init__(self, target_system, target_component, param_id, param_index):
MAVLink_message.__init__(self, MAVLink_param_request_read_message.id, MAVLink_param_request_read_message.name)
self._fieldnames = MAVLink_param_request_read_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.param_id = param_id
self.param_index = param_index
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 214, struct.pack('<hBB16s', self.param_index, self.target_system, self.target_component, self.param_id), force_mavlink1=force_mavlink1)
class MAVLink_param_request_list_message(MAVLink_message):
'''
Request all parameters of this component. After this request,
all parameters are emitted.
'''
id = MAVLINK_MSG_ID_PARAM_REQUEST_LIST
name = 'PARAM_REQUEST_LIST'
fieldnames = ['target_system', 'target_component']
ordered_fieldnames = [ 'target_system', 'target_component' ]
format = '<BB'
native_format = bytearray('<BB', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 159
def __init__(self, target_system, target_component):
MAVLink_message.__init__(self, MAVLink_param_request_list_message.id, MAVLink_param_request_list_message.name)
self._fieldnames = MAVLink_param_request_list_message.fieldnames
self.target_system = target_system
self.target_component = target_component
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 159, struct.pack('<BB', self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_param_value_message(MAVLink_message):
'''
Emit the value of a onboard parameter. The inclusion of
param_count and param_index in the message allows the
recipient to keep track of received parameters and allows him
to re-request missing parameters after a loss or timeout.
'''
id = MAVLINK_MSG_ID_PARAM_VALUE
name = 'PARAM_VALUE'
fieldnames = ['param_id', 'param_value', 'param_type', 'param_count', 'param_index']
ordered_fieldnames = [ 'param_value', 'param_count', 'param_index', 'param_id', 'param_type' ]
format = '<fHH16sB'
native_format = bytearray('<fHHcB', 'ascii')
orders = [3, 0, 4, 1, 2]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 16, 0]
crc_extra = 220
def __init__(self, param_id, param_value, param_type, param_count, param_index):
MAVLink_message.__init__(self, MAVLink_param_value_message.id, MAVLink_param_value_message.name)
self._fieldnames = MAVLink_param_value_message.fieldnames
self.param_id = param_id
self.param_value = param_value
self.param_type = param_type
self.param_count = param_count
self.param_index = param_index
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 220, struct.pack('<fHH16sB', self.param_value, self.param_count, self.param_index, self.param_id, self.param_type), force_mavlink1=force_mavlink1)
class MAVLink_param_set_message(MAVLink_message):
'''
Set a parameter value TEMPORARILY to RAM. It will be reset to
default on system reboot. Send the ACTION
MAV_ACTION_STORAGE_WRITE to PERMANENTLY write the RAM contents
to EEPROM. IMPORTANT: The receiving component should
acknowledge the new parameter value by sending a param_value
message to all communication partners. This will also ensure
that multiple GCS all have an up-to-date list of all
parameters. If the sending GCS did not receive a PARAM_VALUE
message within its timeout time, it should re-send the
PARAM_SET message.
'''
id = MAVLINK_MSG_ID_PARAM_SET
name = 'PARAM_SET'
fieldnames = ['target_system', 'target_component', 'param_id', 'param_value', 'param_type']
ordered_fieldnames = [ 'param_value', 'target_system', 'target_component', 'param_id', 'param_type' ]
format = '<fBB16sB'
native_format = bytearray('<fBBcB', 'ascii')
orders = [1, 2, 3, 0, 4]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 16, 0]
crc_extra = 168
def __init__(self, target_system, target_component, param_id, param_value, param_type):
MAVLink_message.__init__(self, MAVLink_param_set_message.id, MAVLink_param_set_message.name)
self._fieldnames = MAVLink_param_set_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.param_id = param_id
self.param_value = param_value
self.param_type = param_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 168, struct.pack('<fBB16sB', self.param_value, self.target_system, self.target_component, self.param_id, self.param_type), force_mavlink1=force_mavlink1)
class MAVLink_gps_raw_int_message(MAVLink_message):
'''
The global position, as returned by the Global Positioning
System (GPS). This is NOT the global position
estimate of the system, but rather a RAW sensor value. See
message GLOBAL_POSITION for the global position estimate.
'''
id = MAVLINK_MSG_ID_GPS_RAW_INT
name = 'GPS_RAW_INT'
fieldnames = ['time_usec', 'fix_type', 'lat', 'lon', 'alt', 'eph', 'epv', 'vel', 'cog', 'satellites_visible', 'alt_ellipsoid', 'h_acc', 'v_acc', 'vel_acc', 'hdg_acc']
ordered_fieldnames = [ 'time_usec', 'lat', 'lon', 'alt', 'eph', 'epv', 'vel', 'cog', 'fix_type', 'satellites_visible', 'alt_ellipsoid', 'h_acc', 'v_acc', 'vel_acc', 'hdg_acc' ]
format = '<QiiiHHHHBBiIIII'
native_format = bytearray('<QiiiHHHHBBiIIII', 'ascii')
orders = [0, 8, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 24
def __init__(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, alt_ellipsoid=0, h_acc=0, v_acc=0, vel_acc=0, hdg_acc=0):
MAVLink_message.__init__(self, MAVLink_gps_raw_int_message.id, MAVLink_gps_raw_int_message.name)
self._fieldnames = MAVLink_gps_raw_int_message.fieldnames
self.time_usec = time_usec
self.fix_type = fix_type
self.lat = lat
self.lon = lon
self.alt = alt
self.eph = eph
self.epv = epv
self.vel = vel
self.cog = cog
self.satellites_visible = satellites_visible
self.alt_ellipsoid = alt_ellipsoid
self.h_acc = h_acc
self.v_acc = v_acc
self.vel_acc = vel_acc
self.hdg_acc = hdg_acc
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 24, struct.pack('<QiiiHHHHBBiIIII', self.time_usec, self.lat, self.lon, self.alt, self.eph, self.epv, self.vel, self.cog, self.fix_type, self.satellites_visible, self.alt_ellipsoid, self.h_acc, self.v_acc, self.vel_acc, self.hdg_acc), force_mavlink1=force_mavlink1)
class MAVLink_gps_status_message(MAVLink_message):
'''
The positioning status, as reported by GPS. This message is
intended to display status information about each satellite
visible to the receiver. See message GLOBAL_POSITION for the
global position estimate. This message can contain information
for up to 20 satellites.
'''
id = MAVLINK_MSG_ID_GPS_STATUS
name = 'GPS_STATUS'
fieldnames = ['satellites_visible', 'satellite_prn', 'satellite_used', 'satellite_elevation', 'satellite_azimuth', 'satellite_snr']
ordered_fieldnames = [ 'satellites_visible', 'satellite_prn', 'satellite_used', 'satellite_elevation', 'satellite_azimuth', 'satellite_snr' ]
format = '<B20B20B20B20B20B'
native_format = bytearray('<BBBBBB', 'ascii')
orders = [0, 1, 2, 3, 4, 5]
lengths = [1, 20, 20, 20, 20, 20]
array_lengths = [0, 20, 20, 20, 20, 20]
crc_extra = 23
def __init__(self, satellites_visible, satellite_prn, satellite_used, satellite_elevation, satellite_azimuth, satellite_snr):
MAVLink_message.__init__(self, MAVLink_gps_status_message.id, MAVLink_gps_status_message.name)
self._fieldnames = MAVLink_gps_status_message.fieldnames
self.satellites_visible = satellites_visible
self.satellite_prn = satellite_prn
self.satellite_used = satellite_used
self.satellite_elevation = satellite_elevation
self.satellite_azimuth = satellite_azimuth
self.satellite_snr = satellite_snr
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 23, struct.pack('<B20B20B20B20B20B', self.satellites_visible, self.satellite_prn[0], self.satellite_prn[1], self.satellite_prn[2], self.satellite_prn[3], self.satellite_prn[4], self.satellite_prn[5], self.satellite_prn[6], self.satellite_prn[7], self.satellite_prn[8], self.satellite_prn[9], self.satellite_prn[10], self.satellite_prn[11], self.satellite_prn[12], self.satellite_prn[13], self.satellite_prn[14], self.satellite_prn[15], self.satellite_prn[16], self.satellite_prn[17], self.satellite_prn[18], self.satellite_prn[19], self.satellite_used[0], self.satellite_used[1], self.satellite_used[2], self.satellite_used[3], self.satellite_used[4], self.satellite_used[5], self.satellite_used[6], self.satellite_used[7], self.satellite_used[8], self.satellite_used[9], self.satellite_used[10], self.satellite_used[11], self.satellite_used[12], self.satellite_used[13], self.satellite_used[14], self.satellite_used[15], self.satellite_used[16], self.satellite_used[17], self.satellite_used[18], self.satellite_used[19], self.satellite_elevation[0], self.satellite_elevation[1], self.satellite_elevation[2], self.satellite_elevation[3], self.satellite_elevation[4], self.satellite_elevation[5], self.satellite_elevation[6], self.satellite_elevation[7], self.satellite_elevation[8], self.satellite_elevation[9], self.satellite_elevation[10], self.satellite_elevation[11], self.satellite_elevation[12], self.satellite_elevation[13], self.satellite_elevation[14], self.satellite_elevation[15], self.satellite_elevation[16], self.satellite_elevation[17], self.satellite_elevation[18], self.satellite_elevation[19], self.satellite_azimuth[0], self.satellite_azimuth[1], self.satellite_azimuth[2], self.satellite_azimuth[3], self.satellite_azimuth[4], self.satellite_azimuth[5], self.satellite_azimuth[6], self.satellite_azimuth[7], self.satellite_azimuth[8], self.satellite_azimuth[9], self.satellite_azimuth[10], self.satellite_azimuth[11], self.satellite_azimuth[12], self.satellite_azimuth[13], self.satellite_azimuth[14], self.satellite_azimuth[15], self.satellite_azimuth[16], self.satellite_azimuth[17], self.satellite_azimuth[18], self.satellite_azimuth[19], self.satellite_snr[0], self.satellite_snr[1], self.satellite_snr[2], self.satellite_snr[3], self.satellite_snr[4], self.satellite_snr[5], self.satellite_snr[6], self.satellite_snr[7], self.satellite_snr[8], self.satellite_snr[9], self.satellite_snr[10], self.satellite_snr[11], self.satellite_snr[12], self.satellite_snr[13], self.satellite_snr[14], self.satellite_snr[15], self.satellite_snr[16], self.satellite_snr[17], self.satellite_snr[18], self.satellite_snr[19]), force_mavlink1=force_mavlink1)
class MAVLink_scaled_imu_message(MAVLink_message):
'''
The RAW IMU readings for the usual 9DOF sensor setup. This
message should contain the scaled values to the described
units
'''
id = MAVLINK_MSG_ID_SCALED_IMU
name = 'SCALED_IMU'
fieldnames = ['time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag']
ordered_fieldnames = [ 'time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag' ]
format = '<Ihhhhhhhhh'
native_format = bytearray('<Ihhhhhhhhh', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 170
def __init__(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
MAVLink_message.__init__(self, MAVLink_scaled_imu_message.id, MAVLink_scaled_imu_message.name)
self._fieldnames = MAVLink_scaled_imu_message.fieldnames
self.time_boot_ms = time_boot_ms
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
self.xgyro = xgyro
self.ygyro = ygyro
self.zgyro = zgyro
self.xmag = xmag
self.ymag = ymag
self.zmag = zmag
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 170, struct.pack('<Ihhhhhhhhh', self.time_boot_ms, self.xacc, self.yacc, self.zacc, self.xgyro, self.ygyro, self.zgyro, self.xmag, self.ymag, self.zmag), force_mavlink1=force_mavlink1)
class MAVLink_raw_imu_message(MAVLink_message):
'''
The RAW IMU readings for the usual 9DOF sensor setup. This
message should always contain the true raw values without any
scaling to allow data capture and system debugging.
'''
id = MAVLINK_MSG_ID_RAW_IMU
name = 'RAW_IMU'
fieldnames = ['time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag']
ordered_fieldnames = [ 'time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag' ]
format = '<Qhhhhhhhhh'
native_format = bytearray('<Qhhhhhhhhh', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 144
def __init__(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
MAVLink_message.__init__(self, MAVLink_raw_imu_message.id, MAVLink_raw_imu_message.name)
self._fieldnames = MAVLink_raw_imu_message.fieldnames
self.time_usec = time_usec
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
self.xgyro = xgyro
self.ygyro = ygyro
self.zgyro = zgyro
self.xmag = xmag
self.ymag = ymag
self.zmag = zmag
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 144, struct.pack('<Qhhhhhhhhh', self.time_usec, self.xacc, self.yacc, self.zacc, self.xgyro, self.ygyro, self.zgyro, self.xmag, self.ymag, self.zmag), force_mavlink1=force_mavlink1)
class MAVLink_raw_pressure_message(MAVLink_message):
'''
The RAW pressure readings for the typical setup of one
absolute pressure and one differential pressure sensor. The
sensor values should be the raw, UNSCALED ADC values.
'''
id = MAVLINK_MSG_ID_RAW_PRESSURE
name = 'RAW_PRESSURE'
fieldnames = ['time_usec', 'press_abs', 'press_diff1', 'press_diff2', 'temperature']
ordered_fieldnames = [ 'time_usec', 'press_abs', 'press_diff1', 'press_diff2', 'temperature' ]
format = '<Qhhhh'
native_format = bytearray('<Qhhhh', 'ascii')
orders = [0, 1, 2, 3, 4]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0]
crc_extra = 67
def __init__(self, time_usec, press_abs, press_diff1, press_diff2, temperature):
MAVLink_message.__init__(self, MAVLink_raw_pressure_message.id, MAVLink_raw_pressure_message.name)
self._fieldnames = MAVLink_raw_pressure_message.fieldnames
self.time_usec = time_usec
self.press_abs = press_abs
self.press_diff1 = press_diff1
self.press_diff2 = press_diff2
self.temperature = temperature
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 67, struct.pack('<Qhhhh', self.time_usec, self.press_abs, self.press_diff1, self.press_diff2, self.temperature), force_mavlink1=force_mavlink1)
class MAVLink_scaled_pressure_message(MAVLink_message):
'''
The pressure readings for the typical setup of one absolute
and differential pressure sensor. The units are as specified
in each field.
'''
id = MAVLINK_MSG_ID_SCALED_PRESSURE
name = 'SCALED_PRESSURE'
fieldnames = ['time_boot_ms', 'press_abs', 'press_diff', 'temperature']
ordered_fieldnames = [ 'time_boot_ms', 'press_abs', 'press_diff', 'temperature' ]
format = '<Iffh'
native_format = bytearray('<Iffh', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 115
def __init__(self, time_boot_ms, press_abs, press_diff, temperature):
MAVLink_message.__init__(self, MAVLink_scaled_pressure_message.id, MAVLink_scaled_pressure_message.name)
self._fieldnames = MAVLink_scaled_pressure_message.fieldnames
self.time_boot_ms = time_boot_ms
self.press_abs = press_abs
self.press_diff = press_diff
self.temperature = temperature
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 115, struct.pack('<Iffh', self.time_boot_ms, self.press_abs, self.press_diff, self.temperature), force_mavlink1=force_mavlink1)
class MAVLink_attitude_message(MAVLink_message):
'''
The attitude in the aeronautical frame (right-handed, Z-down,
X-front, Y-right).
'''
id = MAVLINK_MSG_ID_ATTITUDE
name = 'ATTITUDE'
fieldnames = ['time_boot_ms', 'roll', 'pitch', 'yaw', 'rollspeed', 'pitchspeed', 'yawspeed']
ordered_fieldnames = [ 'time_boot_ms', 'roll', 'pitch', 'yaw', 'rollspeed', 'pitchspeed', 'yawspeed' ]
format = '<Iffffff'
native_format = bytearray('<Iffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 39
def __init__(self, time_boot_ms, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed):
MAVLink_message.__init__(self, MAVLink_attitude_message.id, MAVLink_attitude_message.name)
self._fieldnames = MAVLink_attitude_message.fieldnames
self.time_boot_ms = time_boot_ms
self.roll = roll
self.pitch = pitch
self.yaw = yaw
self.rollspeed = rollspeed
self.pitchspeed = pitchspeed
self.yawspeed = yawspeed
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 39, struct.pack('<Iffffff', self.time_boot_ms, self.roll, self.pitch, self.yaw, self.rollspeed, self.pitchspeed, self.yawspeed), force_mavlink1=force_mavlink1)
class MAVLink_attitude_quaternion_message(MAVLink_message):
'''
The attitude in the aeronautical frame (right-handed, Z-down,
X-front, Y-right), expressed as quaternion. Quaternion order
is w, x, y, z and a zero rotation would be expressed as (1 0 0
0).
'''
id = MAVLINK_MSG_ID_ATTITUDE_QUATERNION
name = 'ATTITUDE_QUATERNION'
fieldnames = ['time_boot_ms', 'q1', 'q2', 'q3', 'q4', 'rollspeed', 'pitchspeed', 'yawspeed']
ordered_fieldnames = [ 'time_boot_ms', 'q1', 'q2', 'q3', 'q4', 'rollspeed', 'pitchspeed', 'yawspeed' ]
format = '<Ifffffff'
native_format = bytearray('<Ifffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7]
lengths = [1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 246
def __init__(self, time_boot_ms, q1, q2, q3, q4, rollspeed, pitchspeed, yawspeed):
MAVLink_message.__init__(self, MAVLink_attitude_quaternion_message.id, MAVLink_attitude_quaternion_message.name)
self._fieldnames = MAVLink_attitude_quaternion_message.fieldnames
self.time_boot_ms = time_boot_ms
self.q1 = q1
self.q2 = q2
self.q3 = q3
self.q4 = q4
self.rollspeed = rollspeed
self.pitchspeed = pitchspeed
self.yawspeed = yawspeed
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 246, struct.pack('<Ifffffff', self.time_boot_ms, self.q1, self.q2, self.q3, self.q4, self.rollspeed, self.pitchspeed, self.yawspeed), force_mavlink1=force_mavlink1)
class MAVLink_local_position_ned_message(MAVLink_message):
'''
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed, Z-axis down
(aeronautical frame, NED / north-east-down convention)
'''
id = MAVLINK_MSG_ID_LOCAL_POSITION_NED
name = 'LOCAL_POSITION_NED'
fieldnames = ['time_boot_ms', 'x', 'y', 'z', 'vx', 'vy', 'vz']
ordered_fieldnames = [ 'time_boot_ms', 'x', 'y', 'z', 'vx', 'vy', 'vz' ]
format = '<Iffffff'
native_format = bytearray('<Iffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 185
def __init__(self, time_boot_ms, x, y, z, vx, vy, vz):
MAVLink_message.__init__(self, MAVLink_local_position_ned_message.id, MAVLink_local_position_ned_message.name)
self._fieldnames = MAVLink_local_position_ned_message.fieldnames
self.time_boot_ms = time_boot_ms
self.x = x
self.y = y
self.z = z
self.vx = vx
self.vy = vy
self.vz = vz
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 185, struct.pack('<Iffffff', self.time_boot_ms, self.x, self.y, self.z, self.vx, self.vy, self.vz), force_mavlink1=force_mavlink1)
class MAVLink_global_position_int_message(MAVLink_message):
'''
The filtered global position (e.g. fused GPS and
accelerometers). The position is in GPS-frame (right-handed,
Z-up). It is designed as scaled integer message
since the resolution of float is not sufficient.
'''
id = MAVLINK_MSG_ID_GLOBAL_POSITION_INT
name = 'GLOBAL_POSITION_INT'
fieldnames = ['time_boot_ms', 'lat', 'lon', 'alt', 'relative_alt', 'vx', 'vy', 'vz', 'hdg']
ordered_fieldnames = [ 'time_boot_ms', 'lat', 'lon', 'alt', 'relative_alt', 'vx', 'vy', 'vz', 'hdg' ]
format = '<IiiiihhhH'
native_format = bytearray('<IiiiihhhH', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 104
def __init__(self, time_boot_ms, lat, lon, alt, relative_alt, vx, vy, vz, hdg):
MAVLink_message.__init__(self, MAVLink_global_position_int_message.id, MAVLink_global_position_int_message.name)
self._fieldnames = MAVLink_global_position_int_message.fieldnames
self.time_boot_ms = time_boot_ms
self.lat = lat
self.lon = lon
self.alt = alt
self.relative_alt = relative_alt
self.vx = vx
self.vy = vy
self.vz = vz
self.hdg = hdg
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 104, struct.pack('<IiiiihhhH', self.time_boot_ms, self.lat, self.lon, self.alt, self.relative_alt, self.vx, self.vy, self.vz, self.hdg), force_mavlink1=force_mavlink1)
class MAVLink_rc_channels_scaled_message(MAVLink_message):
'''
The scaled values of the RC channels received. (-100%) -10000,
(0%) 0, (100%) 10000. Channels that are inactive should be set
to UINT16_MAX.
'''
id = MAVLINK_MSG_ID_RC_CHANNELS_SCALED
name = 'RC_CHANNELS_SCALED'
fieldnames = ['time_boot_ms', 'port', 'chan1_scaled', 'chan2_scaled', 'chan3_scaled', 'chan4_scaled', 'chan5_scaled', 'chan6_scaled', 'chan7_scaled', 'chan8_scaled', 'rssi']
ordered_fieldnames = [ 'time_boot_ms', 'chan1_scaled', 'chan2_scaled', 'chan3_scaled', 'chan4_scaled', 'chan5_scaled', 'chan6_scaled', 'chan7_scaled', 'chan8_scaled', 'port', 'rssi' ]
format = '<IhhhhhhhhBB'
native_format = bytearray('<IhhhhhhhhBB', 'ascii')
orders = [0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 237
def __init__(self, time_boot_ms, port, chan1_scaled, chan2_scaled, chan3_scaled, chan4_scaled, chan5_scaled, chan6_scaled, chan7_scaled, chan8_scaled, rssi):
MAVLink_message.__init__(self, MAVLink_rc_channels_scaled_message.id, MAVLink_rc_channels_scaled_message.name)
self._fieldnames = MAVLink_rc_channels_scaled_message.fieldnames
self.time_boot_ms = time_boot_ms
self.port = port
self.chan1_scaled = chan1_scaled
self.chan2_scaled = chan2_scaled
self.chan3_scaled = chan3_scaled
self.chan4_scaled = chan4_scaled
self.chan5_scaled = chan5_scaled
self.chan6_scaled = chan6_scaled
self.chan7_scaled = chan7_scaled
self.chan8_scaled = chan8_scaled
self.rssi = rssi
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 237, struct.pack('<IhhhhhhhhBB', self.time_boot_ms, self.chan1_scaled, self.chan2_scaled, self.chan3_scaled, self.chan4_scaled, self.chan5_scaled, self.chan6_scaled, self.chan7_scaled, self.chan8_scaled, self.port, self.rssi), force_mavlink1=force_mavlink1)
class MAVLink_rc_channels_raw_message(MAVLink_message):
'''
The RAW values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%. Individual receivers/transmitters might
violate this specification.
'''
id = MAVLINK_MSG_ID_RC_CHANNELS_RAW
name = 'RC_CHANNELS_RAW'
fieldnames = ['time_boot_ms', 'port', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'rssi']
ordered_fieldnames = [ 'time_boot_ms', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'port', 'rssi' ]
format = '<IHHHHHHHHBB'
native_format = bytearray('<IHHHHHHHHBB', 'ascii')
orders = [0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 244
def __init__(self, time_boot_ms, port, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, rssi):
MAVLink_message.__init__(self, MAVLink_rc_channels_raw_message.id, MAVLink_rc_channels_raw_message.name)
self._fieldnames = MAVLink_rc_channels_raw_message.fieldnames
self.time_boot_ms = time_boot_ms
self.port = port
self.chan1_raw = chan1_raw
self.chan2_raw = chan2_raw
self.chan3_raw = chan3_raw
self.chan4_raw = chan4_raw
self.chan5_raw = chan5_raw
self.chan6_raw = chan6_raw
self.chan7_raw = chan7_raw
self.chan8_raw = chan8_raw
self.rssi = rssi
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 244, struct.pack('<IHHHHHHHHBB', self.time_boot_ms, self.chan1_raw, self.chan2_raw, self.chan3_raw, self.chan4_raw, self.chan5_raw, self.chan6_raw, self.chan7_raw, self.chan8_raw, self.port, self.rssi), force_mavlink1=force_mavlink1)
class MAVLink_servo_output_raw_message(MAVLink_message):
'''
The RAW values of the servo outputs (for RC input from the
remote, use the RC_CHANNELS messages). The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%.
'''
id = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW
name = 'SERVO_OUTPUT_RAW'
fieldnames = ['time_usec', 'port', 'servo1_raw', 'servo2_raw', 'servo3_raw', 'servo4_raw', 'servo5_raw', 'servo6_raw', 'servo7_raw', 'servo8_raw', 'servo9_raw', 'servo10_raw', 'servo11_raw', 'servo12_raw', 'servo13_raw', 'servo14_raw', 'servo15_raw', 'servo16_raw']
ordered_fieldnames = [ 'time_usec', 'servo1_raw', 'servo2_raw', 'servo3_raw', 'servo4_raw', 'servo5_raw', 'servo6_raw', 'servo7_raw', 'servo8_raw', 'port', 'servo9_raw', 'servo10_raw', 'servo11_raw', 'servo12_raw', 'servo13_raw', 'servo14_raw', 'servo15_raw', 'servo16_raw' ]
format = '<IHHHHHHHHBHHHHHHHH'
native_format = bytearray('<IHHHHHHHHBHHHHHHHH', 'ascii')
orders = [0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 222
def __init__(self, time_usec, port, servo1_raw, servo2_raw, servo3_raw, servo4_raw, servo5_raw, servo6_raw, servo7_raw, servo8_raw, servo9_raw=0, servo10_raw=0, servo11_raw=0, servo12_raw=0, servo13_raw=0, servo14_raw=0, servo15_raw=0, servo16_raw=0):
MAVLink_message.__init__(self, MAVLink_servo_output_raw_message.id, MAVLink_servo_output_raw_message.name)
self._fieldnames = MAVLink_servo_output_raw_message.fieldnames
self.time_usec = time_usec
self.port = port
self.servo1_raw = servo1_raw
self.servo2_raw = servo2_raw
self.servo3_raw = servo3_raw
self.servo4_raw = servo4_raw
self.servo5_raw = servo5_raw
self.servo6_raw = servo6_raw
self.servo7_raw = servo7_raw
self.servo8_raw = servo8_raw
self.servo9_raw = servo9_raw
self.servo10_raw = servo10_raw
self.servo11_raw = servo11_raw
self.servo12_raw = servo12_raw
self.servo13_raw = servo13_raw
self.servo14_raw = servo14_raw
self.servo15_raw = servo15_raw
self.servo16_raw = servo16_raw
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 222, struct.pack('<IHHHHHHHHBHHHHHHHH', self.time_usec, self.servo1_raw, self.servo2_raw, self.servo3_raw, self.servo4_raw, self.servo5_raw, self.servo6_raw, self.servo7_raw, self.servo8_raw, self.port, self.servo9_raw, self.servo10_raw, self.servo11_raw, self.servo12_raw, self.servo13_raw, self.servo14_raw, self.servo15_raw, self.servo16_raw), force_mavlink1=force_mavlink1)
class MAVLink_mission_request_partial_list_message(MAVLink_message):
'''
Request a partial list of mission items from the
system/component. https://mavlink.io/en/protocol/mission.html.
If start and end index are the same, just send one waypoint.
'''
id = MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST
name = 'MISSION_REQUEST_PARTIAL_LIST'
fieldnames = ['target_system', 'target_component', 'start_index', 'end_index', 'mission_type']
ordered_fieldnames = [ 'start_index', 'end_index', 'target_system', 'target_component', 'mission_type' ]
format = '<hhBBB'
native_format = bytearray('<hhBBB', 'ascii')
orders = [2, 3, 0, 1, 4]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0]
crc_extra = 212
def __init__(self, target_system, target_component, start_index, end_index, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_request_partial_list_message.id, MAVLink_mission_request_partial_list_message.name)
self._fieldnames = MAVLink_mission_request_partial_list_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.start_index = start_index
self.end_index = end_index
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 212, struct.pack('<hhBBB', self.start_index, self.end_index, self.target_system, self.target_component, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_mission_write_partial_list_message(MAVLink_message):
'''
This message is sent to the MAV to write a partial list. If
start index == end index, only one item will be transmitted /
updated. If the start index is NOT 0 and above the current
list size, this request should be REJECTED!
'''
id = MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST
name = 'MISSION_WRITE_PARTIAL_LIST'
fieldnames = ['target_system', 'target_component', 'start_index', 'end_index', 'mission_type']
ordered_fieldnames = [ 'start_index', 'end_index', 'target_system', 'target_component', 'mission_type' ]
format = '<hhBBB'
native_format = bytearray('<hhBBB', 'ascii')
orders = [2, 3, 0, 1, 4]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0]
crc_extra = 9
def __init__(self, target_system, target_component, start_index, end_index, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_write_partial_list_message.id, MAVLink_mission_write_partial_list_message.name)
self._fieldnames = MAVLink_mission_write_partial_list_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.start_index = start_index
self.end_index = end_index
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 9, struct.pack('<hhBBB', self.start_index, self.end_index, self.target_system, self.target_component, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_mission_item_message(MAVLink_message):
'''
Message encoding a mission item. This message is emitted to
announce the presence of a mission item and to
set a mission item on the system. The mission item can be
either in x, y, z meters (type: LOCAL) or x:lat, y:lon,
z:altitude. Local frame is Z-down, right handed (NED), global
frame is Z-up, right handed (ENU). See also
https://mavlink.io/en/protocol/mission.html.
'''
id = MAVLINK_MSG_ID_MISSION_ITEM
name = 'MISSION_ITEM'
fieldnames = ['target_system', 'target_component', 'seq', 'frame', 'command', 'current', 'autocontinue', 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z', 'mission_type']
ordered_fieldnames = [ 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z', 'seq', 'command', 'target_system', 'target_component', 'frame', 'current', 'autocontinue', 'mission_type' ]
format = '<fffffffHHBBBBBB'
native_format = bytearray('<fffffffHHBBBBBB', 'ascii')
orders = [9, 10, 7, 11, 8, 12, 13, 0, 1, 2, 3, 4, 5, 6, 14]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 254
def __init__(self, target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_item_message.id, MAVLink_mission_item_message.name)
self._fieldnames = MAVLink_mission_item_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.seq = seq
self.frame = frame
self.command = command
self.current = current
self.autocontinue = autocontinue
self.param1 = param1
self.param2 = param2
self.param3 = param3
self.param4 = param4
self.x = x
self.y = y
self.z = z
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 254, struct.pack('<fffffffHHBBBBBB', self.param1, self.param2, self.param3, self.param4, self.x, self.y, self.z, self.seq, self.command, self.target_system, self.target_component, self.frame, self.current, self.autocontinue, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_mission_request_message(MAVLink_message):
'''
Request the information of the mission item with the sequence
number seq. The response of the system to this message should
be a MISSION_ITEM message.
https://mavlink.io/en/protocol/mission.html
'''
id = MAVLINK_MSG_ID_MISSION_REQUEST
name = 'MISSION_REQUEST'
fieldnames = ['target_system', 'target_component', 'seq', 'mission_type']
ordered_fieldnames = [ 'seq', 'target_system', 'target_component', 'mission_type' ]
format = '<HBBB'
native_format = bytearray('<HBBB', 'ascii')
orders = [1, 2, 0, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 230
def __init__(self, target_system, target_component, seq, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_request_message.id, MAVLink_mission_request_message.name)
self._fieldnames = MAVLink_mission_request_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.seq = seq
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 230, struct.pack('<HBBB', self.seq, self.target_system, self.target_component, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_mission_set_current_message(MAVLink_message):
'''
Set the mission item with sequence number seq as current item.
This means that the MAV will continue to this mission item on
the shortest path (not following the mission items in-
between).
'''
id = MAVLINK_MSG_ID_MISSION_SET_CURRENT
name = 'MISSION_SET_CURRENT'
fieldnames = ['target_system', 'target_component', 'seq']
ordered_fieldnames = [ 'seq', 'target_system', 'target_component' ]
format = '<HBB'
native_format = bytearray('<HBB', 'ascii')
orders = [1, 2, 0]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 28
def __init__(self, target_system, target_component, seq):
MAVLink_message.__init__(self, MAVLink_mission_set_current_message.id, MAVLink_mission_set_current_message.name)
self._fieldnames = MAVLink_mission_set_current_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.seq = seq
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 28, struct.pack('<HBB', self.seq, self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_mission_current_message(MAVLink_message):
'''
Message that announces the sequence number of the current
active mission item. The MAV will fly towards this mission
item.
'''
id = MAVLINK_MSG_ID_MISSION_CURRENT
name = 'MISSION_CURRENT'
fieldnames = ['seq']
ordered_fieldnames = [ 'seq' ]
format = '<H'
native_format = bytearray('<H', 'ascii')
orders = [0]
lengths = [1]
array_lengths = [0]
crc_extra = 28
def __init__(self, seq):
MAVLink_message.__init__(self, MAVLink_mission_current_message.id, MAVLink_mission_current_message.name)
self._fieldnames = MAVLink_mission_current_message.fieldnames
self.seq = seq
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 28, struct.pack('<H', self.seq), force_mavlink1=force_mavlink1)
class MAVLink_mission_request_list_message(MAVLink_message):
'''
Request the overall list of mission items from the
system/component.
'''
id = MAVLINK_MSG_ID_MISSION_REQUEST_LIST
name = 'MISSION_REQUEST_LIST'
fieldnames = ['target_system', 'target_component', 'mission_type']
ordered_fieldnames = [ 'target_system', 'target_component', 'mission_type' ]
format = '<BBB'
native_format = bytearray('<BBB', 'ascii')
orders = [0, 1, 2]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 132
def __init__(self, target_system, target_component, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_request_list_message.id, MAVLink_mission_request_list_message.name)
self._fieldnames = MAVLink_mission_request_list_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 132, struct.pack('<BBB', self.target_system, self.target_component, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_mission_count_message(MAVLink_message):
'''
This message is emitted as response to MISSION_REQUEST_LIST by
the MAV and to initiate a write transaction. The GCS can then
request the individual mission item based on the knowledge of
the total number of waypoints.
'''
id = MAVLINK_MSG_ID_MISSION_COUNT
name = 'MISSION_COUNT'
fieldnames = ['target_system', 'target_component', 'count', 'mission_type']
ordered_fieldnames = [ 'count', 'target_system', 'target_component', 'mission_type' ]
format = '<HBBB'
native_format = bytearray('<HBBB', 'ascii')
orders = [1, 2, 0, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 221
def __init__(self, target_system, target_component, count, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_count_message.id, MAVLink_mission_count_message.name)
self._fieldnames = MAVLink_mission_count_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.count = count
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 221, struct.pack('<HBBB', self.count, self.target_system, self.target_component, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_mission_clear_all_message(MAVLink_message):
'''
Delete all mission items at once.
'''
id = MAVLINK_MSG_ID_MISSION_CLEAR_ALL
name = 'MISSION_CLEAR_ALL'
fieldnames = ['target_system', 'target_component', 'mission_type']
ordered_fieldnames = [ 'target_system', 'target_component', 'mission_type' ]
format = '<BBB'
native_format = bytearray('<BBB', 'ascii')
orders = [0, 1, 2]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 232
def __init__(self, target_system, target_component, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_clear_all_message.id, MAVLink_mission_clear_all_message.name)
self._fieldnames = MAVLink_mission_clear_all_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 232, struct.pack('<BBB', self.target_system, self.target_component, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_mission_item_reached_message(MAVLink_message):
'''
A certain mission item has been reached. The system will
either hold this position (or circle on the orbit) or (if the
autocontinue on the WP was set) continue to the next waypoint.
'''
id = MAVLINK_MSG_ID_MISSION_ITEM_REACHED
name = 'MISSION_ITEM_REACHED'
fieldnames = ['seq']
ordered_fieldnames = [ 'seq' ]
format = '<H'
native_format = bytearray('<H', 'ascii')
orders = [0]
lengths = [1]
array_lengths = [0]
crc_extra = 11
def __init__(self, seq):
MAVLink_message.__init__(self, MAVLink_mission_item_reached_message.id, MAVLink_mission_item_reached_message.name)
self._fieldnames = MAVLink_mission_item_reached_message.fieldnames
self.seq = seq
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 11, struct.pack('<H', self.seq), force_mavlink1=force_mavlink1)
class MAVLink_mission_ack_message(MAVLink_message):
'''
Ack message during waypoint handling. The type field states if
this message is a positive ack (type=0) or if an error
happened (type=non-zero).
'''
id = MAVLINK_MSG_ID_MISSION_ACK
name = 'MISSION_ACK'
fieldnames = ['target_system', 'target_component', 'type', 'mission_type']
ordered_fieldnames = [ 'target_system', 'target_component', 'type', 'mission_type' ]
format = '<BBBB'
native_format = bytearray('<BBBB', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 153
def __init__(self, target_system, target_component, type, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_ack_message.id, MAVLink_mission_ack_message.name)
self._fieldnames = MAVLink_mission_ack_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.type = type
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 153, struct.pack('<BBBB', self.target_system, self.target_component, self.type, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_set_gps_global_origin_message(MAVLink_message):
'''
As local waypoints exist, the global waypoint reference allows
to transform between the local coordinate frame and the global
(GPS) coordinate frame. This can be necessary when e.g. in-
and outdoor settings are connected and the MAV should move
from in- to outdoor.
'''
id = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN
name = 'SET_GPS_GLOBAL_ORIGIN'
fieldnames = ['target_system', 'latitude', 'longitude', 'altitude', 'time_usec']
ordered_fieldnames = [ 'latitude', 'longitude', 'altitude', 'target_system', 'time_usec' ]
format = '<iiiBQ'
native_format = bytearray('<iiiBQ', 'ascii')
orders = [3, 0, 1, 2, 4]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0]
crc_extra = 41
def __init__(self, target_system, latitude, longitude, altitude, time_usec=0):
MAVLink_message.__init__(self, MAVLink_set_gps_global_origin_message.id, MAVLink_set_gps_global_origin_message.name)
self._fieldnames = MAVLink_set_gps_global_origin_message.fieldnames
self.target_system = target_system
self.latitude = latitude
self.longitude = longitude
self.altitude = altitude
self.time_usec = time_usec
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 41, struct.pack('<iiiBQ', self.latitude, self.longitude, self.altitude, self.target_system, self.time_usec), force_mavlink1=force_mavlink1)
class MAVLink_gps_global_origin_message(MAVLink_message):
'''
Once the MAV sets a new GPS-Local correspondence, this message
announces the origin (0,0,0) position
'''
id = MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
name = 'GPS_GLOBAL_ORIGIN'
fieldnames = ['latitude', 'longitude', 'altitude', 'time_usec']
ordered_fieldnames = [ 'latitude', 'longitude', 'altitude', 'time_usec' ]
format = '<iiiQ'
native_format = bytearray('<iiiQ', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 39
def __init__(self, latitude, longitude, altitude, time_usec=0):
MAVLink_message.__init__(self, MAVLink_gps_global_origin_message.id, MAVLink_gps_global_origin_message.name)
self._fieldnames = MAVLink_gps_global_origin_message.fieldnames
self.latitude = latitude
self.longitude = longitude
self.altitude = altitude
self.time_usec = time_usec
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 39, struct.pack('<iiiQ', self.latitude, self.longitude, self.altitude, self.time_usec), force_mavlink1=force_mavlink1)
class MAVLink_param_map_rc_message(MAVLink_message):
'''
Bind a RC channel to a parameter. The parameter should change
accoding to the RC channel value.
'''
id = MAVLINK_MSG_ID_PARAM_MAP_RC
name = 'PARAM_MAP_RC'
fieldnames = ['target_system', 'target_component', 'param_id', 'param_index', 'parameter_rc_channel_index', 'param_value0', 'scale', 'param_value_min', 'param_value_max']
ordered_fieldnames = [ 'param_value0', 'scale', 'param_value_min', 'param_value_max', 'param_index', 'target_system', 'target_component', 'param_id', 'parameter_rc_channel_index' ]
format = '<ffffhBB16sB'
native_format = bytearray('<ffffhBBcB', 'ascii')
orders = [5, 6, 7, 4, 8, 0, 1, 2, 3]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 16, 0]
crc_extra = 78
def __init__(self, target_system, target_component, param_id, param_index, parameter_rc_channel_index, param_value0, scale, param_value_min, param_value_max):
MAVLink_message.__init__(self, MAVLink_param_map_rc_message.id, MAVLink_param_map_rc_message.name)
self._fieldnames = MAVLink_param_map_rc_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.param_id = param_id
self.param_index = param_index
self.parameter_rc_channel_index = parameter_rc_channel_index
self.param_value0 = param_value0
self.scale = scale
self.param_value_min = param_value_min
self.param_value_max = param_value_max
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 78, struct.pack('<ffffhBB16sB', self.param_value0, self.scale, self.param_value_min, self.param_value_max, self.param_index, self.target_system, self.target_component, self.param_id, self.parameter_rc_channel_index), force_mavlink1=force_mavlink1)
class MAVLink_mission_request_int_message(MAVLink_message):
'''
Request the information of the mission item with the sequence
number seq. The response of the system to this message should
be a MISSION_ITEM_INT message.
https://mavlink.io/en/protocol/mission.html
'''
id = MAVLINK_MSG_ID_MISSION_REQUEST_INT
name = 'MISSION_REQUEST_INT'
fieldnames = ['target_system', 'target_component', 'seq', 'mission_type']
ordered_fieldnames = [ 'seq', 'target_system', 'target_component', 'mission_type' ]
format = '<HBBB'
native_format = bytearray('<HBBB', 'ascii')
orders = [1, 2, 0, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 196
def __init__(self, target_system, target_component, seq, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_request_int_message.id, MAVLink_mission_request_int_message.name)
self._fieldnames = MAVLink_mission_request_int_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.seq = seq
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 196, struct.pack('<HBBB', self.seq, self.target_system, self.target_component, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_safety_set_allowed_area_message(MAVLink_message):
'''
Set a safety zone (volume), which is defined by two corners of
a cube. This message can be used to tell the MAV which
setpoints/waypoints to accept and which to reject. Safety
areas are often enforced by national or competition
regulations.
'''
id = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
name = 'SAFETY_SET_ALLOWED_AREA'
fieldnames = ['target_system', 'target_component', 'frame', 'p1x', 'p1y', 'p1z', 'p2x', 'p2y', 'p2z']
ordered_fieldnames = [ 'p1x', 'p1y', 'p1z', 'p2x', 'p2y', 'p2z', 'target_system', 'target_component', 'frame' ]
format = '<ffffffBBB'
native_format = bytearray('<ffffffBBB', 'ascii')
orders = [6, 7, 8, 0, 1, 2, 3, 4, 5]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 15
def __init__(self, target_system, target_component, frame, p1x, p1y, p1z, p2x, p2y, p2z):
MAVLink_message.__init__(self, MAVLink_safety_set_allowed_area_message.id, MAVLink_safety_set_allowed_area_message.name)
self._fieldnames = MAVLink_safety_set_allowed_area_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.frame = frame
self.p1x = p1x
self.p1y = p1y
self.p1z = p1z
self.p2x = p2x
self.p2y = p2y
self.p2z = p2z
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 15, struct.pack('<ffffffBBB', self.p1x, self.p1y, self.p1z, self.p2x, self.p2y, self.p2z, self.target_system, self.target_component, self.frame), force_mavlink1=force_mavlink1)
class MAVLink_safety_allowed_area_message(MAVLink_message):
'''
Read out the safety zone the MAV currently assumes.
'''
id = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
name = 'SAFETY_ALLOWED_AREA'
fieldnames = ['frame', 'p1x', 'p1y', 'p1z', 'p2x', 'p2y', 'p2z']
ordered_fieldnames = [ 'p1x', 'p1y', 'p1z', 'p2x', 'p2y', 'p2z', 'frame' ]
format = '<ffffffB'
native_format = bytearray('<ffffffB', 'ascii')
orders = [6, 0, 1, 2, 3, 4, 5]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 3
def __init__(self, frame, p1x, p1y, p1z, p2x, p2y, p2z):
MAVLink_message.__init__(self, MAVLink_safety_allowed_area_message.id, MAVLink_safety_allowed_area_message.name)
self._fieldnames = MAVLink_safety_allowed_area_message.fieldnames
self.frame = frame
self.p1x = p1x
self.p1y = p1y
self.p1z = p1z
self.p2x = p2x
self.p2y = p2y
self.p2z = p2z
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 3, struct.pack('<ffffffB', self.p1x, self.p1y, self.p1z, self.p2x, self.p2y, self.p2z, self.frame), force_mavlink1=force_mavlink1)
class MAVLink_attitude_quaternion_cov_message(MAVLink_message):
'''
The attitude in the aeronautical frame (right-handed, Z-down,
X-front, Y-right), expressed as quaternion. Quaternion order
is w, x, y, z and a zero rotation would be expressed as (1 0 0
0).
'''
id = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV
name = 'ATTITUDE_QUATERNION_COV'
fieldnames = ['time_usec', 'q', 'rollspeed', 'pitchspeed', 'yawspeed', 'covariance']
ordered_fieldnames = [ 'time_usec', 'q', 'rollspeed', 'pitchspeed', 'yawspeed', 'covariance' ]
format = '<Q4ffff9f'
native_format = bytearray('<Qfffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5]
lengths = [1, 4, 1, 1, 1, 9]
array_lengths = [0, 4, 0, 0, 0, 9]
crc_extra = 167
def __init__(self, time_usec, q, rollspeed, pitchspeed, yawspeed, covariance):
MAVLink_message.__init__(self, MAVLink_attitude_quaternion_cov_message.id, MAVLink_attitude_quaternion_cov_message.name)
self._fieldnames = MAVLink_attitude_quaternion_cov_message.fieldnames
self.time_usec = time_usec
self.q = q
self.rollspeed = rollspeed
self.pitchspeed = pitchspeed
self.yawspeed = yawspeed
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 167, struct.pack('<Q4ffff9f', self.time_usec, self.q[0], self.q[1], self.q[2], self.q[3], self.rollspeed, self.pitchspeed, self.yawspeed, self.covariance[0], self.covariance[1], self.covariance[2], self.covariance[3], self.covariance[4], self.covariance[5], self.covariance[6], self.covariance[7], self.covariance[8]), force_mavlink1=force_mavlink1)
class MAVLink_nav_controller_output_message(MAVLink_message):
'''
The state of the fixed wing navigation and position
controller.
'''
id = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT
name = 'NAV_CONTROLLER_OUTPUT'
fieldnames = ['nav_roll', 'nav_pitch', 'nav_bearing', 'target_bearing', 'wp_dist', 'alt_error', 'aspd_error', 'xtrack_error']
ordered_fieldnames = [ 'nav_roll', 'nav_pitch', 'alt_error', 'aspd_error', 'xtrack_error', 'nav_bearing', 'target_bearing', 'wp_dist' ]
format = '<fffffhhH'
native_format = bytearray('<fffffhhH', 'ascii')
orders = [0, 1, 5, 6, 7, 2, 3, 4]
lengths = [1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 183
def __init__(self, nav_roll, nav_pitch, nav_bearing, target_bearing, wp_dist, alt_error, aspd_error, xtrack_error):
MAVLink_message.__init__(self, MAVLink_nav_controller_output_message.id, MAVLink_nav_controller_output_message.name)
self._fieldnames = MAVLink_nav_controller_output_message.fieldnames
self.nav_roll = nav_roll
self.nav_pitch = nav_pitch
self.nav_bearing = nav_bearing
self.target_bearing = target_bearing
self.wp_dist = wp_dist
self.alt_error = alt_error
self.aspd_error = aspd_error
self.xtrack_error = xtrack_error
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 183, struct.pack('<fffffhhH', self.nav_roll, self.nav_pitch, self.alt_error, self.aspd_error, self.xtrack_error, self.nav_bearing, self.target_bearing, self.wp_dist), force_mavlink1=force_mavlink1)
class MAVLink_global_position_int_cov_message(MAVLink_message):
'''
The filtered global position (e.g. fused GPS and
accelerometers). The position is in GPS-frame (right-handed,
Z-up). It is designed as scaled integer message since the
resolution of float is not sufficient. NOTE: This message is
intended for onboard networks / companion computers and
higher-bandwidth links and optimized for accuracy and
completeness. Please use the GLOBAL_POSITION_INT message for a
minimal subset.
'''
id = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV
name = 'GLOBAL_POSITION_INT_COV'
fieldnames = ['time_usec', 'estimator_type', 'lat', 'lon', 'alt', 'relative_alt', 'vx', 'vy', 'vz', 'covariance']
ordered_fieldnames = [ 'time_usec', 'lat', 'lon', 'alt', 'relative_alt', 'vx', 'vy', 'vz', 'covariance', 'estimator_type' ]
format = '<Qiiiifff36fB'
native_format = bytearray('<QiiiiffffB', 'ascii')
orders = [0, 9, 1, 2, 3, 4, 5, 6, 7, 8]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 36, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 36, 0]
crc_extra = 119
def __init__(self, time_usec, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance):
MAVLink_message.__init__(self, MAVLink_global_position_int_cov_message.id, MAVLink_global_position_int_cov_message.name)
self._fieldnames = MAVLink_global_position_int_cov_message.fieldnames
self.time_usec = time_usec
self.estimator_type = estimator_type
self.lat = lat
self.lon = lon
self.alt = alt
self.relative_alt = relative_alt
self.vx = vx
self.vy = vy
self.vz = vz
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 119, struct.pack('<Qiiiifff36fB', self.time_usec, self.lat, self.lon, self.alt, self.relative_alt, self.vx, self.vy, self.vz, self.covariance[0], self.covariance[1], self.covariance[2], self.covariance[3], self.covariance[4], self.covariance[5], self.covariance[6], self.covariance[7], self.covariance[8], self.covariance[9], self.covariance[10], self.covariance[11], self.covariance[12], self.covariance[13], self.covariance[14], self.covariance[15], self.covariance[16], self.covariance[17], self.covariance[18], self.covariance[19], self.covariance[20], self.covariance[21], self.covariance[22], self.covariance[23], self.covariance[24], self.covariance[25], self.covariance[26], self.covariance[27], self.covariance[28], self.covariance[29], self.covariance[30], self.covariance[31], self.covariance[32], self.covariance[33], self.covariance[34], self.covariance[35], self.estimator_type), force_mavlink1=force_mavlink1)
class MAVLink_local_position_ned_cov_message(MAVLink_message):
'''
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed, Z-axis down
(aeronautical frame, NED / north-east-down convention)
'''
id = MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV
name = 'LOCAL_POSITION_NED_COV'
fieldnames = ['time_usec', 'estimator_type', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'ax', 'ay', 'az', 'covariance']
ordered_fieldnames = [ 'time_usec', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'ax', 'ay', 'az', 'covariance', 'estimator_type' ]
format = '<Qfffffffff45fB'
native_format = bytearray('<QffffffffffB', 'ascii')
orders = [0, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0]
crc_extra = 191
def __init__(self, time_usec, estimator_type, x, y, z, vx, vy, vz, ax, ay, az, covariance):
MAVLink_message.__init__(self, MAVLink_local_position_ned_cov_message.id, MAVLink_local_position_ned_cov_message.name)
self._fieldnames = MAVLink_local_position_ned_cov_message.fieldnames
self.time_usec = time_usec
self.estimator_type = estimator_type
self.x = x
self.y = y
self.z = z
self.vx = vx
self.vy = vy
self.vz = vz
self.ax = ax
self.ay = ay
self.az = az
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 191, struct.pack('<Qfffffffff45fB', self.time_usec, self.x, self.y, self.z, self.vx, self.vy, self.vz, self.ax, self.ay, self.az, self.covariance[0], self.covariance[1], self.covariance[2], self.covariance[3], self.covariance[4], self.covariance[5], self.covariance[6], self.covariance[7], self.covariance[8], self.covariance[9], self.covariance[10], self.covariance[11], self.covariance[12], self.covariance[13], self.covariance[14], self.covariance[15], self.covariance[16], self.covariance[17], self.covariance[18], self.covariance[19], self.covariance[20], self.covariance[21], self.covariance[22], self.covariance[23], self.covariance[24], self.covariance[25], self.covariance[26], self.covariance[27], self.covariance[28], self.covariance[29], self.covariance[30], self.covariance[31], self.covariance[32], self.covariance[33], self.covariance[34], self.covariance[35], self.covariance[36], self.covariance[37], self.covariance[38], self.covariance[39], self.covariance[40], self.covariance[41], self.covariance[42], self.covariance[43], self.covariance[44], self.estimator_type), force_mavlink1=force_mavlink1)
class MAVLink_rc_channels_message(MAVLink_message):
'''
The PPM values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%. Individual receivers/transmitters might
violate this specification.
'''
id = MAVLINK_MSG_ID_RC_CHANNELS
name = 'RC_CHANNELS'
fieldnames = ['time_boot_ms', 'chancount', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'chan9_raw', 'chan10_raw', 'chan11_raw', 'chan12_raw', 'chan13_raw', 'chan14_raw', 'chan15_raw', 'chan16_raw', 'chan17_raw', 'chan18_raw', 'rssi']
ordered_fieldnames = [ 'time_boot_ms', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'chan9_raw', 'chan10_raw', 'chan11_raw', 'chan12_raw', 'chan13_raw', 'chan14_raw', 'chan15_raw', 'chan16_raw', 'chan17_raw', 'chan18_raw', 'chancount', 'rssi' ]
format = '<IHHHHHHHHHHHHHHHHHHBB'
native_format = bytearray('<IHHHHHHHHHHHHHHHHHHBB', 'ascii')
orders = [0, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 118
def __init__(self, time_boot_ms, chancount, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, chan13_raw, chan14_raw, chan15_raw, chan16_raw, chan17_raw, chan18_raw, rssi):
MAVLink_message.__init__(self, MAVLink_rc_channels_message.id, MAVLink_rc_channels_message.name)
self._fieldnames = MAVLink_rc_channels_message.fieldnames
self.time_boot_ms = time_boot_ms
self.chancount = chancount
self.chan1_raw = chan1_raw
self.chan2_raw = chan2_raw
self.chan3_raw = chan3_raw
self.chan4_raw = chan4_raw
self.chan5_raw = chan5_raw
self.chan6_raw = chan6_raw
self.chan7_raw = chan7_raw
self.chan8_raw = chan8_raw
self.chan9_raw = chan9_raw
self.chan10_raw = chan10_raw
self.chan11_raw = chan11_raw
self.chan12_raw = chan12_raw
self.chan13_raw = chan13_raw
self.chan14_raw = chan14_raw
self.chan15_raw = chan15_raw
self.chan16_raw = chan16_raw
self.chan17_raw = chan17_raw
self.chan18_raw = chan18_raw
self.rssi = rssi
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 118, struct.pack('<IHHHHHHHHHHHHHHHHHHBB', self.time_boot_ms, self.chan1_raw, self.chan2_raw, self.chan3_raw, self.chan4_raw, self.chan5_raw, self.chan6_raw, self.chan7_raw, self.chan8_raw, self.chan9_raw, self.chan10_raw, self.chan11_raw, self.chan12_raw, self.chan13_raw, self.chan14_raw, self.chan15_raw, self.chan16_raw, self.chan17_raw, self.chan18_raw, self.chancount, self.rssi), force_mavlink1=force_mavlink1)
class MAVLink_request_data_stream_message(MAVLink_message):
'''
THIS INTERFACE IS DEPRECATED. USE SET_MESSAGE_INTERVAL
INSTEAD.
'''
id = MAVLINK_MSG_ID_REQUEST_DATA_STREAM
name = 'REQUEST_DATA_STREAM'
fieldnames = ['target_system', 'target_component', 'req_stream_id', 'req_message_rate', 'start_stop']
ordered_fieldnames = [ 'req_message_rate', 'target_system', 'target_component', 'req_stream_id', 'start_stop' ]
format = '<HBBBB'
native_format = bytearray('<HBBBB', 'ascii')
orders = [1, 2, 3, 0, 4]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0]
crc_extra = 148
def __init__(self, target_system, target_component, req_stream_id, req_message_rate, start_stop):
MAVLink_message.__init__(self, MAVLink_request_data_stream_message.id, MAVLink_request_data_stream_message.name)
self._fieldnames = MAVLink_request_data_stream_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.req_stream_id = req_stream_id
self.req_message_rate = req_message_rate
self.start_stop = start_stop
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 148, struct.pack('<HBBBB', self.req_message_rate, self.target_system, self.target_component, self.req_stream_id, self.start_stop), force_mavlink1=force_mavlink1)
class MAVLink_data_stream_message(MAVLink_message):
'''
THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
'''
id = MAVLINK_MSG_ID_DATA_STREAM
name = 'DATA_STREAM'
fieldnames = ['stream_id', 'message_rate', 'on_off']
ordered_fieldnames = [ 'message_rate', 'stream_id', 'on_off' ]
format = '<HBB'
native_format = bytearray('<HBB', 'ascii')
orders = [1, 0, 2]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 21
def __init__(self, stream_id, message_rate, on_off):
MAVLink_message.__init__(self, MAVLink_data_stream_message.id, MAVLink_data_stream_message.name)
self._fieldnames = MAVLink_data_stream_message.fieldnames
self.stream_id = stream_id
self.message_rate = message_rate
self.on_off = on_off
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 21, struct.pack('<HBB', self.message_rate, self.stream_id, self.on_off), force_mavlink1=force_mavlink1)
class MAVLink_manual_control_message(MAVLink_message):
'''
This message provides an API for manually controlling the
vehicle using standard joystick axes nomenclature, along with
a joystick-like input device. Unused axes can be disabled an
buttons are also transmit as boolean values of their
'''
id = MAVLINK_MSG_ID_MANUAL_CONTROL
name = 'MANUAL_CONTROL'
fieldnames = ['target', 'x', 'y', 'z', 'r', 'buttons']
ordered_fieldnames = [ 'x', 'y', 'z', 'r', 'buttons', 'target' ]
format = '<hhhhHB'
native_format = bytearray('<hhhhHB', 'ascii')
orders = [5, 0, 1, 2, 3, 4]
lengths = [1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0]
crc_extra = 243
def __init__(self, target, x, y, z, r, buttons):
MAVLink_message.__init__(self, MAVLink_manual_control_message.id, MAVLink_manual_control_message.name)
self._fieldnames = MAVLink_manual_control_message.fieldnames
self.target = target
self.x = x
self.y = y
self.z = z
self.r = r
self.buttons = buttons
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 243, struct.pack('<hhhhHB', self.x, self.y, self.z, self.r, self.buttons, self.target), force_mavlink1=force_mavlink1)
class MAVLink_rc_channels_override_message(MAVLink_message):
'''
The RAW values of the RC channels sent to the MAV to override
info received from the RC radio. A value of UINT16_MAX means
no change to that channel. A value of 0 means control of that
channel should be released back to the RC radio. The standard
PPM modulation is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%. Individual receivers/transmitters might
violate this specification.
'''
id = MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE
name = 'RC_CHANNELS_OVERRIDE'
fieldnames = ['target_system', 'target_component', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'chan9_raw', 'chan10_raw', 'chan11_raw', 'chan12_raw', 'chan13_raw', 'chan14_raw', 'chan15_raw', 'chan16_raw', 'chan17_raw', 'chan18_raw']
ordered_fieldnames = [ 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'target_system', 'target_component', 'chan9_raw', 'chan10_raw', 'chan11_raw', 'chan12_raw', 'chan13_raw', 'chan14_raw', 'chan15_raw', 'chan16_raw', 'chan17_raw', 'chan18_raw' ]
format = '<HHHHHHHHBBHHHHHHHHHH'
native_format = bytearray('<HHHHHHHHBBHHHHHHHHHH', 'ascii')
orders = [8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 124
def __init__(self, target_system, target_component, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw=0, chan10_raw=0, chan11_raw=0, chan12_raw=0, chan13_raw=0, chan14_raw=0, chan15_raw=0, chan16_raw=0, chan17_raw=0, chan18_raw=0):
MAVLink_message.__init__(self, MAVLink_rc_channels_override_message.id, MAVLink_rc_channels_override_message.name)
self._fieldnames = MAVLink_rc_channels_override_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.chan1_raw = chan1_raw
self.chan2_raw = chan2_raw
self.chan3_raw = chan3_raw
self.chan4_raw = chan4_raw
self.chan5_raw = chan5_raw
self.chan6_raw = chan6_raw
self.chan7_raw = chan7_raw
self.chan8_raw = chan8_raw
self.chan9_raw = chan9_raw
self.chan10_raw = chan10_raw
self.chan11_raw = chan11_raw
self.chan12_raw = chan12_raw
self.chan13_raw = chan13_raw
self.chan14_raw = chan14_raw
self.chan15_raw = chan15_raw
self.chan16_raw = chan16_raw
self.chan17_raw = chan17_raw
self.chan18_raw = chan18_raw
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 124, struct.pack('<HHHHHHHHBBHHHHHHHHHH', self.chan1_raw, self.chan2_raw, self.chan3_raw, self.chan4_raw, self.chan5_raw, self.chan6_raw, self.chan7_raw, self.chan8_raw, self.target_system, self.target_component, self.chan9_raw, self.chan10_raw, self.chan11_raw, self.chan12_raw, self.chan13_raw, self.chan14_raw, self.chan15_raw, self.chan16_raw, self.chan17_raw, self.chan18_raw), force_mavlink1=force_mavlink1)
class MAVLink_mission_item_int_message(MAVLink_message):
'''
Message encoding a mission item. This message is emitted to
announce the presence of a mission item and to
set a mission item on the system. The mission item can be
either in x, y, z meters (type: LOCAL) or x:lat, y:lon,
z:altitude. Local frame is Z-down, right handed (NED), global
frame is Z-up, right handed (ENU). See also
https://mavlink.io/en/protocol/mission.html.
'''
id = MAVLINK_MSG_ID_MISSION_ITEM_INT
name = 'MISSION_ITEM_INT'
fieldnames = ['target_system', 'target_component', 'seq', 'frame', 'command', 'current', 'autocontinue', 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z', 'mission_type']
ordered_fieldnames = [ 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z', 'seq', 'command', 'target_system', 'target_component', 'frame', 'current', 'autocontinue', 'mission_type' ]
format = '<ffffiifHHBBBBBB'
native_format = bytearray('<ffffiifHHBBBBBB', 'ascii')
orders = [9, 10, 7, 11, 8, 12, 13, 0, 1, 2, 3, 4, 5, 6, 14]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 38
def __init__(self, target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type=0):
MAVLink_message.__init__(self, MAVLink_mission_item_int_message.id, MAVLink_mission_item_int_message.name)
self._fieldnames = MAVLink_mission_item_int_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.seq = seq
self.frame = frame
self.command = command
self.current = current
self.autocontinue = autocontinue
self.param1 = param1
self.param2 = param2
self.param3 = param3
self.param4 = param4
self.x = x
self.y = y
self.z = z
self.mission_type = mission_type
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 38, struct.pack('<ffffiifHHBBBBBB', self.param1, self.param2, self.param3, self.param4, self.x, self.y, self.z, self.seq, self.command, self.target_system, self.target_component, self.frame, self.current, self.autocontinue, self.mission_type), force_mavlink1=force_mavlink1)
class MAVLink_vfr_hud_message(MAVLink_message):
'''
Metrics typically displayed on a HUD for fixed wing aircraft
'''
id = MAVLINK_MSG_ID_VFR_HUD
name = 'VFR_HUD'
fieldnames = ['airspeed', 'groundspeed', 'heading', 'throttle', 'alt', 'climb']
ordered_fieldnames = [ 'airspeed', 'groundspeed', 'alt', 'climb', 'heading', 'throttle' ]
format = '<ffffhH'
native_format = bytearray('<ffffhH', 'ascii')
orders = [0, 1, 4, 5, 2, 3]
lengths = [1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0]
crc_extra = 20
def __init__(self, airspeed, groundspeed, heading, throttle, alt, climb):
MAVLink_message.__init__(self, MAVLink_vfr_hud_message.id, MAVLink_vfr_hud_message.name)
self._fieldnames = MAVLink_vfr_hud_message.fieldnames
self.airspeed = airspeed
self.groundspeed = groundspeed
self.heading = heading
self.throttle = throttle
self.alt = alt
self.climb = climb
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 20, struct.pack('<ffffhH', self.airspeed, self.groundspeed, self.alt, self.climb, self.heading, self.throttle), force_mavlink1=force_mavlink1)
class MAVLink_command_int_message(MAVLink_message):
'''
Message encoding a command with parameters as scaled integers.
Scaling depends on the actual command value.
'''
id = MAVLINK_MSG_ID_COMMAND_INT
name = 'COMMAND_INT'
fieldnames = ['target_system', 'target_component', 'frame', 'command', 'current', 'autocontinue', 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z']
ordered_fieldnames = [ 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z', 'command', 'target_system', 'target_component', 'frame', 'current', 'autocontinue' ]
format = '<ffffiifHBBBBB'
native_format = bytearray('<ffffiifHBBBBB', 'ascii')
orders = [8, 9, 10, 7, 11, 12, 0, 1, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 158
def __init__(self, target_system, target_component, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z):
MAVLink_message.__init__(self, MAVLink_command_int_message.id, MAVLink_command_int_message.name)
self._fieldnames = MAVLink_command_int_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.frame = frame
self.command = command
self.current = current
self.autocontinue = autocontinue
self.param1 = param1
self.param2 = param2
self.param3 = param3
self.param4 = param4
self.x = x
self.y = y
self.z = z
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 158, struct.pack('<ffffiifHBBBBB', self.param1, self.param2, self.param3, self.param4, self.x, self.y, self.z, self.command, self.target_system, self.target_component, self.frame, self.current, self.autocontinue), force_mavlink1=force_mavlink1)
class MAVLink_command_long_message(MAVLink_message):
'''
Send a command with up to seven parameters to the MAV
'''
id = MAVLINK_MSG_ID_COMMAND_LONG
name = 'COMMAND_LONG'
fieldnames = ['target_system', 'target_component', 'command', 'confirmation', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7']
ordered_fieldnames = [ 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7', 'command', 'target_system', 'target_component', 'confirmation' ]
format = '<fffffffHBBB'
native_format = bytearray('<fffffffHBBB', 'ascii')
orders = [8, 9, 7, 10, 0, 1, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 152
def __init__(self, target_system, target_component, command, confirmation, param1, param2, param3, param4, param5, param6, param7):
MAVLink_message.__init__(self, MAVLink_command_long_message.id, MAVLink_command_long_message.name)
self._fieldnames = MAVLink_command_long_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.command = command
self.confirmation = confirmation
self.param1 = param1
self.param2 = param2
self.param3 = param3
self.param4 = param4
self.param5 = param5
self.param6 = param6
self.param7 = param7
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 152, struct.pack('<fffffffHBBB', self.param1, self.param2, self.param3, self.param4, self.param5, self.param6, self.param7, self.command, self.target_system, self.target_component, self.confirmation), force_mavlink1=force_mavlink1)
class MAVLink_command_ack_message(MAVLink_message):
'''
Report status of a command. Includes feedback whether the
command was executed.
'''
id = MAVLINK_MSG_ID_COMMAND_ACK
name = 'COMMAND_ACK'
fieldnames = ['command', 'result']
ordered_fieldnames = [ 'command', 'result' ]
format = '<HB'
native_format = bytearray('<HB', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 143
def __init__(self, command, result):
MAVLink_message.__init__(self, MAVLink_command_ack_message.id, MAVLink_command_ack_message.name)
self._fieldnames = MAVLink_command_ack_message.fieldnames
self.command = command
self.result = result
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 143, struct.pack('<HB', self.command, self.result), force_mavlink1=force_mavlink1)
class MAVLink_manual_setpoint_message(MAVLink_message):
'''
Setpoint in roll, pitch, yaw and thrust from the operator
'''
id = MAVLINK_MSG_ID_MANUAL_SETPOINT
name = 'MANUAL_SETPOINT'
fieldnames = ['time_boot_ms', 'roll', 'pitch', 'yaw', 'thrust', 'mode_switch', 'manual_override_switch']
ordered_fieldnames = [ 'time_boot_ms', 'roll', 'pitch', 'yaw', 'thrust', 'mode_switch', 'manual_override_switch' ]
format = '<IffffBB'
native_format = bytearray('<IffffBB', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 106
def __init__(self, time_boot_ms, roll, pitch, yaw, thrust, mode_switch, manual_override_switch):
MAVLink_message.__init__(self, MAVLink_manual_setpoint_message.id, MAVLink_manual_setpoint_message.name)
self._fieldnames = MAVLink_manual_setpoint_message.fieldnames
self.time_boot_ms = time_boot_ms
self.roll = roll
self.pitch = pitch
self.yaw = yaw
self.thrust = thrust
self.mode_switch = mode_switch
self.manual_override_switch = manual_override_switch
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 106, struct.pack('<IffffBB', self.time_boot_ms, self.roll, self.pitch, self.yaw, self.thrust, self.mode_switch, self.manual_override_switch), force_mavlink1=force_mavlink1)
class MAVLink_set_attitude_target_message(MAVLink_message):
'''
Sets a desired vehicle attitude. Used by an external
controller to command the vehicle (manual controller or other
system).
'''
id = MAVLINK_MSG_ID_SET_ATTITUDE_TARGET
name = 'SET_ATTITUDE_TARGET'
fieldnames = ['time_boot_ms', 'target_system', 'target_component', 'type_mask', 'q', 'body_roll_rate', 'body_pitch_rate', 'body_yaw_rate', 'thrust']
ordered_fieldnames = [ 'time_boot_ms', 'q', 'body_roll_rate', 'body_pitch_rate', 'body_yaw_rate', 'thrust', 'target_system', 'target_component', 'type_mask' ]
format = '<I4fffffBBB'
native_format = bytearray('<IfffffBBB', 'ascii')
orders = [0, 6, 7, 8, 1, 2, 3, 4, 5]
lengths = [1, 4, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 4, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 49
def __init__(self, time_boot_ms, target_system, target_component, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust):
MAVLink_message.__init__(self, MAVLink_set_attitude_target_message.id, MAVLink_set_attitude_target_message.name)
self._fieldnames = MAVLink_set_attitude_target_message.fieldnames
self.time_boot_ms = time_boot_ms
self.target_system = target_system
self.target_component = target_component
self.type_mask = type_mask
self.q = q
self.body_roll_rate = body_roll_rate
self.body_pitch_rate = body_pitch_rate
self.body_yaw_rate = body_yaw_rate
self.thrust = thrust
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 49, struct.pack('<I4fffffBBB', self.time_boot_ms, self.q[0], self.q[1], self.q[2], self.q[3], self.body_roll_rate, self.body_pitch_rate, self.body_yaw_rate, self.thrust, self.target_system, self.target_component, self.type_mask), force_mavlink1=force_mavlink1)
class MAVLink_attitude_target_message(MAVLink_message):
'''
Reports the current commanded attitude of the vehicle as
specified by the autopilot. This should match the commands
sent in a SET_ATTITUDE_TARGET message if the vehicle is being
controlled this way.
'''
id = MAVLINK_MSG_ID_ATTITUDE_TARGET
name = 'ATTITUDE_TARGET'
fieldnames = ['time_boot_ms', 'type_mask', 'q', 'body_roll_rate', 'body_pitch_rate', 'body_yaw_rate', 'thrust']
ordered_fieldnames = [ 'time_boot_ms', 'q', 'body_roll_rate', 'body_pitch_rate', 'body_yaw_rate', 'thrust', 'type_mask' ]
format = '<I4fffffB'
native_format = bytearray('<IfffffB', 'ascii')
orders = [0, 6, 1, 2, 3, 4, 5]
lengths = [1, 4, 1, 1, 1, 1, 1]
array_lengths = [0, 4, 0, 0, 0, 0, 0]
crc_extra = 22
def __init__(self, time_boot_ms, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust):
MAVLink_message.__init__(self, MAVLink_attitude_target_message.id, MAVLink_attitude_target_message.name)
self._fieldnames = MAVLink_attitude_target_message.fieldnames
self.time_boot_ms = time_boot_ms
self.type_mask = type_mask
self.q = q
self.body_roll_rate = body_roll_rate
self.body_pitch_rate = body_pitch_rate
self.body_yaw_rate = body_yaw_rate
self.thrust = thrust
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 22, struct.pack('<I4fffffB', self.time_boot_ms, self.q[0], self.q[1], self.q[2], self.q[3], self.body_roll_rate, self.body_pitch_rate, self.body_yaw_rate, self.thrust, self.type_mask), force_mavlink1=force_mavlink1)
class MAVLink_set_position_target_local_ned_message(MAVLink_message):
'''
Sets a desired vehicle position in a local north-east-down
coordinate frame. Used by an external controller to command
the vehicle (manual controller or other system).
'''
id = MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED
name = 'SET_POSITION_TARGET_LOCAL_NED'
fieldnames = ['time_boot_ms', 'target_system', 'target_component', 'coordinate_frame', 'type_mask', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate']
ordered_fieldnames = [ 'time_boot_ms', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate', 'type_mask', 'target_system', 'target_component', 'coordinate_frame' ]
format = '<IfffffffffffHBBB'
native_format = bytearray('<IfffffffffffHBBB', 'ascii')
orders = [0, 13, 14, 15, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 143
def __init__(self, time_boot_ms, target_system, target_component, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate):
MAVLink_message.__init__(self, MAVLink_set_position_target_local_ned_message.id, MAVLink_set_position_target_local_ned_message.name)
self._fieldnames = MAVLink_set_position_target_local_ned_message.fieldnames
self.time_boot_ms = time_boot_ms
self.target_system = target_system
self.target_component = target_component
self.coordinate_frame = coordinate_frame
self.type_mask = type_mask
self.x = x
self.y = y
self.z = z
self.vx = vx
self.vy = vy
self.vz = vz
self.afx = afx
self.afy = afy
self.afz = afz
self.yaw = yaw
self.yaw_rate = yaw_rate
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 143, struct.pack('<IfffffffffffHBBB', self.time_boot_ms, self.x, self.y, self.z, self.vx, self.vy, self.vz, self.afx, self.afy, self.afz, self.yaw, self.yaw_rate, self.type_mask, self.target_system, self.target_component, self.coordinate_frame), force_mavlink1=force_mavlink1)
class MAVLink_position_target_local_ned_message(MAVLink_message):
'''
Reports the current commanded vehicle position, velocity, and
acceleration as specified by the autopilot. This should match
the commands sent in SET_POSITION_TARGET_LOCAL_NED if the
vehicle is being controlled this way.
'''
id = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED
name = 'POSITION_TARGET_LOCAL_NED'
fieldnames = ['time_boot_ms', 'coordinate_frame', 'type_mask', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate']
ordered_fieldnames = [ 'time_boot_ms', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate', 'type_mask', 'coordinate_frame' ]
format = '<IfffffffffffHB'
native_format = bytearray('<IfffffffffffHB', 'ascii')
orders = [0, 13, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 140
def __init__(self, time_boot_ms, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate):
MAVLink_message.__init__(self, MAVLink_position_target_local_ned_message.id, MAVLink_position_target_local_ned_message.name)
self._fieldnames = MAVLink_position_target_local_ned_message.fieldnames
self.time_boot_ms = time_boot_ms
self.coordinate_frame = coordinate_frame
self.type_mask = type_mask
self.x = x
self.y = y
self.z = z
self.vx = vx
self.vy = vy
self.vz = vz
self.afx = afx
self.afy = afy
self.afz = afz
self.yaw = yaw
self.yaw_rate = yaw_rate
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 140, struct.pack('<IfffffffffffHB', self.time_boot_ms, self.x, self.y, self.z, self.vx, self.vy, self.vz, self.afx, self.afy, self.afz, self.yaw, self.yaw_rate, self.type_mask, self.coordinate_frame), force_mavlink1=force_mavlink1)
class MAVLink_set_position_target_global_int_message(MAVLink_message):
'''
Sets a desired vehicle position, velocity, and/or acceleration
in a global coordinate system (WGS84). Used by an external
controller to command the vehicle (manual controller or other
system).
'''
id = MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT
name = 'SET_POSITION_TARGET_GLOBAL_INT'
fieldnames = ['time_boot_ms', 'target_system', 'target_component', 'coordinate_frame', 'type_mask', 'lat_int', 'lon_int', 'alt', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate']
ordered_fieldnames = [ 'time_boot_ms', 'lat_int', 'lon_int', 'alt', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate', 'type_mask', 'target_system', 'target_component', 'coordinate_frame' ]
format = '<IiifffffffffHBBB'
native_format = bytearray('<IiifffffffffHBBB', 'ascii')
orders = [0, 13, 14, 15, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 5
def __init__(self, time_boot_ms, target_system, target_component, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate):
MAVLink_message.__init__(self, MAVLink_set_position_target_global_int_message.id, MAVLink_set_position_target_global_int_message.name)
self._fieldnames = MAVLink_set_position_target_global_int_message.fieldnames
self.time_boot_ms = time_boot_ms
self.target_system = target_system
self.target_component = target_component
self.coordinate_frame = coordinate_frame
self.type_mask = type_mask
self.lat_int = lat_int
self.lon_int = lon_int
self.alt = alt
self.vx = vx
self.vy = vy
self.vz = vz
self.afx = afx
self.afy = afy
self.afz = afz
self.yaw = yaw
self.yaw_rate = yaw_rate
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 5, struct.pack('<IiifffffffffHBBB', self.time_boot_ms, self.lat_int, self.lon_int, self.alt, self.vx, self.vy, self.vz, self.afx, self.afy, self.afz, self.yaw, self.yaw_rate, self.type_mask, self.target_system, self.target_component, self.coordinate_frame), force_mavlink1=force_mavlink1)
class MAVLink_position_target_global_int_message(MAVLink_message):
'''
Reports the current commanded vehicle position, velocity, and
acceleration as specified by the autopilot. This should match
the commands sent in SET_POSITION_TARGET_GLOBAL_INT if the
vehicle is being controlled this way.
'''
id = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT
name = 'POSITION_TARGET_GLOBAL_INT'
fieldnames = ['time_boot_ms', 'coordinate_frame', 'type_mask', 'lat_int', 'lon_int', 'alt', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate']
ordered_fieldnames = [ 'time_boot_ms', 'lat_int', 'lon_int', 'alt', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate', 'type_mask', 'coordinate_frame' ]
format = '<IiifffffffffHB'
native_format = bytearray('<IiifffffffffHB', 'ascii')
orders = [0, 13, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 150
def __init__(self, time_boot_ms, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate):
MAVLink_message.__init__(self, MAVLink_position_target_global_int_message.id, MAVLink_position_target_global_int_message.name)
self._fieldnames = MAVLink_position_target_global_int_message.fieldnames
self.time_boot_ms = time_boot_ms
self.coordinate_frame = coordinate_frame
self.type_mask = type_mask
self.lat_int = lat_int
self.lon_int = lon_int
self.alt = alt
self.vx = vx
self.vy = vy
self.vz = vz
self.afx = afx
self.afy = afy
self.afz = afz
self.yaw = yaw
self.yaw_rate = yaw_rate
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 150, struct.pack('<IiifffffffffHB', self.time_boot_ms, self.lat_int, self.lon_int, self.alt, self.vx, self.vy, self.vz, self.afx, self.afy, self.afz, self.yaw, self.yaw_rate, self.type_mask, self.coordinate_frame), force_mavlink1=force_mavlink1)
class MAVLink_local_position_ned_system_global_offset_message(MAVLink_message):
'''
The offset in X, Y, Z and yaw between the LOCAL_POSITION_NED
messages of MAV X and the global coordinate frame in NED
coordinates. Coordinate frame is right-handed, Z-axis down
(aeronautical frame, NED / north-east-down convention)
'''
id = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET
name = 'LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET'
fieldnames = ['time_boot_ms', 'x', 'y', 'z', 'roll', 'pitch', 'yaw']
ordered_fieldnames = [ 'time_boot_ms', 'x', 'y', 'z', 'roll', 'pitch', 'yaw' ]
format = '<Iffffff'
native_format = bytearray('<Iffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 231
def __init__(self, time_boot_ms, x, y, z, roll, pitch, yaw):
MAVLink_message.__init__(self, MAVLink_local_position_ned_system_global_offset_message.id, MAVLink_local_position_ned_system_global_offset_message.name)
self._fieldnames = MAVLink_local_position_ned_system_global_offset_message.fieldnames
self.time_boot_ms = time_boot_ms
self.x = x
self.y = y
self.z = z
self.roll = roll
self.pitch = pitch
self.yaw = yaw
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 231, struct.pack('<Iffffff', self.time_boot_ms, self.x, self.y, self.z, self.roll, self.pitch, self.yaw), force_mavlink1=force_mavlink1)
class MAVLink_hil_state_message(MAVLink_message):
'''
DEPRECATED PACKET! Suffers from missing airspeed fields and
singularities due to Euler angles. Please use
HIL_STATE_QUATERNION instead. Sent from simulation to
autopilot. This packet is useful for high throughput
applications such as hardware in the loop simulations.
'''
id = MAVLINK_MSG_ID_HIL_STATE
name = 'HIL_STATE'
fieldnames = ['time_usec', 'roll', 'pitch', 'yaw', 'rollspeed', 'pitchspeed', 'yawspeed', 'lat', 'lon', 'alt', 'vx', 'vy', 'vz', 'xacc', 'yacc', 'zacc']
ordered_fieldnames = [ 'time_usec', 'roll', 'pitch', 'yaw', 'rollspeed', 'pitchspeed', 'yawspeed', 'lat', 'lon', 'alt', 'vx', 'vy', 'vz', 'xacc', 'yacc', 'zacc' ]
format = '<Qffffffiiihhhhhh'
native_format = bytearray('<Qffffffiiihhhhhh', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 183
def __init__(self, time_usec, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, xacc, yacc, zacc):
MAVLink_message.__init__(self, MAVLink_hil_state_message.id, MAVLink_hil_state_message.name)
self._fieldnames = MAVLink_hil_state_message.fieldnames
self.time_usec = time_usec
self.roll = roll
self.pitch = pitch
self.yaw = yaw
self.rollspeed = rollspeed
self.pitchspeed = pitchspeed
self.yawspeed = yawspeed
self.lat = lat
self.lon = lon
self.alt = alt
self.vx = vx
self.vy = vy
self.vz = vz
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 183, struct.pack('<Qffffffiiihhhhhh', self.time_usec, self.roll, self.pitch, self.yaw, self.rollspeed, self.pitchspeed, self.yawspeed, self.lat, self.lon, self.alt, self.vx, self.vy, self.vz, self.xacc, self.yacc, self.zacc), force_mavlink1=force_mavlink1)
class MAVLink_hil_controls_message(MAVLink_message):
'''
Sent from autopilot to simulation. Hardware in the loop
control outputs
'''
id = MAVLINK_MSG_ID_HIL_CONTROLS
name = 'HIL_CONTROLS'
fieldnames = ['time_usec', 'roll_ailerons', 'pitch_elevator', 'yaw_rudder', 'throttle', 'aux1', 'aux2', 'aux3', 'aux4', 'mode', 'nav_mode']
ordered_fieldnames = [ 'time_usec', 'roll_ailerons', 'pitch_elevator', 'yaw_rudder', 'throttle', 'aux1', 'aux2', 'aux3', 'aux4', 'mode', 'nav_mode' ]
format = '<QffffffffBB'
native_format = bytearray('<QffffffffBB', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 63
def __init__(self, time_usec, roll_ailerons, pitch_elevator, yaw_rudder, throttle, aux1, aux2, aux3, aux4, mode, nav_mode):
MAVLink_message.__init__(self, MAVLink_hil_controls_message.id, MAVLink_hil_controls_message.name)
self._fieldnames = MAVLink_hil_controls_message.fieldnames
self.time_usec = time_usec
self.roll_ailerons = roll_ailerons
self.pitch_elevator = pitch_elevator
self.yaw_rudder = yaw_rudder
self.throttle = throttle
self.aux1 = aux1
self.aux2 = aux2
self.aux3 = aux3
self.aux4 = aux4
self.mode = mode
self.nav_mode = nav_mode
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 63, struct.pack('<QffffffffBB', self.time_usec, self.roll_ailerons, self.pitch_elevator, self.yaw_rudder, self.throttle, self.aux1, self.aux2, self.aux3, self.aux4, self.mode, self.nav_mode), force_mavlink1=force_mavlink1)
class MAVLink_hil_rc_inputs_raw_message(MAVLink_message):
'''
Sent from simulation to autopilot. The RAW values of the RC
channels received. The standard PPM modulation is as follows:
1000 microseconds: 0%, 2000 microseconds: 100%. Individual
receivers/transmitters might violate this specification.
'''
id = MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW
name = 'HIL_RC_INPUTS_RAW'
fieldnames = ['time_usec', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'chan9_raw', 'chan10_raw', 'chan11_raw', 'chan12_raw', 'rssi']
ordered_fieldnames = [ 'time_usec', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'chan9_raw', 'chan10_raw', 'chan11_raw', 'chan12_raw', 'rssi' ]
format = '<QHHHHHHHHHHHHB'
native_format = bytearray('<QHHHHHHHHHHHHB', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 54
def __init__(self, time_usec, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, rssi):
MAVLink_message.__init__(self, MAVLink_hil_rc_inputs_raw_message.id, MAVLink_hil_rc_inputs_raw_message.name)
self._fieldnames = MAVLink_hil_rc_inputs_raw_message.fieldnames
self.time_usec = time_usec
self.chan1_raw = chan1_raw
self.chan2_raw = chan2_raw
self.chan3_raw = chan3_raw
self.chan4_raw = chan4_raw
self.chan5_raw = chan5_raw
self.chan6_raw = chan6_raw
self.chan7_raw = chan7_raw
self.chan8_raw = chan8_raw
self.chan9_raw = chan9_raw
self.chan10_raw = chan10_raw
self.chan11_raw = chan11_raw
self.chan12_raw = chan12_raw
self.rssi = rssi
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 54, struct.pack('<QHHHHHHHHHHHHB', self.time_usec, self.chan1_raw, self.chan2_raw, self.chan3_raw, self.chan4_raw, self.chan5_raw, self.chan6_raw, self.chan7_raw, self.chan8_raw, self.chan9_raw, self.chan10_raw, self.chan11_raw, self.chan12_raw, self.rssi), force_mavlink1=force_mavlink1)
class MAVLink_hil_actuator_controls_message(MAVLink_message):
'''
Sent from autopilot to simulation. Hardware in the loop
control outputs (replacement for HIL_CONTROLS)
'''
id = MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS
name = 'HIL_ACTUATOR_CONTROLS'
fieldnames = ['time_usec', 'controls', 'mode', 'flags']
ordered_fieldnames = [ 'time_usec', 'flags', 'controls', 'mode' ]
format = '<QQ16fB'
native_format = bytearray('<QQfB', 'ascii')
orders = [0, 2, 3, 1]
lengths = [1, 1, 16, 1]
array_lengths = [0, 0, 16, 0]
crc_extra = 47
def __init__(self, time_usec, controls, mode, flags):
MAVLink_message.__init__(self, MAVLink_hil_actuator_controls_message.id, MAVLink_hil_actuator_controls_message.name)
self._fieldnames = MAVLink_hil_actuator_controls_message.fieldnames
self.time_usec = time_usec
self.controls = controls
self.mode = mode
self.flags = flags
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 47, struct.pack('<QQ16fB', self.time_usec, self.flags, self.controls[0], self.controls[1], self.controls[2], self.controls[3], self.controls[4], self.controls[5], self.controls[6], self.controls[7], self.controls[8], self.controls[9], self.controls[10], self.controls[11], self.controls[12], self.controls[13], self.controls[14], self.controls[15], self.mode), force_mavlink1=force_mavlink1)
class MAVLink_optical_flow_message(MAVLink_message):
'''
Optical flow from a flow sensor (e.g. optical mouse sensor)
'''
id = MAVLINK_MSG_ID_OPTICAL_FLOW
name = 'OPTICAL_FLOW'
fieldnames = ['time_usec', 'sensor_id', 'flow_x', 'flow_y', 'flow_comp_m_x', 'flow_comp_m_y', 'quality', 'ground_distance', 'flow_rate_x', 'flow_rate_y']
ordered_fieldnames = [ 'time_usec', 'flow_comp_m_x', 'flow_comp_m_y', 'ground_distance', 'flow_x', 'flow_y', 'sensor_id', 'quality', 'flow_rate_x', 'flow_rate_y' ]
format = '<QfffhhBBff'
native_format = bytearray('<QfffhhBBff', 'ascii')
orders = [0, 6, 4, 5, 1, 2, 7, 3, 8, 9]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 175
def __init__(self, time_usec, sensor_id, flow_x, flow_y, flow_comp_m_x, flow_comp_m_y, quality, ground_distance, flow_rate_x=0, flow_rate_y=0):
MAVLink_message.__init__(self, MAVLink_optical_flow_message.id, MAVLink_optical_flow_message.name)
self._fieldnames = MAVLink_optical_flow_message.fieldnames
self.time_usec = time_usec
self.sensor_id = sensor_id
self.flow_x = flow_x
self.flow_y = flow_y
self.flow_comp_m_x = flow_comp_m_x
self.flow_comp_m_y = flow_comp_m_y
self.quality = quality
self.ground_distance = ground_distance
self.flow_rate_x = flow_rate_x
self.flow_rate_y = flow_rate_y
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 175, struct.pack('<QfffhhBBff', self.time_usec, self.flow_comp_m_x, self.flow_comp_m_y, self.ground_distance, self.flow_x, self.flow_y, self.sensor_id, self.quality, self.flow_rate_x, self.flow_rate_y), force_mavlink1=force_mavlink1)
class MAVLink_global_vision_position_estimate_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE
name = 'GLOBAL_VISION_POSITION_ESTIMATE'
fieldnames = ['usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw', 'covariance']
ordered_fieldnames = [ 'usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw', 'covariance' ]
format = '<Qffffff21f'
native_format = bytearray('<Qfffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7]
lengths = [1, 1, 1, 1, 1, 1, 1, 21]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 21]
crc_extra = 102
def __init__(self, usec, x, y, z, roll, pitch, yaw, covariance=0):
MAVLink_message.__init__(self, MAVLink_global_vision_position_estimate_message.id, MAVLink_global_vision_position_estimate_message.name)
self._fieldnames = MAVLink_global_vision_position_estimate_message.fieldnames
self.usec = usec
self.x = x
self.y = y
self.z = z
self.roll = roll
self.pitch = pitch
self.yaw = yaw
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 102, struct.pack('<Qffffff21f', self.usec, self.x, self.y, self.z, self.roll, self.pitch, self.yaw, self.covariance[0], self.covariance[1], self.covariance[2], self.covariance[3], self.covariance[4], self.covariance[5], self.covariance[6], self.covariance[7], self.covariance[8], self.covariance[9], self.covariance[10], self.covariance[11], self.covariance[12], self.covariance[13], self.covariance[14], self.covariance[15], self.covariance[16], self.covariance[17], self.covariance[18], self.covariance[19], self.covariance[20]), force_mavlink1=force_mavlink1)
class MAVLink_vision_position_estimate_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
name = 'VISION_POSITION_ESTIMATE'
fieldnames = ['usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw', 'covariance']
ordered_fieldnames = [ 'usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw', 'covariance' ]
format = '<Qffffff21f'
native_format = bytearray('<Qfffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7]
lengths = [1, 1, 1, 1, 1, 1, 1, 21]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 21]
crc_extra = 158
def __init__(self, usec, x, y, z, roll, pitch, yaw, covariance=0):
MAVLink_message.__init__(self, MAVLink_vision_position_estimate_message.id, MAVLink_vision_position_estimate_message.name)
self._fieldnames = MAVLink_vision_position_estimate_message.fieldnames
self.usec = usec
self.x = x
self.y = y
self.z = z
self.roll = roll
self.pitch = pitch
self.yaw = yaw
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 158, struct.pack('<Qffffff21f', self.usec, self.x, self.y, self.z, self.roll, self.pitch, self.yaw, self.covariance[0], self.covariance[1], self.covariance[2], self.covariance[3], self.covariance[4], self.covariance[5], self.covariance[6], self.covariance[7], self.covariance[8], self.covariance[9], self.covariance[10], self.covariance[11], self.covariance[12], self.covariance[13], self.covariance[14], self.covariance[15], self.covariance[16], self.covariance[17], self.covariance[18], self.covariance[19], self.covariance[20]), force_mavlink1=force_mavlink1)
class MAVLink_vision_speed_estimate_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE
name = 'VISION_SPEED_ESTIMATE'
fieldnames = ['usec', 'x', 'y', 'z', 'covariance']
ordered_fieldnames = [ 'usec', 'x', 'y', 'z', 'covariance' ]
format = '<Qfff9f'
native_format = bytearray('<Qffff', 'ascii')
orders = [0, 1, 2, 3, 4]
lengths = [1, 1, 1, 1, 9]
array_lengths = [0, 0, 0, 0, 9]
crc_extra = 208
def __init__(self, usec, x, y, z, covariance=0):
MAVLink_message.__init__(self, MAVLink_vision_speed_estimate_message.id, MAVLink_vision_speed_estimate_message.name)
self._fieldnames = MAVLink_vision_speed_estimate_message.fieldnames
self.usec = usec
self.x = x
self.y = y
self.z = z
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 208, struct.pack('<Qfff9f', self.usec, self.x, self.y, self.z, self.covariance[0], self.covariance[1], self.covariance[2], self.covariance[3], self.covariance[4], self.covariance[5], self.covariance[6], self.covariance[7], self.covariance[8]), force_mavlink1=force_mavlink1)
class MAVLink_vicon_position_estimate_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE
name = 'VICON_POSITION_ESTIMATE'
fieldnames = ['usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw', 'covariance']
ordered_fieldnames = [ 'usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw', 'covariance' ]
format = '<Qffffff21f'
native_format = bytearray('<Qfffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7]
lengths = [1, 1, 1, 1, 1, 1, 1, 21]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 21]
crc_extra = 56
def __init__(self, usec, x, y, z, roll, pitch, yaw, covariance=0):
MAVLink_message.__init__(self, MAVLink_vicon_position_estimate_message.id, MAVLink_vicon_position_estimate_message.name)
self._fieldnames = MAVLink_vicon_position_estimate_message.fieldnames
self.usec = usec
self.x = x
self.y = y
self.z = z
self.roll = roll
self.pitch = pitch
self.yaw = yaw
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 56, struct.pack('<Qffffff21f', self.usec, self.x, self.y, self.z, self.roll, self.pitch, self.yaw, self.covariance[0], self.covariance[1], self.covariance[2], self.covariance[3], self.covariance[4], self.covariance[5], self.covariance[6], self.covariance[7], self.covariance[8], self.covariance[9], self.covariance[10], self.covariance[11], self.covariance[12], self.covariance[13], self.covariance[14], self.covariance[15], self.covariance[16], self.covariance[17], self.covariance[18], self.covariance[19], self.covariance[20]), force_mavlink1=force_mavlink1)
class MAVLink_highres_imu_message(MAVLink_message):
'''
The IMU readings in SI units in NED body frame
'''
id = MAVLINK_MSG_ID_HIGHRES_IMU
name = 'HIGHRES_IMU'
fieldnames = ['time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag', 'abs_pressure', 'diff_pressure', 'pressure_alt', 'temperature', 'fields_updated']
ordered_fieldnames = [ 'time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag', 'abs_pressure', 'diff_pressure', 'pressure_alt', 'temperature', 'fields_updated' ]
format = '<QfffffffffffffH'
native_format = bytearray('<QfffffffffffffH', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 93
def __init__(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated):
MAVLink_message.__init__(self, MAVLink_highres_imu_message.id, MAVLink_highres_imu_message.name)
self._fieldnames = MAVLink_highres_imu_message.fieldnames
self.time_usec = time_usec
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
self.xgyro = xgyro
self.ygyro = ygyro
self.zgyro = zgyro
self.xmag = xmag
self.ymag = ymag
self.zmag = zmag
self.abs_pressure = abs_pressure
self.diff_pressure = diff_pressure
self.pressure_alt = pressure_alt
self.temperature = temperature
self.fields_updated = fields_updated
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 93, struct.pack('<QfffffffffffffH', self.time_usec, self.xacc, self.yacc, self.zacc, self.xgyro, self.ygyro, self.zgyro, self.xmag, self.ymag, self.zmag, self.abs_pressure, self.diff_pressure, self.pressure_alt, self.temperature, self.fields_updated), force_mavlink1=force_mavlink1)
class MAVLink_optical_flow_rad_message(MAVLink_message):
'''
Optical flow from an angular rate flow sensor (e.g. PX4FLOW or
mouse sensor)
'''
id = MAVLINK_MSG_ID_OPTICAL_FLOW_RAD
name = 'OPTICAL_FLOW_RAD'
fieldnames = ['time_usec', 'sensor_id', 'integration_time_us', 'integrated_x', 'integrated_y', 'integrated_xgyro', 'integrated_ygyro', 'integrated_zgyro', 'temperature', 'quality', 'time_delta_distance_us', 'distance']
ordered_fieldnames = [ 'time_usec', 'integration_time_us', 'integrated_x', 'integrated_y', 'integrated_xgyro', 'integrated_ygyro', 'integrated_zgyro', 'time_delta_distance_us', 'distance', 'temperature', 'sensor_id', 'quality' ]
format = '<QIfffffIfhBB'
native_format = bytearray('<QIfffffIfhBB', 'ascii')
orders = [0, 10, 1, 2, 3, 4, 5, 6, 9, 11, 7, 8]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 138
def __init__(self, time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance):
MAVLink_message.__init__(self, MAVLink_optical_flow_rad_message.id, MAVLink_optical_flow_rad_message.name)
self._fieldnames = MAVLink_optical_flow_rad_message.fieldnames
self.time_usec = time_usec
self.sensor_id = sensor_id
self.integration_time_us = integration_time_us
self.integrated_x = integrated_x
self.integrated_y = integrated_y
self.integrated_xgyro = integrated_xgyro
self.integrated_ygyro = integrated_ygyro
self.integrated_zgyro = integrated_zgyro
self.temperature = temperature
self.quality = quality
self.time_delta_distance_us = time_delta_distance_us
self.distance = distance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 138, struct.pack('<QIfffffIfhBB', self.time_usec, self.integration_time_us, self.integrated_x, self.integrated_y, self.integrated_xgyro, self.integrated_ygyro, self.integrated_zgyro, self.time_delta_distance_us, self.distance, self.temperature, self.sensor_id, self.quality), force_mavlink1=force_mavlink1)
class MAVLink_hil_sensor_message(MAVLink_message):
'''
The IMU readings in SI units in NED body frame
'''
id = MAVLINK_MSG_ID_HIL_SENSOR
name = 'HIL_SENSOR'
fieldnames = ['time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag', 'abs_pressure', 'diff_pressure', 'pressure_alt', 'temperature', 'fields_updated']
ordered_fieldnames = [ 'time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag', 'abs_pressure', 'diff_pressure', 'pressure_alt', 'temperature', 'fields_updated' ]
format = '<QfffffffffffffI'
native_format = bytearray('<QfffffffffffffI', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 108
def __init__(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated):
MAVLink_message.__init__(self, MAVLink_hil_sensor_message.id, MAVLink_hil_sensor_message.name)
self._fieldnames = MAVLink_hil_sensor_message.fieldnames
self.time_usec = time_usec
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
self.xgyro = xgyro
self.ygyro = ygyro
self.zgyro = zgyro
self.xmag = xmag
self.ymag = ymag
self.zmag = zmag
self.abs_pressure = abs_pressure
self.diff_pressure = diff_pressure
self.pressure_alt = pressure_alt
self.temperature = temperature
self.fields_updated = fields_updated
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 108, struct.pack('<QfffffffffffffI', self.time_usec, self.xacc, self.yacc, self.zacc, self.xgyro, self.ygyro, self.zgyro, self.xmag, self.ymag, self.zmag, self.abs_pressure, self.diff_pressure, self.pressure_alt, self.temperature, self.fields_updated), force_mavlink1=force_mavlink1)
class MAVLink_sim_state_message(MAVLink_message):
'''
Status of simulation environment, if used
'''
id = MAVLINK_MSG_ID_SIM_STATE
name = 'SIM_STATE'
fieldnames = ['q1', 'q2', 'q3', 'q4', 'roll', 'pitch', 'yaw', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'lat', 'lon', 'alt', 'std_dev_horz', 'std_dev_vert', 'vn', 've', 'vd']
ordered_fieldnames = [ 'q1', 'q2', 'q3', 'q4', 'roll', 'pitch', 'yaw', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'lat', 'lon', 'alt', 'std_dev_horz', 'std_dev_vert', 'vn', 've', 'vd' ]
format = '<fffffffffffffffffffff'
native_format = bytearray('<fffffffffffffffffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 32
def __init__(self, q1, q2, q3, q4, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lon, alt, std_dev_horz, std_dev_vert, vn, ve, vd):
MAVLink_message.__init__(self, MAVLink_sim_state_message.id, MAVLink_sim_state_message.name)
self._fieldnames = MAVLink_sim_state_message.fieldnames
self.q1 = q1
self.q2 = q2
self.q3 = q3
self.q4 = q4
self.roll = roll
self.pitch = pitch
self.yaw = yaw
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
self.xgyro = xgyro
self.ygyro = ygyro
self.zgyro = zgyro
self.lat = lat
self.lon = lon
self.alt = alt
self.std_dev_horz = std_dev_horz
self.std_dev_vert = std_dev_vert
self.vn = vn
self.ve = ve
self.vd = vd
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 32, struct.pack('<fffffffffffffffffffff', self.q1, self.q2, self.q3, self.q4, self.roll, self.pitch, self.yaw, self.xacc, self.yacc, self.zacc, self.xgyro, self.ygyro, self.zgyro, self.lat, self.lon, self.alt, self.std_dev_horz, self.std_dev_vert, self.vn, self.ve, self.vd), force_mavlink1=force_mavlink1)
class MAVLink_radio_status_message(MAVLink_message):
'''
Status generated by radio and injected into MAVLink stream.
'''
id = MAVLINK_MSG_ID_RADIO_STATUS
name = 'RADIO_STATUS'
fieldnames = ['rssi', 'remrssi', 'txbuf', 'noise', 'remnoise', 'rxerrors', 'fixed']
ordered_fieldnames = [ 'rxerrors', 'fixed', 'rssi', 'remrssi', 'txbuf', 'noise', 'remnoise' ]
format = '<HHBBBBB'
native_format = bytearray('<HHBBBBB', 'ascii')
orders = [2, 3, 4, 5, 6, 0, 1]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 185
def __init__(self, rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed):
MAVLink_message.__init__(self, MAVLink_radio_status_message.id, MAVLink_radio_status_message.name)
self._fieldnames = MAVLink_radio_status_message.fieldnames
self.rssi = rssi
self.remrssi = remrssi
self.txbuf = txbuf
self.noise = noise
self.remnoise = remnoise
self.rxerrors = rxerrors
self.fixed = fixed
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 185, struct.pack('<HHBBBBB', self.rxerrors, self.fixed, self.rssi, self.remrssi, self.txbuf, self.noise, self.remnoise), force_mavlink1=force_mavlink1)
class MAVLink_file_transfer_protocol_message(MAVLink_message):
'''
File transfer message
'''
id = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL
name = 'FILE_TRANSFER_PROTOCOL'
fieldnames = ['target_network', 'target_system', 'target_component', 'payload']
ordered_fieldnames = [ 'target_network', 'target_system', 'target_component', 'payload' ]
format = '<BBB251B'
native_format = bytearray('<BBBB', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 251]
array_lengths = [0, 0, 0, 251]
crc_extra = 84
def __init__(self, target_network, target_system, target_component, payload):
MAVLink_message.__init__(self, MAVLink_file_transfer_protocol_message.id, MAVLink_file_transfer_protocol_message.name)
self._fieldnames = MAVLink_file_transfer_protocol_message.fieldnames
self.target_network = target_network
self.target_system = target_system
self.target_component = target_component
self.payload = payload
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 84, struct.pack('<BBB251B', self.target_network, self.target_system, self.target_component, self.payload[0], self.payload[1], self.payload[2], self.payload[3], self.payload[4], self.payload[5], self.payload[6], self.payload[7], self.payload[8], self.payload[9], self.payload[10], self.payload[11], self.payload[12], self.payload[13], self.payload[14], self.payload[15], self.payload[16], self.payload[17], self.payload[18], self.payload[19], self.payload[20], self.payload[21], self.payload[22], self.payload[23], self.payload[24], self.payload[25], self.payload[26], self.payload[27], self.payload[28], self.payload[29], self.payload[30], self.payload[31], self.payload[32], self.payload[33], self.payload[34], self.payload[35], self.payload[36], self.payload[37], self.payload[38], self.payload[39], self.payload[40], self.payload[41], self.payload[42], self.payload[43], self.payload[44], self.payload[45], self.payload[46], self.payload[47], self.payload[48], self.payload[49], self.payload[50], self.payload[51], self.payload[52], self.payload[53], self.payload[54], self.payload[55], self.payload[56], self.payload[57], self.payload[58], self.payload[59], self.payload[60], self.payload[61], self.payload[62], self.payload[63], self.payload[64], self.payload[65], self.payload[66], self.payload[67], self.payload[68], self.payload[69], self.payload[70], self.payload[71], self.payload[72], self.payload[73], self.payload[74], self.payload[75], self.payload[76], self.payload[77], self.payload[78], self.payload[79], self.payload[80], self.payload[81], self.payload[82], self.payload[83], self.payload[84], self.payload[85], self.payload[86], self.payload[87], self.payload[88], self.payload[89], self.payload[90], self.payload[91], self.payload[92], self.payload[93], self.payload[94], self.payload[95], self.payload[96], self.payload[97], self.payload[98], self.payload[99], self.payload[100], self.payload[101], self.payload[102], self.payload[103], self.payload[104], self.payload[105], self.payload[106], self.payload[107], self.payload[108], self.payload[109], self.payload[110], self.payload[111], self.payload[112], self.payload[113], self.payload[114], self.payload[115], self.payload[116], self.payload[117], self.payload[118], self.payload[119], self.payload[120], self.payload[121], self.payload[122], self.payload[123], self.payload[124], self.payload[125], self.payload[126], self.payload[127], self.payload[128], self.payload[129], self.payload[130], self.payload[131], self.payload[132], self.payload[133], self.payload[134], self.payload[135], self.payload[136], self.payload[137], self.payload[138], self.payload[139], self.payload[140], self.payload[141], self.payload[142], self.payload[143], self.payload[144], self.payload[145], self.payload[146], self.payload[147], self.payload[148], self.payload[149], self.payload[150], self.payload[151], self.payload[152], self.payload[153], self.payload[154], self.payload[155], self.payload[156], self.payload[157], self.payload[158], self.payload[159], self.payload[160], self.payload[161], self.payload[162], self.payload[163], self.payload[164], self.payload[165], self.payload[166], self.payload[167], self.payload[168], self.payload[169], self.payload[170], self.payload[171], self.payload[172], self.payload[173], self.payload[174], self.payload[175], self.payload[176], self.payload[177], self.payload[178], self.payload[179], self.payload[180], self.payload[181], self.payload[182], self.payload[183], self.payload[184], self.payload[185], self.payload[186], self.payload[187], self.payload[188], self.payload[189], self.payload[190], self.payload[191], self.payload[192], self.payload[193], self.payload[194], self.payload[195], self.payload[196], self.payload[197], self.payload[198], self.payload[199], self.payload[200], self.payload[201], self.payload[202], self.payload[203], self.payload[204], self.payload[205], self.payload[206], self.payload[207], self.payload[208], self.payload[209], self.payload[210], self.payload[211], self.payload[212], self.payload[213], self.payload[214], self.payload[215], self.payload[216], self.payload[217], self.payload[218], self.payload[219], self.payload[220], self.payload[221], self.payload[222], self.payload[223], self.payload[224], self.payload[225], self.payload[226], self.payload[227], self.payload[228], self.payload[229], self.payload[230], self.payload[231], self.payload[232], self.payload[233], self.payload[234], self.payload[235], self.payload[236], self.payload[237], self.payload[238], self.payload[239], self.payload[240], self.payload[241], self.payload[242], self.payload[243], self.payload[244], self.payload[245], self.payload[246], self.payload[247], self.payload[248], self.payload[249], self.payload[250]), force_mavlink1=force_mavlink1)
class MAVLink_timesync_message(MAVLink_message):
'''
Time synchronization message.
'''
id = MAVLINK_MSG_ID_TIMESYNC
name = 'TIMESYNC'
fieldnames = ['tc1', 'ts1']
ordered_fieldnames = [ 'tc1', 'ts1' ]
format = '<qq'
native_format = bytearray('<qq', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 34
def __init__(self, tc1, ts1):
MAVLink_message.__init__(self, MAVLink_timesync_message.id, MAVLink_timesync_message.name)
self._fieldnames = MAVLink_timesync_message.fieldnames
self.tc1 = tc1
self.ts1 = ts1
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 34, struct.pack('<qq', self.tc1, self.ts1), force_mavlink1=force_mavlink1)
class MAVLink_camera_trigger_message(MAVLink_message):
'''
Camera-IMU triggering and synchronisation message.
'''
id = MAVLINK_MSG_ID_CAMERA_TRIGGER
name = 'CAMERA_TRIGGER'
fieldnames = ['time_usec', 'seq']
ordered_fieldnames = [ 'time_usec', 'seq' ]
format = '<QI'
native_format = bytearray('<QI', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 174
def __init__(self, time_usec, seq):
MAVLink_message.__init__(self, MAVLink_camera_trigger_message.id, MAVLink_camera_trigger_message.name)
self._fieldnames = MAVLink_camera_trigger_message.fieldnames
self.time_usec = time_usec
self.seq = seq
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 174, struct.pack('<QI', self.time_usec, self.seq), force_mavlink1=force_mavlink1)
class MAVLink_hil_gps_message(MAVLink_message):
'''
The global position, as returned by the Global Positioning
System (GPS). This is NOT the global position
estimate of the sytem, but rather a RAW sensor value. See
message GLOBAL_POSITION for the global position estimate.
'''
id = MAVLINK_MSG_ID_HIL_GPS
name = 'HIL_GPS'
fieldnames = ['time_usec', 'fix_type', 'lat', 'lon', 'alt', 'eph', 'epv', 'vel', 'vn', 've', 'vd', 'cog', 'satellites_visible']
ordered_fieldnames = [ 'time_usec', 'lat', 'lon', 'alt', 'eph', 'epv', 'vel', 'vn', 've', 'vd', 'cog', 'fix_type', 'satellites_visible' ]
format = '<QiiiHHHhhhHBB'
native_format = bytearray('<QiiiHHHhhhHBB', 'ascii')
orders = [0, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 124
def __init__(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, vn, ve, vd, cog, satellites_visible):
MAVLink_message.__init__(self, MAVLink_hil_gps_message.id, MAVLink_hil_gps_message.name)
self._fieldnames = MAVLink_hil_gps_message.fieldnames
self.time_usec = time_usec
self.fix_type = fix_type
self.lat = lat
self.lon = lon
self.alt = alt
self.eph = eph
self.epv = epv
self.vel = vel
self.vn = vn
self.ve = ve
self.vd = vd
self.cog = cog
self.satellites_visible = satellites_visible
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 124, struct.pack('<QiiiHHHhhhHBB', self.time_usec, self.lat, self.lon, self.alt, self.eph, self.epv, self.vel, self.vn, self.ve, self.vd, self.cog, self.fix_type, self.satellites_visible), force_mavlink1=force_mavlink1)
class MAVLink_hil_optical_flow_message(MAVLink_message):
'''
Simulated optical flow from a flow sensor (e.g. PX4FLOW or
optical mouse sensor)
'''
id = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW
name = 'HIL_OPTICAL_FLOW'
fieldnames = ['time_usec', 'sensor_id', 'integration_time_us', 'integrated_x', 'integrated_y', 'integrated_xgyro', 'integrated_ygyro', 'integrated_zgyro', 'temperature', 'quality', 'time_delta_distance_us', 'distance']
ordered_fieldnames = [ 'time_usec', 'integration_time_us', 'integrated_x', 'integrated_y', 'integrated_xgyro', 'integrated_ygyro', 'integrated_zgyro', 'time_delta_distance_us', 'distance', 'temperature', 'sensor_id', 'quality' ]
format = '<QIfffffIfhBB'
native_format = bytearray('<QIfffffIfhBB', 'ascii')
orders = [0, 10, 1, 2, 3, 4, 5, 6, 9, 11, 7, 8]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 237
def __init__(self, time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance):
MAVLink_message.__init__(self, MAVLink_hil_optical_flow_message.id, MAVLink_hil_optical_flow_message.name)
self._fieldnames = MAVLink_hil_optical_flow_message.fieldnames
self.time_usec = time_usec
self.sensor_id = sensor_id
self.integration_time_us = integration_time_us
self.integrated_x = integrated_x
self.integrated_y = integrated_y
self.integrated_xgyro = integrated_xgyro
self.integrated_ygyro = integrated_ygyro
self.integrated_zgyro = integrated_zgyro
self.temperature = temperature
self.quality = quality
self.time_delta_distance_us = time_delta_distance_us
self.distance = distance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 237, struct.pack('<QIfffffIfhBB', self.time_usec, self.integration_time_us, self.integrated_x, self.integrated_y, self.integrated_xgyro, self.integrated_ygyro, self.integrated_zgyro, self.time_delta_distance_us, self.distance, self.temperature, self.sensor_id, self.quality), force_mavlink1=force_mavlink1)
class MAVLink_hil_state_quaternion_message(MAVLink_message):
'''
Sent from simulation to autopilot, avoids in contrast to
HIL_STATE singularities. This packet is useful for high
throughput applications such as hardware in the loop
simulations.
'''
id = MAVLINK_MSG_ID_HIL_STATE_QUATERNION
name = 'HIL_STATE_QUATERNION'
fieldnames = ['time_usec', 'attitude_quaternion', 'rollspeed', 'pitchspeed', 'yawspeed', 'lat', 'lon', 'alt', 'vx', 'vy', 'vz', 'ind_airspeed', 'true_airspeed', 'xacc', 'yacc', 'zacc']
ordered_fieldnames = [ 'time_usec', 'attitude_quaternion', 'rollspeed', 'pitchspeed', 'yawspeed', 'lat', 'lon', 'alt', 'vx', 'vy', 'vz', 'ind_airspeed', 'true_airspeed', 'xacc', 'yacc', 'zacc' ]
format = '<Q4ffffiiihhhHHhhh'
native_format = bytearray('<QffffiiihhhHHhhh', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
lengths = [1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 4
def __init__(self, time_usec, attitude_quaternion, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc):
MAVLink_message.__init__(self, MAVLink_hil_state_quaternion_message.id, MAVLink_hil_state_quaternion_message.name)
self._fieldnames = MAVLink_hil_state_quaternion_message.fieldnames
self.time_usec = time_usec
self.attitude_quaternion = attitude_quaternion
self.rollspeed = rollspeed
self.pitchspeed = pitchspeed
self.yawspeed = yawspeed
self.lat = lat
self.lon = lon
self.alt = alt
self.vx = vx
self.vy = vy
self.vz = vz
self.ind_airspeed = ind_airspeed
self.true_airspeed = true_airspeed
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 4, struct.pack('<Q4ffffiiihhhHHhhh', self.time_usec, self.attitude_quaternion[0], self.attitude_quaternion[1], self.attitude_quaternion[2], self.attitude_quaternion[3], self.rollspeed, self.pitchspeed, self.yawspeed, self.lat, self.lon, self.alt, self.vx, self.vy, self.vz, self.ind_airspeed, self.true_airspeed, self.xacc, self.yacc, self.zacc), force_mavlink1=force_mavlink1)
class MAVLink_scaled_imu2_message(MAVLink_message):
'''
The RAW IMU readings for secondary 9DOF sensor setup. This
message should contain the scaled values to the described
units
'''
id = MAVLINK_MSG_ID_SCALED_IMU2
name = 'SCALED_IMU2'
fieldnames = ['time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag']
ordered_fieldnames = [ 'time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag' ]
format = '<Ihhhhhhhhh'
native_format = bytearray('<Ihhhhhhhhh', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 76
def __init__(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
MAVLink_message.__init__(self, MAVLink_scaled_imu2_message.id, MAVLink_scaled_imu2_message.name)
self._fieldnames = MAVLink_scaled_imu2_message.fieldnames
self.time_boot_ms = time_boot_ms
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
self.xgyro = xgyro
self.ygyro = ygyro
self.zgyro = zgyro
self.xmag = xmag
self.ymag = ymag
self.zmag = zmag
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 76, struct.pack('<Ihhhhhhhhh', self.time_boot_ms, self.xacc, self.yacc, self.zacc, self.xgyro, self.ygyro, self.zgyro, self.xmag, self.ymag, self.zmag), force_mavlink1=force_mavlink1)
class MAVLink_log_request_list_message(MAVLink_message):
'''
Request a list of available logs. On some systems calling this
may stop on-board logging until LOG_REQUEST_END is called.
'''
id = MAVLINK_MSG_ID_LOG_REQUEST_LIST
name = 'LOG_REQUEST_LIST'
fieldnames = ['target_system', 'target_component', 'start', 'end']
ordered_fieldnames = [ 'start', 'end', 'target_system', 'target_component' ]
format = '<HHBB'
native_format = bytearray('<HHBB', 'ascii')
orders = [2, 3, 0, 1]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 128
def __init__(self, target_system, target_component, start, end):
MAVLink_message.__init__(self, MAVLink_log_request_list_message.id, MAVLink_log_request_list_message.name)
self._fieldnames = MAVLink_log_request_list_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.start = start
self.end = end
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 128, struct.pack('<HHBB', self.start, self.end, self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_log_entry_message(MAVLink_message):
'''
Reply to LOG_REQUEST_LIST
'''
id = MAVLINK_MSG_ID_LOG_ENTRY
name = 'LOG_ENTRY'
fieldnames = ['id', 'num_logs', 'last_log_num', 'time_utc', 'size']
ordered_fieldnames = [ 'time_utc', 'size', 'id', 'num_logs', 'last_log_num' ]
format = '<IIHHH'
native_format = bytearray('<IIHHH', 'ascii')
orders = [2, 3, 4, 0, 1]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0]
crc_extra = 56
def __init__(self, id, num_logs, last_log_num, time_utc, size):
MAVLink_message.__init__(self, MAVLink_log_entry_message.id, MAVLink_log_entry_message.name)
self._fieldnames = MAVLink_log_entry_message.fieldnames
self.id = id
self.num_logs = num_logs
self.last_log_num = last_log_num
self.time_utc = time_utc
self.size = size
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 56, struct.pack('<IIHHH', self.time_utc, self.size, self.id, self.num_logs, self.last_log_num), force_mavlink1=force_mavlink1)
class MAVLink_log_request_data_message(MAVLink_message):
'''
Request a chunk of a log
'''
id = MAVLINK_MSG_ID_LOG_REQUEST_DATA
name = 'LOG_REQUEST_DATA'
fieldnames = ['target_system', 'target_component', 'id', 'ofs', 'count']
ordered_fieldnames = [ 'ofs', 'count', 'id', 'target_system', 'target_component' ]
format = '<IIHBB'
native_format = bytearray('<IIHBB', 'ascii')
orders = [3, 4, 2, 0, 1]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0]
crc_extra = 116
def __init__(self, target_system, target_component, id, ofs, count):
MAVLink_message.__init__(self, MAVLink_log_request_data_message.id, MAVLink_log_request_data_message.name)
self._fieldnames = MAVLink_log_request_data_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.id = id
self.ofs = ofs
self.count = count
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 116, struct.pack('<IIHBB', self.ofs, self.count, self.id, self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_log_data_message(MAVLink_message):
'''
Reply to LOG_REQUEST_DATA
'''
id = MAVLINK_MSG_ID_LOG_DATA
name = 'LOG_DATA'
fieldnames = ['id', 'ofs', 'count', 'data']
ordered_fieldnames = [ 'ofs', 'id', 'count', 'data' ]
format = '<IHB90B'
native_format = bytearray('<IHBB', 'ascii')
orders = [1, 0, 2, 3]
lengths = [1, 1, 1, 90]
array_lengths = [0, 0, 0, 90]
crc_extra = 134
def __init__(self, id, ofs, count, data):
MAVLink_message.__init__(self, MAVLink_log_data_message.id, MAVLink_log_data_message.name)
self._fieldnames = MAVLink_log_data_message.fieldnames
self.id = id
self.ofs = ofs
self.count = count
self.data = data
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 134, struct.pack('<IHB90B', self.ofs, self.id, self.count, self.data[0], self.data[1], self.data[2], self.data[3], self.data[4], self.data[5], self.data[6], self.data[7], self.data[8], self.data[9], self.data[10], self.data[11], self.data[12], self.data[13], self.data[14], self.data[15], self.data[16], self.data[17], self.data[18], self.data[19], self.data[20], self.data[21], self.data[22], self.data[23], self.data[24], self.data[25], self.data[26], self.data[27], self.data[28], self.data[29], self.data[30], self.data[31], self.data[32], self.data[33], self.data[34], self.data[35], self.data[36], self.data[37], self.data[38], self.data[39], self.data[40], self.data[41], self.data[42], self.data[43], self.data[44], self.data[45], self.data[46], self.data[47], self.data[48], self.data[49], self.data[50], self.data[51], self.data[52], self.data[53], self.data[54], self.data[55], self.data[56], self.data[57], self.data[58], self.data[59], self.data[60], self.data[61], self.data[62], self.data[63], self.data[64], self.data[65], self.data[66], self.data[67], self.data[68], self.data[69], self.data[70], self.data[71], self.data[72], self.data[73], self.data[74], self.data[75], self.data[76], self.data[77], self.data[78], self.data[79], self.data[80], self.data[81], self.data[82], self.data[83], self.data[84], self.data[85], self.data[86], self.data[87], self.data[88], self.data[89]), force_mavlink1=force_mavlink1)
class MAVLink_log_erase_message(MAVLink_message):
'''
Erase all logs
'''
id = MAVLINK_MSG_ID_LOG_ERASE
name = 'LOG_ERASE'
fieldnames = ['target_system', 'target_component']
ordered_fieldnames = [ 'target_system', 'target_component' ]
format = '<BB'
native_format = bytearray('<BB', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 237
def __init__(self, target_system, target_component):
MAVLink_message.__init__(self, MAVLink_log_erase_message.id, MAVLink_log_erase_message.name)
self._fieldnames = MAVLink_log_erase_message.fieldnames
self.target_system = target_system
self.target_component = target_component
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 237, struct.pack('<BB', self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_log_request_end_message(MAVLink_message):
'''
Stop log transfer and resume normal logging
'''
id = MAVLINK_MSG_ID_LOG_REQUEST_END
name = 'LOG_REQUEST_END'
fieldnames = ['target_system', 'target_component']
ordered_fieldnames = [ 'target_system', 'target_component' ]
format = '<BB'
native_format = bytearray('<BB', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 203
def __init__(self, target_system, target_component):
MAVLink_message.__init__(self, MAVLink_log_request_end_message.id, MAVLink_log_request_end_message.name)
self._fieldnames = MAVLink_log_request_end_message.fieldnames
self.target_system = target_system
self.target_component = target_component
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 203, struct.pack('<BB', self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_gps_inject_data_message(MAVLink_message):
'''
data for injecting into the onboard GPS (used for DGPS)
'''
id = MAVLINK_MSG_ID_GPS_INJECT_DATA
name = 'GPS_INJECT_DATA'
fieldnames = ['target_system', 'target_component', 'len', 'data']
ordered_fieldnames = [ 'target_system', 'target_component', 'len', 'data' ]
format = '<BBB110B'
native_format = bytearray('<BBBB', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 110]
array_lengths = [0, 0, 0, 110]
crc_extra = 250
def __init__(self, target_system, target_component, len, data):
MAVLink_message.__init__(self, MAVLink_gps_inject_data_message.id, MAVLink_gps_inject_data_message.name)
self._fieldnames = MAVLink_gps_inject_data_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.len = len
self.data = data
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 250, struct.pack('<BBB110B', self.target_system, self.target_component, self.len, self.data[0], self.data[1], self.data[2], self.data[3], self.data[4], self.data[5], self.data[6], self.data[7], self.data[8], self.data[9], self.data[10], self.data[11], self.data[12], self.data[13], self.data[14], self.data[15], self.data[16], self.data[17], self.data[18], self.data[19], self.data[20], self.data[21], self.data[22], self.data[23], self.data[24], self.data[25], self.data[26], self.data[27], self.data[28], self.data[29], self.data[30], self.data[31], self.data[32], self.data[33], self.data[34], self.data[35], self.data[36], self.data[37], self.data[38], self.data[39], self.data[40], self.data[41], self.data[42], self.data[43], self.data[44], self.data[45], self.data[46], self.data[47], self.data[48], self.data[49], self.data[50], self.data[51], self.data[52], self.data[53], self.data[54], self.data[55], self.data[56], self.data[57], self.data[58], self.data[59], self.data[60], self.data[61], self.data[62], self.data[63], self.data[64], self.data[65], self.data[66], self.data[67], self.data[68], self.data[69], self.data[70], self.data[71], self.data[72], self.data[73], self.data[74], self.data[75], self.data[76], self.data[77], self.data[78], self.data[79], self.data[80], self.data[81], self.data[82], self.data[83], self.data[84], self.data[85], self.data[86], self.data[87], self.data[88], self.data[89], self.data[90], self.data[91], self.data[92], self.data[93], self.data[94], self.data[95], self.data[96], self.data[97], self.data[98], self.data[99], self.data[100], self.data[101], self.data[102], self.data[103], self.data[104], self.data[105], self.data[106], self.data[107], self.data[108], self.data[109]), force_mavlink1=force_mavlink1)
class MAVLink_gps2_raw_message(MAVLink_message):
'''
Second GPS data.
'''
id = MAVLINK_MSG_ID_GPS2_RAW
name = 'GPS2_RAW'
fieldnames = ['time_usec', 'fix_type', 'lat', 'lon', 'alt', 'eph', 'epv', 'vel', 'cog', 'satellites_visible', 'dgps_numch', 'dgps_age']
ordered_fieldnames = [ 'time_usec', 'lat', 'lon', 'alt', 'dgps_age', 'eph', 'epv', 'vel', 'cog', 'fix_type', 'satellites_visible', 'dgps_numch' ]
format = '<QiiiIHHHHBBB'
native_format = bytearray('<QiiiIHHHHBBB', 'ascii')
orders = [0, 9, 1, 2, 3, 5, 6, 7, 8, 10, 11, 4]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 87
def __init__(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, dgps_numch, dgps_age):
MAVLink_message.__init__(self, MAVLink_gps2_raw_message.id, MAVLink_gps2_raw_message.name)
self._fieldnames = MAVLink_gps2_raw_message.fieldnames
self.time_usec = time_usec
self.fix_type = fix_type
self.lat = lat
self.lon = lon
self.alt = alt
self.eph = eph
self.epv = epv
self.vel = vel
self.cog = cog
self.satellites_visible = satellites_visible
self.dgps_numch = dgps_numch
self.dgps_age = dgps_age
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 87, struct.pack('<QiiiIHHHHBBB', self.time_usec, self.lat, self.lon, self.alt, self.dgps_age, self.eph, self.epv, self.vel, self.cog, self.fix_type, self.satellites_visible, self.dgps_numch), force_mavlink1=force_mavlink1)
class MAVLink_power_status_message(MAVLink_message):
'''
Power supply status
'''
id = MAVLINK_MSG_ID_POWER_STATUS
name = 'POWER_STATUS'
fieldnames = ['Vcc', 'Vservo', 'flags']
ordered_fieldnames = [ 'Vcc', 'Vservo', 'flags' ]
format = '<HHH'
native_format = bytearray('<HHH', 'ascii')
orders = [0, 1, 2]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 203
def __init__(self, Vcc, Vservo, flags):
MAVLink_message.__init__(self, MAVLink_power_status_message.id, MAVLink_power_status_message.name)
self._fieldnames = MAVLink_power_status_message.fieldnames
self.Vcc = Vcc
self.Vservo = Vservo
self.flags = flags
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 203, struct.pack('<HHH', self.Vcc, self.Vservo, self.flags), force_mavlink1=force_mavlink1)
class MAVLink_serial_control_message(MAVLink_message):
'''
Control a serial port. This can be used for raw access to an
onboard serial peripheral such as a GPS or telemetry radio. It
is designed to make it possible to update the devices firmware
via MAVLink messages or change the devices settings. A message
with zero bytes can be used to change just the baudrate.
'''
id = MAVLINK_MSG_ID_SERIAL_CONTROL
name = 'SERIAL_CONTROL'
fieldnames = ['device', 'flags', 'timeout', 'baudrate', 'count', 'data']
ordered_fieldnames = [ 'baudrate', 'timeout', 'device', 'flags', 'count', 'data' ]
format = '<IHBBB70B'
native_format = bytearray('<IHBBBB', 'ascii')
orders = [2, 3, 1, 0, 4, 5]
lengths = [1, 1, 1, 1, 1, 70]
array_lengths = [0, 0, 0, 0, 0, 70]
crc_extra = 220
def __init__(self, device, flags, timeout, baudrate, count, data):
MAVLink_message.__init__(self, MAVLink_serial_control_message.id, MAVLink_serial_control_message.name)
self._fieldnames = MAVLink_serial_control_message.fieldnames
self.device = device
self.flags = flags
self.timeout = timeout
self.baudrate = baudrate
self.count = count
self.data = data
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 220, struct.pack('<IHBBB70B', self.baudrate, self.timeout, self.device, self.flags, self.count, self.data[0], self.data[1], self.data[2], self.data[3], self.data[4], self.data[5], self.data[6], self.data[7], self.data[8], self.data[9], self.data[10], self.data[11], self.data[12], self.data[13], self.data[14], self.data[15], self.data[16], self.data[17], self.data[18], self.data[19], self.data[20], self.data[21], self.data[22], self.data[23], self.data[24], self.data[25], self.data[26], self.data[27], self.data[28], self.data[29], self.data[30], self.data[31], self.data[32], self.data[33], self.data[34], self.data[35], self.data[36], self.data[37], self.data[38], self.data[39], self.data[40], self.data[41], self.data[42], self.data[43], self.data[44], self.data[45], self.data[46], self.data[47], self.data[48], self.data[49], self.data[50], self.data[51], self.data[52], self.data[53], self.data[54], self.data[55], self.data[56], self.data[57], self.data[58], self.data[59], self.data[60], self.data[61], self.data[62], self.data[63], self.data[64], self.data[65], self.data[66], self.data[67], self.data[68], self.data[69]), force_mavlink1=force_mavlink1)
class MAVLink_gps_rtk_message(MAVLink_message):
'''
RTK GPS data. Gives information on the relative baseline
calculation the GPS is reporting
'''
id = MAVLINK_MSG_ID_GPS_RTK
name = 'GPS_RTK'
fieldnames = ['time_last_baseline_ms', 'rtk_receiver_id', 'wn', 'tow', 'rtk_health', 'rtk_rate', 'nsats', 'baseline_coords_type', 'baseline_a_mm', 'baseline_b_mm', 'baseline_c_mm', 'accuracy', 'iar_num_hypotheses']
ordered_fieldnames = [ 'time_last_baseline_ms', 'tow', 'baseline_a_mm', 'baseline_b_mm', 'baseline_c_mm', 'accuracy', 'iar_num_hypotheses', 'wn', 'rtk_receiver_id', 'rtk_health', 'rtk_rate', 'nsats', 'baseline_coords_type' ]
format = '<IIiiiIiHBBBBB'
native_format = bytearray('<IIiiiIiHBBBBB', 'ascii')
orders = [0, 8, 7, 1, 9, 10, 11, 12, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 25
def __init__(self, time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses):
MAVLink_message.__init__(self, MAVLink_gps_rtk_message.id, MAVLink_gps_rtk_message.name)
self._fieldnames = MAVLink_gps_rtk_message.fieldnames
self.time_last_baseline_ms = time_last_baseline_ms
self.rtk_receiver_id = rtk_receiver_id
self.wn = wn
self.tow = tow
self.rtk_health = rtk_health
self.rtk_rate = rtk_rate
self.nsats = nsats
self.baseline_coords_type = baseline_coords_type
self.baseline_a_mm = baseline_a_mm
self.baseline_b_mm = baseline_b_mm
self.baseline_c_mm = baseline_c_mm
self.accuracy = accuracy
self.iar_num_hypotheses = iar_num_hypotheses
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 25, struct.pack('<IIiiiIiHBBBBB', self.time_last_baseline_ms, self.tow, self.baseline_a_mm, self.baseline_b_mm, self.baseline_c_mm, self.accuracy, self.iar_num_hypotheses, self.wn, self.rtk_receiver_id, self.rtk_health, self.rtk_rate, self.nsats, self.baseline_coords_type), force_mavlink1=force_mavlink1)
class MAVLink_gps2_rtk_message(MAVLink_message):
'''
RTK GPS data. Gives information on the relative baseline
calculation the GPS is reporting
'''
id = MAVLINK_MSG_ID_GPS2_RTK
name = 'GPS2_RTK'
fieldnames = ['time_last_baseline_ms', 'rtk_receiver_id', 'wn', 'tow', 'rtk_health', 'rtk_rate', 'nsats', 'baseline_coords_type', 'baseline_a_mm', 'baseline_b_mm', 'baseline_c_mm', 'accuracy', 'iar_num_hypotheses']
ordered_fieldnames = [ 'time_last_baseline_ms', 'tow', 'baseline_a_mm', 'baseline_b_mm', 'baseline_c_mm', 'accuracy', 'iar_num_hypotheses', 'wn', 'rtk_receiver_id', 'rtk_health', 'rtk_rate', 'nsats', 'baseline_coords_type' ]
format = '<IIiiiIiHBBBBB'
native_format = bytearray('<IIiiiIiHBBBBB', 'ascii')
orders = [0, 8, 7, 1, 9, 10, 11, 12, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 226
def __init__(self, time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses):
MAVLink_message.__init__(self, MAVLink_gps2_rtk_message.id, MAVLink_gps2_rtk_message.name)
self._fieldnames = MAVLink_gps2_rtk_message.fieldnames
self.time_last_baseline_ms = time_last_baseline_ms
self.rtk_receiver_id = rtk_receiver_id
self.wn = wn
self.tow = tow
self.rtk_health = rtk_health
self.rtk_rate = rtk_rate
self.nsats = nsats
self.baseline_coords_type = baseline_coords_type
self.baseline_a_mm = baseline_a_mm
self.baseline_b_mm = baseline_b_mm
self.baseline_c_mm = baseline_c_mm
self.accuracy = accuracy
self.iar_num_hypotheses = iar_num_hypotheses
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 226, struct.pack('<IIiiiIiHBBBBB', self.time_last_baseline_ms, self.tow, self.baseline_a_mm, self.baseline_b_mm, self.baseline_c_mm, self.accuracy, self.iar_num_hypotheses, self.wn, self.rtk_receiver_id, self.rtk_health, self.rtk_rate, self.nsats, self.baseline_coords_type), force_mavlink1=force_mavlink1)
class MAVLink_scaled_imu3_message(MAVLink_message):
'''
The RAW IMU readings for 3rd 9DOF sensor setup. This message
should contain the scaled values to the described units
'''
id = MAVLINK_MSG_ID_SCALED_IMU3
name = 'SCALED_IMU3'
fieldnames = ['time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag']
ordered_fieldnames = [ 'time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag' ]
format = '<Ihhhhhhhhh'
native_format = bytearray('<Ihhhhhhhhh', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 46
def __init__(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
MAVLink_message.__init__(self, MAVLink_scaled_imu3_message.id, MAVLink_scaled_imu3_message.name)
self._fieldnames = MAVLink_scaled_imu3_message.fieldnames
self.time_boot_ms = time_boot_ms
self.xacc = xacc
self.yacc = yacc
self.zacc = zacc
self.xgyro = xgyro
self.ygyro = ygyro
self.zgyro = zgyro
self.xmag = xmag
self.ymag = ymag
self.zmag = zmag
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 46, struct.pack('<Ihhhhhhhhh', self.time_boot_ms, self.xacc, self.yacc, self.zacc, self.xgyro, self.ygyro, self.zgyro, self.xmag, self.ymag, self.zmag), force_mavlink1=force_mavlink1)
class MAVLink_data_transmission_handshake_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE
name = 'DATA_TRANSMISSION_HANDSHAKE'
fieldnames = ['type', 'size', 'width', 'height', 'packets', 'payload', 'jpg_quality']
ordered_fieldnames = [ 'size', 'width', 'height', 'packets', 'type', 'payload', 'jpg_quality' ]
format = '<IHHHBBB'
native_format = bytearray('<IHHHBBB', 'ascii')
orders = [4, 0, 1, 2, 3, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 29
def __init__(self, type, size, width, height, packets, payload, jpg_quality):
MAVLink_message.__init__(self, MAVLink_data_transmission_handshake_message.id, MAVLink_data_transmission_handshake_message.name)
self._fieldnames = MAVLink_data_transmission_handshake_message.fieldnames
self.type = type
self.size = size
self.width = width
self.height = height
self.packets = packets
self.payload = payload
self.jpg_quality = jpg_quality
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 29, struct.pack('<IHHHBBB', self.size, self.width, self.height, self.packets, self.type, self.payload, self.jpg_quality), force_mavlink1=force_mavlink1)
class MAVLink_encapsulated_data_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_ENCAPSULATED_DATA
name = 'ENCAPSULATED_DATA'
fieldnames = ['seqnr', 'data']
ordered_fieldnames = [ 'seqnr', 'data' ]
format = '<H253B'
native_format = bytearray('<HB', 'ascii')
orders = [0, 1]
lengths = [1, 253]
array_lengths = [0, 253]
crc_extra = 223
def __init__(self, seqnr, data):
MAVLink_message.__init__(self, MAVLink_encapsulated_data_message.id, MAVLink_encapsulated_data_message.name)
self._fieldnames = MAVLink_encapsulated_data_message.fieldnames
self.seqnr = seqnr
self.data = data
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 223, struct.pack('<H253B', self.seqnr, self.data[0], self.data[1], self.data[2], self.data[3], self.data[4], self.data[5], self.data[6], self.data[7], self.data[8], self.data[9], self.data[10], self.data[11], self.data[12], self.data[13], self.data[14], self.data[15], self.data[16], self.data[17], self.data[18], self.data[19], self.data[20], self.data[21], self.data[22], self.data[23], self.data[24], self.data[25], self.data[26], self.data[27], self.data[28], self.data[29], self.data[30], self.data[31], self.data[32], self.data[33], self.data[34], self.data[35], self.data[36], self.data[37], self.data[38], self.data[39], self.data[40], self.data[41], self.data[42], self.data[43], self.data[44], self.data[45], self.data[46], self.data[47], self.data[48], self.data[49], self.data[50], self.data[51], self.data[52], self.data[53], self.data[54], self.data[55], self.data[56], self.data[57], self.data[58], self.data[59], self.data[60], self.data[61], self.data[62], self.data[63], self.data[64], self.data[65], self.data[66], self.data[67], self.data[68], self.data[69], self.data[70], self.data[71], self.data[72], self.data[73], self.data[74], self.data[75], self.data[76], self.data[77], self.data[78], self.data[79], self.data[80], self.data[81], self.data[82], self.data[83], self.data[84], self.data[85], self.data[86], self.data[87], self.data[88], self.data[89], self.data[90], self.data[91], self.data[92], self.data[93], self.data[94], self.data[95], self.data[96], self.data[97], self.data[98], self.data[99], self.data[100], self.data[101], self.data[102], self.data[103], self.data[104], self.data[105], self.data[106], self.data[107], self.data[108], self.data[109], self.data[110], self.data[111], self.data[112], self.data[113], self.data[114], self.data[115], self.data[116], self.data[117], self.data[118], self.data[119], self.data[120], self.data[121], self.data[122], self.data[123], self.data[124], self.data[125], self.data[126], self.data[127], self.data[128], self.data[129], self.data[130], self.data[131], self.data[132], self.data[133], self.data[134], self.data[135], self.data[136], self.data[137], self.data[138], self.data[139], self.data[140], self.data[141], self.data[142], self.data[143], self.data[144], self.data[145], self.data[146], self.data[147], self.data[148], self.data[149], self.data[150], self.data[151], self.data[152], self.data[153], self.data[154], self.data[155], self.data[156], self.data[157], self.data[158], self.data[159], self.data[160], self.data[161], self.data[162], self.data[163], self.data[164], self.data[165], self.data[166], self.data[167], self.data[168], self.data[169], self.data[170], self.data[171], self.data[172], self.data[173], self.data[174], self.data[175], self.data[176], self.data[177], self.data[178], self.data[179], self.data[180], self.data[181], self.data[182], self.data[183], self.data[184], self.data[185], self.data[186], self.data[187], self.data[188], self.data[189], self.data[190], self.data[191], self.data[192], self.data[193], self.data[194], self.data[195], self.data[196], self.data[197], self.data[198], self.data[199], self.data[200], self.data[201], self.data[202], self.data[203], self.data[204], self.data[205], self.data[206], self.data[207], self.data[208], self.data[209], self.data[210], self.data[211], self.data[212], self.data[213], self.data[214], self.data[215], self.data[216], self.data[217], self.data[218], self.data[219], self.data[220], self.data[221], self.data[222], self.data[223], self.data[224], self.data[225], self.data[226], self.data[227], self.data[228], self.data[229], self.data[230], self.data[231], self.data[232], self.data[233], self.data[234], self.data[235], self.data[236], self.data[237], self.data[238], self.data[239], self.data[240], self.data[241], self.data[242], self.data[243], self.data[244], self.data[245], self.data[246], self.data[247], self.data[248], self.data[249], self.data[250], self.data[251], self.data[252]), force_mavlink1=force_mavlink1)
class MAVLink_distance_sensor_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_DISTANCE_SENSOR
name = 'DISTANCE_SENSOR'
fieldnames = ['time_boot_ms', 'min_distance', 'max_distance', 'current_distance', 'type', 'id', 'orientation', 'covariance']
ordered_fieldnames = [ 'time_boot_ms', 'min_distance', 'max_distance', 'current_distance', 'type', 'id', 'orientation', 'covariance' ]
format = '<IHHHBBBB'
native_format = bytearray('<IHHHBBBB', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7]
lengths = [1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 85
def __init__(self, time_boot_ms, min_distance, max_distance, current_distance, type, id, orientation, covariance):
MAVLink_message.__init__(self, MAVLink_distance_sensor_message.id, MAVLink_distance_sensor_message.name)
self._fieldnames = MAVLink_distance_sensor_message.fieldnames
self.time_boot_ms = time_boot_ms
self.min_distance = min_distance
self.max_distance = max_distance
self.current_distance = current_distance
self.type = type
self.id = id
self.orientation = orientation
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 85, struct.pack('<IHHHBBBB', self.time_boot_ms, self.min_distance, self.max_distance, self.current_distance, self.type, self.id, self.orientation, self.covariance), force_mavlink1=force_mavlink1)
class MAVLink_terrain_request_message(MAVLink_message):
'''
Request for terrain data and terrain status
'''
id = MAVLINK_MSG_ID_TERRAIN_REQUEST
name = 'TERRAIN_REQUEST'
fieldnames = ['lat', 'lon', 'grid_spacing', 'mask']
ordered_fieldnames = [ 'mask', 'lat', 'lon', 'grid_spacing' ]
format = '<QiiH'
native_format = bytearray('<QiiH', 'ascii')
orders = [1, 2, 3, 0]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 6
def __init__(self, lat, lon, grid_spacing, mask):
MAVLink_message.__init__(self, MAVLink_terrain_request_message.id, MAVLink_terrain_request_message.name)
self._fieldnames = MAVLink_terrain_request_message.fieldnames
self.lat = lat
self.lon = lon
self.grid_spacing = grid_spacing
self.mask = mask
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 6, struct.pack('<QiiH', self.mask, self.lat, self.lon, self.grid_spacing), force_mavlink1=force_mavlink1)
class MAVLink_terrain_data_message(MAVLink_message):
'''
Terrain data sent from GCS. The lat/lon and grid_spacing must
be the same as a lat/lon from a TERRAIN_REQUEST
'''
id = MAVLINK_MSG_ID_TERRAIN_DATA
name = 'TERRAIN_DATA'
fieldnames = ['lat', 'lon', 'grid_spacing', 'gridbit', 'data']
ordered_fieldnames = [ 'lat', 'lon', 'grid_spacing', 'data', 'gridbit' ]
format = '<iiH16hB'
native_format = bytearray('<iiHhB', 'ascii')
orders = [0, 1, 2, 4, 3]
lengths = [1, 1, 1, 16, 1]
array_lengths = [0, 0, 0, 16, 0]
crc_extra = 229
def __init__(self, lat, lon, grid_spacing, gridbit, data):
MAVLink_message.__init__(self, MAVLink_terrain_data_message.id, MAVLink_terrain_data_message.name)
self._fieldnames = MAVLink_terrain_data_message.fieldnames
self.lat = lat
self.lon = lon
self.grid_spacing = grid_spacing
self.gridbit = gridbit
self.data = data
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 229, struct.pack('<iiH16hB', self.lat, self.lon, self.grid_spacing, self.data[0], self.data[1], self.data[2], self.data[3], self.data[4], self.data[5], self.data[6], self.data[7], self.data[8], self.data[9], self.data[10], self.data[11], self.data[12], self.data[13], self.data[14], self.data[15], self.gridbit), force_mavlink1=force_mavlink1)
class MAVLink_terrain_check_message(MAVLink_message):
'''
Request that the vehicle report terrain height at the given
location. Used by GCS to check if vehicle has all terrain data
needed for a mission.
'''
id = MAVLINK_MSG_ID_TERRAIN_CHECK
name = 'TERRAIN_CHECK'
fieldnames = ['lat', 'lon']
ordered_fieldnames = [ 'lat', 'lon' ]
format = '<ii'
native_format = bytearray('<ii', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 203
def __init__(self, lat, lon):
MAVLink_message.__init__(self, MAVLink_terrain_check_message.id, MAVLink_terrain_check_message.name)
self._fieldnames = MAVLink_terrain_check_message.fieldnames
self.lat = lat
self.lon = lon
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 203, struct.pack('<ii', self.lat, self.lon), force_mavlink1=force_mavlink1)
class MAVLink_terrain_report_message(MAVLink_message):
'''
Response from a TERRAIN_CHECK request
'''
id = MAVLINK_MSG_ID_TERRAIN_REPORT
name = 'TERRAIN_REPORT'
fieldnames = ['lat', 'lon', 'spacing', 'terrain_height', 'current_height', 'pending', 'loaded']
ordered_fieldnames = [ 'lat', 'lon', 'terrain_height', 'current_height', 'spacing', 'pending', 'loaded' ]
format = '<iiffHHH'
native_format = bytearray('<iiffHHH', 'ascii')
orders = [0, 1, 4, 2, 3, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 1
def __init__(self, lat, lon, spacing, terrain_height, current_height, pending, loaded):
MAVLink_message.__init__(self, MAVLink_terrain_report_message.id, MAVLink_terrain_report_message.name)
self._fieldnames = MAVLink_terrain_report_message.fieldnames
self.lat = lat
self.lon = lon
self.spacing = spacing
self.terrain_height = terrain_height
self.current_height = current_height
self.pending = pending
self.loaded = loaded
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 1, struct.pack('<iiffHHH', self.lat, self.lon, self.terrain_height, self.current_height, self.spacing, self.pending, self.loaded), force_mavlink1=force_mavlink1)
class MAVLink_scaled_pressure2_message(MAVLink_message):
'''
Barometer readings for 2nd barometer
'''
id = MAVLINK_MSG_ID_SCALED_PRESSURE2
name = 'SCALED_PRESSURE2'
fieldnames = ['time_boot_ms', 'press_abs', 'press_diff', 'temperature']
ordered_fieldnames = [ 'time_boot_ms', 'press_abs', 'press_diff', 'temperature' ]
format = '<Iffh'
native_format = bytearray('<Iffh', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 195
def __init__(self, time_boot_ms, press_abs, press_diff, temperature):
MAVLink_message.__init__(self, MAVLink_scaled_pressure2_message.id, MAVLink_scaled_pressure2_message.name)
self._fieldnames = MAVLink_scaled_pressure2_message.fieldnames
self.time_boot_ms = time_boot_ms
self.press_abs = press_abs
self.press_diff = press_diff
self.temperature = temperature
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 195, struct.pack('<Iffh', self.time_boot_ms, self.press_abs, self.press_diff, self.temperature), force_mavlink1=force_mavlink1)
class MAVLink_att_pos_mocap_message(MAVLink_message):
'''
Motion capture attitude and position
'''
id = MAVLINK_MSG_ID_ATT_POS_MOCAP
name = 'ATT_POS_MOCAP'
fieldnames = ['time_usec', 'q', 'x', 'y', 'z', 'covariance']
ordered_fieldnames = [ 'time_usec', 'q', 'x', 'y', 'z', 'covariance' ]
format = '<Q4ffff21f'
native_format = bytearray('<Qfffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5]
lengths = [1, 4, 1, 1, 1, 21]
array_lengths = [0, 4, 0, 0, 0, 21]
crc_extra = 109
def __init__(self, time_usec, q, x, y, z, covariance=0):
MAVLink_message.__init__(self, MAVLink_att_pos_mocap_message.id, MAVLink_att_pos_mocap_message.name)
self._fieldnames = MAVLink_att_pos_mocap_message.fieldnames
self.time_usec = time_usec
self.q = q
self.x = x
self.y = y
self.z = z
self.covariance = covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 109, struct.pack('<Q4ffff21f', self.time_usec, self.q[0], self.q[1], self.q[2], self.q[3], self.x, self.y, self.z, self.covariance[0], self.covariance[1], self.covariance[2], self.covariance[3], self.covariance[4], self.covariance[5], self.covariance[6], self.covariance[7], self.covariance[8], self.covariance[9], self.covariance[10], self.covariance[11], self.covariance[12], self.covariance[13], self.covariance[14], self.covariance[15], self.covariance[16], self.covariance[17], self.covariance[18], self.covariance[19], self.covariance[20]), force_mavlink1=force_mavlink1)
class MAVLink_set_actuator_control_target_message(MAVLink_message):
'''
Set the vehicle attitude and body angular rates.
'''
id = MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET
name = 'SET_ACTUATOR_CONTROL_TARGET'
fieldnames = ['time_usec', 'group_mlx', 'target_system', 'target_component', 'controls']
ordered_fieldnames = [ 'time_usec', 'controls', 'group_mlx', 'target_system', 'target_component' ]
format = '<Q8fBBB'
native_format = bytearray('<QfBBB', 'ascii')
orders = [0, 2, 3, 4, 1]
lengths = [1, 8, 1, 1, 1]
array_lengths = [0, 8, 0, 0, 0]
crc_extra = 168
def __init__(self, time_usec, group_mlx, target_system, target_component, controls):
MAVLink_message.__init__(self, MAVLink_set_actuator_control_target_message.id, MAVLink_set_actuator_control_target_message.name)
self._fieldnames = MAVLink_set_actuator_control_target_message.fieldnames
self.time_usec = time_usec
self.group_mlx = group_mlx
self.target_system = target_system
self.target_component = target_component
self.controls = controls
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 168, struct.pack('<Q8fBBB', self.time_usec, self.controls[0], self.controls[1], self.controls[2], self.controls[3], self.controls[4], self.controls[5], self.controls[6], self.controls[7], self.group_mlx, self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_actuator_control_target_message(MAVLink_message):
'''
Set the vehicle attitude and body angular rates.
'''
id = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET
name = 'ACTUATOR_CONTROL_TARGET'
fieldnames = ['time_usec', 'group_mlx', 'controls']
ordered_fieldnames = [ 'time_usec', 'controls', 'group_mlx' ]
format = '<Q8fB'
native_format = bytearray('<QfB', 'ascii')
orders = [0, 2, 1]
lengths = [1, 8, 1]
array_lengths = [0, 8, 0]
crc_extra = 181
def __init__(self, time_usec, group_mlx, controls):
MAVLink_message.__init__(self, MAVLink_actuator_control_target_message.id, MAVLink_actuator_control_target_message.name)
self._fieldnames = MAVLink_actuator_control_target_message.fieldnames
self.time_usec = time_usec
self.group_mlx = group_mlx
self.controls = controls
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 181, struct.pack('<Q8fB', self.time_usec, self.controls[0], self.controls[1], self.controls[2], self.controls[3], self.controls[4], self.controls[5], self.controls[6], self.controls[7], self.group_mlx), force_mavlink1=force_mavlink1)
class MAVLink_altitude_message(MAVLink_message):
'''
The current system altitude.
'''
id = MAVLINK_MSG_ID_ALTITUDE
name = 'ALTITUDE'
fieldnames = ['time_usec', 'altitude_monotonic', 'altitude_amsl', 'altitude_local', 'altitude_relative', 'altitude_terrain', 'bottom_clearance']
ordered_fieldnames = [ 'time_usec', 'altitude_monotonic', 'altitude_amsl', 'altitude_local', 'altitude_relative', 'altitude_terrain', 'bottom_clearance' ]
format = '<Qffffff'
native_format = bytearray('<Qffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 47
def __init__(self, time_usec, altitude_monotonic, altitude_amsl, altitude_local, altitude_relative, altitude_terrain, bottom_clearance):
MAVLink_message.__init__(self, MAVLink_altitude_message.id, MAVLink_altitude_message.name)
self._fieldnames = MAVLink_altitude_message.fieldnames
self.time_usec = time_usec
self.altitude_monotonic = altitude_monotonic
self.altitude_amsl = altitude_amsl
self.altitude_local = altitude_local
self.altitude_relative = altitude_relative
self.altitude_terrain = altitude_terrain
self.bottom_clearance = bottom_clearance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 47, struct.pack('<Qffffff', self.time_usec, self.altitude_monotonic, self.altitude_amsl, self.altitude_local, self.altitude_relative, self.altitude_terrain, self.bottom_clearance), force_mavlink1=force_mavlink1)
class MAVLink_resource_request_message(MAVLink_message):
'''
The autopilot is requesting a resource (file, binary, other
type of data)
'''
id = MAVLINK_MSG_ID_RESOURCE_REQUEST
name = 'RESOURCE_REQUEST'
fieldnames = ['request_id', 'uri_type', 'uri', 'transfer_type', 'storage']
ordered_fieldnames = [ 'request_id', 'uri_type', 'uri', 'transfer_type', 'storage' ]
format = '<BB120BB120B'
native_format = bytearray('<BBBBB', 'ascii')
orders = [0, 1, 2, 3, 4]
lengths = [1, 1, 120, 1, 120]
array_lengths = [0, 0, 120, 0, 120]
crc_extra = 72
def __init__(self, request_id, uri_type, uri, transfer_type, storage):
MAVLink_message.__init__(self, MAVLink_resource_request_message.id, MAVLink_resource_request_message.name)
self._fieldnames = MAVLink_resource_request_message.fieldnames
self.request_id = request_id
self.uri_type = uri_type
self.uri = uri
self.transfer_type = transfer_type
self.storage = storage
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 72, struct.pack('<BB120BB120B', self.request_id, self.uri_type, self.uri[0], self.uri[1], self.uri[2], self.uri[3], self.uri[4], self.uri[5], self.uri[6], self.uri[7], self.uri[8], self.uri[9], self.uri[10], self.uri[11], self.uri[12], self.uri[13], self.uri[14], self.uri[15], self.uri[16], self.uri[17], self.uri[18], self.uri[19], self.uri[20], self.uri[21], self.uri[22], self.uri[23], self.uri[24], self.uri[25], self.uri[26], self.uri[27], self.uri[28], self.uri[29], self.uri[30], self.uri[31], self.uri[32], self.uri[33], self.uri[34], self.uri[35], self.uri[36], self.uri[37], self.uri[38], self.uri[39], self.uri[40], self.uri[41], self.uri[42], self.uri[43], self.uri[44], self.uri[45], self.uri[46], self.uri[47], self.uri[48], self.uri[49], self.uri[50], self.uri[51], self.uri[52], self.uri[53], self.uri[54], self.uri[55], self.uri[56], self.uri[57], self.uri[58], self.uri[59], self.uri[60], self.uri[61], self.uri[62], self.uri[63], self.uri[64], self.uri[65], self.uri[66], self.uri[67], self.uri[68], self.uri[69], self.uri[70], self.uri[71], self.uri[72], self.uri[73], self.uri[74], self.uri[75], self.uri[76], self.uri[77], self.uri[78], self.uri[79], self.uri[80], self.uri[81], self.uri[82], self.uri[83], self.uri[84], self.uri[85], self.uri[86], self.uri[87], self.uri[88], self.uri[89], self.uri[90], self.uri[91], self.uri[92], self.uri[93], self.uri[94], self.uri[95], self.uri[96], self.uri[97], self.uri[98], self.uri[99], self.uri[100], self.uri[101], self.uri[102], self.uri[103], self.uri[104], self.uri[105], self.uri[106], self.uri[107], self.uri[108], self.uri[109], self.uri[110], self.uri[111], self.uri[112], self.uri[113], self.uri[114], self.uri[115], self.uri[116], self.uri[117], self.uri[118], self.uri[119], self.transfer_type, self.storage[0], self.storage[1], self.storage[2], self.storage[3], self.storage[4], self.storage[5], self.storage[6], self.storage[7], self.storage[8], self.storage[9], self.storage[10], self.storage[11], self.storage[12], self.storage[13], self.storage[14], self.storage[15], self.storage[16], self.storage[17], self.storage[18], self.storage[19], self.storage[20], self.storage[21], self.storage[22], self.storage[23], self.storage[24], self.storage[25], self.storage[26], self.storage[27], self.storage[28], self.storage[29], self.storage[30], self.storage[31], self.storage[32], self.storage[33], self.storage[34], self.storage[35], self.storage[36], self.storage[37], self.storage[38], self.storage[39], self.storage[40], self.storage[41], self.storage[42], self.storage[43], self.storage[44], self.storage[45], self.storage[46], self.storage[47], self.storage[48], self.storage[49], self.storage[50], self.storage[51], self.storage[52], self.storage[53], self.storage[54], self.storage[55], self.storage[56], self.storage[57], self.storage[58], self.storage[59], self.storage[60], self.storage[61], self.storage[62], self.storage[63], self.storage[64], self.storage[65], self.storage[66], self.storage[67], self.storage[68], self.storage[69], self.storage[70], self.storage[71], self.storage[72], self.storage[73], self.storage[74], self.storage[75], self.storage[76], self.storage[77], self.storage[78], self.storage[79], self.storage[80], self.storage[81], self.storage[82], self.storage[83], self.storage[84], self.storage[85], self.storage[86], self.storage[87], self.storage[88], self.storage[89], self.storage[90], self.storage[91], self.storage[92], self.storage[93], self.storage[94], self.storage[95], self.storage[96], self.storage[97], self.storage[98], self.storage[99], self.storage[100], self.storage[101], self.storage[102], self.storage[103], self.storage[104], self.storage[105], self.storage[106], self.storage[107], self.storage[108], self.storage[109], self.storage[110], self.storage[111], self.storage[112], self.storage[113], self.storage[114], self.storage[115], self.storage[116], self.storage[117], self.storage[118], self.storage[119]), force_mavlink1=force_mavlink1)
class MAVLink_scaled_pressure3_message(MAVLink_message):
'''
Barometer readings for 3rd barometer
'''
id = MAVLINK_MSG_ID_SCALED_PRESSURE3
name = 'SCALED_PRESSURE3'
fieldnames = ['time_boot_ms', 'press_abs', 'press_diff', 'temperature']
ordered_fieldnames = [ 'time_boot_ms', 'press_abs', 'press_diff', 'temperature' ]
format = '<Iffh'
native_format = bytearray('<Iffh', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 131
def __init__(self, time_boot_ms, press_abs, press_diff, temperature):
MAVLink_message.__init__(self, MAVLink_scaled_pressure3_message.id, MAVLink_scaled_pressure3_message.name)
self._fieldnames = MAVLink_scaled_pressure3_message.fieldnames
self.time_boot_ms = time_boot_ms
self.press_abs = press_abs
self.press_diff = press_diff
self.temperature = temperature
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 131, struct.pack('<Iffh', self.time_boot_ms, self.press_abs, self.press_diff, self.temperature), force_mavlink1=force_mavlink1)
class MAVLink_follow_target_message(MAVLink_message):
'''
current motion information from a designated system
'''
id = MAVLINK_MSG_ID_FOLLOW_TARGET
name = 'FOLLOW_TARGET'
fieldnames = ['timestamp', 'est_capabilities', 'lat', 'lon', 'alt', 'vel', 'acc', 'attitude_q', 'rates', 'position_cov', 'custom_state']
ordered_fieldnames = [ 'timestamp', 'custom_state', 'lat', 'lon', 'alt', 'vel', 'acc', 'attitude_q', 'rates', 'position_cov', 'est_capabilities' ]
format = '<QQiif3f3f4f3f3fB'
native_format = bytearray('<QQiiffffffB', 'ascii')
orders = [0, 10, 2, 3, 4, 5, 6, 7, 8, 9, 1]
lengths = [1, 1, 1, 1, 1, 3, 3, 4, 3, 3, 1]
array_lengths = [0, 0, 0, 0, 0, 3, 3, 4, 3, 3, 0]
crc_extra = 127
def __init__(self, timestamp, est_capabilities, lat, lon, alt, vel, acc, attitude_q, rates, position_cov, custom_state):
MAVLink_message.__init__(self, MAVLink_follow_target_message.id, MAVLink_follow_target_message.name)
self._fieldnames = MAVLink_follow_target_message.fieldnames
self.timestamp = timestamp
self.est_capabilities = est_capabilities
self.lat = lat
self.lon = lon
self.alt = alt
self.vel = vel
self.acc = acc
self.attitude_q = attitude_q
self.rates = rates
self.position_cov = position_cov
self.custom_state = custom_state
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 127, struct.pack('<QQiif3f3f4f3f3fB', self.timestamp, self.custom_state, self.lat, self.lon, self.alt, self.vel[0], self.vel[1], self.vel[2], self.acc[0], self.acc[1], self.acc[2], self.attitude_q[0], self.attitude_q[1], self.attitude_q[2], self.attitude_q[3], self.rates[0], self.rates[1], self.rates[2], self.position_cov[0], self.position_cov[1], self.position_cov[2], self.est_capabilities), force_mavlink1=force_mavlink1)
class MAVLink_control_system_state_message(MAVLink_message):
'''
The smoothed, monotonic system state used to feed the control
loops of the system.
'''
id = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE
name = 'CONTROL_SYSTEM_STATE'
fieldnames = ['time_usec', 'x_acc', 'y_acc', 'z_acc', 'x_vel', 'y_vel', 'z_vel', 'x_pos', 'y_pos', 'z_pos', 'airspeed', 'vel_variance', 'pos_variance', 'q', 'roll_rate', 'pitch_rate', 'yaw_rate']
ordered_fieldnames = [ 'time_usec', 'x_acc', 'y_acc', 'z_acc', 'x_vel', 'y_vel', 'z_vel', 'x_pos', 'y_pos', 'z_pos', 'airspeed', 'vel_variance', 'pos_variance', 'q', 'roll_rate', 'pitch_rate', 'yaw_rate' ]
format = '<Qffffffffff3f3f4ffff'
native_format = bytearray('<Qffffffffffffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 4, 0, 0, 0]
crc_extra = 103
def __init__(self, time_usec, x_acc, y_acc, z_acc, x_vel, y_vel, z_vel, x_pos, y_pos, z_pos, airspeed, vel_variance, pos_variance, q, roll_rate, pitch_rate, yaw_rate):
MAVLink_message.__init__(self, MAVLink_control_system_state_message.id, MAVLink_control_system_state_message.name)
self._fieldnames = MAVLink_control_system_state_message.fieldnames
self.time_usec = time_usec
self.x_acc = x_acc
self.y_acc = y_acc
self.z_acc = z_acc
self.x_vel = x_vel
self.y_vel = y_vel
self.z_vel = z_vel
self.x_pos = x_pos
self.y_pos = y_pos
self.z_pos = z_pos
self.airspeed = airspeed
self.vel_variance = vel_variance
self.pos_variance = pos_variance
self.q = q
self.roll_rate = roll_rate
self.pitch_rate = pitch_rate
self.yaw_rate = yaw_rate
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 103, struct.pack('<Qffffffffff3f3f4ffff', self.time_usec, self.x_acc, self.y_acc, self.z_acc, self.x_vel, self.y_vel, self.z_vel, self.x_pos, self.y_pos, self.z_pos, self.airspeed, self.vel_variance[0], self.vel_variance[1], self.vel_variance[2], self.pos_variance[0], self.pos_variance[1], self.pos_variance[2], self.q[0], self.q[1], self.q[2], self.q[3], self.roll_rate, self.pitch_rate, self.yaw_rate), force_mavlink1=force_mavlink1)
class MAVLink_battery_status_message(MAVLink_message):
'''
Battery information
'''
id = MAVLINK_MSG_ID_BATTERY_STATUS
name = 'BATTERY_STATUS'
fieldnames = ['id', 'battery_function', 'type', 'temperature', 'voltages', 'current_battery', 'current_consumed', 'energy_consumed', 'battery_remaining', 'time_remaining', 'charge_state']
ordered_fieldnames = [ 'current_consumed', 'energy_consumed', 'temperature', 'voltages', 'current_battery', 'id', 'battery_function', 'type', 'battery_remaining', 'time_remaining', 'charge_state' ]
format = '<iih10HhBBBbiB'
native_format = bytearray('<iihHhBBBbiB', 'ascii')
orders = [5, 6, 7, 2, 3, 4, 0, 1, 8, 9, 10]
lengths = [1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 154
def __init__(self, id, battery_function, type, temperature, voltages, current_battery, current_consumed, energy_consumed, battery_remaining, time_remaining=0, charge_state=0):
MAVLink_message.__init__(self, MAVLink_battery_status_message.id, MAVLink_battery_status_message.name)
self._fieldnames = MAVLink_battery_status_message.fieldnames
self.id = id
self.battery_function = battery_function
self.type = type
self.temperature = temperature
self.voltages = voltages
self.current_battery = current_battery
self.current_consumed = current_consumed
self.energy_consumed = energy_consumed
self.battery_remaining = battery_remaining
self.time_remaining = time_remaining
self.charge_state = charge_state
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 154, struct.pack('<iih10HhBBBbiB', self.current_consumed, self.energy_consumed, self.temperature, self.voltages[0], self.voltages[1], self.voltages[2], self.voltages[3], self.voltages[4], self.voltages[5], self.voltages[6], self.voltages[7], self.voltages[8], self.voltages[9], self.current_battery, self.id, self.battery_function, self.type, self.battery_remaining, self.time_remaining, self.charge_state), force_mavlink1=force_mavlink1)
class MAVLink_autopilot_version_message(MAVLink_message):
'''
Version and capability of autopilot software
'''
id = MAVLINK_MSG_ID_AUTOPILOT_VERSION
name = 'AUTOPILOT_VERSION'
fieldnames = ['capabilities', 'flight_sw_version', 'middleware_sw_version', 'os_sw_version', 'board_version', 'flight_custom_version', 'middleware_custom_version', 'os_custom_version', 'vendor_id', 'product_id', 'uid', 'uid2']
ordered_fieldnames = [ 'capabilities', 'uid', 'flight_sw_version', 'middleware_sw_version', 'os_sw_version', 'board_version', 'vendor_id', 'product_id', 'flight_custom_version', 'middleware_custom_version', 'os_custom_version', 'uid2' ]
format = '<QQIIIIHH8B8B8B18B'
native_format = bytearray('<QQIIIIHHBBBB', 'ascii')
orders = [0, 2, 3, 4, 5, 8, 9, 10, 6, 7, 1, 11]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 18]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 18]
crc_extra = 178
def __init__(self, capabilities, flight_sw_version, middleware_sw_version, os_sw_version, board_version, flight_custom_version, middleware_custom_version, os_custom_version, vendor_id, product_id, uid, uid2=0):
MAVLink_message.__init__(self, MAVLink_autopilot_version_message.id, MAVLink_autopilot_version_message.name)
self._fieldnames = MAVLink_autopilot_version_message.fieldnames
self.capabilities = capabilities
self.flight_sw_version = flight_sw_version
self.middleware_sw_version = middleware_sw_version
self.os_sw_version = os_sw_version
self.board_version = board_version
self.flight_custom_version = flight_custom_version
self.middleware_custom_version = middleware_custom_version
self.os_custom_version = os_custom_version
self.vendor_id = vendor_id
self.product_id = product_id
self.uid = uid
self.uid2 = uid2
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 178, struct.pack('<QQIIIIHH8B8B8B18B', self.capabilities, self.uid, self.flight_sw_version, self.middleware_sw_version, self.os_sw_version, self.board_version, self.vendor_id, self.product_id, self.flight_custom_version[0], self.flight_custom_version[1], self.flight_custom_version[2], self.flight_custom_version[3], self.flight_custom_version[4], self.flight_custom_version[5], self.flight_custom_version[6], self.flight_custom_version[7], self.middleware_custom_version[0], self.middleware_custom_version[1], self.middleware_custom_version[2], self.middleware_custom_version[3], self.middleware_custom_version[4], self.middleware_custom_version[5], self.middleware_custom_version[6], self.middleware_custom_version[7], self.os_custom_version[0], self.os_custom_version[1], self.os_custom_version[2], self.os_custom_version[3], self.os_custom_version[4], self.os_custom_version[5], self.os_custom_version[6], self.os_custom_version[7], self.uid2[0], self.uid2[1], self.uid2[2], self.uid2[3], self.uid2[4], self.uid2[5], self.uid2[6], self.uid2[7], self.uid2[8], self.uid2[9], self.uid2[10], self.uid2[11], self.uid2[12], self.uid2[13], self.uid2[14], self.uid2[15], self.uid2[16], self.uid2[17]), force_mavlink1=force_mavlink1)
class MAVLink_landing_target_message(MAVLink_message):
'''
The location of a landing area captured from a downward facing
camera
'''
id = MAVLINK_MSG_ID_LANDING_TARGET
name = 'LANDING_TARGET'
fieldnames = ['time_usec', 'target_num', 'frame', 'angle_x', 'angle_y', 'distance', 'size_x', 'size_y', 'x', 'y', 'z', 'q', 'type', 'position_valid']
ordered_fieldnames = [ 'time_usec', 'angle_x', 'angle_y', 'distance', 'size_x', 'size_y', 'target_num', 'frame', 'x', 'y', 'z', 'q', 'type', 'position_valid' ]
format = '<QfffffBBfff4fBB'
native_format = bytearray('<QfffffBBffffBB', 'ascii')
orders = [0, 6, 7, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0]
crc_extra = 200
def __init__(self, time_usec, target_num, frame, angle_x, angle_y, distance, size_x, size_y, x=0, y=0, z=0, q=0, type=0, position_valid=0):
MAVLink_message.__init__(self, MAVLink_landing_target_message.id, MAVLink_landing_target_message.name)
self._fieldnames = MAVLink_landing_target_message.fieldnames
self.time_usec = time_usec
self.target_num = target_num
self.frame = frame
self.angle_x = angle_x
self.angle_y = angle_y
self.distance = distance
self.size_x = size_x
self.size_y = size_y
self.x = x
self.y = y
self.z = z
self.q = q
self.type = type
self.position_valid = position_valid
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 200, struct.pack('<QfffffBBfff4fBB', self.time_usec, self.angle_x, self.angle_y, self.distance, self.size_x, self.size_y, self.target_num, self.frame, self.x, self.y, self.z, self.q[0], self.q[1], self.q[2], self.q[3], self.type, self.position_valid), force_mavlink1=force_mavlink1)
class MAVLink_estimator_status_message(MAVLink_message):
'''
Estimator status message including flags, innovation test
ratios and estimated accuracies. The flags message is an
integer bitmask containing information on which EKF outputs
are valid. See the ESTIMATOR_STATUS_FLAGS enum definition for
further information. The innovaton test ratios show the
magnitude of the sensor innovation divided by the innovation
check threshold. Under normal operation the innovaton test
ratios should be below 0.5 with occasional values up to 1.0.
Values greater than 1.0 should be rare under normal operation
and indicate that a measurement has been rejected by the
filter. The user should be notified if an innovation test
ratio greater than 1.0 is recorded. Notifications for values
in the range between 0.5 and 1.0 should be optional and
controllable by the user.
'''
id = MAVLINK_MSG_ID_ESTIMATOR_STATUS
name = 'ESTIMATOR_STATUS'
fieldnames = ['time_usec', 'flags', 'vel_ratio', 'pos_horiz_ratio', 'pos_vert_ratio', 'mag_ratio', 'hagl_ratio', 'tas_ratio', 'pos_horiz_accuracy', 'pos_vert_accuracy']
ordered_fieldnames = [ 'time_usec', 'vel_ratio', 'pos_horiz_ratio', 'pos_vert_ratio', 'mag_ratio', 'hagl_ratio', 'tas_ratio', 'pos_horiz_accuracy', 'pos_vert_accuracy', 'flags' ]
format = '<QffffffffH'
native_format = bytearray('<QffffffffH', 'ascii')
orders = [0, 9, 1, 2, 3, 4, 5, 6, 7, 8]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 163
def __init__(self, time_usec, flags, vel_ratio, pos_horiz_ratio, pos_vert_ratio, mag_ratio, hagl_ratio, tas_ratio, pos_horiz_accuracy, pos_vert_accuracy):
MAVLink_message.__init__(self, MAVLink_estimator_status_message.id, MAVLink_estimator_status_message.name)
self._fieldnames = MAVLink_estimator_status_message.fieldnames
self.time_usec = time_usec
self.flags = flags
self.vel_ratio = vel_ratio
self.pos_horiz_ratio = pos_horiz_ratio
self.pos_vert_ratio = pos_vert_ratio
self.mag_ratio = mag_ratio
self.hagl_ratio = hagl_ratio
self.tas_ratio = tas_ratio
self.pos_horiz_accuracy = pos_horiz_accuracy
self.pos_vert_accuracy = pos_vert_accuracy
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 163, struct.pack('<QffffffffH', self.time_usec, self.vel_ratio, self.pos_horiz_ratio, self.pos_vert_ratio, self.mag_ratio, self.hagl_ratio, self.tas_ratio, self.pos_horiz_accuracy, self.pos_vert_accuracy, self.flags), force_mavlink1=force_mavlink1)
class MAVLink_wind_cov_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_WIND_COV
name = 'WIND_COV'
fieldnames = ['time_usec', 'wind_x', 'wind_y', 'wind_z', 'var_horiz', 'var_vert', 'wind_alt', 'horiz_accuracy', 'vert_accuracy']
ordered_fieldnames = [ 'time_usec', 'wind_x', 'wind_y', 'wind_z', 'var_horiz', 'var_vert', 'wind_alt', 'horiz_accuracy', 'vert_accuracy' ]
format = '<Qffffffff'
native_format = bytearray('<Qffffffff', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 105
def __init__(self, time_usec, wind_x, wind_y, wind_z, var_horiz, var_vert, wind_alt, horiz_accuracy, vert_accuracy):
MAVLink_message.__init__(self, MAVLink_wind_cov_message.id, MAVLink_wind_cov_message.name)
self._fieldnames = MAVLink_wind_cov_message.fieldnames
self.time_usec = time_usec
self.wind_x = wind_x
self.wind_y = wind_y
self.wind_z = wind_z
self.var_horiz = var_horiz
self.var_vert = var_vert
self.wind_alt = wind_alt
self.horiz_accuracy = horiz_accuracy
self.vert_accuracy = vert_accuracy
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 105, struct.pack('<Qffffffff', self.time_usec, self.wind_x, self.wind_y, self.wind_z, self.var_horiz, self.var_vert, self.wind_alt, self.horiz_accuracy, self.vert_accuracy), force_mavlink1=force_mavlink1)
class MAVLink_gps_input_message(MAVLink_message):
'''
GPS sensor input message. This is a raw sensor value sent by
the GPS. This is NOT the global position estimate of the
sytem.
'''
id = MAVLINK_MSG_ID_GPS_INPUT
name = 'GPS_INPUT'
fieldnames = ['time_usec', 'gps_id', 'ignore_flags', 'time_week_ms', 'time_week', 'fix_type', 'lat', 'lon', 'alt', 'hdop', 'vdop', 'vn', 've', 'vd', 'speed_accuracy', 'horiz_accuracy', 'vert_accuracy', 'satellites_visible']
ordered_fieldnames = [ 'time_usec', 'time_week_ms', 'lat', 'lon', 'alt', 'hdop', 'vdop', 'vn', 've', 'vd', 'speed_accuracy', 'horiz_accuracy', 'vert_accuracy', 'ignore_flags', 'time_week', 'gps_id', 'fix_type', 'satellites_visible' ]
format = '<QIiifffffffffHHBBB'
native_format = bytearray('<QIiifffffffffHHBBB', 'ascii')
orders = [0, 15, 13, 1, 14, 16, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 151
def __init__(self, time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible):
MAVLink_message.__init__(self, MAVLink_gps_input_message.id, MAVLink_gps_input_message.name)
self._fieldnames = MAVLink_gps_input_message.fieldnames
self.time_usec = time_usec
self.gps_id = gps_id
self.ignore_flags = ignore_flags
self.time_week_ms = time_week_ms
self.time_week = time_week
self.fix_type = fix_type
self.lat = lat
self.lon = lon
self.alt = alt
self.hdop = hdop
self.vdop = vdop
self.vn = vn
self.ve = ve
self.vd = vd
self.speed_accuracy = speed_accuracy
self.horiz_accuracy = horiz_accuracy
self.vert_accuracy = vert_accuracy
self.satellites_visible = satellites_visible
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 151, struct.pack('<QIiifffffffffHHBBB', self.time_usec, self.time_week_ms, self.lat, self.lon, self.alt, self.hdop, self.vdop, self.vn, self.ve, self.vd, self.speed_accuracy, self.horiz_accuracy, self.vert_accuracy, self.ignore_flags, self.time_week, self.gps_id, self.fix_type, self.satellites_visible), force_mavlink1=force_mavlink1)
class MAVLink_gps_rtcm_data_message(MAVLink_message):
'''
RTCM message for injecting into the onboard GPS (used for
DGPS)
'''
id = MAVLINK_MSG_ID_GPS_RTCM_DATA
name = 'GPS_RTCM_DATA'
fieldnames = ['flags', 'len', 'data']
ordered_fieldnames = [ 'flags', 'len', 'data' ]
format = '<BB180B'
native_format = bytearray('<BBB', 'ascii')
orders = [0, 1, 2]
lengths = [1, 1, 180]
array_lengths = [0, 0, 180]
crc_extra = 35
def __init__(self, flags, len, data):
MAVLink_message.__init__(self, MAVLink_gps_rtcm_data_message.id, MAVLink_gps_rtcm_data_message.name)
self._fieldnames = MAVLink_gps_rtcm_data_message.fieldnames
self.flags = flags
self.len = len
self.data = data
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 35, struct.pack('<BB180B', self.flags, self.len, self.data[0], self.data[1], self.data[2], self.data[3], self.data[4], self.data[5], self.data[6], self.data[7], self.data[8], self.data[9], self.data[10], self.data[11], self.data[12], self.data[13], self.data[14], self.data[15], self.data[16], self.data[17], self.data[18], self.data[19], self.data[20], self.data[21], self.data[22], self.data[23], self.data[24], self.data[25], self.data[26], self.data[27], self.data[28], self.data[29], self.data[30], self.data[31], self.data[32], self.data[33], self.data[34], self.data[35], self.data[36], self.data[37], self.data[38], self.data[39], self.data[40], self.data[41], self.data[42], self.data[43], self.data[44], self.data[45], self.data[46], self.data[47], self.data[48], self.data[49], self.data[50], self.data[51], self.data[52], self.data[53], self.data[54], self.data[55], self.data[56], self.data[57], self.data[58], self.data[59], self.data[60], self.data[61], self.data[62], self.data[63], self.data[64], self.data[65], self.data[66], self.data[67], self.data[68], self.data[69], self.data[70], self.data[71], self.data[72], self.data[73], self.data[74], self.data[75], self.data[76], self.data[77], self.data[78], self.data[79], self.data[80], self.data[81], self.data[82], self.data[83], self.data[84], self.data[85], self.data[86], self.data[87], self.data[88], self.data[89], self.data[90], self.data[91], self.data[92], self.data[93], self.data[94], self.data[95], self.data[96], self.data[97], self.data[98], self.data[99], self.data[100], self.data[101], self.data[102], self.data[103], self.data[104], self.data[105], self.data[106], self.data[107], self.data[108], self.data[109], self.data[110], self.data[111], self.data[112], self.data[113], self.data[114], self.data[115], self.data[116], self.data[117], self.data[118], self.data[119], self.data[120], self.data[121], self.data[122], self.data[123], self.data[124], self.data[125], self.data[126], self.data[127], self.data[128], self.data[129], self.data[130], self.data[131], self.data[132], self.data[133], self.data[134], self.data[135], self.data[136], self.data[137], self.data[138], self.data[139], self.data[140], self.data[141], self.data[142], self.data[143], self.data[144], self.data[145], self.data[146], self.data[147], self.data[148], self.data[149], self.data[150], self.data[151], self.data[152], self.data[153], self.data[154], self.data[155], self.data[156], self.data[157], self.data[158], self.data[159], self.data[160], self.data[161], self.data[162], self.data[163], self.data[164], self.data[165], self.data[166], self.data[167], self.data[168], self.data[169], self.data[170], self.data[171], self.data[172], self.data[173], self.data[174], self.data[175], self.data[176], self.data[177], self.data[178], self.data[179]), force_mavlink1=force_mavlink1)
class MAVLink_high_latency_message(MAVLink_message):
'''
Message appropriate for high latency connections like Iridium
'''
id = MAVLINK_MSG_ID_HIGH_LATENCY
name = 'HIGH_LATENCY'
fieldnames = ['base_mode', 'custom_mode', 'landed_state', 'roll', 'pitch', 'heading', 'throttle', 'heading_sp', 'latitude', 'longitude', 'altitude_amsl', 'altitude_sp', 'airspeed', 'airspeed_sp', 'groundspeed', 'climb_rate', 'gps_nsat', 'gps_fix_type', 'battery_remaining', 'temperature', 'temperature_air', 'failsafe', 'wp_num', 'wp_distance']
ordered_fieldnames = [ 'custom_mode', 'latitude', 'longitude', 'roll', 'pitch', 'heading', 'heading_sp', 'altitude_amsl', 'altitude_sp', 'wp_distance', 'base_mode', 'landed_state', 'throttle', 'airspeed', 'airspeed_sp', 'groundspeed', 'climb_rate', 'gps_nsat', 'gps_fix_type', 'battery_remaining', 'temperature', 'temperature_air', 'failsafe', 'wp_num' ]
format = '<IiihhHhhhHBBbBBBbBBBbbBB'
native_format = bytearray('<IiihhHhhhHBBbBBBbBBBbbBB', 'ascii')
orders = [10, 0, 11, 3, 4, 5, 12, 6, 1, 2, 7, 8, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 9]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 150
def __init__(self, base_mode, custom_mode, landed_state, roll, pitch, heading, throttle, heading_sp, latitude, longitude, altitude_amsl, altitude_sp, airspeed, airspeed_sp, groundspeed, climb_rate, gps_nsat, gps_fix_type, battery_remaining, temperature, temperature_air, failsafe, wp_num, wp_distance):
MAVLink_message.__init__(self, MAVLink_high_latency_message.id, MAVLink_high_latency_message.name)
self._fieldnames = MAVLink_high_latency_message.fieldnames
self.base_mode = base_mode
self.custom_mode = custom_mode
self.landed_state = landed_state
self.roll = roll
self.pitch = pitch
self.heading = heading
self.throttle = throttle
self.heading_sp = heading_sp
self.latitude = latitude
self.longitude = longitude
self.altitude_amsl = altitude_amsl
self.altitude_sp = altitude_sp
self.airspeed = airspeed
self.airspeed_sp = airspeed_sp
self.groundspeed = groundspeed
self.climb_rate = climb_rate
self.gps_nsat = gps_nsat
self.gps_fix_type = gps_fix_type
self.battery_remaining = battery_remaining
self.temperature = temperature
self.temperature_air = temperature_air
self.failsafe = failsafe
self.wp_num = wp_num
self.wp_distance = wp_distance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 150, struct.pack('<IiihhHhhhHBBbBBBbBBBbbBB', self.custom_mode, self.latitude, self.longitude, self.roll, self.pitch, self.heading, self.heading_sp, self.altitude_amsl, self.altitude_sp, self.wp_distance, self.base_mode, self.landed_state, self.throttle, self.airspeed, self.airspeed_sp, self.groundspeed, self.climb_rate, self.gps_nsat, self.gps_fix_type, self.battery_remaining, self.temperature, self.temperature_air, self.failsafe, self.wp_num), force_mavlink1=force_mavlink1)
class MAVLink_vibration_message(MAVLink_message):
'''
Vibration levels and accelerometer clipping
'''
id = MAVLINK_MSG_ID_VIBRATION
name = 'VIBRATION'
fieldnames = ['time_usec', 'vibration_x', 'vibration_y', 'vibration_z', 'clipping_0', 'clipping_1', 'clipping_2']
ordered_fieldnames = [ 'time_usec', 'vibration_x', 'vibration_y', 'vibration_z', 'clipping_0', 'clipping_1', 'clipping_2' ]
format = '<QfffIII'
native_format = bytearray('<QfffIII', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 90
def __init__(self, time_usec, vibration_x, vibration_y, vibration_z, clipping_0, clipping_1, clipping_2):
MAVLink_message.__init__(self, MAVLink_vibration_message.id, MAVLink_vibration_message.name)
self._fieldnames = MAVLink_vibration_message.fieldnames
self.time_usec = time_usec
self.vibration_x = vibration_x
self.vibration_y = vibration_y
self.vibration_z = vibration_z
self.clipping_0 = clipping_0
self.clipping_1 = clipping_1
self.clipping_2 = clipping_2
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 90, struct.pack('<QfffIII', self.time_usec, self.vibration_x, self.vibration_y, self.vibration_z, self.clipping_0, self.clipping_1, self.clipping_2), force_mavlink1=force_mavlink1)
class MAVLink_home_position_message(MAVLink_message):
'''
This message can be requested by sending the
MAV_CMD_GET_HOME_POSITION command. The position the system
will return to and land on. The position is set automatically
by the system during the takeoff in case it was not
explicitely set by the operator before or after. The position
the system will return to and land on. The global and local
positions encode the position in the respective coordinate
frames, while the q parameter encodes the orientation of the
surface. Under normal conditions it describes the heading and
terrain slope, which can be used by the aircraft to adjust the
approach. The approach 3D vector describes the point to which
the system should fly in normal flight mode and then perform a
landing sequence along the vector.
'''
id = MAVLINK_MSG_ID_HOME_POSITION
name = 'HOME_POSITION'
fieldnames = ['latitude', 'longitude', 'altitude', 'x', 'y', 'z', 'q', 'approach_x', 'approach_y', 'approach_z', 'time_usec']
ordered_fieldnames = [ 'latitude', 'longitude', 'altitude', 'x', 'y', 'z', 'q', 'approach_x', 'approach_y', 'approach_z', 'time_usec' ]
format = '<iiifff4ffffQ'
native_format = bytearray('<iiifffffffQ', 'ascii')
orders = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
lengths = [1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0]
crc_extra = 104
def __init__(self, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec=0):
MAVLink_message.__init__(self, MAVLink_home_position_message.id, MAVLink_home_position_message.name)
self._fieldnames = MAVLink_home_position_message.fieldnames
self.latitude = latitude
self.longitude = longitude
self.altitude = altitude
self.x = x
self.y = y
self.z = z
self.q = q
self.approach_x = approach_x
self.approach_y = approach_y
self.approach_z = approach_z
self.time_usec = time_usec
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 104, struct.pack('<iiifff4ffffQ', self.latitude, self.longitude, self.altitude, self.x, self.y, self.z, self.q[0], self.q[1], self.q[2], self.q[3], self.approach_x, self.approach_y, self.approach_z, self.time_usec), force_mavlink1=force_mavlink1)
class MAVLink_set_home_position_message(MAVLink_message):
'''
The position the system will return to and land on. The
position is set automatically by the system during the takeoff
in case it was not explicitely set by the operator before or
after. The global and local positions encode the position in
the respective coordinate frames, while the q parameter
encodes the orientation of the surface. Under normal
conditions it describes the heading and terrain slope, which
can be used by the aircraft to adjust the approach. The
approach 3D vector describes the point to which the system
should fly in normal flight mode and then perform a landing
sequence along the vector.
'''
id = MAVLINK_MSG_ID_SET_HOME_POSITION
name = 'SET_HOME_POSITION'
fieldnames = ['target_system', 'latitude', 'longitude', 'altitude', 'x', 'y', 'z', 'q', 'approach_x', 'approach_y', 'approach_z', 'time_usec']
ordered_fieldnames = [ 'latitude', 'longitude', 'altitude', 'x', 'y', 'z', 'q', 'approach_x', 'approach_y', 'approach_z', 'target_system', 'time_usec' ]
format = '<iiifff4ffffBQ'
native_format = bytearray('<iiifffffffBQ', 'ascii')
orders = [10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11]
lengths = [1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0]
crc_extra = 85
def __init__(self, target_system, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec=0):
MAVLink_message.__init__(self, MAVLink_set_home_position_message.id, MAVLink_set_home_position_message.name)
self._fieldnames = MAVLink_set_home_position_message.fieldnames
self.target_system = target_system
self.latitude = latitude
self.longitude = longitude
self.altitude = altitude
self.x = x
self.y = y
self.z = z
self.q = q
self.approach_x = approach_x
self.approach_y = approach_y
self.approach_z = approach_z
self.time_usec = time_usec
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 85, struct.pack('<iiifff4ffffBQ', self.latitude, self.longitude, self.altitude, self.x, self.y, self.z, self.q[0], self.q[1], self.q[2], self.q[3], self.approach_x, self.approach_y, self.approach_z, self.target_system, self.time_usec), force_mavlink1=force_mavlink1)
class MAVLink_message_interval_message(MAVLink_message):
'''
This interface replaces DATA_STREAM
'''
id = MAVLINK_MSG_ID_MESSAGE_INTERVAL
name = 'MESSAGE_INTERVAL'
fieldnames = ['message_id', 'interval_us']
ordered_fieldnames = [ 'interval_us', 'message_id' ]
format = '<iH'
native_format = bytearray('<iH', 'ascii')
orders = [1, 0]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 95
def __init__(self, message_id, interval_us):
MAVLink_message.__init__(self, MAVLink_message_interval_message.id, MAVLink_message_interval_message.name)
self._fieldnames = MAVLink_message_interval_message.fieldnames
self.message_id = message_id
self.interval_us = interval_us
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 95, struct.pack('<iH', self.interval_us, self.message_id), force_mavlink1=force_mavlink1)
class MAVLink_extended_sys_state_message(MAVLink_message):
'''
Provides state for additional features
'''
id = MAVLINK_MSG_ID_EXTENDED_SYS_STATE
name = 'EXTENDED_SYS_STATE'
fieldnames = ['vtol_state', 'landed_state']
ordered_fieldnames = [ 'vtol_state', 'landed_state' ]
format = '<BB'
native_format = bytearray('<BB', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 0]
crc_extra = 130
def __init__(self, vtol_state, landed_state):
MAVLink_message.__init__(self, MAVLink_extended_sys_state_message.id, MAVLink_extended_sys_state_message.name)
self._fieldnames = MAVLink_extended_sys_state_message.fieldnames
self.vtol_state = vtol_state
self.landed_state = landed_state
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 130, struct.pack('<BB', self.vtol_state, self.landed_state), force_mavlink1=force_mavlink1)
class MAVLink_adsb_vehicle_message(MAVLink_message):
'''
The location and information of an ADSB vehicle
'''
id = MAVLINK_MSG_ID_ADSB_VEHICLE
name = 'ADSB_VEHICLE'
fieldnames = ['ICAO_address', 'lat', 'lon', 'altitude_type', 'altitude', 'heading', 'hor_velocity', 'ver_velocity', 'callsign', 'emitter_type', 'tslc', 'flags', 'squawk']
ordered_fieldnames = [ 'ICAO_address', 'lat', 'lon', 'altitude', 'heading', 'hor_velocity', 'ver_velocity', 'flags', 'squawk', 'altitude_type', 'callsign', 'emitter_type', 'tslc' ]
format = '<IiiiHHhHHB9sBB'
native_format = bytearray('<IiiiHHhHHBcBB', 'ascii')
orders = [0, 1, 2, 9, 3, 4, 5, 6, 10, 11, 12, 7, 8]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0]
crc_extra = 184
def __init__(self, ICAO_address, lat, lon, altitude_type, altitude, heading, hor_velocity, ver_velocity, callsign, emitter_type, tslc, flags, squawk):
MAVLink_message.__init__(self, MAVLink_adsb_vehicle_message.id, MAVLink_adsb_vehicle_message.name)
self._fieldnames = MAVLink_adsb_vehicle_message.fieldnames
self.ICAO_address = ICAO_address
self.lat = lat
self.lon = lon
self.altitude_type = altitude_type
self.altitude = altitude
self.heading = heading
self.hor_velocity = hor_velocity
self.ver_velocity = ver_velocity
self.callsign = callsign
self.emitter_type = emitter_type
self.tslc = tslc
self.flags = flags
self.squawk = squawk
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 184, struct.pack('<IiiiHHhHHB9sBB', self.ICAO_address, self.lat, self.lon, self.altitude, self.heading, self.hor_velocity, self.ver_velocity, self.flags, self.squawk, self.altitude_type, self.callsign, self.emitter_type, self.tslc), force_mavlink1=force_mavlink1)
class MAVLink_collision_message(MAVLink_message):
'''
Information about a potential collision
'''
id = MAVLINK_MSG_ID_COLLISION
name = 'COLLISION'
fieldnames = ['src', 'id', 'action', 'threat_level', 'time_to_minimum_delta', 'altitude_minimum_delta', 'horizontal_minimum_delta']
ordered_fieldnames = [ 'id', 'time_to_minimum_delta', 'altitude_minimum_delta', 'horizontal_minimum_delta', 'src', 'action', 'threat_level' ]
format = '<IfffBBB'
native_format = bytearray('<IfffBBB', 'ascii')
orders = [4, 0, 5, 6, 1, 2, 3]
lengths = [1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0]
crc_extra = 81
def __init__(self, src, id, action, threat_level, time_to_minimum_delta, altitude_minimum_delta, horizontal_minimum_delta):
MAVLink_message.__init__(self, MAVLink_collision_message.id, MAVLink_collision_message.name)
self._fieldnames = MAVLink_collision_message.fieldnames
self.src = src
self.id = id
self.action = action
self.threat_level = threat_level
self.time_to_minimum_delta = time_to_minimum_delta
self.altitude_minimum_delta = altitude_minimum_delta
self.horizontal_minimum_delta = horizontal_minimum_delta
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 81, struct.pack('<IfffBBB', self.id, self.time_to_minimum_delta, self.altitude_minimum_delta, self.horizontal_minimum_delta, self.src, self.action, self.threat_level), force_mavlink1=force_mavlink1)
class MAVLink_v2_extension_message(MAVLink_message):
'''
Message implementing parts of the V2 payload specs in V1
frames for transitional support.
'''
id = MAVLINK_MSG_ID_V2_EXTENSION
name = 'V2_EXTENSION'
fieldnames = ['target_network', 'target_system', 'target_component', 'message_type', 'payload']
ordered_fieldnames = [ 'message_type', 'target_network', 'target_system', 'target_component', 'payload' ]
format = '<HBBB249B'
native_format = bytearray('<HBBBB', 'ascii')
orders = [1, 2, 3, 0, 4]
lengths = [1, 1, 1, 1, 249]
array_lengths = [0, 0, 0, 0, 249]
crc_extra = 8
def __init__(self, target_network, target_system, target_component, message_type, payload):
MAVLink_message.__init__(self, MAVLink_v2_extension_message.id, MAVLink_v2_extension_message.name)
self._fieldnames = MAVLink_v2_extension_message.fieldnames
self.target_network = target_network
self.target_system = target_system
self.target_component = target_component
self.message_type = message_type
self.payload = payload
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 8, struct.pack('<HBBB249B', self.message_type, self.target_network, self.target_system, self.target_component, self.payload[0], self.payload[1], self.payload[2], self.payload[3], self.payload[4], self.payload[5], self.payload[6], self.payload[7], self.payload[8], self.payload[9], self.payload[10], self.payload[11], self.payload[12], self.payload[13], self.payload[14], self.payload[15], self.payload[16], self.payload[17], self.payload[18], self.payload[19], self.payload[20], self.payload[21], self.payload[22], self.payload[23], self.payload[24], self.payload[25], self.payload[26], self.payload[27], self.payload[28], self.payload[29], self.payload[30], self.payload[31], self.payload[32], self.payload[33], self.payload[34], self.payload[35], self.payload[36], self.payload[37], self.payload[38], self.payload[39], self.payload[40], self.payload[41], self.payload[42], self.payload[43], self.payload[44], self.payload[45], self.payload[46], self.payload[47], self.payload[48], self.payload[49], self.payload[50], self.payload[51], self.payload[52], self.payload[53], self.payload[54], self.payload[55], self.payload[56], self.payload[57], self.payload[58], self.payload[59], self.payload[60], self.payload[61], self.payload[62], self.payload[63], self.payload[64], self.payload[65], self.payload[66], self.payload[67], self.payload[68], self.payload[69], self.payload[70], self.payload[71], self.payload[72], self.payload[73], self.payload[74], self.payload[75], self.payload[76], self.payload[77], self.payload[78], self.payload[79], self.payload[80], self.payload[81], self.payload[82], self.payload[83], self.payload[84], self.payload[85], self.payload[86], self.payload[87], self.payload[88], self.payload[89], self.payload[90], self.payload[91], self.payload[92], self.payload[93], self.payload[94], self.payload[95], self.payload[96], self.payload[97], self.payload[98], self.payload[99], self.payload[100], self.payload[101], self.payload[102], self.payload[103], self.payload[104], self.payload[105], self.payload[106], self.payload[107], self.payload[108], self.payload[109], self.payload[110], self.payload[111], self.payload[112], self.payload[113], self.payload[114], self.payload[115], self.payload[116], self.payload[117], self.payload[118], self.payload[119], self.payload[120], self.payload[121], self.payload[122], self.payload[123], self.payload[124], self.payload[125], self.payload[126], self.payload[127], self.payload[128], self.payload[129], self.payload[130], self.payload[131], self.payload[132], self.payload[133], self.payload[134], self.payload[135], self.payload[136], self.payload[137], self.payload[138], self.payload[139], self.payload[140], self.payload[141], self.payload[142], self.payload[143], self.payload[144], self.payload[145], self.payload[146], self.payload[147], self.payload[148], self.payload[149], self.payload[150], self.payload[151], self.payload[152], self.payload[153], self.payload[154], self.payload[155], self.payload[156], self.payload[157], self.payload[158], self.payload[159], self.payload[160], self.payload[161], self.payload[162], self.payload[163], self.payload[164], self.payload[165], self.payload[166], self.payload[167], self.payload[168], self.payload[169], self.payload[170], self.payload[171], self.payload[172], self.payload[173], self.payload[174], self.payload[175], self.payload[176], self.payload[177], self.payload[178], self.payload[179], self.payload[180], self.payload[181], self.payload[182], self.payload[183], self.payload[184], self.payload[185], self.payload[186], self.payload[187], self.payload[188], self.payload[189], self.payload[190], self.payload[191], self.payload[192], self.payload[193], self.payload[194], self.payload[195], self.payload[196], self.payload[197], self.payload[198], self.payload[199], self.payload[200], self.payload[201], self.payload[202], self.payload[203], self.payload[204], self.payload[205], self.payload[206], self.payload[207], self.payload[208], self.payload[209], self.payload[210], self.payload[211], self.payload[212], self.payload[213], self.payload[214], self.payload[215], self.payload[216], self.payload[217], self.payload[218], self.payload[219], self.payload[220], self.payload[221], self.payload[222], self.payload[223], self.payload[224], self.payload[225], self.payload[226], self.payload[227], self.payload[228], self.payload[229], self.payload[230], self.payload[231], self.payload[232], self.payload[233], self.payload[234], self.payload[235], self.payload[236], self.payload[237], self.payload[238], self.payload[239], self.payload[240], self.payload[241], self.payload[242], self.payload[243], self.payload[244], self.payload[245], self.payload[246], self.payload[247], self.payload[248]), force_mavlink1=force_mavlink1)
class MAVLink_memory_vect_message(MAVLink_message):
'''
Send raw controller memory. The use of this message is
discouraged for normal packets, but a quite efficient way for
testing new messages and getting experimental debug output.
'''
id = MAVLINK_MSG_ID_MEMORY_VECT
name = 'MEMORY_VECT'
fieldnames = ['address', 'ver', 'type', 'value']
ordered_fieldnames = [ 'address', 'ver', 'type', 'value' ]
format = '<HBB32b'
native_format = bytearray('<HBBb', 'ascii')
orders = [0, 1, 2, 3]
lengths = [1, 1, 1, 32]
array_lengths = [0, 0, 0, 32]
crc_extra = 204
def __init__(self, address, ver, type, value):
MAVLink_message.__init__(self, MAVLink_memory_vect_message.id, MAVLink_memory_vect_message.name)
self._fieldnames = MAVLink_memory_vect_message.fieldnames
self.address = address
self.ver = ver
self.type = type
self.value = value
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 204, struct.pack('<HBB32b', self.address, self.ver, self.type, self.value[0], self.value[1], self.value[2], self.value[3], self.value[4], self.value[5], self.value[6], self.value[7], self.value[8], self.value[9], self.value[10], self.value[11], self.value[12], self.value[13], self.value[14], self.value[15], self.value[16], self.value[17], self.value[18], self.value[19], self.value[20], self.value[21], self.value[22], self.value[23], self.value[24], self.value[25], self.value[26], self.value[27], self.value[28], self.value[29], self.value[30], self.value[31]), force_mavlink1=force_mavlink1)
class MAVLink_debug_vect_message(MAVLink_message):
'''
'''
id = MAVLINK_MSG_ID_DEBUG_VECT
name = 'DEBUG_VECT'
fieldnames = ['name', 'time_usec', 'x', 'y', 'z']
ordered_fieldnames = [ 'time_usec', 'x', 'y', 'z', 'name' ]
format = '<Qfff10s'
native_format = bytearray('<Qfffc', 'ascii')
orders = [4, 0, 1, 2, 3]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 10]
crc_extra = 49
def __init__(self, name, time_usec, x, y, z):
MAVLink_message.__init__(self, MAVLink_debug_vect_message.id, MAVLink_debug_vect_message.name)
self._fieldnames = MAVLink_debug_vect_message.fieldnames
self.name = name
self.time_usec = time_usec
self.x = x
self.y = y
self.z = z
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 49, struct.pack('<Qfff10s', self.time_usec, self.x, self.y, self.z, self.name), force_mavlink1=force_mavlink1)
class MAVLink_named_value_float_message(MAVLink_message):
'''
Send a key-value pair as float. The use of this message is
discouraged for normal packets, but a quite efficient way for
testing new messages and getting experimental debug output.
'''
id = MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
name = 'NAMED_VALUE_FLOAT'
fieldnames = ['time_boot_ms', 'name', 'value']
ordered_fieldnames = [ 'time_boot_ms', 'value', 'name' ]
format = '<If10s'
native_format = bytearray('<Ifc', 'ascii')
orders = [0, 2, 1]
lengths = [1, 1, 1]
array_lengths = [0, 0, 10]
crc_extra = 170
def __init__(self, time_boot_ms, name, value):
MAVLink_message.__init__(self, MAVLink_named_value_float_message.id, MAVLink_named_value_float_message.name)
self._fieldnames = MAVLink_named_value_float_message.fieldnames
self.time_boot_ms = time_boot_ms
self.name = name
self.value = value
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 170, struct.pack('<If10s', self.time_boot_ms, self.value, self.name), force_mavlink1=force_mavlink1)
class MAVLink_named_value_int_message(MAVLink_message):
'''
Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient way for
testing new messages and getting experimental debug output.
'''
id = MAVLINK_MSG_ID_NAMED_VALUE_INT
name = 'NAMED_VALUE_INT'
fieldnames = ['time_boot_ms', 'name', 'value']
ordered_fieldnames = [ 'time_boot_ms', 'value', 'name' ]
format = '<Ii10s'
native_format = bytearray('<Iic', 'ascii')
orders = [0, 2, 1]
lengths = [1, 1, 1]
array_lengths = [0, 0, 10]
crc_extra = 44
def __init__(self, time_boot_ms, name, value):
MAVLink_message.__init__(self, MAVLink_named_value_int_message.id, MAVLink_named_value_int_message.name)
self._fieldnames = MAVLink_named_value_int_message.fieldnames
self.time_boot_ms = time_boot_ms
self.name = name
self.value = value
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 44, struct.pack('<Ii10s', self.time_boot_ms, self.value, self.name), force_mavlink1=force_mavlink1)
class MAVLink_statustext_message(MAVLink_message):
'''
Status text message. These messages are printed in yellow in
the COMM console of QGroundControl. WARNING: They consume
quite some bandwidth, so use only for important status and
error messages. If implemented wisely, these messages are
buffered on the MCU and sent only at a limited rate (e.g. 10
Hz).
'''
id = MAVLINK_MSG_ID_STATUSTEXT
name = 'STATUSTEXT'
fieldnames = ['severity', 'text']
ordered_fieldnames = [ 'severity', 'text' ]
format = '<B50s'
native_format = bytearray('<Bc', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [0, 50]
crc_extra = 83
def __init__(self, severity, text):
MAVLink_message.__init__(self, MAVLink_statustext_message.id, MAVLink_statustext_message.name)
self._fieldnames = MAVLink_statustext_message.fieldnames
self.severity = severity
self.text = text
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 83, struct.pack('<B50s', self.severity, self.text), force_mavlink1=force_mavlink1)
class MAVLink_debug_message(MAVLink_message):
'''
Send a debug value. The index is used to discriminate between
values. These values show up in the plot of QGroundControl as
DEBUG N.
'''
id = MAVLINK_MSG_ID_DEBUG
name = 'DEBUG'
fieldnames = ['time_boot_ms', 'ind', 'value']
ordered_fieldnames = [ 'time_boot_ms', 'value', 'ind' ]
format = '<IfB'
native_format = bytearray('<IfB', 'ascii')
orders = [0, 2, 1]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 46
def __init__(self, time_boot_ms, ind, value):
MAVLink_message.__init__(self, MAVLink_debug_message.id, MAVLink_debug_message.name)
self._fieldnames = MAVLink_debug_message.fieldnames
self.time_boot_ms = time_boot_ms
self.ind = ind
self.value = value
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 46, struct.pack('<IfB', self.time_boot_ms, self.value, self.ind), force_mavlink1=force_mavlink1)
class MAVLink_setup_signing_message(MAVLink_message):
'''
Setup a MAVLink2 signing key. If called with secret_key of all
zero and zero initial_timestamp will disable signing
'''
id = MAVLINK_MSG_ID_SETUP_SIGNING
name = 'SETUP_SIGNING'
fieldnames = ['target_system', 'target_component', 'secret_key', 'initial_timestamp']
ordered_fieldnames = [ 'initial_timestamp', 'target_system', 'target_component', 'secret_key' ]
format = '<QBB32B'
native_format = bytearray('<QBBB', 'ascii')
orders = [1, 2, 3, 0]
lengths = [1, 1, 1, 32]
array_lengths = [0, 0, 0, 32]
crc_extra = 71
def __init__(self, target_system, target_component, secret_key, initial_timestamp):
MAVLink_message.__init__(self, MAVLink_setup_signing_message.id, MAVLink_setup_signing_message.name)
self._fieldnames = MAVLink_setup_signing_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.secret_key = secret_key
self.initial_timestamp = initial_timestamp
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 71, struct.pack('<QBB32B', self.initial_timestamp, self.target_system, self.target_component, self.secret_key[0], self.secret_key[1], self.secret_key[2], self.secret_key[3], self.secret_key[4], self.secret_key[5], self.secret_key[6], self.secret_key[7], self.secret_key[8], self.secret_key[9], self.secret_key[10], self.secret_key[11], self.secret_key[12], self.secret_key[13], self.secret_key[14], self.secret_key[15], self.secret_key[16], self.secret_key[17], self.secret_key[18], self.secret_key[19], self.secret_key[20], self.secret_key[21], self.secret_key[22], self.secret_key[23], self.secret_key[24], self.secret_key[25], self.secret_key[26], self.secret_key[27], self.secret_key[28], self.secret_key[29], self.secret_key[30], self.secret_key[31]), force_mavlink1=force_mavlink1)
class MAVLink_button_change_message(MAVLink_message):
'''
Report button state change
'''
id = MAVLINK_MSG_ID_BUTTON_CHANGE
name = 'BUTTON_CHANGE'
fieldnames = ['time_boot_ms', 'last_change_ms', 'state']
ordered_fieldnames = [ 'time_boot_ms', 'last_change_ms', 'state' ]
format = '<IIB'
native_format = bytearray('<IIB', 'ascii')
orders = [0, 1, 2]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 131
def __init__(self, time_boot_ms, last_change_ms, state):
MAVLink_message.__init__(self, MAVLink_button_change_message.id, MAVLink_button_change_message.name)
self._fieldnames = MAVLink_button_change_message.fieldnames
self.time_boot_ms = time_boot_ms
self.last_change_ms = last_change_ms
self.state = state
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 131, struct.pack('<IIB', self.time_boot_ms, self.last_change_ms, self.state), force_mavlink1=force_mavlink1)
class MAVLink_play_tune_message(MAVLink_message):
'''
Control vehicle tone generation (buzzer)
'''
id = MAVLINK_MSG_ID_PLAY_TUNE
name = 'PLAY_TUNE'
fieldnames = ['target_system', 'target_component', 'tune']
ordered_fieldnames = [ 'target_system', 'target_component', 'tune' ]
format = '<BB30s'
native_format = bytearray('<BBc', 'ascii')
orders = [0, 1, 2]
lengths = [1, 1, 1]
array_lengths = [0, 0, 30]
crc_extra = 187
def __init__(self, target_system, target_component, tune):
MAVLink_message.__init__(self, MAVLink_play_tune_message.id, MAVLink_play_tune_message.name)
self._fieldnames = MAVLink_play_tune_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.tune = tune
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 187, struct.pack('<BB30s', self.target_system, self.target_component, self.tune), force_mavlink1=force_mavlink1)
class MAVLink_camera_information_message(MAVLink_message):
'''
WIP: Information about a camera
'''
id = MAVLINK_MSG_ID_CAMERA_INFORMATION
name = 'CAMERA_INFORMATION'
fieldnames = ['time_boot_ms', 'camera_id', 'vendor_name', 'model_name', 'focal_length', 'sensor_size_h', 'sensor_size_v', 'resolution_h', 'resolution_v', 'lense_id']
ordered_fieldnames = [ 'time_boot_ms', 'focal_length', 'sensor_size_h', 'sensor_size_v', 'resolution_h', 'resolution_v', 'camera_id', 'vendor_name', 'model_name', 'lense_id' ]
format = '<IfffHHB32B32BB'
native_format = bytearray('<IfffHHBBBB', 'ascii')
orders = [0, 6, 7, 8, 1, 2, 3, 4, 5, 9]
lengths = [1, 1, 1, 1, 1, 1, 1, 32, 32, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 32, 32, 0]
crc_extra = 122
def __init__(self, time_boot_ms, camera_id, vendor_name, model_name, focal_length, sensor_size_h, sensor_size_v, resolution_h, resolution_v, lense_id):
MAVLink_message.__init__(self, MAVLink_camera_information_message.id, MAVLink_camera_information_message.name)
self._fieldnames = MAVLink_camera_information_message.fieldnames
self.time_boot_ms = time_boot_ms
self.camera_id = camera_id
self.vendor_name = vendor_name
self.model_name = model_name
self.focal_length = focal_length
self.sensor_size_h = sensor_size_h
self.sensor_size_v = sensor_size_v
self.resolution_h = resolution_h
self.resolution_v = resolution_v
self.lense_id = lense_id
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 122, struct.pack('<IfffHHB32B32BB', self.time_boot_ms, self.focal_length, self.sensor_size_h, self.sensor_size_v, self.resolution_h, self.resolution_v, self.camera_id, self.vendor_name[0], self.vendor_name[1], self.vendor_name[2], self.vendor_name[3], self.vendor_name[4], self.vendor_name[5], self.vendor_name[6], self.vendor_name[7], self.vendor_name[8], self.vendor_name[9], self.vendor_name[10], self.vendor_name[11], self.vendor_name[12], self.vendor_name[13], self.vendor_name[14], self.vendor_name[15], self.vendor_name[16], self.vendor_name[17], self.vendor_name[18], self.vendor_name[19], self.vendor_name[20], self.vendor_name[21], self.vendor_name[22], self.vendor_name[23], self.vendor_name[24], self.vendor_name[25], self.vendor_name[26], self.vendor_name[27], self.vendor_name[28], self.vendor_name[29], self.vendor_name[30], self.vendor_name[31], self.model_name[0], self.model_name[1], self.model_name[2], self.model_name[3], self.model_name[4], self.model_name[5], self.model_name[6], self.model_name[7], self.model_name[8], self.model_name[9], self.model_name[10], self.model_name[11], self.model_name[12], self.model_name[13], self.model_name[14], self.model_name[15], self.model_name[16], self.model_name[17], self.model_name[18], self.model_name[19], self.model_name[20], self.model_name[21], self.model_name[22], self.model_name[23], self.model_name[24], self.model_name[25], self.model_name[26], self.model_name[27], self.model_name[28], self.model_name[29], self.model_name[30], self.model_name[31], self.lense_id), force_mavlink1=force_mavlink1)
class MAVLink_camera_settings_message(MAVLink_message):
'''
WIP: Settings of a camera, can be requested using
MAV_CMD_REQUEST_CAMERA_SETTINGS and written using
MAV_CMD_SET_CAMERA_SETTINGS
'''
id = MAVLINK_MSG_ID_CAMERA_SETTINGS
name = 'CAMERA_SETTINGS'
fieldnames = ['time_boot_ms', 'camera_id', 'aperture', 'aperture_locked', 'shutter_speed', 'shutter_speed_locked', 'iso_sensitivity', 'iso_sensitivity_locked', 'white_balance', 'white_balance_locked', 'mode_id', 'color_mode_id', 'image_format_id']
ordered_fieldnames = [ 'time_boot_ms', 'aperture', 'shutter_speed', 'iso_sensitivity', 'white_balance', 'camera_id', 'aperture_locked', 'shutter_speed_locked', 'iso_sensitivity_locked', 'white_balance_locked', 'mode_id', 'color_mode_id', 'image_format_id' ]
format = '<IffffBBBBBBBB'
native_format = bytearray('<IffffBBBBBBBB', 'ascii')
orders = [0, 5, 1, 6, 2, 7, 3, 8, 4, 9, 10, 11, 12]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 8
def __init__(self, time_boot_ms, camera_id, aperture, aperture_locked, shutter_speed, shutter_speed_locked, iso_sensitivity, iso_sensitivity_locked, white_balance, white_balance_locked, mode_id, color_mode_id, image_format_id):
MAVLink_message.__init__(self, MAVLink_camera_settings_message.id, MAVLink_camera_settings_message.name)
self._fieldnames = MAVLink_camera_settings_message.fieldnames
self.time_boot_ms = time_boot_ms
self.camera_id = camera_id
self.aperture = aperture
self.aperture_locked = aperture_locked
self.shutter_speed = shutter_speed
self.shutter_speed_locked = shutter_speed_locked
self.iso_sensitivity = iso_sensitivity
self.iso_sensitivity_locked = iso_sensitivity_locked
self.white_balance = white_balance
self.white_balance_locked = white_balance_locked
self.mode_id = mode_id
self.color_mode_id = color_mode_id
self.image_format_id = image_format_id
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 8, struct.pack('<IffffBBBBBBBB', self.time_boot_ms, self.aperture, self.shutter_speed, self.iso_sensitivity, self.white_balance, self.camera_id, self.aperture_locked, self.shutter_speed_locked, self.iso_sensitivity_locked, self.white_balance_locked, self.mode_id, self.color_mode_id, self.image_format_id), force_mavlink1=force_mavlink1)
class MAVLink_storage_information_message(MAVLink_message):
'''
WIP: Information about a storage medium
'''
id = MAVLINK_MSG_ID_STORAGE_INFORMATION
name = 'STORAGE_INFORMATION'
fieldnames = ['time_boot_ms', 'storage_id', 'status', 'total_capacity', 'used_capacity', 'available_capacity', 'read_speed', 'write_speed']
ordered_fieldnames = [ 'time_boot_ms', 'total_capacity', 'used_capacity', 'available_capacity', 'read_speed', 'write_speed', 'storage_id', 'status' ]
format = '<IfffffBB'
native_format = bytearray('<IfffffBB', 'ascii')
orders = [0, 6, 7, 1, 2, 3, 4, 5]
lengths = [1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 244
def __init__(self, time_boot_ms, storage_id, status, total_capacity, used_capacity, available_capacity, read_speed, write_speed):
MAVLink_message.__init__(self, MAVLink_storage_information_message.id, MAVLink_storage_information_message.name)
self._fieldnames = MAVLink_storage_information_message.fieldnames
self.time_boot_ms = time_boot_ms
self.storage_id = storage_id
self.status = status
self.total_capacity = total_capacity
self.used_capacity = used_capacity
self.available_capacity = available_capacity
self.read_speed = read_speed
self.write_speed = write_speed
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 244, struct.pack('<IfffffBB', self.time_boot_ms, self.total_capacity, self.used_capacity, self.available_capacity, self.read_speed, self.write_speed, self.storage_id, self.status), force_mavlink1=force_mavlink1)
class MAVLink_camera_capture_status_message(MAVLink_message):
'''
WIP: Information about the status of a capture
'''
id = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS
name = 'CAMERA_CAPTURE_STATUS'
fieldnames = ['time_boot_ms', 'camera_id', 'image_status', 'video_status', 'image_interval', 'video_framerate', 'image_resolution_h', 'image_resolution_v', 'video_resolution_h', 'video_resolution_v', 'recording_time_ms', 'available_capacity']
ordered_fieldnames = [ 'time_boot_ms', 'image_interval', 'video_framerate', 'recording_time_ms', 'available_capacity', 'image_resolution_h', 'image_resolution_v', 'video_resolution_h', 'video_resolution_v', 'camera_id', 'image_status', 'video_status' ]
format = '<IffIfHHHHBBB'
native_format = bytearray('<IffIfHHHHBBB', 'ascii')
orders = [0, 9, 10, 11, 1, 2, 5, 6, 7, 8, 3, 4]
lengths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
crc_extra = 69
def __init__(self, time_boot_ms, camera_id, image_status, video_status, image_interval, video_framerate, image_resolution_h, image_resolution_v, video_resolution_h, video_resolution_v, recording_time_ms, available_capacity):
MAVLink_message.__init__(self, MAVLink_camera_capture_status_message.id, MAVLink_camera_capture_status_message.name)
self._fieldnames = MAVLink_camera_capture_status_message.fieldnames
self.time_boot_ms = time_boot_ms
self.camera_id = camera_id
self.image_status = image_status
self.video_status = video_status
self.image_interval = image_interval
self.video_framerate = video_framerate
self.image_resolution_h = image_resolution_h
self.image_resolution_v = image_resolution_v
self.video_resolution_h = video_resolution_h
self.video_resolution_v = video_resolution_v
self.recording_time_ms = recording_time_ms
self.available_capacity = available_capacity
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 69, struct.pack('<IffIfHHHHBBB', self.time_boot_ms, self.image_interval, self.video_framerate, self.recording_time_ms, self.available_capacity, self.image_resolution_h, self.image_resolution_v, self.video_resolution_h, self.video_resolution_v, self.camera_id, self.image_status, self.video_status), force_mavlink1=force_mavlink1)
class MAVLink_camera_image_captured_message(MAVLink_message):
'''
Information about a captured image
'''
id = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED
name = 'CAMERA_IMAGE_CAPTURED'
fieldnames = ['time_boot_ms', 'time_utc', 'camera_id', 'lat', 'lon', 'alt', 'relative_alt', 'q', 'image_index', 'capture_result', 'file_url']
ordered_fieldnames = [ 'time_utc', 'time_boot_ms', 'lat', 'lon', 'alt', 'relative_alt', 'q', 'image_index', 'camera_id', 'capture_result', 'file_url' ]
format = '<QIiiii4fiBb205s'
native_format = bytearray('<QIiiiifiBbc', 'ascii')
orders = [1, 0, 8, 2, 3, 4, 5, 6, 7, 9, 10]
lengths = [1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 205]
crc_extra = 133
def __init__(self, time_boot_ms, time_utc, camera_id, lat, lon, alt, relative_alt, q, image_index, capture_result, file_url):
MAVLink_message.__init__(self, MAVLink_camera_image_captured_message.id, MAVLink_camera_image_captured_message.name)
self._fieldnames = MAVLink_camera_image_captured_message.fieldnames
self.time_boot_ms = time_boot_ms
self.time_utc = time_utc
self.camera_id = camera_id
self.lat = lat
self.lon = lon
self.alt = alt
self.relative_alt = relative_alt
self.q = q
self.image_index = image_index
self.capture_result = capture_result
self.file_url = file_url
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 133, struct.pack('<QIiiii4fiBb205s', self.time_utc, self.time_boot_ms, self.lat, self.lon, self.alt, self.relative_alt, self.q[0], self.q[1], self.q[2], self.q[3], self.image_index, self.camera_id, self.capture_result, self.file_url), force_mavlink1=force_mavlink1)
class MAVLink_flight_information_message(MAVLink_message):
'''
WIP: Information about flight since last arming
'''
id = MAVLINK_MSG_ID_FLIGHT_INFORMATION
name = 'FLIGHT_INFORMATION'
fieldnames = ['time_boot_ms', 'arming_time_utc', 'takeoff_time_utc', 'flight_uuid']
ordered_fieldnames = [ 'arming_time_utc', 'takeoff_time_utc', 'flight_uuid', 'time_boot_ms' ]
format = '<QQQI'
native_format = bytearray('<QQQI', 'ascii')
orders = [3, 0, 1, 2]
lengths = [1, 1, 1, 1]
array_lengths = [0, 0, 0, 0]
crc_extra = 49
def __init__(self, time_boot_ms, arming_time_utc, takeoff_time_utc, flight_uuid):
MAVLink_message.__init__(self, MAVLink_flight_information_message.id, MAVLink_flight_information_message.name)
self._fieldnames = MAVLink_flight_information_message.fieldnames
self.time_boot_ms = time_boot_ms
self.arming_time_utc = arming_time_utc
self.takeoff_time_utc = takeoff_time_utc
self.flight_uuid = flight_uuid
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 49, struct.pack('<QQQI', self.arming_time_utc, self.takeoff_time_utc, self.flight_uuid, self.time_boot_ms), force_mavlink1=force_mavlink1)
class MAVLink_mount_orientation_message(MAVLink_message):
'''
Orientation of a mount
'''
id = MAVLINK_MSG_ID_MOUNT_ORIENTATION
name = 'MOUNT_ORIENTATION'
fieldnames = ['time_boot_ms', 'roll', 'pitch', 'yaw', 'yaw_absolute']
ordered_fieldnames = [ 'time_boot_ms', 'roll', 'pitch', 'yaw', 'yaw_absolute' ]
format = '<Iffff'
native_format = bytearray('<Iffff', 'ascii')
orders = [0, 1, 2, 3, 4]
lengths = [1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0]
crc_extra = 26
def __init__(self, time_boot_ms, roll, pitch, yaw, yaw_absolute=0):
MAVLink_message.__init__(self, MAVLink_mount_orientation_message.id, MAVLink_mount_orientation_message.name)
self._fieldnames = MAVLink_mount_orientation_message.fieldnames
self.time_boot_ms = time_boot_ms
self.roll = roll
self.pitch = pitch
self.yaw = yaw
self.yaw_absolute = yaw_absolute
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 26, struct.pack('<Iffff', self.time_boot_ms, self.roll, self.pitch, self.yaw, self.yaw_absolute), force_mavlink1=force_mavlink1)
class MAVLink_logging_data_message(MAVLink_message):
'''
A message containing logged data (see also
MAV_CMD_LOGGING_START)
'''
id = MAVLINK_MSG_ID_LOGGING_DATA
name = 'LOGGING_DATA'
fieldnames = ['target_system', 'target_component', 'sequence', 'length', 'first_message_offset', 'data']
ordered_fieldnames = [ 'sequence', 'target_system', 'target_component', 'length', 'first_message_offset', 'data' ]
format = '<HBBBB249B'
native_format = bytearray('<HBBBBB', 'ascii')
orders = [1, 2, 0, 3, 4, 5]
lengths = [1, 1, 1, 1, 1, 249]
array_lengths = [0, 0, 0, 0, 0, 249]
crc_extra = 193
def __init__(self, target_system, target_component, sequence, length, first_message_offset, data):
MAVLink_message.__init__(self, MAVLink_logging_data_message.id, MAVLink_logging_data_message.name)
self._fieldnames = MAVLink_logging_data_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.sequence = sequence
self.length = length
self.first_message_offset = first_message_offset
self.data = data
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 193, struct.pack('<HBBBB249B', self.sequence, self.target_system, self.target_component, self.length, self.first_message_offset, self.data[0], self.data[1], self.data[2], self.data[3], self.data[4], self.data[5], self.data[6], self.data[7], self.data[8], self.data[9], self.data[10], self.data[11], self.data[12], self.data[13], self.data[14], self.data[15], self.data[16], self.data[17], self.data[18], self.data[19], self.data[20], self.data[21], self.data[22], self.data[23], self.data[24], self.data[25], self.data[26], self.data[27], self.data[28], self.data[29], self.data[30], self.data[31], self.data[32], self.data[33], self.data[34], self.data[35], self.data[36], self.data[37], self.data[38], self.data[39], self.data[40], self.data[41], self.data[42], self.data[43], self.data[44], self.data[45], self.data[46], self.data[47], self.data[48], self.data[49], self.data[50], self.data[51], self.data[52], self.data[53], self.data[54], self.data[55], self.data[56], self.data[57], self.data[58], self.data[59], self.data[60], self.data[61], self.data[62], self.data[63], self.data[64], self.data[65], self.data[66], self.data[67], self.data[68], self.data[69], self.data[70], self.data[71], self.data[72], self.data[73], self.data[74], self.data[75], self.data[76], self.data[77], self.data[78], self.data[79], self.data[80], self.data[81], self.data[82], self.data[83], self.data[84], self.data[85], self.data[86], self.data[87], self.data[88], self.data[89], self.data[90], self.data[91], self.data[92], self.data[93], self.data[94], self.data[95], self.data[96], self.data[97], self.data[98], self.data[99], self.data[100], self.data[101], self.data[102], self.data[103], self.data[104], self.data[105], self.data[106], self.data[107], self.data[108], self.data[109], self.data[110], self.data[111], self.data[112], self.data[113], self.data[114], self.data[115], self.data[116], self.data[117], self.data[118], self.data[119], self.data[120], self.data[121], self.data[122], self.data[123], self.data[124], self.data[125], self.data[126], self.data[127], self.data[128], self.data[129], self.data[130], self.data[131], self.data[132], self.data[133], self.data[134], self.data[135], self.data[136], self.data[137], self.data[138], self.data[139], self.data[140], self.data[141], self.data[142], self.data[143], self.data[144], self.data[145], self.data[146], self.data[147], self.data[148], self.data[149], self.data[150], self.data[151], self.data[152], self.data[153], self.data[154], self.data[155], self.data[156], self.data[157], self.data[158], self.data[159], self.data[160], self.data[161], self.data[162], self.data[163], self.data[164], self.data[165], self.data[166], self.data[167], self.data[168], self.data[169], self.data[170], self.data[171], self.data[172], self.data[173], self.data[174], self.data[175], self.data[176], self.data[177], self.data[178], self.data[179], self.data[180], self.data[181], self.data[182], self.data[183], self.data[184], self.data[185], self.data[186], self.data[187], self.data[188], self.data[189], self.data[190], self.data[191], self.data[192], self.data[193], self.data[194], self.data[195], self.data[196], self.data[197], self.data[198], self.data[199], self.data[200], self.data[201], self.data[202], self.data[203], self.data[204], self.data[205], self.data[206], self.data[207], self.data[208], self.data[209], self.data[210], self.data[211], self.data[212], self.data[213], self.data[214], self.data[215], self.data[216], self.data[217], self.data[218], self.data[219], self.data[220], self.data[221], self.data[222], self.data[223], self.data[224], self.data[225], self.data[226], self.data[227], self.data[228], self.data[229], self.data[230], self.data[231], self.data[232], self.data[233], self.data[234], self.data[235], self.data[236], self.data[237], self.data[238], self.data[239], self.data[240], self.data[241], self.data[242], self.data[243], self.data[244], self.data[245], self.data[246], self.data[247], self.data[248]), force_mavlink1=force_mavlink1)
class MAVLink_logging_data_acked_message(MAVLink_message):
'''
A message containing logged data which requires a LOGGING_ACK
to be sent back
'''
id = MAVLINK_MSG_ID_LOGGING_DATA_ACKED
name = 'LOGGING_DATA_ACKED'
fieldnames = ['target_system', 'target_component', 'sequence', 'length', 'first_message_offset', 'data']
ordered_fieldnames = [ 'sequence', 'target_system', 'target_component', 'length', 'first_message_offset', 'data' ]
format = '<HBBBB249B'
native_format = bytearray('<HBBBBB', 'ascii')
orders = [1, 2, 0, 3, 4, 5]
lengths = [1, 1, 1, 1, 1, 249]
array_lengths = [0, 0, 0, 0, 0, 249]
crc_extra = 35
def __init__(self, target_system, target_component, sequence, length, first_message_offset, data):
MAVLink_message.__init__(self, MAVLink_logging_data_acked_message.id, MAVLink_logging_data_acked_message.name)
self._fieldnames = MAVLink_logging_data_acked_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.sequence = sequence
self.length = length
self.first_message_offset = first_message_offset
self.data = data
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 35, struct.pack('<HBBBB249B', self.sequence, self.target_system, self.target_component, self.length, self.first_message_offset, self.data[0], self.data[1], self.data[2], self.data[3], self.data[4], self.data[5], self.data[6], self.data[7], self.data[8], self.data[9], self.data[10], self.data[11], self.data[12], self.data[13], self.data[14], self.data[15], self.data[16], self.data[17], self.data[18], self.data[19], self.data[20], self.data[21], self.data[22], self.data[23], self.data[24], self.data[25], self.data[26], self.data[27], self.data[28], self.data[29], self.data[30], self.data[31], self.data[32], self.data[33], self.data[34], self.data[35], self.data[36], self.data[37], self.data[38], self.data[39], self.data[40], self.data[41], self.data[42], self.data[43], self.data[44], self.data[45], self.data[46], self.data[47], self.data[48], self.data[49], self.data[50], self.data[51], self.data[52], self.data[53], self.data[54], self.data[55], self.data[56], self.data[57], self.data[58], self.data[59], self.data[60], self.data[61], self.data[62], self.data[63], self.data[64], self.data[65], self.data[66], self.data[67], self.data[68], self.data[69], self.data[70], self.data[71], self.data[72], self.data[73], self.data[74], self.data[75], self.data[76], self.data[77], self.data[78], self.data[79], self.data[80], self.data[81], self.data[82], self.data[83], self.data[84], self.data[85], self.data[86], self.data[87], self.data[88], self.data[89], self.data[90], self.data[91], self.data[92], self.data[93], self.data[94], self.data[95], self.data[96], self.data[97], self.data[98], self.data[99], self.data[100], self.data[101], self.data[102], self.data[103], self.data[104], self.data[105], self.data[106], self.data[107], self.data[108], self.data[109], self.data[110], self.data[111], self.data[112], self.data[113], self.data[114], self.data[115], self.data[116], self.data[117], self.data[118], self.data[119], self.data[120], self.data[121], self.data[122], self.data[123], self.data[124], self.data[125], self.data[126], self.data[127], self.data[128], self.data[129], self.data[130], self.data[131], self.data[132], self.data[133], self.data[134], self.data[135], self.data[136], self.data[137], self.data[138], self.data[139], self.data[140], self.data[141], self.data[142], self.data[143], self.data[144], self.data[145], self.data[146], self.data[147], self.data[148], self.data[149], self.data[150], self.data[151], self.data[152], self.data[153], self.data[154], self.data[155], self.data[156], self.data[157], self.data[158], self.data[159], self.data[160], self.data[161], self.data[162], self.data[163], self.data[164], self.data[165], self.data[166], self.data[167], self.data[168], self.data[169], self.data[170], self.data[171], self.data[172], self.data[173], self.data[174], self.data[175], self.data[176], self.data[177], self.data[178], self.data[179], self.data[180], self.data[181], self.data[182], self.data[183], self.data[184], self.data[185], self.data[186], self.data[187], self.data[188], self.data[189], self.data[190], self.data[191], self.data[192], self.data[193], self.data[194], self.data[195], self.data[196], self.data[197], self.data[198], self.data[199], self.data[200], self.data[201], self.data[202], self.data[203], self.data[204], self.data[205], self.data[206], self.data[207], self.data[208], self.data[209], self.data[210], self.data[211], self.data[212], self.data[213], self.data[214], self.data[215], self.data[216], self.data[217], self.data[218], self.data[219], self.data[220], self.data[221], self.data[222], self.data[223], self.data[224], self.data[225], self.data[226], self.data[227], self.data[228], self.data[229], self.data[230], self.data[231], self.data[232], self.data[233], self.data[234], self.data[235], self.data[236], self.data[237], self.data[238], self.data[239], self.data[240], self.data[241], self.data[242], self.data[243], self.data[244], self.data[245], self.data[246], self.data[247], self.data[248]), force_mavlink1=force_mavlink1)
class MAVLink_logging_ack_message(MAVLink_message):
'''
An ack for a LOGGING_DATA_ACKED message
'''
id = MAVLINK_MSG_ID_LOGGING_ACK
name = 'LOGGING_ACK'
fieldnames = ['target_system', 'target_component', 'sequence']
ordered_fieldnames = [ 'sequence', 'target_system', 'target_component' ]
format = '<HBB'
native_format = bytearray('<HBB', 'ascii')
orders = [1, 2, 0]
lengths = [1, 1, 1]
array_lengths = [0, 0, 0]
crc_extra = 14
def __init__(self, target_system, target_component, sequence):
MAVLink_message.__init__(self, MAVLink_logging_ack_message.id, MAVLink_logging_ack_message.name)
self._fieldnames = MAVLink_logging_ack_message.fieldnames
self.target_system = target_system
self.target_component = target_component
self.sequence = sequence
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 14, struct.pack('<HBB', self.sequence, self.target_system, self.target_component), force_mavlink1=force_mavlink1)
class MAVLink_wifi_config_ap_message(MAVLink_message):
'''
Configure AP SSID and Password.
'''
id = MAVLINK_MSG_ID_WIFI_CONFIG_AP
name = 'WIFI_CONFIG_AP'
fieldnames = ['ssid', 'password']
ordered_fieldnames = [ 'ssid', 'password' ]
format = '<32s64s'
native_format = bytearray('<cc', 'ascii')
orders = [0, 1]
lengths = [1, 1]
array_lengths = [32, 64]
crc_extra = 19
def __init__(self, ssid, password):
MAVLink_message.__init__(self, MAVLink_wifi_config_ap_message.id, MAVLink_wifi_config_ap_message.name)
self._fieldnames = MAVLink_wifi_config_ap_message.fieldnames
self.ssid = ssid
self.password = password
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 19, struct.pack('<32s64s', self.ssid, self.password), force_mavlink1=force_mavlink1)
class MAVLink_uavcan_node_status_message(MAVLink_message):
'''
General status information of an UAVCAN node. Please refer to
the definition of the UAVCAN message
"uavcan.protocol.NodeStatus" for the background information.
The UAVCAN specification is available at http://uavcan.org.
'''
id = MAVLINK_MSG_ID_UAVCAN_NODE_STATUS
name = 'UAVCAN_NODE_STATUS'
fieldnames = ['time_usec', 'uptime_sec', 'health', 'mode', 'sub_mode', 'vendor_specific_status_code']
ordered_fieldnames = [ 'time_usec', 'uptime_sec', 'vendor_specific_status_code', 'health', 'mode', 'sub_mode' ]
format = '<QIHBBB'
native_format = bytearray('<QIHBBB', 'ascii')
orders = [0, 1, 3, 4, 5, 2]
lengths = [1, 1, 1, 1, 1, 1]
array_lengths = [0, 0, 0, 0, 0, 0]
crc_extra = 28
def __init__(self, time_usec, uptime_sec, health, mode, sub_mode, vendor_specific_status_code):
MAVLink_message.__init__(self, MAVLink_uavcan_node_status_message.id, MAVLink_uavcan_node_status_message.name)
self._fieldnames = MAVLink_uavcan_node_status_message.fieldnames
self.time_usec = time_usec
self.uptime_sec = uptime_sec
self.health = health
self.mode = mode
self.sub_mode = sub_mode
self.vendor_specific_status_code = vendor_specific_status_code
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 28, struct.pack('<QIHBBB', self.time_usec, self.uptime_sec, self.vendor_specific_status_code, self.health, self.mode, self.sub_mode), force_mavlink1=force_mavlink1)
class MAVLink_uavcan_node_info_message(MAVLink_message):
'''
General information describing a particular UAVCAN node.
Please refer to the definition of the UAVCAN service
"uavcan.protocol.GetNodeInfo" for the background information.
This message should be emitted by the system whenever a new
node appears online, or an existing node reboots.
Additionally, it can be emitted upon request from the other
end of the MAVLink channel (see MAV_CMD_UAVCAN_GET_NODE_INFO).
It is also not prohibited to emit this message unconditionally
at a low frequency. The UAVCAN specification is available at
http://uavcan.org.
'''
id = MAVLINK_MSG_ID_UAVCAN_NODE_INFO
name = 'UAVCAN_NODE_INFO'
fieldnames = ['time_usec', 'uptime_sec', 'name', 'hw_version_major', 'hw_version_minor', 'hw_unique_id', 'sw_version_major', 'sw_version_minor', 'sw_vcs_commit']
ordered_fieldnames = [ 'time_usec', 'uptime_sec', 'sw_vcs_commit', 'name', 'hw_version_major', 'hw_version_minor', 'hw_unique_id', 'sw_version_major', 'sw_version_minor' ]
format = '<QII80sBB16BBB'
native_format = bytearray('<QIIcBBBBB', 'ascii')
orders = [0, 1, 3, 4, 5, 6, 7, 8, 2]
lengths = [1, 1, 1, 1, 1, 1, 16, 1, 1]
array_lengths = [0, 0, 0, 80, 0, 0, 16, 0, 0]
crc_extra = 95
def __init__(self, time_usec, uptime_sec, name, hw_version_major, hw_version_minor, hw_unique_id, sw_version_major, sw_version_minor, sw_vcs_commit):
MAVLink_message.__init__(self, MAVLink_uavcan_node_info_message.id, MAVLink_uavcan_node_info_message.name)
self._fieldnames = MAVLink_uavcan_node_info_message.fieldnames
self.time_usec = time_usec
self.uptime_sec = uptime_sec
self.name = name
self.hw_version_major = hw_version_major
self.hw_version_minor = hw_version_minor
self.hw_unique_id = hw_unique_id
self.sw_version_major = sw_version_major
self.sw_version_minor = sw_version_minor
self.sw_vcs_commit = sw_vcs_commit
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 95, struct.pack('<QII80sBB16BBB', self.time_usec, self.uptime_sec, self.sw_vcs_commit, self.name, self.hw_version_major, self.hw_version_minor, self.hw_unique_id[0], self.hw_unique_id[1], self.hw_unique_id[2], self.hw_unique_id[3], self.hw_unique_id[4], self.hw_unique_id[5], self.hw_unique_id[6], self.hw_unique_id[7], self.hw_unique_id[8], self.hw_unique_id[9], self.hw_unique_id[10], self.hw_unique_id[11], self.hw_unique_id[12], self.hw_unique_id[13], self.hw_unique_id[14], self.hw_unique_id[15], self.sw_version_major, self.sw_version_minor), force_mavlink1=force_mavlink1)
class MAVLink_obstacle_distance_message(MAVLink_message):
'''
Obstacle distances in front of the sensor, starting from the
left in increment degrees to the right
'''
id = MAVLINK_MSG_ID_OBSTACLE_DISTANCE
name = 'OBSTACLE_DISTANCE'
fieldnames = ['time_usec', 'sensor_type', 'distances', 'increment', 'min_distance', 'max_distance']
ordered_fieldnames = [ 'time_usec', 'distances', 'min_distance', 'max_distance', 'sensor_type', 'increment' ]
format = '<Q72HHHBB'
native_format = bytearray('<QHHHBB', 'ascii')
orders = [0, 4, 1, 5, 2, 3]
lengths = [1, 72, 1, 1, 1, 1]
array_lengths = [0, 72, 0, 0, 0, 0]
crc_extra = 23
def __init__(self, time_usec, sensor_type, distances, increment, min_distance, max_distance):
MAVLink_message.__init__(self, MAVLink_obstacle_distance_message.id, MAVLink_obstacle_distance_message.name)
self._fieldnames = MAVLink_obstacle_distance_message.fieldnames
self.time_usec = time_usec
self.sensor_type = sensor_type
self.distances = distances
self.increment = increment
self.min_distance = min_distance
self.max_distance = max_distance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 23, struct.pack('<Q72HHHBB', self.time_usec, self.distances[0], self.distances[1], self.distances[2], self.distances[3], self.distances[4], self.distances[5], self.distances[6], self.distances[7], self.distances[8], self.distances[9], self.distances[10], self.distances[11], self.distances[12], self.distances[13], self.distances[14], self.distances[15], self.distances[16], self.distances[17], self.distances[18], self.distances[19], self.distances[20], self.distances[21], self.distances[22], self.distances[23], self.distances[24], self.distances[25], self.distances[26], self.distances[27], self.distances[28], self.distances[29], self.distances[30], self.distances[31], self.distances[32], self.distances[33], self.distances[34], self.distances[35], self.distances[36], self.distances[37], self.distances[38], self.distances[39], self.distances[40], self.distances[41], self.distances[42], self.distances[43], self.distances[44], self.distances[45], self.distances[46], self.distances[47], self.distances[48], self.distances[49], self.distances[50], self.distances[51], self.distances[52], self.distances[53], self.distances[54], self.distances[55], self.distances[56], self.distances[57], self.distances[58], self.distances[59], self.distances[60], self.distances[61], self.distances[62], self.distances[63], self.distances[64], self.distances[65], self.distances[66], self.distances[67], self.distances[68], self.distances[69], self.distances[70], self.distances[71], self.min_distance, self.max_distance, self.sensor_type, self.increment), force_mavlink1=force_mavlink1)
class MAVLink_odometry_message(MAVLink_message):
'''
Odometry message to communicate odometry information with an
external interface. Fits ROS REP 147 standard for aerial
vehicles (http://www.ros.org/reps/rep-0147.html).
'''
id = MAVLINK_MSG_ID_ODOMETRY
name = 'ODOMETRY'
fieldnames = ['time_usec', 'frame_id', 'child_frame_id', 'x', 'y', 'z', 'q', 'vx', 'vy', 'vz', 'rollspeed', 'pitchspeed', 'yawspeed', 'pose_covariance', 'twist_covariance']
ordered_fieldnames = [ 'time_usec', 'x', 'y', 'z', 'q', 'vx', 'vy', 'vz', 'rollspeed', 'pitchspeed', 'yawspeed', 'pose_covariance', 'twist_covariance', 'frame_id', 'child_frame_id' ]
format = '<Qfff4fffffff21f21fBB'
native_format = bytearray('<QffffffffffffBB', 'ascii')
orders = [0, 13, 14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
lengths = [1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 21, 21, 1, 1]
array_lengths = [0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 21, 21, 0, 0]
crc_extra = 58
def __init__(self, time_usec, frame_id, child_frame_id, x, y, z, q, vx, vy, vz, rollspeed, pitchspeed, yawspeed, pose_covariance, twist_covariance):
MAVLink_message.__init__(self, MAVLink_odometry_message.id, MAVLink_odometry_message.name)
self._fieldnames = MAVLink_odometry_message.fieldnames
self.time_usec = time_usec
self.frame_id = frame_id
self.child_frame_id = child_frame_id
self.x = x
self.y = y
self.z = z
self.q = q
self.vx = vx
self.vy = vy
self.vz = vz
self.rollspeed = rollspeed
self.pitchspeed = pitchspeed
self.yawspeed = yawspeed
self.pose_covariance = pose_covariance
self.twist_covariance = twist_covariance
def pack(self, mav, force_mavlink1=False):
return MAVLink_message.pack(self, mav, 58, struct.pack('<Qfff4fffffff21f21fBB', self.time_usec, self.x, self.y, self.z, self.q[0], self.q[1], self.q[2], self.q[3], self.vx, self.vy, self.vz, self.rollspeed, self.pitchspeed, self.yawspeed, self.pose_covariance[0], self.pose_covariance[1], self.pose_covariance[2], self.pose_covariance[3], self.pose_covariance[4], self.pose_covariance[5], self.pose_covariance[6], self.pose_covariance[7], self.pose_covariance[8], self.pose_covariance[9], self.pose_covariance[10], self.pose_covariance[11], self.pose_covariance[12], self.pose_covariance[13], self.pose_covariance[14], self.pose_covariance[15], self.pose_covariance[16], self.pose_covariance[17], self.pose_covariance[18], self.pose_covariance[19], self.pose_covariance[20], self.twist_covariance[0], self.twist_covariance[1], self.twist_covariance[2], self.twist_covariance[3], self.twist_covariance[4], self.twist_covariance[5], self.twist_covariance[6], self.twist_covariance[7], self.twist_covariance[8], self.twist_covariance[9], self.twist_covariance[10], self.twist_covariance[11], self.twist_covariance[12], self.twist_covariance[13], self.twist_covariance[14], self.twist_covariance[15], self.twist_covariance[16], self.twist_covariance[17], self.twist_covariance[18], self.twist_covariance[19], self.twist_covariance[20], self.frame_id, self.child_frame_id), force_mavlink1=force_mavlink1)
mavlink_map = {
MAVLINK_MSG_ID_AQ_TELEMETRY_F : MAVLink_aq_telemetry_f_message,
MAVLINK_MSG_ID_AQ_ESC_TELEMETRY : MAVLink_aq_esc_telemetry_message,
MAVLINK_MSG_ID_HEARTBEAT : MAVLink_heartbeat_message,
MAVLINK_MSG_ID_SYS_STATUS : MAVLink_sys_status_message,
MAVLINK_MSG_ID_SYSTEM_TIME : MAVLink_system_time_message,
MAVLINK_MSG_ID_PING : MAVLink_ping_message,
MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL : MAVLink_change_operator_control_message,
MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK : MAVLink_change_operator_control_ack_message,
MAVLINK_MSG_ID_AUTH_KEY : MAVLink_auth_key_message,
MAVLINK_MSG_ID_SET_MODE : MAVLink_set_mode_message,
MAVLINK_MSG_ID_PARAM_REQUEST_READ : MAVLink_param_request_read_message,
MAVLINK_MSG_ID_PARAM_REQUEST_LIST : MAVLink_param_request_list_message,
MAVLINK_MSG_ID_PARAM_VALUE : MAVLink_param_value_message,
MAVLINK_MSG_ID_PARAM_SET : MAVLink_param_set_message,
MAVLINK_MSG_ID_GPS_RAW_INT : MAVLink_gps_raw_int_message,
MAVLINK_MSG_ID_GPS_STATUS : MAVLink_gps_status_message,
MAVLINK_MSG_ID_SCALED_IMU : MAVLink_scaled_imu_message,
MAVLINK_MSG_ID_RAW_IMU : MAVLink_raw_imu_message,
MAVLINK_MSG_ID_RAW_PRESSURE : MAVLink_raw_pressure_message,
MAVLINK_MSG_ID_SCALED_PRESSURE : MAVLink_scaled_pressure_message,
MAVLINK_MSG_ID_ATTITUDE : MAVLink_attitude_message,
MAVLINK_MSG_ID_ATTITUDE_QUATERNION : MAVLink_attitude_quaternion_message,
MAVLINK_MSG_ID_LOCAL_POSITION_NED : MAVLink_local_position_ned_message,
MAVLINK_MSG_ID_GLOBAL_POSITION_INT : MAVLink_global_position_int_message,
MAVLINK_MSG_ID_RC_CHANNELS_SCALED : MAVLink_rc_channels_scaled_message,
MAVLINK_MSG_ID_RC_CHANNELS_RAW : MAVLink_rc_channels_raw_message,
MAVLINK_MSG_ID_SERVO_OUTPUT_RAW : MAVLink_servo_output_raw_message,
MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST : MAVLink_mission_request_partial_list_message,
MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST : MAVLink_mission_write_partial_list_message,
MAVLINK_MSG_ID_MISSION_ITEM : MAVLink_mission_item_message,
MAVLINK_MSG_ID_MISSION_REQUEST : MAVLink_mission_request_message,
MAVLINK_MSG_ID_MISSION_SET_CURRENT : MAVLink_mission_set_current_message,
MAVLINK_MSG_ID_MISSION_CURRENT : MAVLink_mission_current_message,
MAVLINK_MSG_ID_MISSION_REQUEST_LIST : MAVLink_mission_request_list_message,
MAVLINK_MSG_ID_MISSION_COUNT : MAVLink_mission_count_message,
MAVLINK_MSG_ID_MISSION_CLEAR_ALL : MAVLink_mission_clear_all_message,
MAVLINK_MSG_ID_MISSION_ITEM_REACHED : MAVLink_mission_item_reached_message,
MAVLINK_MSG_ID_MISSION_ACK : MAVLink_mission_ack_message,
MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN : MAVLink_set_gps_global_origin_message,
MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN : MAVLink_gps_global_origin_message,
MAVLINK_MSG_ID_PARAM_MAP_RC : MAVLink_param_map_rc_message,
MAVLINK_MSG_ID_MISSION_REQUEST_INT : MAVLink_mission_request_int_message,
MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA : MAVLink_safety_set_allowed_area_message,
MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA : MAVLink_safety_allowed_area_message,
MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV : MAVLink_attitude_quaternion_cov_message,
MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT : MAVLink_nav_controller_output_message,
MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV : MAVLink_global_position_int_cov_message,
MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV : MAVLink_local_position_ned_cov_message,
MAVLINK_MSG_ID_RC_CHANNELS : MAVLink_rc_channels_message,
MAVLINK_MSG_ID_REQUEST_DATA_STREAM : MAVLink_request_data_stream_message,
MAVLINK_MSG_ID_DATA_STREAM : MAVLink_data_stream_message,
MAVLINK_MSG_ID_MANUAL_CONTROL : MAVLink_manual_control_message,
MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE : MAVLink_rc_channels_override_message,
MAVLINK_MSG_ID_MISSION_ITEM_INT : MAVLink_mission_item_int_message,
MAVLINK_MSG_ID_VFR_HUD : MAVLink_vfr_hud_message,
MAVLINK_MSG_ID_COMMAND_INT : MAVLink_command_int_message,
MAVLINK_MSG_ID_COMMAND_LONG : MAVLink_command_long_message,
MAVLINK_MSG_ID_COMMAND_ACK : MAVLink_command_ack_message,
MAVLINK_MSG_ID_MANUAL_SETPOINT : MAVLink_manual_setpoint_message,
MAVLINK_MSG_ID_SET_ATTITUDE_TARGET : MAVLink_set_attitude_target_message,
MAVLINK_MSG_ID_ATTITUDE_TARGET : MAVLink_attitude_target_message,
MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED : MAVLink_set_position_target_local_ned_message,
MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED : MAVLink_position_target_local_ned_message,
MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT : MAVLink_set_position_target_global_int_message,
MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT : MAVLink_position_target_global_int_message,
MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET : MAVLink_local_position_ned_system_global_offset_message,
MAVLINK_MSG_ID_HIL_STATE : MAVLink_hil_state_message,
MAVLINK_MSG_ID_HIL_CONTROLS : MAVLink_hil_controls_message,
MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW : MAVLink_hil_rc_inputs_raw_message,
MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS : MAVLink_hil_actuator_controls_message,
MAVLINK_MSG_ID_OPTICAL_FLOW : MAVLink_optical_flow_message,
MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE : MAVLink_global_vision_position_estimate_message,
MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE : MAVLink_vision_position_estimate_message,
MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE : MAVLink_vision_speed_estimate_message,
MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE : MAVLink_vicon_position_estimate_message,
MAVLINK_MSG_ID_HIGHRES_IMU : MAVLink_highres_imu_message,
MAVLINK_MSG_ID_OPTICAL_FLOW_RAD : MAVLink_optical_flow_rad_message,
MAVLINK_MSG_ID_HIL_SENSOR : MAVLink_hil_sensor_message,
MAVLINK_MSG_ID_SIM_STATE : MAVLink_sim_state_message,
MAVLINK_MSG_ID_RADIO_STATUS : MAVLink_radio_status_message,
MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL : MAVLink_file_transfer_protocol_message,
MAVLINK_MSG_ID_TIMESYNC : MAVLink_timesync_message,
MAVLINK_MSG_ID_CAMERA_TRIGGER : MAVLink_camera_trigger_message,
MAVLINK_MSG_ID_HIL_GPS : MAVLink_hil_gps_message,
MAVLINK_MSG_ID_HIL_OPTICAL_FLOW : MAVLink_hil_optical_flow_message,
MAVLINK_MSG_ID_HIL_STATE_QUATERNION : MAVLink_hil_state_quaternion_message,
MAVLINK_MSG_ID_SCALED_IMU2 : MAVLink_scaled_imu2_message,
MAVLINK_MSG_ID_LOG_REQUEST_LIST : MAVLink_log_request_list_message,
MAVLINK_MSG_ID_LOG_ENTRY : MAVLink_log_entry_message,
MAVLINK_MSG_ID_LOG_REQUEST_DATA : MAVLink_log_request_data_message,
MAVLINK_MSG_ID_LOG_DATA : MAVLink_log_data_message,
MAVLINK_MSG_ID_LOG_ERASE : MAVLink_log_erase_message,
MAVLINK_MSG_ID_LOG_REQUEST_END : MAVLink_log_request_end_message,
MAVLINK_MSG_ID_GPS_INJECT_DATA : MAVLink_gps_inject_data_message,
MAVLINK_MSG_ID_GPS2_RAW : MAVLink_gps2_raw_message,
MAVLINK_MSG_ID_POWER_STATUS : MAVLink_power_status_message,
MAVLINK_MSG_ID_SERIAL_CONTROL : MAVLink_serial_control_message,
MAVLINK_MSG_ID_GPS_RTK : MAVLink_gps_rtk_message,
MAVLINK_MSG_ID_GPS2_RTK : MAVLink_gps2_rtk_message,
MAVLINK_MSG_ID_SCALED_IMU3 : MAVLink_scaled_imu3_message,
MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE : MAVLink_data_transmission_handshake_message,
MAVLINK_MSG_ID_ENCAPSULATED_DATA : MAVLink_encapsulated_data_message,
MAVLINK_MSG_ID_DISTANCE_SENSOR : MAVLink_distance_sensor_message,
MAVLINK_MSG_ID_TERRAIN_REQUEST : MAVLink_terrain_request_message,
MAVLINK_MSG_ID_TERRAIN_DATA : MAVLink_terrain_data_message,
MAVLINK_MSG_ID_TERRAIN_CHECK : MAVLink_terrain_check_message,
MAVLINK_MSG_ID_TERRAIN_REPORT : MAVLink_terrain_report_message,
MAVLINK_MSG_ID_SCALED_PRESSURE2 : MAVLink_scaled_pressure2_message,
MAVLINK_MSG_ID_ATT_POS_MOCAP : MAVLink_att_pos_mocap_message,
MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET : MAVLink_set_actuator_control_target_message,
MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET : MAVLink_actuator_control_target_message,
MAVLINK_MSG_ID_ALTITUDE : MAVLink_altitude_message,
MAVLINK_MSG_ID_RESOURCE_REQUEST : MAVLink_resource_request_message,
MAVLINK_MSG_ID_SCALED_PRESSURE3 : MAVLink_scaled_pressure3_message,
MAVLINK_MSG_ID_FOLLOW_TARGET : MAVLink_follow_target_message,
MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE : MAVLink_control_system_state_message,
MAVLINK_MSG_ID_BATTERY_STATUS : MAVLink_battery_status_message,
MAVLINK_MSG_ID_AUTOPILOT_VERSION : MAVLink_autopilot_version_message,
MAVLINK_MSG_ID_LANDING_TARGET : MAVLink_landing_target_message,
MAVLINK_MSG_ID_ESTIMATOR_STATUS : MAVLink_estimator_status_message,
MAVLINK_MSG_ID_WIND_COV : MAVLink_wind_cov_message,
MAVLINK_MSG_ID_GPS_INPUT : MAVLink_gps_input_message,
MAVLINK_MSG_ID_GPS_RTCM_DATA : MAVLink_gps_rtcm_data_message,
MAVLINK_MSG_ID_HIGH_LATENCY : MAVLink_high_latency_message,
MAVLINK_MSG_ID_VIBRATION : MAVLink_vibration_message,
MAVLINK_MSG_ID_HOME_POSITION : MAVLink_home_position_message,
MAVLINK_MSG_ID_SET_HOME_POSITION : MAVLink_set_home_position_message,
MAVLINK_MSG_ID_MESSAGE_INTERVAL : MAVLink_message_interval_message,
MAVLINK_MSG_ID_EXTENDED_SYS_STATE : MAVLink_extended_sys_state_message,
MAVLINK_MSG_ID_ADSB_VEHICLE : MAVLink_adsb_vehicle_message,
MAVLINK_MSG_ID_COLLISION : MAVLink_collision_message,
MAVLINK_MSG_ID_V2_EXTENSION : MAVLink_v2_extension_message,
MAVLINK_MSG_ID_MEMORY_VECT : MAVLink_memory_vect_message,
MAVLINK_MSG_ID_DEBUG_VECT : MAVLink_debug_vect_message,
MAVLINK_MSG_ID_NAMED_VALUE_FLOAT : MAVLink_named_value_float_message,
MAVLINK_MSG_ID_NAMED_VALUE_INT : MAVLink_named_value_int_message,
MAVLINK_MSG_ID_STATUSTEXT : MAVLink_statustext_message,
MAVLINK_MSG_ID_DEBUG : MAVLink_debug_message,
MAVLINK_MSG_ID_SETUP_SIGNING : MAVLink_setup_signing_message,
MAVLINK_MSG_ID_BUTTON_CHANGE : MAVLink_button_change_message,
MAVLINK_MSG_ID_PLAY_TUNE : MAVLink_play_tune_message,
MAVLINK_MSG_ID_CAMERA_INFORMATION : MAVLink_camera_information_message,
MAVLINK_MSG_ID_CAMERA_SETTINGS : MAVLink_camera_settings_message,
MAVLINK_MSG_ID_STORAGE_INFORMATION : MAVLink_storage_information_message,
MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS : MAVLink_camera_capture_status_message,
MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED : MAVLink_camera_image_captured_message,
MAVLINK_MSG_ID_FLIGHT_INFORMATION : MAVLink_flight_information_message,
MAVLINK_MSG_ID_MOUNT_ORIENTATION : MAVLink_mount_orientation_message,
MAVLINK_MSG_ID_LOGGING_DATA : MAVLink_logging_data_message,
MAVLINK_MSG_ID_LOGGING_DATA_ACKED : MAVLink_logging_data_acked_message,
MAVLINK_MSG_ID_LOGGING_ACK : MAVLink_logging_ack_message,
MAVLINK_MSG_ID_WIFI_CONFIG_AP : MAVLink_wifi_config_ap_message,
MAVLINK_MSG_ID_UAVCAN_NODE_STATUS : MAVLink_uavcan_node_status_message,
MAVLINK_MSG_ID_UAVCAN_NODE_INFO : MAVLink_uavcan_node_info_message,
MAVLINK_MSG_ID_OBSTACLE_DISTANCE : MAVLink_obstacle_distance_message,
MAVLINK_MSG_ID_ODOMETRY : MAVLink_odometry_message,
}
class MAVError(Exception):
'''MAVLink error class'''
def __init__(self, msg):
Exception.__init__(self, msg)
self.message = msg
class MAVString(str):
'''NUL terminated string'''
def __init__(self, s):
str.__init__(self)
def __str__(self):
i = self.find(chr(0))
if i == -1:
return self[:]
return self[0:i]
class MAVLink_bad_data(MAVLink_message):
'''
a piece of bad data in a mavlink stream
'''
def __init__(self, data, reason):
MAVLink_message.__init__(self, MAVLINK_MSG_ID_BAD_DATA, 'BAD_DATA')
self._fieldnames = ['data', 'reason']
self.data = data
self.reason = reason
self._msgbuf = data
def __str__(self):
'''Override the __str__ function from MAVLink_messages because non-printable characters are common in to be the reason for this message to exist.'''
return '%s {%s, data:%s}' % (self._type, self.reason, [('%x' % ord(i) if isinstance(i, str) else '%x' % i) for i in self.data])
class MAVLinkSigning(object):
'''MAVLink signing state class'''
def __init__(self):
self.secret_key = None
self.timestamp = 0
self.link_id = 0
self.sign_outgoing = False
self.allow_unsigned_callback = None
self.stream_timestamps = {}
self.sig_count = 0
self.badsig_count = 0
self.goodsig_count = 0
self.unsigned_count = 0
self.reject_count = 0
class MAVLink(object):
'''MAVLink protocol handling class'''
def __init__(self, file, srcSystem=0, srcComponent=0, use_native=False):
self.seq = 0
self.file = file
self.srcSystem = srcSystem
self.srcComponent = srcComponent
self.callback = None
self.callback_args = None
self.callback_kwargs = None
self.send_callback = None
self.send_callback_args = None
self.send_callback_kwargs = None
self.buf = bytearray()
self.buf_index = 0
self.expected_length = HEADER_LEN_V1+2
self.have_prefix_error = False
self.robust_parsing = False
self.protocol_marker = 253
self.little_endian = True
self.crc_extra = True
self.sort_fields = True
self.total_packets_sent = 0
self.total_bytes_sent = 0
self.total_packets_received = 0
self.total_bytes_received = 0
self.total_receive_errors = 0
self.startup_time = time.time()
self.signing = MAVLinkSigning()
if native_supported and (use_native or native_testing or native_force):
print("NOTE: mavnative is currently beta-test code")
self.native = mavnative.NativeConnection(MAVLink_message, mavlink_map)
else:
self.native = None
if native_testing:
self.test_buf = bytearray()
def set_callback(self, callback, *args, **kwargs):
self.callback = callback
self.callback_args = args
self.callback_kwargs = kwargs
def set_send_callback(self, callback, *args, **kwargs):
self.send_callback = callback
self.send_callback_args = args
self.send_callback_kwargs = kwargs
def send(self, mavmsg, force_mavlink1=False):
'''send a MAVLink message'''
buf = mavmsg.pack(self, force_mavlink1=force_mavlink1)
self.file.write(buf)
self.seq = (self.seq + 1) % 256
self.total_packets_sent += 1
self.total_bytes_sent += len(buf)
if self.send_callback:
self.send_callback(mavmsg, *self.send_callback_args, **self.send_callback_kwargs)
def buf_len(self):
return len(self.buf) - self.buf_index
def bytes_needed(self):
'''return number of bytes needed for next parsing stage'''
if self.native:
ret = self.native.expected_length - self.buf_len()
else:
ret = self.expected_length - self.buf_len()
if ret <= 0:
return 1
return ret
def __parse_char_native(self, c):
'''this method exists only to see in profiling results'''
m = self.native.parse_chars(c)
return m
def __callbacks(self, msg):
'''this method exists only to make profiling results easier to read'''
if self.callback:
self.callback(msg, *self.callback_args, **self.callback_kwargs)
def parse_char(self, c):
'''input some data bytes, possibly returning a new message'''
self.buf.extend(c)
self.total_bytes_received += len(c)
if self.native:
if native_testing:
self.test_buf.extend(c)
m = self.__parse_char_native(self.test_buf)
m2 = self.__parse_char_legacy()
if m2 != m:
print("Native: %s\nLegacy: %s\n" % (m, m2))
raise Exception('Native vs. Legacy mismatch')
else:
m = self.__parse_char_native(self.buf)
else:
m = self.__parse_char_legacy()
if m != None:
self.total_packets_received += 1
self.__callbacks(m)
else:
# XXX The idea here is if we've read something and there's nothing left in
# the buffer, reset it to 0 which frees the memory
if self.buf_len() == 0 and self.buf_index != 0:
self.buf = bytearray()
self.buf_index = 0
return m
def __parse_char_legacy(self):
'''input some data bytes, possibly returning a new message (uses no native code)'''
header_len = HEADER_LEN_V1
if self.buf_len() >= 1 and self.buf[self.buf_index] == PROTOCOL_MARKER_V2:
header_len = HEADER_LEN_V2
if self.buf_len() >= 1 and self.buf[self.buf_index] != PROTOCOL_MARKER_V1 and self.buf[self.buf_index] != PROTOCOL_MARKER_V2:
magic = self.buf[self.buf_index]
self.buf_index += 1
if self.robust_parsing:
m = MAVLink_bad_data(chr(magic), 'Bad prefix')
self.expected_length = header_len+2
self.total_receive_errors += 1
return m
if self.have_prefix_error:
return None
self.have_prefix_error = True
self.total_receive_errors += 1
raise MAVError("invalid MAVLink prefix '%s'" % magic)
self.have_prefix_error = False
if self.buf_len() >= 3:
sbuf = self.buf[self.buf_index:3+self.buf_index]
if sys.version_info[0] < 3:
sbuf = str(sbuf)
(magic, self.expected_length, incompat_flags) = struct.unpack('BBB', sbuf)
if magic == PROTOCOL_MARKER_V2 and (incompat_flags & MAVLINK_IFLAG_SIGNED):
self.expected_length += MAVLINK_SIGNATURE_BLOCK_LEN
self.expected_length += header_len + 2
if self.expected_length >= (header_len+2) and self.buf_len() >= self.expected_length:
mbuf = array.array('B', self.buf[self.buf_index:self.buf_index+self.expected_length])
self.buf_index += self.expected_length
self.expected_length = header_len+2
if self.robust_parsing:
try:
if magic == PROTOCOL_MARKER_V2 and (incompat_flags & ~MAVLINK_IFLAG_SIGNED) != 0:
raise MAVError('invalid incompat_flags 0x%x 0x%x %u' % (incompat_flags, magic, self.expected_length))
m = self.decode(mbuf)
except MAVError as reason:
m = MAVLink_bad_data(mbuf, reason.message)
self.total_receive_errors += 1
else:
if magic == PROTOCOL_MARKER_V2 and (incompat_flags & ~MAVLINK_IFLAG_SIGNED) != 0:
raise MAVError('invalid incompat_flags 0x%x 0x%x %u' % (incompat_flags, magic, self.expected_length))
m = self.decode(mbuf)
return m
return None
def parse_buffer(self, s):
'''input some data bytes, possibly returning a list of new messages'''
m = self.parse_char(s)
if m is None:
return None
ret = [m]
while True:
m = self.parse_char("")
if m is None:
return ret
ret.append(m)
return ret
def check_signature(self, msgbuf, srcSystem, srcComponent):
'''check signature on incoming message'''
if isinstance(msgbuf, array.array):
msgbuf = msgbuf.tostring()
timestamp_buf = msgbuf[-12:-6]
link_id = msgbuf[-13]
(tlow, thigh) = struct.unpack('<IH', timestamp_buf)
timestamp = tlow + (thigh<<32)
# see if the timestamp is acceptable
stream_key = (link_id,srcSystem,srcComponent)
if stream_key in self.signing.stream_timestamps:
if timestamp <= self.signing.stream_timestamps[stream_key]:
# reject old timestamp
# print('old timestamp')
return False
else:
# a new stream has appeared. Accept the timestamp if it is at most
# one minute behind our current timestamp
if timestamp + 6000*1000 < self.signing.timestamp:
# print('bad new stream ', timestamp/(100.0*1000*60*60*24*365), self.signing.timestamp/(100.0*1000*60*60*24*365))
return False
self.signing.stream_timestamps[stream_key] = timestamp
# print('new stream')
h = hashlib.new('sha256')
h.update(self.signing.secret_key)
h.update(msgbuf[:-6])
sig1 = str(h.digest())[:6]
sig2 = str(msgbuf)[-6:]
if sig1 != sig2:
# print('sig mismatch')
return False
# the timestamp we next send with is the max of the received timestamp and
# our current timestamp
self.signing.timestamp = max(self.signing.timestamp, timestamp)
return True
def decode(self, msgbuf):
'''decode a buffer as a MAVLink message'''
# decode the header
if msgbuf[0] != PROTOCOL_MARKER_V1:
headerlen = 10
try:
magic, mlen, incompat_flags, compat_flags, seq, srcSystem, srcComponent, msgIdlow, msgIdhigh = struct.unpack('<cBBBBBBHB', msgbuf[:headerlen])
except struct.error as emsg:
raise MAVError('Unable to unpack MAVLink header: %s' % emsg)
msgId = msgIdlow | (msgIdhigh<<16)
mapkey = msgId
else:
headerlen = 6
try:
magic, mlen, seq, srcSystem, srcComponent, msgId = struct.unpack('<cBBBBB', msgbuf[:headerlen])
incompat_flags = 0
compat_flags = 0
except struct.error as emsg:
raise MAVError('Unable to unpack MAVLink header: %s' % emsg)
mapkey = msgId
if (incompat_flags & MAVLINK_IFLAG_SIGNED) != 0:
signature_len = MAVLINK_SIGNATURE_BLOCK_LEN
else:
signature_len = 0
if ord(magic) != PROTOCOL_MARKER_V1 and ord(magic) != PROTOCOL_MARKER_V2:
raise MAVError("invalid MAVLink prefix '%s'" % magic)
if mlen != len(msgbuf)-(headerlen+2+signature_len):
raise MAVError('invalid MAVLink message length. Got %u expected %u, msgId=%u headerlen=%u' % (len(msgbuf)-(headerlen+2+signature_len), mlen, msgId, headerlen))
if not mapkey in mavlink_map:
raise MAVError('unknown MAVLink message ID %s' % str(mapkey))
# decode the payload
type = mavlink_map[mapkey]
fmt = type.format
order_map = type.orders
len_map = type.lengths
crc_extra = type.crc_extra
# decode the checksum
try:
crc, = struct.unpack('<H', msgbuf[-(2+signature_len):][:2])
except struct.error as emsg:
raise MAVError('Unable to unpack MAVLink CRC: %s' % emsg)
crcbuf = msgbuf[1:-(2+signature_len)]
if True: # using CRC extra
crcbuf.append(crc_extra)
crc2 = x25crc(crcbuf)
if crc != crc2.crc:
raise MAVError('invalid MAVLink CRC in msgID %u 0x%04x should be 0x%04x' % (msgId, crc, crc2.crc))
sig_ok = False
if signature_len == MAVLINK_SIGNATURE_BLOCK_LEN:
self.signing.sig_count += 1
if self.signing.secret_key is not None:
accept_signature = False
if signature_len == MAVLINK_SIGNATURE_BLOCK_LEN:
sig_ok = self.check_signature(msgbuf, srcSystem, srcComponent)
accept_signature = sig_ok
if sig_ok:
self.signing.goodsig_count += 1
else:
self.signing.badsig_count += 1
if not accept_signature and self.signing.allow_unsigned_callback is not None:
accept_signature = self.signing.allow_unsigned_callback(self, msgId)
if accept_signature:
self.signing.unsigned_count += 1
else:
self.signing.reject_count += 1
elif self.signing.allow_unsigned_callback is not None:
accept_signature = self.signing.allow_unsigned_callback(self, msgId)
if accept_signature:
self.signing.unsigned_count += 1
else:
self.signing.reject_count += 1
if not accept_signature:
raise MAVError('Invalid signature')
csize = struct.calcsize(fmt)
mbuf = msgbuf[headerlen:-(2+signature_len)]
if len(mbuf) < csize:
# zero pad to give right size
mbuf.extend([0]*(csize - len(mbuf)))
if len(mbuf) < csize:
raise MAVError('Bad message of type %s length %u needs %s' % (
type, len(mbuf), csize))
mbuf = mbuf[:csize]
try:
t = struct.unpack(fmt, mbuf)
except struct.error as emsg:
raise MAVError('Unable to unpack MAVLink payload type=%s fmt=%s payloadLength=%u: %s' % (
type, fmt, len(mbuf), emsg))
tlist = list(t)
# handle sorted fields
if True:
t = tlist[:]
if sum(len_map) == len(len_map):
# message has no arrays in it
for i in range(0, len(tlist)):
tlist[i] = t[order_map[i]]
else:
# message has some arrays
tlist = []
for i in range(0, len(order_map)):
order = order_map[i]
L = len_map[order]
tip = sum(len_map[:order])
field = t[tip]
if L == 1 or isinstance(field, str):
tlist.append(field)
else:
tlist.append(t[tip:(tip + L)])
# terminate any strings
for i in range(0, len(tlist)):
if isinstance(tlist[i], str):
tlist[i] = str(MAVString(tlist[i]))
t = tuple(tlist)
# construct the message object
try:
m = type(*t)
except Exception as emsg:
raise MAVError('Unable to instantiate MAVLink message of type %s : %s' % (type, emsg))
m._signed = sig_ok
if m._signed:
m._link_id = msgbuf[-13]
m._msgbuf = msgbuf
m._payload = msgbuf[6:-(2+signature_len)]
m._crc = crc
m._header = MAVLink_header(msgId, incompat_flags, compat_flags, mlen, seq, srcSystem, srcComponent)
return m
def aq_telemetry_f_encode(self, Index, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20):
'''
Sends up to 20 raw float values.
Index : Index of message (uint16_t)
value1 : value1 (float)
value2 : value2 (float)
value3 : value3 (float)
value4 : value4 (float)
value5 : value5 (float)
value6 : value6 (float)
value7 : value7 (float)
value8 : value8 (float)
value9 : value9 (float)
value10 : value10 (float)
value11 : value11 (float)
value12 : value12 (float)
value13 : value13 (float)
value14 : value14 (float)
value15 : value15 (float)
value16 : value16 (float)
value17 : value17 (float)
value18 : value18 (float)
value19 : value19 (float)
value20 : value20 (float)
'''
return MAVLink_aq_telemetry_f_message(Index, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20)
def aq_telemetry_f_send(self, Index, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20, force_mavlink1=False):
'''
Sends up to 20 raw float values.
Index : Index of message (uint16_t)
value1 : value1 (float)
value2 : value2 (float)
value3 : value3 (float)
value4 : value4 (float)
value5 : value5 (float)
value6 : value6 (float)
value7 : value7 (float)
value8 : value8 (float)
value9 : value9 (float)
value10 : value10 (float)
value11 : value11 (float)
value12 : value12 (float)
value13 : value13 (float)
value14 : value14 (float)
value15 : value15 (float)
value16 : value16 (float)
value17 : value17 (float)
value18 : value18 (float)
value19 : value19 (float)
value20 : value20 (float)
'''
return self.send(self.aq_telemetry_f_encode(Index, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20), force_mavlink1=force_mavlink1)
def aq_esc_telemetry_encode(self, time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1):
'''
Sends ESC32 telemetry data for up to 4 motors. Multiple messages may
be sent in sequence when system has > 4 motors. Data
is described as follows:
// unsigned int state : 3;
// unsigned int vin : 12; // x 100
// unsigned int amps : 14; // x 100
// unsigned int rpm : 15;
// unsigned int duty : 8; // x (255/100)
// - Data Version 2 - //
unsigned int errors : 9; // Bad detects error
count // - Data Version 3
- // unsigned int temp
: 9; // (Deg C + 32) * 4
// unsigned int errCode : 3;
time_boot_ms : Timestamp of the component clock since boot time in ms. (uint32_t)
seq : Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). (uint8_t)
num_motors : Total number of active ESCs/motors on the system. (uint8_t)
num_in_seq : Number of active ESCs in this sequence (1 through this many array members will be populated with data) (uint8_t)
escid : ESC/Motor ID (uint8_t)
status_age : Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. (uint16_t)
data_version : Version of data structure (determines contents). (uint8_t)
data0 : Data bits 1-32 for each ESC. (uint32_t)
data1 : Data bits 33-64 for each ESC. (uint32_t)
'''
return MAVLink_aq_esc_telemetry_message(time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1)
def aq_esc_telemetry_send(self, time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1, force_mavlink1=False):
'''
Sends ESC32 telemetry data for up to 4 motors. Multiple messages may
be sent in sequence when system has > 4 motors. Data
is described as follows:
// unsigned int state : 3;
// unsigned int vin : 12; // x 100
// unsigned int amps : 14; // x 100
// unsigned int rpm : 15;
// unsigned int duty : 8; // x (255/100)
// - Data Version 2 - //
unsigned int errors : 9; // Bad detects error
count // - Data Version 3
- // unsigned int temp
: 9; // (Deg C + 32) * 4
// unsigned int errCode : 3;
time_boot_ms : Timestamp of the component clock since boot time in ms. (uint32_t)
seq : Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). (uint8_t)
num_motors : Total number of active ESCs/motors on the system. (uint8_t)
num_in_seq : Number of active ESCs in this sequence (1 through this many array members will be populated with data) (uint8_t)
escid : ESC/Motor ID (uint8_t)
status_age : Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. (uint16_t)
data_version : Version of data structure (determines contents). (uint8_t)
data0 : Data bits 1-32 for each ESC. (uint32_t)
data1 : Data bits 33-64 for each ESC. (uint32_t)
'''
return self.send(self.aq_esc_telemetry_encode(time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1), force_mavlink1=force_mavlink1)
def heartbeat_encode(self, type, autopilot, base_mode, custom_mode, system_status, mavlink_version=3):
'''
The heartbeat message shows that a system is present and responding.
The type of the MAV and Autopilot hardware allow the
receiving system to treat further messages from this
system appropriate (e.g. by laying out the user
interface based on the autopilot).
type : Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) (uint8_t)
autopilot : Autopilot type / class. defined in MAV_AUTOPILOT ENUM (uint8_t)
base_mode : System mode bitfield, as defined by MAV_MODE_FLAG enum (uint8_t)
custom_mode : A bitfield for use for autopilot-specific flags (uint32_t)
system_status : System status flag, as defined by MAV_STATE enum (uint8_t)
mavlink_version : MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version (uint8_t)
'''
return MAVLink_heartbeat_message(type, autopilot, base_mode, custom_mode, system_status, mavlink_version)
def heartbeat_send(self, type, autopilot, base_mode, custom_mode, system_status, mavlink_version=3, force_mavlink1=False):
'''
The heartbeat message shows that a system is present and responding.
The type of the MAV and Autopilot hardware allow the
receiving system to treat further messages from this
system appropriate (e.g. by laying out the user
interface based on the autopilot).
type : Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) (uint8_t)
autopilot : Autopilot type / class. defined in MAV_AUTOPILOT ENUM (uint8_t)
base_mode : System mode bitfield, as defined by MAV_MODE_FLAG enum (uint8_t)
custom_mode : A bitfield for use for autopilot-specific flags (uint32_t)
system_status : System status flag, as defined by MAV_STATE enum (uint8_t)
mavlink_version : MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version (uint8_t)
'''
return self.send(self.heartbeat_encode(type, autopilot, base_mode, custom_mode, system_status, mavlink_version), force_mavlink1=force_mavlink1)
def sys_status_encode(self, onboard_control_sensors_present, onboard_control_sensors_enabled, onboard_control_sensors_health, load, voltage_battery, current_battery, battery_remaining, drop_rate_comm, errors_comm, errors_count1, errors_count2, errors_count3, errors_count4):
'''
The general system state. If the system is following the MAVLink
standard, the system state is mainly defined by three
orthogonal states/modes: The system mode, which is
either LOCKED (motors shut down and locked), MANUAL
(system under RC control), GUIDED (system with
autonomous position control, position setpoint
controlled manually) or AUTO (system guided by
path/waypoint planner). The NAV_MODE defined the
current flight state: LIFTOFF (often an open-loop
maneuver), LANDING, WAYPOINTS or VECTOR. This
represents the internal navigation state machine. The
system status shows whether the system is currently
active or not and if an emergency occured. During the
CRITICAL and EMERGENCY states the MAV is still
considered to be active, but should start emergency
procedures autonomously. After a failure occured it
should first move from active to critical to allow
manual intervention and then move to emergency after a
certain timeout.
onboard_control_sensors_present : Bitmask showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
onboard_control_sensors_enabled : Bitmask showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
onboard_control_sensors_health : Bitmask showing which onboard controllers and sensors are operational or have an error: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
load : Maximum usage in percent of the mainloop time, (0%: 0, 100%: 1000) should be always below 1000 (uint16_t)
voltage_battery : Battery voltage, in millivolts (1 = 1 millivolt) (uint16_t)
current_battery : Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current (int16_t)
battery_remaining : Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot estimate the remaining battery (int8_t)
drop_rate_comm : Communication drops in percent, (0%: 0, 100%: 10'000), (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) (uint16_t)
errors_comm : Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) (uint16_t)
errors_count1 : Autopilot-specific errors (uint16_t)
errors_count2 : Autopilot-specific errors (uint16_t)
errors_count3 : Autopilot-specific errors (uint16_t)
errors_count4 : Autopilot-specific errors (uint16_t)
'''
return MAVLink_sys_status_message(onboard_control_sensors_present, onboard_control_sensors_enabled, onboard_control_sensors_health, load, voltage_battery, current_battery, battery_remaining, drop_rate_comm, errors_comm, errors_count1, errors_count2, errors_count3, errors_count4)
def sys_status_send(self, onboard_control_sensors_present, onboard_control_sensors_enabled, onboard_control_sensors_health, load, voltage_battery, current_battery, battery_remaining, drop_rate_comm, errors_comm, errors_count1, errors_count2, errors_count3, errors_count4, force_mavlink1=False):
'''
The general system state. If the system is following the MAVLink
standard, the system state is mainly defined by three
orthogonal states/modes: The system mode, which is
either LOCKED (motors shut down and locked), MANUAL
(system under RC control), GUIDED (system with
autonomous position control, position setpoint
controlled manually) or AUTO (system guided by
path/waypoint planner). The NAV_MODE defined the
current flight state: LIFTOFF (often an open-loop
maneuver), LANDING, WAYPOINTS or VECTOR. This
represents the internal navigation state machine. The
system status shows whether the system is currently
active or not and if an emergency occured. During the
CRITICAL and EMERGENCY states the MAV is still
considered to be active, but should start emergency
procedures autonomously. After a failure occured it
should first move from active to critical to allow
manual intervention and then move to emergency after a
certain timeout.
onboard_control_sensors_present : Bitmask showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
onboard_control_sensors_enabled : Bitmask showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
onboard_control_sensors_health : Bitmask showing which onboard controllers and sensors are operational or have an error: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
load : Maximum usage in percent of the mainloop time, (0%: 0, 100%: 1000) should be always below 1000 (uint16_t)
voltage_battery : Battery voltage, in millivolts (1 = 1 millivolt) (uint16_t)
current_battery : Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current (int16_t)
battery_remaining : Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot estimate the remaining battery (int8_t)
drop_rate_comm : Communication drops in percent, (0%: 0, 100%: 10'000), (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) (uint16_t)
errors_comm : Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) (uint16_t)
errors_count1 : Autopilot-specific errors (uint16_t)
errors_count2 : Autopilot-specific errors (uint16_t)
errors_count3 : Autopilot-specific errors (uint16_t)
errors_count4 : Autopilot-specific errors (uint16_t)
'''
return self.send(self.sys_status_encode(onboard_control_sensors_present, onboard_control_sensors_enabled, onboard_control_sensors_health, load, voltage_battery, current_battery, battery_remaining, drop_rate_comm, errors_comm, errors_count1, errors_count2, errors_count3, errors_count4), force_mavlink1=force_mavlink1)
def system_time_encode(self, time_unix_usec, time_boot_ms):
'''
The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
time_unix_usec : Timestamp of the master clock in microseconds since UNIX epoch. (uint64_t)
time_boot_ms : Timestamp of the component clock since boot time in milliseconds. (uint32_t)
'''
return MAVLink_system_time_message(time_unix_usec, time_boot_ms)
def system_time_send(self, time_unix_usec, time_boot_ms, force_mavlink1=False):
'''
The system time is the time of the master clock, typically the
computer clock of the main onboard computer.
time_unix_usec : Timestamp of the master clock in microseconds since UNIX epoch. (uint64_t)
time_boot_ms : Timestamp of the component clock since boot time in milliseconds. (uint32_t)
'''
return self.send(self.system_time_encode(time_unix_usec, time_boot_ms), force_mavlink1=force_mavlink1)
def ping_encode(self, time_usec, seq, target_system, target_component):
'''
A ping message either requesting or responding to a ping. This allows
to measure the system latencies, including serial
port, radio modem and UDP connections.
time_usec : Unix timestamp in microseconds or since system boot if smaller than MAVLink epoch (1.1.2009) (uint64_t)
seq : PING sequence (uint32_t)
target_system : 0: request ping from all receiving systems, if greater than 0: message is a ping response and number is the system id of the requesting system (uint8_t)
target_component : 0: request ping from all receiving components, if greater than 0: message is a ping response and number is the system id of the requesting system (uint8_t)
'''
return MAVLink_ping_message(time_usec, seq, target_system, target_component)
def ping_send(self, time_usec, seq, target_system, target_component, force_mavlink1=False):
'''
A ping message either requesting or responding to a ping. This allows
to measure the system latencies, including serial
port, radio modem and UDP connections.
time_usec : Unix timestamp in microseconds or since system boot if smaller than MAVLink epoch (1.1.2009) (uint64_t)
seq : PING sequence (uint32_t)
target_system : 0: request ping from all receiving systems, if greater than 0: message is a ping response and number is the system id of the requesting system (uint8_t)
target_component : 0: request ping from all receiving components, if greater than 0: message is a ping response and number is the system id of the requesting system (uint8_t)
'''
return self.send(self.ping_encode(time_usec, seq, target_system, target_component), force_mavlink1=force_mavlink1)
def change_operator_control_encode(self, target_system, control_request, version, passkey):
'''
Request to control this MAV
target_system : System the GCS requests control for (uint8_t)
control_request : 0: request control of this MAV, 1: Release control of this MAV (uint8_t)
version : 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch. (uint8_t)
passkey : Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" (char)
'''
return MAVLink_change_operator_control_message(target_system, control_request, version, passkey)
def change_operator_control_send(self, target_system, control_request, version, passkey, force_mavlink1=False):
'''
Request to control this MAV
target_system : System the GCS requests control for (uint8_t)
control_request : 0: request control of this MAV, 1: Release control of this MAV (uint8_t)
version : 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch. (uint8_t)
passkey : Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" (char)
'''
return self.send(self.change_operator_control_encode(target_system, control_request, version, passkey), force_mavlink1=force_mavlink1)
def change_operator_control_ack_encode(self, gcs_system_id, control_request, ack):
'''
Accept / deny control of this MAV
gcs_system_id : ID of the GCS this message (uint8_t)
control_request : 0: request control of this MAV, 1: Release control of this MAV (uint8_t)
ack : 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control (uint8_t)
'''
return MAVLink_change_operator_control_ack_message(gcs_system_id, control_request, ack)
def change_operator_control_ack_send(self, gcs_system_id, control_request, ack, force_mavlink1=False):
'''
Accept / deny control of this MAV
gcs_system_id : ID of the GCS this message (uint8_t)
control_request : 0: request control of this MAV, 1: Release control of this MAV (uint8_t)
ack : 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control (uint8_t)
'''
return self.send(self.change_operator_control_ack_encode(gcs_system_id, control_request, ack), force_mavlink1=force_mavlink1)
def auth_key_encode(self, key):
'''
Emit an encrypted signature / key identifying this system. PLEASE
NOTE: This protocol has been kept simple, so
transmitting the key requires an encrypted channel for
true safety.
key : key (char)
'''
return MAVLink_auth_key_message(key)
def auth_key_send(self, key, force_mavlink1=False):
'''
Emit an encrypted signature / key identifying this system. PLEASE
NOTE: This protocol has been kept simple, so
transmitting the key requires an encrypted channel for
true safety.
key : key (char)
'''
return self.send(self.auth_key_encode(key), force_mavlink1=force_mavlink1)
def set_mode_encode(self, target_system, base_mode, custom_mode):
'''
THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as
defined by enum MAV_MODE. There is no target component
id as the mode is by definition for the overall
aircraft, not only for one component.
target_system : The system setting the mode (uint8_t)
base_mode : The new base mode (uint8_t)
custom_mode : The new autopilot-specific mode. This field can be ignored by an autopilot. (uint32_t)
'''
return MAVLink_set_mode_message(target_system, base_mode, custom_mode)
def set_mode_send(self, target_system, base_mode, custom_mode, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with
MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as
defined by enum MAV_MODE. There is no target component
id as the mode is by definition for the overall
aircraft, not only for one component.
target_system : The system setting the mode (uint8_t)
base_mode : The new base mode (uint8_t)
custom_mode : The new autopilot-specific mode. This field can be ignored by an autopilot. (uint32_t)
'''
return self.send(self.set_mode_encode(target_system, base_mode, custom_mode), force_mavlink1=force_mavlink1)
def param_request_read_encode(self, target_system, target_component, param_id, param_index):
'''
Request to read the onboard parameter with the param_id string id.
Onboard parameters are stored as key[const char*] ->
value[float]. This allows to send a parameter to any
other component (such as the GCS) without the need of
previous knowledge of possible parameter names. Thus
the same GCS can store different parameters for
different autopilots. See also
https://mavlink.io/en/protocol/parameter.html for a
full documentation of QGroundControl and IMU code.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
param_id : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
param_index : Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored) (int16_t)
'''
return MAVLink_param_request_read_message(target_system, target_component, param_id, param_index)
def param_request_read_send(self, target_system, target_component, param_id, param_index, force_mavlink1=False):
'''
Request to read the onboard parameter with the param_id string id.
Onboard parameters are stored as key[const char*] ->
value[float]. This allows to send a parameter to any
other component (such as the GCS) without the need of
previous knowledge of possible parameter names. Thus
the same GCS can store different parameters for
different autopilots. See also
https://mavlink.io/en/protocol/parameter.html for a
full documentation of QGroundControl and IMU code.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
param_id : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
param_index : Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored) (int16_t)
'''
return self.send(self.param_request_read_encode(target_system, target_component, param_id, param_index), force_mavlink1=force_mavlink1)
def param_request_list_encode(self, target_system, target_component):
'''
Request all parameters of this component. After this request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return MAVLink_param_request_list_message(target_system, target_component)
def param_request_list_send(self, target_system, target_component, force_mavlink1=False):
'''
Request all parameters of this component. After this request, all
parameters are emitted.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.param_request_list_encode(target_system, target_component), force_mavlink1=force_mavlink1)
def param_value_encode(self, param_id, param_value, param_type, param_count, param_index):
'''
Emit the value of a onboard parameter. The inclusion of param_count
and param_index in the message allows the recipient to
keep track of received parameters and allows him to
re-request missing parameters after a loss or timeout.
param_id : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
param_value : Onboard parameter value (float)
param_type : Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. (uint8_t)
param_count : Total number of onboard parameters (uint16_t)
param_index : Index of this onboard parameter (uint16_t)
'''
return MAVLink_param_value_message(param_id, param_value, param_type, param_count, param_index)
def param_value_send(self, param_id, param_value, param_type, param_count, param_index, force_mavlink1=False):
'''
Emit the value of a onboard parameter. The inclusion of param_count
and param_index in the message allows the recipient to
keep track of received parameters and allows him to
re-request missing parameters after a loss or timeout.
param_id : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
param_value : Onboard parameter value (float)
param_type : Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. (uint8_t)
param_count : Total number of onboard parameters (uint16_t)
param_index : Index of this onboard parameter (uint16_t)
'''
return self.send(self.param_value_encode(param_id, param_value, param_type, param_count, param_index), force_mavlink1=force_mavlink1)
def param_set_encode(self, target_system, target_component, param_id, param_value, param_type):
'''
Set a parameter value TEMPORARILY to RAM. It will be reset to default
on system reboot. Send the ACTION
MAV_ACTION_STORAGE_WRITE to PERMANENTLY write the RAM
contents to EEPROM. IMPORTANT: The receiving component
should acknowledge the new parameter value by sending
a param_value message to all communication partners.
This will also ensure that multiple GCS all have an
up-to-date list of all parameters. If the sending GCS
did not receive a PARAM_VALUE message within its
timeout time, it should re-send the PARAM_SET message.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
param_id : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
param_value : Onboard parameter value (float)
param_type : Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. (uint8_t)
'''
return MAVLink_param_set_message(target_system, target_component, param_id, param_value, param_type)
def param_set_send(self, target_system, target_component, param_id, param_value, param_type, force_mavlink1=False):
'''
Set a parameter value TEMPORARILY to RAM. It will be reset to default
on system reboot. Send the ACTION
MAV_ACTION_STORAGE_WRITE to PERMANENTLY write the RAM
contents to EEPROM. IMPORTANT: The receiving component
should acknowledge the new parameter value by sending
a param_value message to all communication partners.
This will also ensure that multiple GCS all have an
up-to-date list of all parameters. If the sending GCS
did not receive a PARAM_VALUE message within its
timeout time, it should re-send the PARAM_SET message.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
param_id : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
param_value : Onboard parameter value (float)
param_type : Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. (uint8_t)
'''
return self.send(self.param_set_encode(target_system, target_component, param_id, param_value, param_type), force_mavlink1=force_mavlink1)
def gps_raw_int_encode(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, alt_ellipsoid=0, h_acc=0, v_acc=0, vel_acc=0, hdg_acc=0):
'''
The global position, as returned by the Global Positioning System
(GPS). This is NOT the global position
estimate of the system, but rather a RAW sensor value.
See message GLOBAL_POSITION for the global position
estimate.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
fix_type : See the GPS_FIX_TYPE enum. (uint8_t)
lat : Latitude (WGS84, EGM96 ellipsoid), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84, EGM96 ellipsoid), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. (int32_t)
eph : GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t)
epv : GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t)
vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t)
cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)
satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t)
alt_ellipsoid : Altitude (above WGS84, EGM96 ellipsoid), in meters * 1000 (positive for up). (int32_t)
h_acc : Position uncertainty in meters * 1000 (positive for up). (uint32_t)
v_acc : Altitude uncertainty in meters * 1000 (positive for up). (uint32_t)
vel_acc : Speed uncertainty in meters * 1000 (positive for up). (uint32_t)
hdg_acc : Heading / track uncertainty in degrees * 1e5. (uint32_t)
'''
return MAVLink_gps_raw_int_message(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, alt_ellipsoid, h_acc, v_acc, vel_acc, hdg_acc)
def gps_raw_int_send(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, alt_ellipsoid=0, h_acc=0, v_acc=0, vel_acc=0, hdg_acc=0, force_mavlink1=False):
'''
The global position, as returned by the Global Positioning System
(GPS). This is NOT the global position
estimate of the system, but rather a RAW sensor value.
See message GLOBAL_POSITION for the global position
estimate.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
fix_type : See the GPS_FIX_TYPE enum. (uint8_t)
lat : Latitude (WGS84, EGM96 ellipsoid), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84, EGM96 ellipsoid), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. (int32_t)
eph : GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t)
epv : GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t)
vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t)
cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)
satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t)
alt_ellipsoid : Altitude (above WGS84, EGM96 ellipsoid), in meters * 1000 (positive for up). (int32_t)
h_acc : Position uncertainty in meters * 1000 (positive for up). (uint32_t)
v_acc : Altitude uncertainty in meters * 1000 (positive for up). (uint32_t)
vel_acc : Speed uncertainty in meters * 1000 (positive for up). (uint32_t)
hdg_acc : Heading / track uncertainty in degrees * 1e5. (uint32_t)
'''
return self.send(self.gps_raw_int_encode(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, alt_ellipsoid, h_acc, v_acc, vel_acc, hdg_acc), force_mavlink1=force_mavlink1)
def gps_status_encode(self, satellites_visible, satellite_prn, satellite_used, satellite_elevation, satellite_azimuth, satellite_snr):
'''
The positioning status, as reported by GPS. This message is intended
to display status information about each satellite
visible to the receiver. See message GLOBAL_POSITION
for the global position estimate. This message can
contain information for up to 20 satellites.
satellites_visible : Number of satellites visible (uint8_t)
satellite_prn : Global satellite ID (uint8_t)
satellite_used : 0: Satellite not used, 1: used for localization (uint8_t)
satellite_elevation : Elevation (0: right on top of receiver, 90: on the horizon) of satellite (uint8_t)
satellite_azimuth : Direction of satellite, 0: 0 deg, 255: 360 deg. (uint8_t)
satellite_snr : Signal to noise ratio of satellite (uint8_t)
'''
return MAVLink_gps_status_message(satellites_visible, satellite_prn, satellite_used, satellite_elevation, satellite_azimuth, satellite_snr)
def gps_status_send(self, satellites_visible, satellite_prn, satellite_used, satellite_elevation, satellite_azimuth, satellite_snr, force_mavlink1=False):
'''
The positioning status, as reported by GPS. This message is intended
to display status information about each satellite
visible to the receiver. See message GLOBAL_POSITION
for the global position estimate. This message can
contain information for up to 20 satellites.
satellites_visible : Number of satellites visible (uint8_t)
satellite_prn : Global satellite ID (uint8_t)
satellite_used : 0: Satellite not used, 1: used for localization (uint8_t)
satellite_elevation : Elevation (0: right on top of receiver, 90: on the horizon) of satellite (uint8_t)
satellite_azimuth : Direction of satellite, 0: 0 deg, 255: 360 deg. (uint8_t)
satellite_snr : Signal to noise ratio of satellite (uint8_t)
'''
return self.send(self.gps_status_encode(satellites_visible, satellite_prn, satellite_used, satellite_elevation, satellite_azimuth, satellite_snr), force_mavlink1=force_mavlink1)
def scaled_imu_encode(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
'''
The RAW IMU readings for the usual 9DOF sensor setup. This message
should contain the scaled values to the described
units
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
xgyro : Angular speed around X axis (millirad /sec) (int16_t)
ygyro : Angular speed around Y axis (millirad /sec) (int16_t)
zgyro : Angular speed around Z axis (millirad /sec) (int16_t)
xmag : X Magnetic field (milli tesla) (int16_t)
ymag : Y Magnetic field (milli tesla) (int16_t)
zmag : Z Magnetic field (milli tesla) (int16_t)
'''
return MAVLink_scaled_imu_message(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag)
def scaled_imu_send(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, force_mavlink1=False):
'''
The RAW IMU readings for the usual 9DOF sensor setup. This message
should contain the scaled values to the described
units
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
xgyro : Angular speed around X axis (millirad /sec) (int16_t)
ygyro : Angular speed around Y axis (millirad /sec) (int16_t)
zgyro : Angular speed around Z axis (millirad /sec) (int16_t)
xmag : X Magnetic field (milli tesla) (int16_t)
ymag : Y Magnetic field (milli tesla) (int16_t)
zmag : Z Magnetic field (milli tesla) (int16_t)
'''
return self.send(self.scaled_imu_encode(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag), force_mavlink1=force_mavlink1)
def raw_imu_encode(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
'''
The RAW IMU readings for the usual 9DOF sensor setup. This message
should always contain the true raw values without any
scaling to allow data capture and system debugging.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
xacc : X acceleration (raw) (int16_t)
yacc : Y acceleration (raw) (int16_t)
zacc : Z acceleration (raw) (int16_t)
xgyro : Angular speed around X axis (raw) (int16_t)
ygyro : Angular speed around Y axis (raw) (int16_t)
zgyro : Angular speed around Z axis (raw) (int16_t)
xmag : X Magnetic field (raw) (int16_t)
ymag : Y Magnetic field (raw) (int16_t)
zmag : Z Magnetic field (raw) (int16_t)
'''
return MAVLink_raw_imu_message(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag)
def raw_imu_send(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, force_mavlink1=False):
'''
The RAW IMU readings for the usual 9DOF sensor setup. This message
should always contain the true raw values without any
scaling to allow data capture and system debugging.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
xacc : X acceleration (raw) (int16_t)
yacc : Y acceleration (raw) (int16_t)
zacc : Z acceleration (raw) (int16_t)
xgyro : Angular speed around X axis (raw) (int16_t)
ygyro : Angular speed around Y axis (raw) (int16_t)
zgyro : Angular speed around Z axis (raw) (int16_t)
xmag : X Magnetic field (raw) (int16_t)
ymag : Y Magnetic field (raw) (int16_t)
zmag : Z Magnetic field (raw) (int16_t)
'''
return self.send(self.raw_imu_encode(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag), force_mavlink1=force_mavlink1)
def raw_pressure_encode(self, time_usec, press_abs, press_diff1, press_diff2, temperature):
'''
The RAW pressure readings for the typical setup of one absolute
pressure and one differential pressure sensor. The
sensor values should be the raw, UNSCALED ADC values.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
press_abs : Absolute pressure (raw) (int16_t)
press_diff1 : Differential pressure 1 (raw, 0 if nonexistant) (int16_t)
press_diff2 : Differential pressure 2 (raw, 0 if nonexistant) (int16_t)
temperature : Raw Temperature measurement (raw) (int16_t)
'''
return MAVLink_raw_pressure_message(time_usec, press_abs, press_diff1, press_diff2, temperature)
def raw_pressure_send(self, time_usec, press_abs, press_diff1, press_diff2, temperature, force_mavlink1=False):
'''
The RAW pressure readings for the typical setup of one absolute
pressure and one differential pressure sensor. The
sensor values should be the raw, UNSCALED ADC values.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
press_abs : Absolute pressure (raw) (int16_t)
press_diff1 : Differential pressure 1 (raw, 0 if nonexistant) (int16_t)
press_diff2 : Differential pressure 2 (raw, 0 if nonexistant) (int16_t)
temperature : Raw Temperature measurement (raw) (int16_t)
'''
return self.send(self.raw_pressure_encode(time_usec, press_abs, press_diff1, press_diff2, temperature), force_mavlink1=force_mavlink1)
def scaled_pressure_encode(self, time_boot_ms, press_abs, press_diff, temperature):
'''
The pressure readings for the typical setup of one absolute and
differential pressure sensor. The units are as
specified in each field.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
press_abs : Absolute pressure (hectopascal) (float)
press_diff : Differential pressure 1 (hectopascal) (float)
temperature : Temperature measurement (0.01 degrees celsius) (int16_t)
'''
return MAVLink_scaled_pressure_message(time_boot_ms, press_abs, press_diff, temperature)
def scaled_pressure_send(self, time_boot_ms, press_abs, press_diff, temperature, force_mavlink1=False):
'''
The pressure readings for the typical setup of one absolute and
differential pressure sensor. The units are as
specified in each field.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
press_abs : Absolute pressure (hectopascal) (float)
press_diff : Differential pressure 1 (hectopascal) (float)
temperature : Temperature measurement (0.01 degrees celsius) (int16_t)
'''
return self.send(self.scaled_pressure_encode(time_boot_ms, press_abs, press_diff, temperature), force_mavlink1=force_mavlink1)
def attitude_encode(self, time_boot_ms, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed):
'''
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right).
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
roll : Roll angle (rad, -pi..+pi) (float)
pitch : Pitch angle (rad, -pi..+pi) (float)
yaw : Yaw angle (rad, -pi..+pi) (float)
rollspeed : Roll angular speed (rad/s) (float)
pitchspeed : Pitch angular speed (rad/s) (float)
yawspeed : Yaw angular speed (rad/s) (float)
'''
return MAVLink_attitude_message(time_boot_ms, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed)
def attitude_send(self, time_boot_ms, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, force_mavlink1=False):
'''
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right).
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
roll : Roll angle (rad, -pi..+pi) (float)
pitch : Pitch angle (rad, -pi..+pi) (float)
yaw : Yaw angle (rad, -pi..+pi) (float)
rollspeed : Roll angular speed (rad/s) (float)
pitchspeed : Pitch angular speed (rad/s) (float)
yawspeed : Yaw angular speed (rad/s) (float)
'''
return self.send(self.attitude_encode(time_boot_ms, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed), force_mavlink1=force_mavlink1)
def attitude_quaternion_encode(self, time_boot_ms, q1, q2, q3, q4, rollspeed, pitchspeed, yawspeed):
'''
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right), expressed as quaternion. Quaternion order is
w, x, y, z and a zero rotation would be expressed as
(1 0 0 0).
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
q1 : Quaternion component 1, w (1 in null-rotation) (float)
q2 : Quaternion component 2, x (0 in null-rotation) (float)
q3 : Quaternion component 3, y (0 in null-rotation) (float)
q4 : Quaternion component 4, z (0 in null-rotation) (float)
rollspeed : Roll angular speed (rad/s) (float)
pitchspeed : Pitch angular speed (rad/s) (float)
yawspeed : Yaw angular speed (rad/s) (float)
'''
return MAVLink_attitude_quaternion_message(time_boot_ms, q1, q2, q3, q4, rollspeed, pitchspeed, yawspeed)
def attitude_quaternion_send(self, time_boot_ms, q1, q2, q3, q4, rollspeed, pitchspeed, yawspeed, force_mavlink1=False):
'''
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right), expressed as quaternion. Quaternion order is
w, x, y, z and a zero rotation would be expressed as
(1 0 0 0).
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
q1 : Quaternion component 1, w (1 in null-rotation) (float)
q2 : Quaternion component 2, x (0 in null-rotation) (float)
q3 : Quaternion component 3, y (0 in null-rotation) (float)
q4 : Quaternion component 4, z (0 in null-rotation) (float)
rollspeed : Roll angular speed (rad/s) (float)
pitchspeed : Pitch angular speed (rad/s) (float)
yawspeed : Yaw angular speed (rad/s) (float)
'''
return self.send(self.attitude_quaternion_encode(time_boot_ms, q1, q2, q3, q4, rollspeed, pitchspeed, yawspeed), force_mavlink1=force_mavlink1)
def local_position_ned_encode(self, time_boot_ms, x, y, z, vx, vy, vz):
'''
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed,
Z-axis down (aeronautical frame, NED / north-east-down
convention)
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
x : X Position (float)
y : Y Position (float)
z : Z Position (float)
vx : X Speed (float)
vy : Y Speed (float)
vz : Z Speed (float)
'''
return MAVLink_local_position_ned_message(time_boot_ms, x, y, z, vx, vy, vz)
def local_position_ned_send(self, time_boot_ms, x, y, z, vx, vy, vz, force_mavlink1=False):
'''
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed,
Z-axis down (aeronautical frame, NED / north-east-down
convention)
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
x : X Position (float)
y : Y Position (float)
z : Z Position (float)
vx : X Speed (float)
vy : Y Speed (float)
vz : Z Speed (float)
'''
return self.send(self.local_position_ned_encode(time_boot_ms, x, y, z, vx, vy, vz), force_mavlink1=force_mavlink1)
def global_position_int_encode(self, time_boot_ms, lat, lon, alt, relative_alt, vx, vy, vz, hdg):
'''
The filtered global position (e.g. fused GPS and accelerometers). The
position is in GPS-frame (right-handed, Z-up). It
is designed as scaled integer message since the
resolution of float is not sufficient.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
alt : Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well) (int32_t)
relative_alt : Altitude above ground in meters, expressed as * 1000 (millimeters) (int32_t)
vx : Ground X Speed (Latitude, positive north), expressed as m/s * 100 (int16_t)
vy : Ground Y Speed (Longitude, positive east), expressed as m/s * 100 (int16_t)
vz : Ground Z Speed (Altitude, positive down), expressed as m/s * 100 (int16_t)
hdg : Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)
'''
return MAVLink_global_position_int_message(time_boot_ms, lat, lon, alt, relative_alt, vx, vy, vz, hdg)
def global_position_int_send(self, time_boot_ms, lat, lon, alt, relative_alt, vx, vy, vz, hdg, force_mavlink1=False):
'''
The filtered global position (e.g. fused GPS and accelerometers). The
position is in GPS-frame (right-handed, Z-up). It
is designed as scaled integer message since the
resolution of float is not sufficient.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
alt : Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well) (int32_t)
relative_alt : Altitude above ground in meters, expressed as * 1000 (millimeters) (int32_t)
vx : Ground X Speed (Latitude, positive north), expressed as m/s * 100 (int16_t)
vy : Ground Y Speed (Longitude, positive east), expressed as m/s * 100 (int16_t)
vz : Ground Z Speed (Altitude, positive down), expressed as m/s * 100 (int16_t)
hdg : Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)
'''
return self.send(self.global_position_int_encode(time_boot_ms, lat, lon, alt, relative_alt, vx, vy, vz, hdg), force_mavlink1=force_mavlink1)
def rc_channels_scaled_encode(self, time_boot_ms, port, chan1_scaled, chan2_scaled, chan3_scaled, chan4_scaled, chan5_scaled, chan6_scaled, chan7_scaled, chan8_scaled, rssi):
'''
The scaled values of the RC channels received. (-100%) -10000, (0%) 0,
(100%) 10000. Channels that are inactive should be set
to UINT16_MAX.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
port : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. (uint8_t)
chan1_scaled : RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan2_scaled : RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan3_scaled : RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan4_scaled : RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan5_scaled : RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan6_scaled : RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan7_scaled : RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan8_scaled : RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
rssi : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)
'''
return MAVLink_rc_channels_scaled_message(time_boot_ms, port, chan1_scaled, chan2_scaled, chan3_scaled, chan4_scaled, chan5_scaled, chan6_scaled, chan7_scaled, chan8_scaled, rssi)
def rc_channels_scaled_send(self, time_boot_ms, port, chan1_scaled, chan2_scaled, chan3_scaled, chan4_scaled, chan5_scaled, chan6_scaled, chan7_scaled, chan8_scaled, rssi, force_mavlink1=False):
'''
The scaled values of the RC channels received. (-100%) -10000, (0%) 0,
(100%) 10000. Channels that are inactive should be set
to UINT16_MAX.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
port : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. (uint8_t)
chan1_scaled : RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan2_scaled : RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan3_scaled : RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan4_scaled : RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan5_scaled : RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan6_scaled : RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan7_scaled : RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
chan8_scaled : RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
rssi : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)
'''
return self.send(self.rc_channels_scaled_encode(time_boot_ms, port, chan1_scaled, chan2_scaled, chan3_scaled, chan4_scaled, chan5_scaled, chan6_scaled, chan7_scaled, chan8_scaled, rssi), force_mavlink1=force_mavlink1)
def rc_channels_raw_encode(self, time_boot_ms, port, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, rssi):
'''
The RAW values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%. Individual receivers/transmitters
might violate this specification.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
port : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. (uint8_t)
chan1_raw : RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan2_raw : RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan3_raw : RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan4_raw : RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan5_raw : RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan6_raw : RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan7_raw : RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan8_raw : RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
rssi : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)
'''
return MAVLink_rc_channels_raw_message(time_boot_ms, port, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, rssi)
def rc_channels_raw_send(self, time_boot_ms, port, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, rssi, force_mavlink1=False):
'''
The RAW values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%. Individual receivers/transmitters
might violate this specification.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
port : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. (uint8_t)
chan1_raw : RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan2_raw : RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan3_raw : RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan4_raw : RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan5_raw : RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan6_raw : RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan7_raw : RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan8_raw : RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
rssi : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)
'''
return self.send(self.rc_channels_raw_encode(time_boot_ms, port, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, rssi), force_mavlink1=force_mavlink1)
def servo_output_raw_encode(self, time_usec, port, servo1_raw, servo2_raw, servo3_raw, servo4_raw, servo5_raw, servo6_raw, servo7_raw, servo8_raw, servo9_raw=0, servo10_raw=0, servo11_raw=0, servo12_raw=0, servo13_raw=0, servo14_raw=0, servo15_raw=0, servo16_raw=0):
'''
The RAW values of the servo outputs (for RC input from the remote, use
the RC_CHANNELS messages). The standard PPM modulation
is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%.
time_usec : Timestamp (microseconds since system boot) (uint32_t)
port : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos. (uint8_t)
servo1_raw : Servo output 1 value, in microseconds (uint16_t)
servo2_raw : Servo output 2 value, in microseconds (uint16_t)
servo3_raw : Servo output 3 value, in microseconds (uint16_t)
servo4_raw : Servo output 4 value, in microseconds (uint16_t)
servo5_raw : Servo output 5 value, in microseconds (uint16_t)
servo6_raw : Servo output 6 value, in microseconds (uint16_t)
servo7_raw : Servo output 7 value, in microseconds (uint16_t)
servo8_raw : Servo output 8 value, in microseconds (uint16_t)
servo9_raw : Servo output 9 value, in microseconds (uint16_t)
servo10_raw : Servo output 10 value, in microseconds (uint16_t)
servo11_raw : Servo output 11 value, in microseconds (uint16_t)
servo12_raw : Servo output 12 value, in microseconds (uint16_t)
servo13_raw : Servo output 13 value, in microseconds (uint16_t)
servo14_raw : Servo output 14 value, in microseconds (uint16_t)
servo15_raw : Servo output 15 value, in microseconds (uint16_t)
servo16_raw : Servo output 16 value, in microseconds (uint16_t)
'''
return MAVLink_servo_output_raw_message(time_usec, port, servo1_raw, servo2_raw, servo3_raw, servo4_raw, servo5_raw, servo6_raw, servo7_raw, servo8_raw, servo9_raw, servo10_raw, servo11_raw, servo12_raw, servo13_raw, servo14_raw, servo15_raw, servo16_raw)
def servo_output_raw_send(self, time_usec, port, servo1_raw, servo2_raw, servo3_raw, servo4_raw, servo5_raw, servo6_raw, servo7_raw, servo8_raw, servo9_raw=0, servo10_raw=0, servo11_raw=0, servo12_raw=0, servo13_raw=0, servo14_raw=0, servo15_raw=0, servo16_raw=0, force_mavlink1=False):
'''
The RAW values of the servo outputs (for RC input from the remote, use
the RC_CHANNELS messages). The standard PPM modulation
is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%.
time_usec : Timestamp (microseconds since system boot) (uint32_t)
port : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos. (uint8_t)
servo1_raw : Servo output 1 value, in microseconds (uint16_t)
servo2_raw : Servo output 2 value, in microseconds (uint16_t)
servo3_raw : Servo output 3 value, in microseconds (uint16_t)
servo4_raw : Servo output 4 value, in microseconds (uint16_t)
servo5_raw : Servo output 5 value, in microseconds (uint16_t)
servo6_raw : Servo output 6 value, in microseconds (uint16_t)
servo7_raw : Servo output 7 value, in microseconds (uint16_t)
servo8_raw : Servo output 8 value, in microseconds (uint16_t)
servo9_raw : Servo output 9 value, in microseconds (uint16_t)
servo10_raw : Servo output 10 value, in microseconds (uint16_t)
servo11_raw : Servo output 11 value, in microseconds (uint16_t)
servo12_raw : Servo output 12 value, in microseconds (uint16_t)
servo13_raw : Servo output 13 value, in microseconds (uint16_t)
servo14_raw : Servo output 14 value, in microseconds (uint16_t)
servo15_raw : Servo output 15 value, in microseconds (uint16_t)
servo16_raw : Servo output 16 value, in microseconds (uint16_t)
'''
return self.send(self.servo_output_raw_encode(time_usec, port, servo1_raw, servo2_raw, servo3_raw, servo4_raw, servo5_raw, servo6_raw, servo7_raw, servo8_raw, servo9_raw, servo10_raw, servo11_raw, servo12_raw, servo13_raw, servo14_raw, servo15_raw, servo16_raw), force_mavlink1=force_mavlink1)
def mission_request_partial_list_encode(self, target_system, target_component, start_index, end_index, mission_type=0):
'''
Request a partial list of mission items from the system/component.
https://mavlink.io/en/protocol/mission.html. If start
and end index are the same, just send one waypoint.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
start_index : Start index, 0 by default (int16_t)
end_index : End index, -1 by default (-1: send list to end). Else a valid index of the list (int16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_request_partial_list_message(target_system, target_component, start_index, end_index, mission_type)
def mission_request_partial_list_send(self, target_system, target_component, start_index, end_index, mission_type=0, force_mavlink1=False):
'''
Request a partial list of mission items from the system/component.
https://mavlink.io/en/protocol/mission.html. If start
and end index are the same, just send one waypoint.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
start_index : Start index, 0 by default (int16_t)
end_index : End index, -1 by default (-1: send list to end). Else a valid index of the list (int16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_request_partial_list_encode(target_system, target_component, start_index, end_index, mission_type), force_mavlink1=force_mavlink1)
def mission_write_partial_list_encode(self, target_system, target_component, start_index, end_index, mission_type=0):
'''
This message is sent to the MAV to write a partial list. If start
index == end index, only one item will be transmitted
/ updated. If the start index is NOT 0 and above the
current list size, this request should be REJECTED!
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
start_index : Start index, 0 by default and smaller / equal to the largest index of the current onboard list. (int16_t)
end_index : End index, equal or greater than start index. (int16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_write_partial_list_message(target_system, target_component, start_index, end_index, mission_type)
def mission_write_partial_list_send(self, target_system, target_component, start_index, end_index, mission_type=0, force_mavlink1=False):
'''
This message is sent to the MAV to write a partial list. If start
index == end index, only one item will be transmitted
/ updated. If the start index is NOT 0 and above the
current list size, this request should be REJECTED!
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
start_index : Start index, 0 by default and smaller / equal to the largest index of the current onboard list. (int16_t)
end_index : End index, equal or greater than start index. (int16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_write_partial_list_encode(target_system, target_component, start_index, end_index, mission_type), force_mavlink1=force_mavlink1)
def mission_item_encode(self, target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type=0):
'''
Message encoding a mission item. This message is emitted to announce
the presence of a mission item and to set a mission
item on the system. The mission item can be either in
x, y, z meters (type: LOCAL) or x:lat, y:lon,
z:altitude. Local frame is Z-down, right handed (NED),
global frame is Z-up, right handed (ENU). See also
https://mavlink.io/en/protocol/mission.html.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
frame : The coordinate system of the waypoint, as defined by MAV_FRAME enum (uint8_t)
command : The scheduled action for the waypoint, as defined by MAV_CMD enum (uint16_t)
current : false:0, true:1 (uint8_t)
autocontinue : autocontinue to next wp (uint8_t)
param1 : PARAM1, see MAV_CMD enum (float)
param2 : PARAM2, see MAV_CMD enum (float)
param3 : PARAM3, see MAV_CMD enum (float)
param4 : PARAM4, see MAV_CMD enum (float)
x : PARAM5 / local: x position, global: latitude (float)
y : PARAM6 / y position: global: longitude (float)
z : PARAM7 / z position: global: altitude (relative or absolute, depending on frame. (float)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_item_message(target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type)
def mission_item_send(self, target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type=0, force_mavlink1=False):
'''
Message encoding a mission item. This message is emitted to announce
the presence of a mission item and to set a mission
item on the system. The mission item can be either in
x, y, z meters (type: LOCAL) or x:lat, y:lon,
z:altitude. Local frame is Z-down, right handed (NED),
global frame is Z-up, right handed (ENU). See also
https://mavlink.io/en/protocol/mission.html.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
frame : The coordinate system of the waypoint, as defined by MAV_FRAME enum (uint8_t)
command : The scheduled action for the waypoint, as defined by MAV_CMD enum (uint16_t)
current : false:0, true:1 (uint8_t)
autocontinue : autocontinue to next wp (uint8_t)
param1 : PARAM1, see MAV_CMD enum (float)
param2 : PARAM2, see MAV_CMD enum (float)
param3 : PARAM3, see MAV_CMD enum (float)
param4 : PARAM4, see MAV_CMD enum (float)
x : PARAM5 / local: x position, global: latitude (float)
y : PARAM6 / y position: global: longitude (float)
z : PARAM7 / z position: global: altitude (relative or absolute, depending on frame. (float)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_item_encode(target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type), force_mavlink1=force_mavlink1)
def mission_request_encode(self, target_system, target_component, seq, mission_type=0):
'''
Request the information of the mission item with the sequence number
seq. The response of the system to this message should
be a MISSION_ITEM message.
https://mavlink.io/en/protocol/mission.html
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_request_message(target_system, target_component, seq, mission_type)
def mission_request_send(self, target_system, target_component, seq, mission_type=0, force_mavlink1=False):
'''
Request the information of the mission item with the sequence number
seq. The response of the system to this message should
be a MISSION_ITEM message.
https://mavlink.io/en/protocol/mission.html
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_request_encode(target_system, target_component, seq, mission_type), force_mavlink1=force_mavlink1)
def mission_set_current_encode(self, target_system, target_component, seq):
'''
Set the mission item with sequence number seq as current item. This
means that the MAV will continue to this mission item
on the shortest path (not following the mission items
in-between).
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
'''
return MAVLink_mission_set_current_message(target_system, target_component, seq)
def mission_set_current_send(self, target_system, target_component, seq, force_mavlink1=False):
'''
Set the mission item with sequence number seq as current item. This
means that the MAV will continue to this mission item
on the shortest path (not following the mission items
in-between).
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
'''
return self.send(self.mission_set_current_encode(target_system, target_component, seq), force_mavlink1=force_mavlink1)
def mission_current_encode(self, seq):
'''
Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t)
'''
return MAVLink_mission_current_message(seq)
def mission_current_send(self, seq, force_mavlink1=False):
'''
Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission
item.
seq : Sequence (uint16_t)
'''
return self.send(self.mission_current_encode(seq), force_mavlink1=force_mavlink1)
def mission_request_list_encode(self, target_system, target_component, mission_type=0):
'''
Request the overall list of mission items from the system/component.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_request_list_message(target_system, target_component, mission_type)
def mission_request_list_send(self, target_system, target_component, mission_type=0, force_mavlink1=False):
'''
Request the overall list of mission items from the system/component.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_request_list_encode(target_system, target_component, mission_type), force_mavlink1=force_mavlink1)
def mission_count_encode(self, target_system, target_component, count, mission_type=0):
'''
This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then
request the individual mission item based on the
knowledge of the total number of waypoints.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
count : Number of mission items in the sequence (uint16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_count_message(target_system, target_component, count, mission_type)
def mission_count_send(self, target_system, target_component, count, mission_type=0, force_mavlink1=False):
'''
This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then
request the individual mission item based on the
knowledge of the total number of waypoints.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
count : Number of mission items in the sequence (uint16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_count_encode(target_system, target_component, count, mission_type), force_mavlink1=force_mavlink1)
def mission_clear_all_encode(self, target_system, target_component, mission_type=0):
'''
Delete all mission items at once.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_clear_all_message(target_system, target_component, mission_type)
def mission_clear_all_send(self, target_system, target_component, mission_type=0, force_mavlink1=False):
'''
Delete all mission items at once.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_clear_all_encode(target_system, target_component, mission_type), force_mavlink1=force_mavlink1)
def mission_item_reached_encode(self, seq):
'''
A certain mission item has been reached. The system will either hold
this position (or circle on the orbit) or (if the
autocontinue on the WP was set) continue to the next
waypoint.
seq : Sequence (uint16_t)
'''
return MAVLink_mission_item_reached_message(seq)
def mission_item_reached_send(self, seq, force_mavlink1=False):
'''
A certain mission item has been reached. The system will either hold
this position (or circle on the orbit) or (if the
autocontinue on the WP was set) continue to the next
waypoint.
seq : Sequence (uint16_t)
'''
return self.send(self.mission_item_reached_encode(seq), force_mavlink1=force_mavlink1)
def mission_ack_encode(self, target_system, target_component, type, mission_type=0):
'''
Ack message during waypoint handling. The type field states if this
message is a positive ack (type=0) or if an error
happened (type=non-zero).
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
type : See MAV_MISSION_RESULT enum (uint8_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_ack_message(target_system, target_component, type, mission_type)
def mission_ack_send(self, target_system, target_component, type, mission_type=0, force_mavlink1=False):
'''
Ack message during waypoint handling. The type field states if this
message is a positive ack (type=0) or if an error
happened (type=non-zero).
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
type : See MAV_MISSION_RESULT enum (uint8_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_ack_encode(target_system, target_component, type, mission_type), force_mavlink1=force_mavlink1)
def set_gps_global_origin_encode(self, target_system, latitude, longitude, altitude, time_usec=0):
'''
As local waypoints exist, the global waypoint reference allows to
transform between the local coordinate frame and the
global (GPS) coordinate frame. This can be necessary
when e.g. in- and outdoor settings are connected and
the MAV should move from in- to outdoor.
target_system : System ID (uint8_t)
latitude : Latitude (WGS84), in degrees * 1E7 (int32_t)
longitude : Longitude (WGS84), in degrees * 1E7 (int32_t)
altitude : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
'''
return MAVLink_set_gps_global_origin_message(target_system, latitude, longitude, altitude, time_usec)
def set_gps_global_origin_send(self, target_system, latitude, longitude, altitude, time_usec=0, force_mavlink1=False):
'''
As local waypoints exist, the global waypoint reference allows to
transform between the local coordinate frame and the
global (GPS) coordinate frame. This can be necessary
when e.g. in- and outdoor settings are connected and
the MAV should move from in- to outdoor.
target_system : System ID (uint8_t)
latitude : Latitude (WGS84), in degrees * 1E7 (int32_t)
longitude : Longitude (WGS84), in degrees * 1E7 (int32_t)
altitude : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
'''
return self.send(self.set_gps_global_origin_encode(target_system, latitude, longitude, altitude, time_usec), force_mavlink1=force_mavlink1)
def gps_global_origin_encode(self, latitude, longitude, altitude, time_usec=0):
'''
Once the MAV sets a new GPS-Local correspondence, this message
announces the origin (0,0,0) position
latitude : Latitude (WGS84), in degrees * 1E7 (int32_t)
longitude : Longitude (WGS84), in degrees * 1E7 (int32_t)
altitude : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
'''
return MAVLink_gps_global_origin_message(latitude, longitude, altitude, time_usec)
def gps_global_origin_send(self, latitude, longitude, altitude, time_usec=0, force_mavlink1=False):
'''
Once the MAV sets a new GPS-Local correspondence, this message
announces the origin (0,0,0) position
latitude : Latitude (WGS84), in degrees * 1E7 (int32_t)
longitude : Longitude (WGS84), in degrees * 1E7 (int32_t)
altitude : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
'''
return self.send(self.gps_global_origin_encode(latitude, longitude, altitude, time_usec), force_mavlink1=force_mavlink1)
def param_map_rc_encode(self, target_system, target_component, param_id, param_index, parameter_rc_channel_index, param_value0, scale, param_value_min, param_value_max):
'''
Bind a RC channel to a parameter. The parameter should change accoding
to the RC channel value.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
param_id : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
param_index : Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index. (int16_t)
parameter_rc_channel_index : Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC. (uint8_t)
param_value0 : Initial parameter value (float)
scale : Scale, maps the RC range [-1, 1] to a parameter value (float)
param_value_min : Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation) (float)
param_value_max : Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation) (float)
'''
return MAVLink_param_map_rc_message(target_system, target_component, param_id, param_index, parameter_rc_channel_index, param_value0, scale, param_value_min, param_value_max)
def param_map_rc_send(self, target_system, target_component, param_id, param_index, parameter_rc_channel_index, param_value0, scale, param_value_min, param_value_max, force_mavlink1=False):
'''
Bind a RC channel to a parameter. The parameter should change accoding
to the RC channel value.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
param_id : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
param_index : Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index. (int16_t)
parameter_rc_channel_index : Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC. (uint8_t)
param_value0 : Initial parameter value (float)
scale : Scale, maps the RC range [-1, 1] to a parameter value (float)
param_value_min : Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation) (float)
param_value_max : Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation) (float)
'''
return self.send(self.param_map_rc_encode(target_system, target_component, param_id, param_index, parameter_rc_channel_index, param_value0, scale, param_value_min, param_value_max), force_mavlink1=force_mavlink1)
def mission_request_int_encode(self, target_system, target_component, seq, mission_type=0):
'''
Request the information of the mission item with the sequence number
seq. The response of the system to this message should
be a MISSION_ITEM_INT message.
https://mavlink.io/en/protocol/mission.html
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_request_int_message(target_system, target_component, seq, mission_type)
def mission_request_int_send(self, target_system, target_component, seq, mission_type=0, force_mavlink1=False):
'''
Request the information of the mission item with the sequence number
seq. The response of the system to this message should
be a MISSION_ITEM_INT message.
https://mavlink.io/en/protocol/mission.html
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Sequence (uint16_t)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_request_int_encode(target_system, target_component, seq, mission_type), force_mavlink1=force_mavlink1)
def safety_set_allowed_area_encode(self, target_system, target_component, frame, p1x, p1y, p1z, p2x, p2y, p2z):
'''
Set a safety zone (volume), which is defined by two corners of a cube.
This message can be used to tell the MAV which
setpoints/waypoints to accept and which to reject.
Safety areas are often enforced by national or
competition regulations.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
frame : Coordinate frame, as defined by MAV_FRAME enum. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. (uint8_t)
p1x : x position 1 / Latitude 1 (float)
p1y : y position 1 / Longitude 1 (float)
p1z : z position 1 / Altitude 1 (float)
p2x : x position 2 / Latitude 2 (float)
p2y : y position 2 / Longitude 2 (float)
p2z : z position 2 / Altitude 2 (float)
'''
return MAVLink_safety_set_allowed_area_message(target_system, target_component, frame, p1x, p1y, p1z, p2x, p2y, p2z)
def safety_set_allowed_area_send(self, target_system, target_component, frame, p1x, p1y, p1z, p2x, p2y, p2z, force_mavlink1=False):
'''
Set a safety zone (volume), which is defined by two corners of a cube.
This message can be used to tell the MAV which
setpoints/waypoints to accept and which to reject.
Safety areas are often enforced by national or
competition regulations.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
frame : Coordinate frame, as defined by MAV_FRAME enum. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. (uint8_t)
p1x : x position 1 / Latitude 1 (float)
p1y : y position 1 / Longitude 1 (float)
p1z : z position 1 / Altitude 1 (float)
p2x : x position 2 / Latitude 2 (float)
p2y : y position 2 / Longitude 2 (float)
p2z : z position 2 / Altitude 2 (float)
'''
return self.send(self.safety_set_allowed_area_encode(target_system, target_component, frame, p1x, p1y, p1z, p2x, p2y, p2z), force_mavlink1=force_mavlink1)
def safety_allowed_area_encode(self, frame, p1x, p1y, p1z, p2x, p2y, p2z):
'''
Read out the safety zone the MAV currently assumes.
frame : Coordinate frame, as defined by MAV_FRAME enum. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. (uint8_t)
p1x : x position 1 / Latitude 1 (float)
p1y : y position 1 / Longitude 1 (float)
p1z : z position 1 / Altitude 1 (float)
p2x : x position 2 / Latitude 2 (float)
p2y : y position 2 / Longitude 2 (float)
p2z : z position 2 / Altitude 2 (float)
'''
return MAVLink_safety_allowed_area_message(frame, p1x, p1y, p1z, p2x, p2y, p2z)
def safety_allowed_area_send(self, frame, p1x, p1y, p1z, p2x, p2y, p2z, force_mavlink1=False):
'''
Read out the safety zone the MAV currently assumes.
frame : Coordinate frame, as defined by MAV_FRAME enum. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. (uint8_t)
p1x : x position 1 / Latitude 1 (float)
p1y : y position 1 / Longitude 1 (float)
p1z : z position 1 / Altitude 1 (float)
p2x : x position 2 / Latitude 2 (float)
p2y : y position 2 / Longitude 2 (float)
p2z : z position 2 / Altitude 2 (float)
'''
return self.send(self.safety_allowed_area_encode(frame, p1x, p1y, p1z, p2x, p2y, p2z), force_mavlink1=force_mavlink1)
def attitude_quaternion_cov_encode(self, time_usec, q, rollspeed, pitchspeed, yawspeed, covariance):
'''
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right), expressed as quaternion. Quaternion order is
w, x, y, z and a zero rotation would be expressed as
(1 0 0 0).
time_usec : Timestamp (microseconds since system boot or since UNIX epoch) (uint64_t)
q : Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) (float)
rollspeed : Roll angular speed (rad/s) (float)
pitchspeed : Pitch angular speed (rad/s) (float)
yawspeed : Yaw angular speed (rad/s) (float)
covariance : Attitude covariance (float)
'''
return MAVLink_attitude_quaternion_cov_message(time_usec, q, rollspeed, pitchspeed, yawspeed, covariance)
def attitude_quaternion_cov_send(self, time_usec, q, rollspeed, pitchspeed, yawspeed, covariance, force_mavlink1=False):
'''
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right), expressed as quaternion. Quaternion order is
w, x, y, z and a zero rotation would be expressed as
(1 0 0 0).
time_usec : Timestamp (microseconds since system boot or since UNIX epoch) (uint64_t)
q : Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) (float)
rollspeed : Roll angular speed (rad/s) (float)
pitchspeed : Pitch angular speed (rad/s) (float)
yawspeed : Yaw angular speed (rad/s) (float)
covariance : Attitude covariance (float)
'''
return self.send(self.attitude_quaternion_cov_encode(time_usec, q, rollspeed, pitchspeed, yawspeed, covariance), force_mavlink1=force_mavlink1)
def nav_controller_output_encode(self, nav_roll, nav_pitch, nav_bearing, target_bearing, wp_dist, alt_error, aspd_error, xtrack_error):
'''
The state of the fixed wing navigation and position controller.
nav_roll : Current desired roll in degrees (float)
nav_pitch : Current desired pitch in degrees (float)
nav_bearing : Current desired heading in degrees (int16_t)
target_bearing : Bearing to current waypoint/target in degrees (int16_t)
wp_dist : Distance to active waypoint in meters (uint16_t)
alt_error : Current altitude error in meters (float)
aspd_error : Current airspeed error in meters/second (float)
xtrack_error : Current crosstrack error on x-y plane in meters (float)
'''
return MAVLink_nav_controller_output_message(nav_roll, nav_pitch, nav_bearing, target_bearing, wp_dist, alt_error, aspd_error, xtrack_error)
def nav_controller_output_send(self, nav_roll, nav_pitch, nav_bearing, target_bearing, wp_dist, alt_error, aspd_error, xtrack_error, force_mavlink1=False):
'''
The state of the fixed wing navigation and position controller.
nav_roll : Current desired roll in degrees (float)
nav_pitch : Current desired pitch in degrees (float)
nav_bearing : Current desired heading in degrees (int16_t)
target_bearing : Bearing to current waypoint/target in degrees (int16_t)
wp_dist : Distance to active waypoint in meters (uint16_t)
alt_error : Current altitude error in meters (float)
aspd_error : Current airspeed error in meters/second (float)
xtrack_error : Current crosstrack error on x-y plane in meters (float)
'''
return self.send(self.nav_controller_output_encode(nav_roll, nav_pitch, nav_bearing, target_bearing, wp_dist, alt_error, aspd_error, xtrack_error), force_mavlink1=force_mavlink1)
def global_position_int_cov_encode(self, time_usec, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance):
'''
The filtered global position (e.g. fused GPS and accelerometers). The
position is in GPS-frame (right-handed, Z-up). It is
designed as scaled integer message since the
resolution of float is not sufficient. NOTE: This
message is intended for onboard networks / companion
computers and higher-bandwidth links and optimized for
accuracy and completeness. Please use the
GLOBAL_POSITION_INT message for a minimal subset.
time_usec : Timestamp (microseconds since system boot or since UNIX epoch) (uint64_t)
estimator_type : Class id of the estimator this estimate originated from. (uint8_t)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
alt : Altitude in meters, expressed as * 1000 (millimeters), above MSL (int32_t)
relative_alt : Altitude above ground in meters, expressed as * 1000 (millimeters) (int32_t)
vx : Ground X Speed (Latitude), expressed as m/s (float)
vy : Ground Y Speed (Longitude), expressed as m/s (float)
vz : Ground Z Speed (Altitude), expressed as m/s (float)
covariance : Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.) (float)
'''
return MAVLink_global_position_int_cov_message(time_usec, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance)
def global_position_int_cov_send(self, time_usec, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance, force_mavlink1=False):
'''
The filtered global position (e.g. fused GPS and accelerometers). The
position is in GPS-frame (right-handed, Z-up). It is
designed as scaled integer message since the
resolution of float is not sufficient. NOTE: This
message is intended for onboard networks / companion
computers and higher-bandwidth links and optimized for
accuracy and completeness. Please use the
GLOBAL_POSITION_INT message for a minimal subset.
time_usec : Timestamp (microseconds since system boot or since UNIX epoch) (uint64_t)
estimator_type : Class id of the estimator this estimate originated from. (uint8_t)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
alt : Altitude in meters, expressed as * 1000 (millimeters), above MSL (int32_t)
relative_alt : Altitude above ground in meters, expressed as * 1000 (millimeters) (int32_t)
vx : Ground X Speed (Latitude), expressed as m/s (float)
vy : Ground Y Speed (Longitude), expressed as m/s (float)
vz : Ground Z Speed (Altitude), expressed as m/s (float)
covariance : Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.) (float)
'''
return self.send(self.global_position_int_cov_encode(time_usec, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance), force_mavlink1=force_mavlink1)
def local_position_ned_cov_encode(self, time_usec, estimator_type, x, y, z, vx, vy, vz, ax, ay, az, covariance):
'''
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed,
Z-axis down (aeronautical frame, NED / north-east-down
convention)
time_usec : Timestamp (microseconds since system boot or since UNIX epoch) (uint64_t)
estimator_type : Class id of the estimator this estimate originated from. (uint8_t)
x : X Position (float)
y : Y Position (float)
z : Z Position (float)
vx : X Speed (m/s) (float)
vy : Y Speed (m/s) (float)
vz : Z Speed (m/s) (float)
ax : X Acceleration (m/s^2) (float)
ay : Y Acceleration (m/s^2) (float)
az : Z Acceleration (m/s^2) (float)
covariance : Covariance matrix upper right triangular (first nine entries are the first ROW, next eight entries are the second row, etc.) (float)
'''
return MAVLink_local_position_ned_cov_message(time_usec, estimator_type, x, y, z, vx, vy, vz, ax, ay, az, covariance)
def local_position_ned_cov_send(self, time_usec, estimator_type, x, y, z, vx, vy, vz, ax, ay, az, covariance, force_mavlink1=False):
'''
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed,
Z-axis down (aeronautical frame, NED / north-east-down
convention)
time_usec : Timestamp (microseconds since system boot or since UNIX epoch) (uint64_t)
estimator_type : Class id of the estimator this estimate originated from. (uint8_t)
x : X Position (float)
y : Y Position (float)
z : Z Position (float)
vx : X Speed (m/s) (float)
vy : Y Speed (m/s) (float)
vz : Z Speed (m/s) (float)
ax : X Acceleration (m/s^2) (float)
ay : Y Acceleration (m/s^2) (float)
az : Z Acceleration (m/s^2) (float)
covariance : Covariance matrix upper right triangular (first nine entries are the first ROW, next eight entries are the second row, etc.) (float)
'''
return self.send(self.local_position_ned_cov_encode(time_usec, estimator_type, x, y, z, vx, vy, vz, ax, ay, az, covariance), force_mavlink1=force_mavlink1)
def rc_channels_encode(self, time_boot_ms, chancount, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, chan13_raw, chan14_raw, chan15_raw, chan16_raw, chan17_raw, chan18_raw, rssi):
'''
The PPM values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%. Individual receivers/transmitters
might violate this specification.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
chancount : Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available. (uint8_t)
chan1_raw : RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan2_raw : RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan3_raw : RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan4_raw : RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan5_raw : RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan6_raw : RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan7_raw : RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan8_raw : RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan9_raw : RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan10_raw : RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan11_raw : RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan12_raw : RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan13_raw : RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan14_raw : RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan15_raw : RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan16_raw : RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan17_raw : RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan18_raw : RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
rssi : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)
'''
return MAVLink_rc_channels_message(time_boot_ms, chancount, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, chan13_raw, chan14_raw, chan15_raw, chan16_raw, chan17_raw, chan18_raw, rssi)
def rc_channels_send(self, time_boot_ms, chancount, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, chan13_raw, chan14_raw, chan15_raw, chan16_raw, chan17_raw, chan18_raw, rssi, force_mavlink1=False):
'''
The PPM values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000
microseconds: 100%. Individual receivers/transmitters
might violate this specification.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
chancount : Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available. (uint8_t)
chan1_raw : RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan2_raw : RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan3_raw : RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan4_raw : RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan5_raw : RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan6_raw : RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan7_raw : RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan8_raw : RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan9_raw : RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan10_raw : RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan11_raw : RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan12_raw : RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan13_raw : RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan14_raw : RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan15_raw : RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan16_raw : RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan17_raw : RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
chan18_raw : RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
rssi : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)
'''
return self.send(self.rc_channels_encode(time_boot_ms, chancount, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, chan13_raw, chan14_raw, chan15_raw, chan16_raw, chan17_raw, chan18_raw, rssi), force_mavlink1=force_mavlink1)
def request_data_stream_encode(self, target_system, target_component, req_stream_id, req_message_rate, start_stop):
'''
THIS INTERFACE IS DEPRECATED. USE SET_MESSAGE_INTERVAL INSTEAD.
target_system : The target requested to send the message stream. (uint8_t)
target_component : The target requested to send the message stream. (uint8_t)
req_stream_id : The ID of the requested data stream (uint8_t)
req_message_rate : The requested message rate (uint16_t)
start_stop : 1 to start sending, 0 to stop sending. (uint8_t)
'''
return MAVLink_request_data_stream_message(target_system, target_component, req_stream_id, req_message_rate, start_stop)
def request_data_stream_send(self, target_system, target_component, req_stream_id, req_message_rate, start_stop, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE SET_MESSAGE_INTERVAL INSTEAD.
target_system : The target requested to send the message stream. (uint8_t)
target_component : The target requested to send the message stream. (uint8_t)
req_stream_id : The ID of the requested data stream (uint8_t)
req_message_rate : The requested message rate (uint16_t)
start_stop : 1 to start sending, 0 to stop sending. (uint8_t)
'''
return self.send(self.request_data_stream_encode(target_system, target_component, req_stream_id, req_message_rate, start_stop), force_mavlink1=force_mavlink1)
def data_stream_encode(self, stream_id, message_rate, on_off):
'''
THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The message rate (uint16_t)
on_off : 1 stream is enabled, 0 stream is stopped. (uint8_t)
'''
return MAVLink_data_stream_message(stream_id, message_rate, on_off)
def data_stream_send(self, stream_id, message_rate, on_off, force_mavlink1=False):
'''
THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD.
stream_id : The ID of the requested data stream (uint8_t)
message_rate : The message rate (uint16_t)
on_off : 1 stream is enabled, 0 stream is stopped. (uint8_t)
'''
return self.send(self.data_stream_encode(stream_id, message_rate, on_off), force_mavlink1=force_mavlink1)
def manual_control_encode(self, target, x, y, z, r, buttons):
'''
This message provides an API for manually controlling the vehicle
using standard joystick axes nomenclature, along with
a joystick-like input device. Unused axes can be
disabled an buttons are also transmit as boolean
values of their
target : The system to be controlled. (uint8_t)
x : X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. (int16_t)
y : Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. (int16_t)
z : Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. (int16_t)
r : R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. (int16_t)
buttons : A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. (uint16_t)
'''
return MAVLink_manual_control_message(target, x, y, z, r, buttons)
def manual_control_send(self, target, x, y, z, r, buttons, force_mavlink1=False):
'''
This message provides an API for manually controlling the vehicle
using standard joystick axes nomenclature, along with
a joystick-like input device. Unused axes can be
disabled an buttons are also transmit as boolean
values of their
target : The system to be controlled. (uint8_t)
x : X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. (int16_t)
y : Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. (int16_t)
z : Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. (int16_t)
r : R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. (int16_t)
buttons : A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. (uint16_t)
'''
return self.send(self.manual_control_encode(target, x, y, z, r, buttons), force_mavlink1=force_mavlink1)
def rc_channels_override_encode(self, target_system, target_component, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw=0, chan10_raw=0, chan11_raw=0, chan12_raw=0, chan13_raw=0, chan14_raw=0, chan15_raw=0, chan16_raw=0, chan17_raw=0, chan18_raw=0):
'''
The RAW values of the RC channels sent to the MAV to override info
received from the RC radio. A value of UINT16_MAX
means no change to that channel. A value of 0 means
control of that channel should be released back to the
RC radio. The standard PPM modulation is as follows:
1000 microseconds: 0%, 2000 microseconds: 100%.
Individual receivers/transmitters might violate this
specification.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
chan1_raw : RC channel 1 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan2_raw : RC channel 2 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan3_raw : RC channel 3 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan4_raw : RC channel 4 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan5_raw : RC channel 5 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan6_raw : RC channel 6 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan7_raw : RC channel 7 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan8_raw : RC channel 8 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan9_raw : RC channel 9 value, in microseconds. A value of 0 means to ignore this field. (uint16_t)
chan10_raw : RC channel 10 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan11_raw : RC channel 11 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan12_raw : RC channel 12 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan13_raw : RC channel 13 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan14_raw : RC channel 14 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan15_raw : RC channel 15 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan16_raw : RC channel 16 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan17_raw : RC channel 17 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan18_raw : RC channel 18 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
'''
return MAVLink_rc_channels_override_message(target_system, target_component, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, chan13_raw, chan14_raw, chan15_raw, chan16_raw, chan17_raw, chan18_raw)
def rc_channels_override_send(self, target_system, target_component, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw=0, chan10_raw=0, chan11_raw=0, chan12_raw=0, chan13_raw=0, chan14_raw=0, chan15_raw=0, chan16_raw=0, chan17_raw=0, chan18_raw=0, force_mavlink1=False):
'''
The RAW values of the RC channels sent to the MAV to override info
received from the RC radio. A value of UINT16_MAX
means no change to that channel. A value of 0 means
control of that channel should be released back to the
RC radio. The standard PPM modulation is as follows:
1000 microseconds: 0%, 2000 microseconds: 100%.
Individual receivers/transmitters might violate this
specification.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
chan1_raw : RC channel 1 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan2_raw : RC channel 2 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan3_raw : RC channel 3 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan4_raw : RC channel 4 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan5_raw : RC channel 5 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan6_raw : RC channel 6 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan7_raw : RC channel 7 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan8_raw : RC channel 8 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
chan9_raw : RC channel 9 value, in microseconds. A value of 0 means to ignore this field. (uint16_t)
chan10_raw : RC channel 10 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan11_raw : RC channel 11 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan12_raw : RC channel 12 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan13_raw : RC channel 13 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan14_raw : RC channel 14 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan15_raw : RC channel 15 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan16_raw : RC channel 16 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan17_raw : RC channel 17 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
chan18_raw : RC channel 18 value, in microseconds. A value of 0 or UINT16_MAX means to ignore this field. (uint16_t)
'''
return self.send(self.rc_channels_override_encode(target_system, target_component, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, chan13_raw, chan14_raw, chan15_raw, chan16_raw, chan17_raw, chan18_raw), force_mavlink1=force_mavlink1)
def mission_item_int_encode(self, target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type=0):
'''
Message encoding a mission item. This message is emitted to announce
the presence of a mission item and to set a mission
item on the system. The mission item can be either in
x, y, z meters (type: LOCAL) or x:lat, y:lon,
z:altitude. Local frame is Z-down, right handed (NED),
global frame is Z-up, right handed (ENU). See also
https://mavlink.io/en/protocol/mission.html.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4). (uint16_t)
frame : The coordinate system of the waypoint, as defined by MAV_FRAME enum (uint8_t)
command : The scheduled action for the waypoint, as defined by MAV_CMD enum (uint16_t)
current : false:0, true:1 (uint8_t)
autocontinue : autocontinue to next wp (uint8_t)
param1 : PARAM1, see MAV_CMD enum (float)
param2 : PARAM2, see MAV_CMD enum (float)
param3 : PARAM3, see MAV_CMD enum (float)
param4 : PARAM4, see MAV_CMD enum (float)
x : PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 (int32_t)
y : PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7 (int32_t)
z : PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. (float)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return MAVLink_mission_item_int_message(target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type)
def mission_item_int_send(self, target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type=0, force_mavlink1=False):
'''
Message encoding a mission item. This message is emitted to announce
the presence of a mission item and to set a mission
item on the system. The mission item can be either in
x, y, z meters (type: LOCAL) or x:lat, y:lon,
z:altitude. Local frame is Z-down, right handed (NED),
global frame is Z-up, right handed (ENU). See also
https://mavlink.io/en/protocol/mission.html.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
seq : Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4). (uint16_t)
frame : The coordinate system of the waypoint, as defined by MAV_FRAME enum (uint8_t)
command : The scheduled action for the waypoint, as defined by MAV_CMD enum (uint16_t)
current : false:0, true:1 (uint8_t)
autocontinue : autocontinue to next wp (uint8_t)
param1 : PARAM1, see MAV_CMD enum (float)
param2 : PARAM2, see MAV_CMD enum (float)
param3 : PARAM3, see MAV_CMD enum (float)
param4 : PARAM4, see MAV_CMD enum (float)
x : PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 (int32_t)
y : PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7 (int32_t)
z : PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. (float)
mission_type : Mission type, see MAV_MISSION_TYPE (uint8_t)
'''
return self.send(self.mission_item_int_encode(target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, mission_type), force_mavlink1=force_mavlink1)
def vfr_hud_encode(self, airspeed, groundspeed, heading, throttle, alt, climb):
'''
Metrics typically displayed on a HUD for fixed wing aircraft
airspeed : Current airspeed in m/s (float)
groundspeed : Current ground speed in m/s (float)
heading : Current heading in degrees, in compass units (0..360, 0=north) (int16_t)
throttle : Current throttle setting in integer percent, 0 to 100 (uint16_t)
alt : Current altitude (MSL), in meters (float)
climb : Current climb rate in meters/second (float)
'''
return MAVLink_vfr_hud_message(airspeed, groundspeed, heading, throttle, alt, climb)
def vfr_hud_send(self, airspeed, groundspeed, heading, throttle, alt, climb, force_mavlink1=False):
'''
Metrics typically displayed on a HUD for fixed wing aircraft
airspeed : Current airspeed in m/s (float)
groundspeed : Current ground speed in m/s (float)
heading : Current heading in degrees, in compass units (0..360, 0=north) (int16_t)
throttle : Current throttle setting in integer percent, 0 to 100 (uint16_t)
alt : Current altitude (MSL), in meters (float)
climb : Current climb rate in meters/second (float)
'''
return self.send(self.vfr_hud_encode(airspeed, groundspeed, heading, throttle, alt, climb), force_mavlink1=force_mavlink1)
def command_int_encode(self, target_system, target_component, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z):
'''
Message encoding a command with parameters as scaled integers. Scaling
depends on the actual command value.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
frame : The coordinate system of the COMMAND, as defined by MAV_FRAME enum (uint8_t)
command : The scheduled action for the mission item, as defined by MAV_CMD enum (uint16_t)
current : false:0, true:1 (uint8_t)
autocontinue : autocontinue to next wp (uint8_t)
param1 : PARAM1, see MAV_CMD enum (float)
param2 : PARAM2, see MAV_CMD enum (float)
param3 : PARAM3, see MAV_CMD enum (float)
param4 : PARAM4, see MAV_CMD enum (float)
x : PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 (int32_t)
y : PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 (int32_t)
z : PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. (float)
'''
return MAVLink_command_int_message(target_system, target_component, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z)
def command_int_send(self, target_system, target_component, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z, force_mavlink1=False):
'''
Message encoding a command with parameters as scaled integers. Scaling
depends on the actual command value.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
frame : The coordinate system of the COMMAND, as defined by MAV_FRAME enum (uint8_t)
command : The scheduled action for the mission item, as defined by MAV_CMD enum (uint16_t)
current : false:0, true:1 (uint8_t)
autocontinue : autocontinue to next wp (uint8_t)
param1 : PARAM1, see MAV_CMD enum (float)
param2 : PARAM2, see MAV_CMD enum (float)
param3 : PARAM3, see MAV_CMD enum (float)
param4 : PARAM4, see MAV_CMD enum (float)
x : PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 (int32_t)
y : PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 (int32_t)
z : PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. (float)
'''
return self.send(self.command_int_encode(target_system, target_component, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z), force_mavlink1=force_mavlink1)
def command_long_encode(self, target_system, target_component, command, confirmation, param1, param2, param3, param4, param5, param6, param7):
'''
Send a command with up to seven parameters to the MAV
target_system : System which should execute the command (uint8_t)
target_component : Component which should execute the command, 0 for all components (uint8_t)
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
confirmation : 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) (uint8_t)
param1 : Parameter 1, as defined by MAV_CMD enum. (float)
param2 : Parameter 2, as defined by MAV_CMD enum. (float)
param3 : Parameter 3, as defined by MAV_CMD enum. (float)
param4 : Parameter 4, as defined by MAV_CMD enum. (float)
param5 : Parameter 5, as defined by MAV_CMD enum. (float)
param6 : Parameter 6, as defined by MAV_CMD enum. (float)
param7 : Parameter 7, as defined by MAV_CMD enum. (float)
'''
return MAVLink_command_long_message(target_system, target_component, command, confirmation, param1, param2, param3, param4, param5, param6, param7)
def command_long_send(self, target_system, target_component, command, confirmation, param1, param2, param3, param4, param5, param6, param7, force_mavlink1=False):
'''
Send a command with up to seven parameters to the MAV
target_system : System which should execute the command (uint8_t)
target_component : Component which should execute the command, 0 for all components (uint8_t)
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
confirmation : 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) (uint8_t)
param1 : Parameter 1, as defined by MAV_CMD enum. (float)
param2 : Parameter 2, as defined by MAV_CMD enum. (float)
param3 : Parameter 3, as defined by MAV_CMD enum. (float)
param4 : Parameter 4, as defined by MAV_CMD enum. (float)
param5 : Parameter 5, as defined by MAV_CMD enum. (float)
param6 : Parameter 6, as defined by MAV_CMD enum. (float)
param7 : Parameter 7, as defined by MAV_CMD enum. (float)
'''
return self.send(self.command_long_encode(target_system, target_component, command, confirmation, param1, param2, param3, param4, param5, param6, param7), force_mavlink1=force_mavlink1)
def command_ack_encode(self, command, result):
'''
Report status of a command. Includes feedback whether the command was
executed.
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
result : See MAV_RESULT enum (uint8_t)
'''
return MAVLink_command_ack_message(command, result)
def command_ack_send(self, command, result, force_mavlink1=False):
'''
Report status of a command. Includes feedback whether the command was
executed.
command : Command ID, as defined by MAV_CMD enum. (uint16_t)
result : See MAV_RESULT enum (uint8_t)
'''
return self.send(self.command_ack_encode(command, result), force_mavlink1=force_mavlink1)
def manual_setpoint_encode(self, time_boot_ms, roll, pitch, yaw, thrust, mode_switch, manual_override_switch):
'''
Setpoint in roll, pitch, yaw and thrust from the operator
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
roll : Desired roll rate in radians per second (float)
pitch : Desired pitch rate in radians per second (float)
yaw : Desired yaw rate in radians per second (float)
thrust : Collective thrust, normalized to 0 .. 1 (float)
mode_switch : Flight mode switch position, 0.. 255 (uint8_t)
manual_override_switch : Override mode switch position, 0.. 255 (uint8_t)
'''
return MAVLink_manual_setpoint_message(time_boot_ms, roll, pitch, yaw, thrust, mode_switch, manual_override_switch)
def manual_setpoint_send(self, time_boot_ms, roll, pitch, yaw, thrust, mode_switch, manual_override_switch, force_mavlink1=False):
'''
Setpoint in roll, pitch, yaw and thrust from the operator
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
roll : Desired roll rate in radians per second (float)
pitch : Desired pitch rate in radians per second (float)
yaw : Desired yaw rate in radians per second (float)
thrust : Collective thrust, normalized to 0 .. 1 (float)
mode_switch : Flight mode switch position, 0.. 255 (uint8_t)
manual_override_switch : Override mode switch position, 0.. 255 (uint8_t)
'''
return self.send(self.manual_setpoint_encode(time_boot_ms, roll, pitch, yaw, thrust, mode_switch, manual_override_switch), force_mavlink1=force_mavlink1)
def set_attitude_target_encode(self, time_boot_ms, target_system, target_component, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust):
'''
Sets a desired vehicle attitude. Used by an external controller to
command the vehicle (manual controller or other
system).
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
type_mask : Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 6: reserved, bit 7: throttle, bit 8: attitude (uint8_t)
q : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
body_roll_rate : Body roll rate in radians per second (float)
body_pitch_rate : Body pitch rate in radians per second (float)
body_yaw_rate : Body yaw rate in radians per second (float)
thrust : Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) (float)
'''
return MAVLink_set_attitude_target_message(time_boot_ms, target_system, target_component, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust)
def set_attitude_target_send(self, time_boot_ms, target_system, target_component, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust, force_mavlink1=False):
'''
Sets a desired vehicle attitude. Used by an external controller to
command the vehicle (manual controller or other
system).
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
type_mask : Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 6: reserved, bit 7: throttle, bit 8: attitude (uint8_t)
q : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
body_roll_rate : Body roll rate in radians per second (float)
body_pitch_rate : Body pitch rate in radians per second (float)
body_yaw_rate : Body yaw rate in radians per second (float)
thrust : Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) (float)
'''
return self.send(self.set_attitude_target_encode(time_boot_ms, target_system, target_component, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust), force_mavlink1=force_mavlink1)
def attitude_target_encode(self, time_boot_ms, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust):
'''
Reports the current commanded attitude of the vehicle as specified by
the autopilot. This should match the commands sent in
a SET_ATTITUDE_TARGET message if the vehicle is being
controlled this way.
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
type_mask : Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 7: reserved, bit 8: attitude (uint8_t)
q : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
body_roll_rate : Body roll rate in radians per second (float)
body_pitch_rate : Body pitch rate in radians per second (float)
body_yaw_rate : Body yaw rate in radians per second (float)
thrust : Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) (float)
'''
return MAVLink_attitude_target_message(time_boot_ms, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust)
def attitude_target_send(self, time_boot_ms, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust, force_mavlink1=False):
'''
Reports the current commanded attitude of the vehicle as specified by
the autopilot. This should match the commands sent in
a SET_ATTITUDE_TARGET message if the vehicle is being
controlled this way.
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
type_mask : Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 7: reserved, bit 8: attitude (uint8_t)
q : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
body_roll_rate : Body roll rate in radians per second (float)
body_pitch_rate : Body pitch rate in radians per second (float)
body_yaw_rate : Body yaw rate in radians per second (float)
thrust : Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) (float)
'''
return self.send(self.attitude_target_encode(time_boot_ms, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust), force_mavlink1=force_mavlink1)
def set_position_target_local_ned_encode(self, time_boot_ms, target_system, target_component, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate):
'''
Sets a desired vehicle position in a local north-east-down coordinate
frame. Used by an external controller to command the
vehicle (manual controller or other system).
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
coordinate_frame : Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 (uint8_t)
type_mask : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
x : X Position in NED frame in meters (float)
y : Y Position in NED frame in meters (float)
z : Z Position in NED frame in meters (note, altitude is negative in NED) (float)
vx : X velocity in NED frame in meter / s (float)
vy : Y velocity in NED frame in meter / s (float)
vz : Z velocity in NED frame in meter / s (float)
afx : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afy : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afz : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
yaw : yaw setpoint in rad (float)
yaw_rate : yaw rate setpoint in rad/s (float)
'''
return MAVLink_set_position_target_local_ned_message(time_boot_ms, target_system, target_component, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate)
def set_position_target_local_ned_send(self, time_boot_ms, target_system, target_component, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate, force_mavlink1=False):
'''
Sets a desired vehicle position in a local north-east-down coordinate
frame. Used by an external controller to command the
vehicle (manual controller or other system).
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
coordinate_frame : Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 (uint8_t)
type_mask : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
x : X Position in NED frame in meters (float)
y : Y Position in NED frame in meters (float)
z : Z Position in NED frame in meters (note, altitude is negative in NED) (float)
vx : X velocity in NED frame in meter / s (float)
vy : Y velocity in NED frame in meter / s (float)
vz : Z velocity in NED frame in meter / s (float)
afx : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afy : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afz : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
yaw : yaw setpoint in rad (float)
yaw_rate : yaw rate setpoint in rad/s (float)
'''
return self.send(self.set_position_target_local_ned_encode(time_boot_ms, target_system, target_component, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate), force_mavlink1=force_mavlink1)
def position_target_local_ned_encode(self, time_boot_ms, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate):
'''
Reports the current commanded vehicle position, velocity, and
acceleration as specified by the autopilot. This
should match the commands sent in
SET_POSITION_TARGET_LOCAL_NED if the vehicle is being
controlled this way.
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
coordinate_frame : Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 (uint8_t)
type_mask : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
x : X Position in NED frame in meters (float)
y : Y Position in NED frame in meters (float)
z : Z Position in NED frame in meters (note, altitude is negative in NED) (float)
vx : X velocity in NED frame in meter / s (float)
vy : Y velocity in NED frame in meter / s (float)
vz : Z velocity in NED frame in meter / s (float)
afx : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afy : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afz : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
yaw : yaw setpoint in rad (float)
yaw_rate : yaw rate setpoint in rad/s (float)
'''
return MAVLink_position_target_local_ned_message(time_boot_ms, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate)
def position_target_local_ned_send(self, time_boot_ms, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate, force_mavlink1=False):
'''
Reports the current commanded vehicle position, velocity, and
acceleration as specified by the autopilot. This
should match the commands sent in
SET_POSITION_TARGET_LOCAL_NED if the vehicle is being
controlled this way.
time_boot_ms : Timestamp in milliseconds since system boot (uint32_t)
coordinate_frame : Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 (uint8_t)
type_mask : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
x : X Position in NED frame in meters (float)
y : Y Position in NED frame in meters (float)
z : Z Position in NED frame in meters (note, altitude is negative in NED) (float)
vx : X velocity in NED frame in meter / s (float)
vy : Y velocity in NED frame in meter / s (float)
vz : Z velocity in NED frame in meter / s (float)
afx : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afy : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afz : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
yaw : yaw setpoint in rad (float)
yaw_rate : yaw rate setpoint in rad/s (float)
'''
return self.send(self.position_target_local_ned_encode(time_boot_ms, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate), force_mavlink1=force_mavlink1)
def set_position_target_global_int_encode(self, time_boot_ms, target_system, target_component, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate):
'''
Sets a desired vehicle position, velocity, and/or acceleration in a
global coordinate system (WGS84). Used by an external
controller to command the vehicle (manual controller
or other system).
time_boot_ms : Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. (uint32_t)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
coordinate_frame : Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 (uint8_t)
type_mask : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
lat_int : X Position in WGS84 frame in 1e7 * degrees (int32_t)
lon_int : Y Position in WGS84 frame in 1e7 * degrees (int32_t)
alt : Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT (float)
vx : X velocity in NED frame in meter / s (float)
vy : Y velocity in NED frame in meter / s (float)
vz : Z velocity in NED frame in meter / s (float)
afx : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afy : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afz : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
yaw : yaw setpoint in rad (float)
yaw_rate : yaw rate setpoint in rad/s (float)
'''
return MAVLink_set_position_target_global_int_message(time_boot_ms, target_system, target_component, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate)
def set_position_target_global_int_send(self, time_boot_ms, target_system, target_component, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate, force_mavlink1=False):
'''
Sets a desired vehicle position, velocity, and/or acceleration in a
global coordinate system (WGS84). Used by an external
controller to command the vehicle (manual controller
or other system).
time_boot_ms : Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. (uint32_t)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
coordinate_frame : Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 (uint8_t)
type_mask : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
lat_int : X Position in WGS84 frame in 1e7 * degrees (int32_t)
lon_int : Y Position in WGS84 frame in 1e7 * degrees (int32_t)
alt : Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT (float)
vx : X velocity in NED frame in meter / s (float)
vy : Y velocity in NED frame in meter / s (float)
vz : Z velocity in NED frame in meter / s (float)
afx : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afy : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afz : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
yaw : yaw setpoint in rad (float)
yaw_rate : yaw rate setpoint in rad/s (float)
'''
return self.send(self.set_position_target_global_int_encode(time_boot_ms, target_system, target_component, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate), force_mavlink1=force_mavlink1)
def position_target_global_int_encode(self, time_boot_ms, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate):
'''
Reports the current commanded vehicle position, velocity, and
acceleration as specified by the autopilot. This
should match the commands sent in
SET_POSITION_TARGET_GLOBAL_INT if the vehicle is being
controlled this way.
time_boot_ms : Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. (uint32_t)
coordinate_frame : Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 (uint8_t)
type_mask : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
lat_int : X Position in WGS84 frame in 1e7 * degrees (int32_t)
lon_int : Y Position in WGS84 frame in 1e7 * degrees (int32_t)
alt : Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT (float)
vx : X velocity in NED frame in meter / s (float)
vy : Y velocity in NED frame in meter / s (float)
vz : Z velocity in NED frame in meter / s (float)
afx : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afy : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afz : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
yaw : yaw setpoint in rad (float)
yaw_rate : yaw rate setpoint in rad/s (float)
'''
return MAVLink_position_target_global_int_message(time_boot_ms, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate)
def position_target_global_int_send(self, time_boot_ms, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate, force_mavlink1=False):
'''
Reports the current commanded vehicle position, velocity, and
acceleration as specified by the autopilot. This
should match the commands sent in
SET_POSITION_TARGET_GLOBAL_INT if the vehicle is being
controlled this way.
time_boot_ms : Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. (uint32_t)
coordinate_frame : Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 (uint8_t)
type_mask : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
lat_int : X Position in WGS84 frame in 1e7 * degrees (int32_t)
lon_int : Y Position in WGS84 frame in 1e7 * degrees (int32_t)
alt : Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT (float)
vx : X velocity in NED frame in meter / s (float)
vy : Y velocity in NED frame in meter / s (float)
vz : Z velocity in NED frame in meter / s (float)
afx : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afy : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
afz : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
yaw : yaw setpoint in rad (float)
yaw_rate : yaw rate setpoint in rad/s (float)
'''
return self.send(self.position_target_global_int_encode(time_boot_ms, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate), force_mavlink1=force_mavlink1)
def local_position_ned_system_global_offset_encode(self, time_boot_ms, x, y, z, roll, pitch, yaw):
'''
The offset in X, Y, Z and yaw between the LOCAL_POSITION_NED messages
of MAV X and the global coordinate frame in NED
coordinates. Coordinate frame is right-handed, Z-axis
down (aeronautical frame, NED / north-east-down
convention)
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
x : X Position (float)
y : Y Position (float)
z : Z Position (float)
roll : Roll (float)
pitch : Pitch (float)
yaw : Yaw (float)
'''
return MAVLink_local_position_ned_system_global_offset_message(time_boot_ms, x, y, z, roll, pitch, yaw)
def local_position_ned_system_global_offset_send(self, time_boot_ms, x, y, z, roll, pitch, yaw, force_mavlink1=False):
'''
The offset in X, Y, Z and yaw between the LOCAL_POSITION_NED messages
of MAV X and the global coordinate frame in NED
coordinates. Coordinate frame is right-handed, Z-axis
down (aeronautical frame, NED / north-east-down
convention)
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
x : X Position (float)
y : Y Position (float)
z : Z Position (float)
roll : Roll (float)
pitch : Pitch (float)
yaw : Yaw (float)
'''
return self.send(self.local_position_ned_system_global_offset_encode(time_boot_ms, x, y, z, roll, pitch, yaw), force_mavlink1=force_mavlink1)
def hil_state_encode(self, time_usec, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, xacc, yacc, zacc):
'''
DEPRECATED PACKET! Suffers from missing airspeed fields and
singularities due to Euler angles. Please use
HIL_STATE_QUATERNION instead. Sent from simulation to
autopilot. This packet is useful for high throughput
applications such as hardware in the loop simulations.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
roll : Roll angle (rad) (float)
pitch : Pitch angle (rad) (float)
yaw : Yaw angle (rad) (float)
rollspeed : Body frame roll / phi angular speed (rad/s) (float)
pitchspeed : Body frame pitch / theta angular speed (rad/s) (float)
yawspeed : Body frame yaw / psi angular speed (rad/s) (float)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
alt : Altitude in meters, expressed as * 1000 (millimeters) (int32_t)
vx : Ground X Speed (Latitude), expressed as m/s * 100 (int16_t)
vy : Ground Y Speed (Longitude), expressed as m/s * 100 (int16_t)
vz : Ground Z Speed (Altitude), expressed as m/s * 100 (int16_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
'''
return MAVLink_hil_state_message(time_usec, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, xacc, yacc, zacc)
def hil_state_send(self, time_usec, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, xacc, yacc, zacc, force_mavlink1=False):
'''
DEPRECATED PACKET! Suffers from missing airspeed fields and
singularities due to Euler angles. Please use
HIL_STATE_QUATERNION instead. Sent from simulation to
autopilot. This packet is useful for high throughput
applications such as hardware in the loop simulations.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
roll : Roll angle (rad) (float)
pitch : Pitch angle (rad) (float)
yaw : Yaw angle (rad) (float)
rollspeed : Body frame roll / phi angular speed (rad/s) (float)
pitchspeed : Body frame pitch / theta angular speed (rad/s) (float)
yawspeed : Body frame yaw / psi angular speed (rad/s) (float)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
alt : Altitude in meters, expressed as * 1000 (millimeters) (int32_t)
vx : Ground X Speed (Latitude), expressed as m/s * 100 (int16_t)
vy : Ground Y Speed (Longitude), expressed as m/s * 100 (int16_t)
vz : Ground Z Speed (Altitude), expressed as m/s * 100 (int16_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
'''
return self.send(self.hil_state_encode(time_usec, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, xacc, yacc, zacc), force_mavlink1=force_mavlink1)
def hil_controls_encode(self, time_usec, roll_ailerons, pitch_elevator, yaw_rudder, throttle, aux1, aux2, aux3, aux4, mode, nav_mode):
'''
Sent from autopilot to simulation. Hardware in the loop control
outputs
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
roll_ailerons : Control output -1 .. 1 (float)
pitch_elevator : Control output -1 .. 1 (float)
yaw_rudder : Control output -1 .. 1 (float)
throttle : Throttle 0 .. 1 (float)
aux1 : Aux 1, -1 .. 1 (float)
aux2 : Aux 2, -1 .. 1 (float)
aux3 : Aux 3, -1 .. 1 (float)
aux4 : Aux 4, -1 .. 1 (float)
mode : System mode (MAV_MODE) (uint8_t)
nav_mode : Navigation mode (MAV_NAV_MODE) (uint8_t)
'''
return MAVLink_hil_controls_message(time_usec, roll_ailerons, pitch_elevator, yaw_rudder, throttle, aux1, aux2, aux3, aux4, mode, nav_mode)
def hil_controls_send(self, time_usec, roll_ailerons, pitch_elevator, yaw_rudder, throttle, aux1, aux2, aux3, aux4, mode, nav_mode, force_mavlink1=False):
'''
Sent from autopilot to simulation. Hardware in the loop control
outputs
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
roll_ailerons : Control output -1 .. 1 (float)
pitch_elevator : Control output -1 .. 1 (float)
yaw_rudder : Control output -1 .. 1 (float)
throttle : Throttle 0 .. 1 (float)
aux1 : Aux 1, -1 .. 1 (float)
aux2 : Aux 2, -1 .. 1 (float)
aux3 : Aux 3, -1 .. 1 (float)
aux4 : Aux 4, -1 .. 1 (float)
mode : System mode (MAV_MODE) (uint8_t)
nav_mode : Navigation mode (MAV_NAV_MODE) (uint8_t)
'''
return self.send(self.hil_controls_encode(time_usec, roll_ailerons, pitch_elevator, yaw_rudder, throttle, aux1, aux2, aux3, aux4, mode, nav_mode), force_mavlink1=force_mavlink1)
def hil_rc_inputs_raw_encode(self, time_usec, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, rssi):
'''
Sent from simulation to autopilot. The RAW values of the RC channels
received. The standard PPM modulation is as follows:
1000 microseconds: 0%, 2000 microseconds: 100%.
Individual receivers/transmitters might violate this
specification.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
chan1_raw : RC channel 1 value, in microseconds (uint16_t)
chan2_raw : RC channel 2 value, in microseconds (uint16_t)
chan3_raw : RC channel 3 value, in microseconds (uint16_t)
chan4_raw : RC channel 4 value, in microseconds (uint16_t)
chan5_raw : RC channel 5 value, in microseconds (uint16_t)
chan6_raw : RC channel 6 value, in microseconds (uint16_t)
chan7_raw : RC channel 7 value, in microseconds (uint16_t)
chan8_raw : RC channel 8 value, in microseconds (uint16_t)
chan9_raw : RC channel 9 value, in microseconds (uint16_t)
chan10_raw : RC channel 10 value, in microseconds (uint16_t)
chan11_raw : RC channel 11 value, in microseconds (uint16_t)
chan12_raw : RC channel 12 value, in microseconds (uint16_t)
rssi : Receive signal strength indicator, 0: 0%, 255: 100% (uint8_t)
'''
return MAVLink_hil_rc_inputs_raw_message(time_usec, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, rssi)
def hil_rc_inputs_raw_send(self, time_usec, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, rssi, force_mavlink1=False):
'''
Sent from simulation to autopilot. The RAW values of the RC channels
received. The standard PPM modulation is as follows:
1000 microseconds: 0%, 2000 microseconds: 100%.
Individual receivers/transmitters might violate this
specification.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
chan1_raw : RC channel 1 value, in microseconds (uint16_t)
chan2_raw : RC channel 2 value, in microseconds (uint16_t)
chan3_raw : RC channel 3 value, in microseconds (uint16_t)
chan4_raw : RC channel 4 value, in microseconds (uint16_t)
chan5_raw : RC channel 5 value, in microseconds (uint16_t)
chan6_raw : RC channel 6 value, in microseconds (uint16_t)
chan7_raw : RC channel 7 value, in microseconds (uint16_t)
chan8_raw : RC channel 8 value, in microseconds (uint16_t)
chan9_raw : RC channel 9 value, in microseconds (uint16_t)
chan10_raw : RC channel 10 value, in microseconds (uint16_t)
chan11_raw : RC channel 11 value, in microseconds (uint16_t)
chan12_raw : RC channel 12 value, in microseconds (uint16_t)
rssi : Receive signal strength indicator, 0: 0%, 255: 100% (uint8_t)
'''
return self.send(self.hil_rc_inputs_raw_encode(time_usec, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, rssi), force_mavlink1=force_mavlink1)
def hil_actuator_controls_encode(self, time_usec, controls, mode, flags):
'''
Sent from autopilot to simulation. Hardware in the loop control
outputs (replacement for HIL_CONTROLS)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
controls : Control outputs -1 .. 1. Channel assignment depends on the simulated hardware. (float)
mode : System mode (MAV_MODE), includes arming state. (uint8_t)
flags : Flags as bitfield, reserved for future use. (uint64_t)
'''
return MAVLink_hil_actuator_controls_message(time_usec, controls, mode, flags)
def hil_actuator_controls_send(self, time_usec, controls, mode, flags, force_mavlink1=False):
'''
Sent from autopilot to simulation. Hardware in the loop control
outputs (replacement for HIL_CONTROLS)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
controls : Control outputs -1 .. 1. Channel assignment depends on the simulated hardware. (float)
mode : System mode (MAV_MODE), includes arming state. (uint8_t)
flags : Flags as bitfield, reserved for future use. (uint64_t)
'''
return self.send(self.hil_actuator_controls_encode(time_usec, controls, mode, flags), force_mavlink1=force_mavlink1)
def optical_flow_encode(self, time_usec, sensor_id, flow_x, flow_y, flow_comp_m_x, flow_comp_m_y, quality, ground_distance, flow_rate_x=0, flow_rate_y=0):
'''
Optical flow from a flow sensor (e.g. optical mouse sensor)
time_usec : Timestamp (UNIX) (uint64_t)
sensor_id : Sensor ID (uint8_t)
flow_x : Flow in pixels * 10 in x-sensor direction (dezi-pixels) (int16_t)
flow_y : Flow in pixels * 10 in y-sensor direction (dezi-pixels) (int16_t)
flow_comp_m_x : Flow in meters in x-sensor direction, angular-speed compensated (float)
flow_comp_m_y : Flow in meters in y-sensor direction, angular-speed compensated (float)
quality : Optical flow quality / confidence. 0: bad, 255: maximum quality (uint8_t)
ground_distance : Ground distance in meters. Positive value: distance known. Negative value: Unknown distance (float)
flow_rate_x : Flow rate in radians/second about X axis (float)
flow_rate_y : Flow rate in radians/second about Y axis (float)
'''
return MAVLink_optical_flow_message(time_usec, sensor_id, flow_x, flow_y, flow_comp_m_x, flow_comp_m_y, quality, ground_distance, flow_rate_x, flow_rate_y)
def optical_flow_send(self, time_usec, sensor_id, flow_x, flow_y, flow_comp_m_x, flow_comp_m_y, quality, ground_distance, flow_rate_x=0, flow_rate_y=0, force_mavlink1=False):
'''
Optical flow from a flow sensor (e.g. optical mouse sensor)
time_usec : Timestamp (UNIX) (uint64_t)
sensor_id : Sensor ID (uint8_t)
flow_x : Flow in pixels * 10 in x-sensor direction (dezi-pixels) (int16_t)
flow_y : Flow in pixels * 10 in y-sensor direction (dezi-pixels) (int16_t)
flow_comp_m_x : Flow in meters in x-sensor direction, angular-speed compensated (float)
flow_comp_m_y : Flow in meters in y-sensor direction, angular-speed compensated (float)
quality : Optical flow quality / confidence. 0: bad, 255: maximum quality (uint8_t)
ground_distance : Ground distance in meters. Positive value: distance known. Negative value: Unknown distance (float)
flow_rate_x : Flow rate in radians/second about X axis (float)
flow_rate_y : Flow rate in radians/second about Y axis (float)
'''
return self.send(self.optical_flow_encode(time_usec, sensor_id, flow_x, flow_y, flow_comp_m_x, flow_comp_m_y, quality, ground_distance, flow_rate_x, flow_rate_y), force_mavlink1=force_mavlink1)
def global_vision_position_estimate_encode(self, usec, x, y, z, roll, pitch, yaw, covariance=0):
'''
usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
x : Global X position (float)
y : Global Y position (float)
z : Global Z position (float)
roll : Roll angle in rad (float)
pitch : Pitch angle in rad (float)
yaw : Yaw angle in rad (float)
covariance : Pose covariance matrix upper right triangular (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return MAVLink_global_vision_position_estimate_message(usec, x, y, z, roll, pitch, yaw, covariance)
def global_vision_position_estimate_send(self, usec, x, y, z, roll, pitch, yaw, covariance=0, force_mavlink1=False):
'''
usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
x : Global X position (float)
y : Global Y position (float)
z : Global Z position (float)
roll : Roll angle in rad (float)
pitch : Pitch angle in rad (float)
yaw : Yaw angle in rad (float)
covariance : Pose covariance matrix upper right triangular (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return self.send(self.global_vision_position_estimate_encode(usec, x, y, z, roll, pitch, yaw, covariance), force_mavlink1=force_mavlink1)
def vision_position_estimate_encode(self, usec, x, y, z, roll, pitch, yaw, covariance=0):
'''
usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
x : Global X position (float)
y : Global Y position (float)
z : Global Z position (float)
roll : Roll angle in rad (float)
pitch : Pitch angle in rad (float)
yaw : Yaw angle in rad (float)
covariance : Pose covariance matrix upper right triangular (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return MAVLink_vision_position_estimate_message(usec, x, y, z, roll, pitch, yaw, covariance)
def vision_position_estimate_send(self, usec, x, y, z, roll, pitch, yaw, covariance=0, force_mavlink1=False):
'''
usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
x : Global X position (float)
y : Global Y position (float)
z : Global Z position (float)
roll : Roll angle in rad (float)
pitch : Pitch angle in rad (float)
yaw : Yaw angle in rad (float)
covariance : Pose covariance matrix upper right triangular (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return self.send(self.vision_position_estimate_encode(usec, x, y, z, roll, pitch, yaw, covariance), force_mavlink1=force_mavlink1)
def vision_speed_estimate_encode(self, usec, x, y, z, covariance=0):
'''
usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
x : Global X speed (float)
y : Global Y speed (float)
z : Global Z speed (float)
covariance : Linear velocity covariance matrix (1st three entries - 1st row, etc.) (float)
'''
return MAVLink_vision_speed_estimate_message(usec, x, y, z, covariance)
def vision_speed_estimate_send(self, usec, x, y, z, covariance=0, force_mavlink1=False):
'''
usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
x : Global X speed (float)
y : Global Y speed (float)
z : Global Z speed (float)
covariance : Linear velocity covariance matrix (1st three entries - 1st row, etc.) (float)
'''
return self.send(self.vision_speed_estimate_encode(usec, x, y, z, covariance), force_mavlink1=force_mavlink1)
def vicon_position_estimate_encode(self, usec, x, y, z, roll, pitch, yaw, covariance=0):
'''
usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
x : Global X position (float)
y : Global Y position (float)
z : Global Z position (float)
roll : Roll angle in rad (float)
pitch : Pitch angle in rad (float)
yaw : Yaw angle in rad (float)
covariance : Pose covariance matrix upper right triangular (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return MAVLink_vicon_position_estimate_message(usec, x, y, z, roll, pitch, yaw, covariance)
def vicon_position_estimate_send(self, usec, x, y, z, roll, pitch, yaw, covariance=0, force_mavlink1=False):
'''
usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
x : Global X position (float)
y : Global Y position (float)
z : Global Z position (float)
roll : Roll angle in rad (float)
pitch : Pitch angle in rad (float)
yaw : Yaw angle in rad (float)
covariance : Pose covariance matrix upper right triangular (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return self.send(self.vicon_position_estimate_encode(usec, x, y, z, roll, pitch, yaw, covariance), force_mavlink1=force_mavlink1)
def highres_imu_encode(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated):
'''
The IMU readings in SI units in NED body frame
time_usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
xacc : X acceleration (m/s^2) (float)
yacc : Y acceleration (m/s^2) (float)
zacc : Z acceleration (m/s^2) (float)
xgyro : Angular speed around X axis (rad / sec) (float)
ygyro : Angular speed around Y axis (rad / sec) (float)
zgyro : Angular speed around Z axis (rad / sec) (float)
xmag : X Magnetic field (Gauss) (float)
ymag : Y Magnetic field (Gauss) (float)
zmag : Z Magnetic field (Gauss) (float)
abs_pressure : Absolute pressure in millibar (float)
diff_pressure : Differential pressure in millibar (float)
pressure_alt : Altitude calculated from pressure (float)
temperature : Temperature in degrees celsius (float)
fields_updated : Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature (uint16_t)
'''
return MAVLink_highres_imu_message(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated)
def highres_imu_send(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated, force_mavlink1=False):
'''
The IMU readings in SI units in NED body frame
time_usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
xacc : X acceleration (m/s^2) (float)
yacc : Y acceleration (m/s^2) (float)
zacc : Z acceleration (m/s^2) (float)
xgyro : Angular speed around X axis (rad / sec) (float)
ygyro : Angular speed around Y axis (rad / sec) (float)
zgyro : Angular speed around Z axis (rad / sec) (float)
xmag : X Magnetic field (Gauss) (float)
ymag : Y Magnetic field (Gauss) (float)
zmag : Z Magnetic field (Gauss) (float)
abs_pressure : Absolute pressure in millibar (float)
diff_pressure : Differential pressure in millibar (float)
pressure_alt : Altitude calculated from pressure (float)
temperature : Temperature in degrees celsius (float)
fields_updated : Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature (uint16_t)
'''
return self.send(self.highres_imu_encode(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated), force_mavlink1=force_mavlink1)
def optical_flow_rad_encode(self, time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance):
'''
Optical flow from an angular rate flow sensor (e.g. PX4FLOW or mouse
sensor)
time_usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
sensor_id : Sensor ID (uint8_t)
integration_time_us : Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. (uint32_t)
integrated_x : Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) (float)
integrated_y : Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) (float)
integrated_xgyro : RH rotation around X axis (rad) (float)
integrated_ygyro : RH rotation around Y axis (rad) (float)
integrated_zgyro : RH rotation around Z axis (rad) (float)
temperature : Temperature * 100 in centi-degrees Celsius (int16_t)
quality : Optical flow quality / confidence. 0: no valid flow, 255: maximum quality (uint8_t)
time_delta_distance_us : Time in microseconds since the distance was sampled. (uint32_t)
distance : Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. (float)
'''
return MAVLink_optical_flow_rad_message(time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance)
def optical_flow_rad_send(self, time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance, force_mavlink1=False):
'''
Optical flow from an angular rate flow sensor (e.g. PX4FLOW or mouse
sensor)
time_usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
sensor_id : Sensor ID (uint8_t)
integration_time_us : Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. (uint32_t)
integrated_x : Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) (float)
integrated_y : Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) (float)
integrated_xgyro : RH rotation around X axis (rad) (float)
integrated_ygyro : RH rotation around Y axis (rad) (float)
integrated_zgyro : RH rotation around Z axis (rad) (float)
temperature : Temperature * 100 in centi-degrees Celsius (int16_t)
quality : Optical flow quality / confidence. 0: no valid flow, 255: maximum quality (uint8_t)
time_delta_distance_us : Time in microseconds since the distance was sampled. (uint32_t)
distance : Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. (float)
'''
return self.send(self.optical_flow_rad_encode(time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance), force_mavlink1=force_mavlink1)
def hil_sensor_encode(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated):
'''
The IMU readings in SI units in NED body frame
time_usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
xacc : X acceleration (m/s^2) (float)
yacc : Y acceleration (m/s^2) (float)
zacc : Z acceleration (m/s^2) (float)
xgyro : Angular speed around X axis in body frame (rad / sec) (float)
ygyro : Angular speed around Y axis in body frame (rad / sec) (float)
zgyro : Angular speed around Z axis in body frame (rad / sec) (float)
xmag : X Magnetic field (Gauss) (float)
ymag : Y Magnetic field (Gauss) (float)
zmag : Z Magnetic field (Gauss) (float)
abs_pressure : Absolute pressure in millibar (float)
diff_pressure : Differential pressure (airspeed) in millibar (float)
pressure_alt : Altitude calculated from pressure (float)
temperature : Temperature in degrees celsius (float)
fields_updated : Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim. (uint32_t)
'''
return MAVLink_hil_sensor_message(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated)
def hil_sensor_send(self, time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated, force_mavlink1=False):
'''
The IMU readings in SI units in NED body frame
time_usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
xacc : X acceleration (m/s^2) (float)
yacc : Y acceleration (m/s^2) (float)
zacc : Z acceleration (m/s^2) (float)
xgyro : Angular speed around X axis in body frame (rad / sec) (float)
ygyro : Angular speed around Y axis in body frame (rad / sec) (float)
zgyro : Angular speed around Z axis in body frame (rad / sec) (float)
xmag : X Magnetic field (Gauss) (float)
ymag : Y Magnetic field (Gauss) (float)
zmag : Z Magnetic field (Gauss) (float)
abs_pressure : Absolute pressure in millibar (float)
diff_pressure : Differential pressure (airspeed) in millibar (float)
pressure_alt : Altitude calculated from pressure (float)
temperature : Temperature in degrees celsius (float)
fields_updated : Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim. (uint32_t)
'''
return self.send(self.hil_sensor_encode(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated), force_mavlink1=force_mavlink1)
def sim_state_encode(self, q1, q2, q3, q4, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lon, alt, std_dev_horz, std_dev_vert, vn, ve, vd):
'''
Status of simulation environment, if used
q1 : True attitude quaternion component 1, w (1 in null-rotation) (float)
q2 : True attitude quaternion component 2, x (0 in null-rotation) (float)
q3 : True attitude quaternion component 3, y (0 in null-rotation) (float)
q4 : True attitude quaternion component 4, z (0 in null-rotation) (float)
roll : Attitude roll expressed as Euler angles, not recommended except for human-readable outputs (float)
pitch : Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs (float)
yaw : Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs (float)
xacc : X acceleration m/s/s (float)
yacc : Y acceleration m/s/s (float)
zacc : Z acceleration m/s/s (float)
xgyro : Angular speed around X axis rad/s (float)
ygyro : Angular speed around Y axis rad/s (float)
zgyro : Angular speed around Z axis rad/s (float)
lat : Latitude in degrees (float)
lon : Longitude in degrees (float)
alt : Altitude in meters (float)
std_dev_horz : Horizontal position standard deviation (float)
std_dev_vert : Vertical position standard deviation (float)
vn : True velocity in m/s in NORTH direction in earth-fixed NED frame (float)
ve : True velocity in m/s in EAST direction in earth-fixed NED frame (float)
vd : True velocity in m/s in DOWN direction in earth-fixed NED frame (float)
'''
return MAVLink_sim_state_message(q1, q2, q3, q4, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lon, alt, std_dev_horz, std_dev_vert, vn, ve, vd)
def sim_state_send(self, q1, q2, q3, q4, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lon, alt, std_dev_horz, std_dev_vert, vn, ve, vd, force_mavlink1=False):
'''
Status of simulation environment, if used
q1 : True attitude quaternion component 1, w (1 in null-rotation) (float)
q2 : True attitude quaternion component 2, x (0 in null-rotation) (float)
q3 : True attitude quaternion component 3, y (0 in null-rotation) (float)
q4 : True attitude quaternion component 4, z (0 in null-rotation) (float)
roll : Attitude roll expressed as Euler angles, not recommended except for human-readable outputs (float)
pitch : Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs (float)
yaw : Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs (float)
xacc : X acceleration m/s/s (float)
yacc : Y acceleration m/s/s (float)
zacc : Z acceleration m/s/s (float)
xgyro : Angular speed around X axis rad/s (float)
ygyro : Angular speed around Y axis rad/s (float)
zgyro : Angular speed around Z axis rad/s (float)
lat : Latitude in degrees (float)
lon : Longitude in degrees (float)
alt : Altitude in meters (float)
std_dev_horz : Horizontal position standard deviation (float)
std_dev_vert : Vertical position standard deviation (float)
vn : True velocity in m/s in NORTH direction in earth-fixed NED frame (float)
ve : True velocity in m/s in EAST direction in earth-fixed NED frame (float)
vd : True velocity in m/s in DOWN direction in earth-fixed NED frame (float)
'''
return self.send(self.sim_state_encode(q1, q2, q3, q4, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lon, alt, std_dev_horz, std_dev_vert, vn, ve, vd), force_mavlink1=force_mavlink1)
def radio_status_encode(self, rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed):
'''
Status generated by radio and injected into MAVLink stream.
rssi : Local signal strength (uint8_t)
remrssi : Remote signal strength (uint8_t)
txbuf : Remaining free buffer space in percent. (uint8_t)
noise : Background noise level (uint8_t)
remnoise : Remote background noise level (uint8_t)
rxerrors : Receive errors (uint16_t)
fixed : Count of error corrected packets (uint16_t)
'''
return MAVLink_radio_status_message(rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed)
def radio_status_send(self, rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed, force_mavlink1=False):
'''
Status generated by radio and injected into MAVLink stream.
rssi : Local signal strength (uint8_t)
remrssi : Remote signal strength (uint8_t)
txbuf : Remaining free buffer space in percent. (uint8_t)
noise : Background noise level (uint8_t)
remnoise : Remote background noise level (uint8_t)
rxerrors : Receive errors (uint16_t)
fixed : Count of error corrected packets (uint16_t)
'''
return self.send(self.radio_status_encode(rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed), force_mavlink1=force_mavlink1)
def file_transfer_protocol_encode(self, target_network, target_system, target_component, payload):
'''
File transfer message
target_network : Network ID (0 for broadcast) (uint8_t)
target_system : System ID (0 for broadcast) (uint8_t)
target_component : Component ID (0 for broadcast) (uint8_t)
payload : Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. (uint8_t)
'''
return MAVLink_file_transfer_protocol_message(target_network, target_system, target_component, payload)
def file_transfer_protocol_send(self, target_network, target_system, target_component, payload, force_mavlink1=False):
'''
File transfer message
target_network : Network ID (0 for broadcast) (uint8_t)
target_system : System ID (0 for broadcast) (uint8_t)
target_component : Component ID (0 for broadcast) (uint8_t)
payload : Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. (uint8_t)
'''
return self.send(self.file_transfer_protocol_encode(target_network, target_system, target_component, payload), force_mavlink1=force_mavlink1)
def timesync_encode(self, tc1, ts1):
'''
Time synchronization message.
tc1 : Time sync timestamp 1 (int64_t)
ts1 : Time sync timestamp 2 (int64_t)
'''
return MAVLink_timesync_message(tc1, ts1)
def timesync_send(self, tc1, ts1, force_mavlink1=False):
'''
Time synchronization message.
tc1 : Time sync timestamp 1 (int64_t)
ts1 : Time sync timestamp 2 (int64_t)
'''
return self.send(self.timesync_encode(tc1, ts1), force_mavlink1=force_mavlink1)
def camera_trigger_encode(self, time_usec, seq):
'''
Camera-IMU triggering and synchronisation message.
time_usec : Timestamp for the image frame in microseconds (uint64_t)
seq : Image frame sequence (uint32_t)
'''
return MAVLink_camera_trigger_message(time_usec, seq)
def camera_trigger_send(self, time_usec, seq, force_mavlink1=False):
'''
Camera-IMU triggering and synchronisation message.
time_usec : Timestamp for the image frame in microseconds (uint64_t)
seq : Image frame sequence (uint32_t)
'''
return self.send(self.camera_trigger_encode(time_usec, seq), force_mavlink1=force_mavlink1)
def hil_gps_encode(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, vn, ve, vd, cog, satellites_visible):
'''
The global position, as returned by the Global Positioning System
(GPS). This is NOT the global
position estimate of the sytem, but rather a RAW
sensor value. See message GLOBAL_POSITION for the
global position estimate.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
fix_type : 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) (int32_t)
eph : GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 (uint16_t)
epv : GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 (uint16_t)
vel : GPS ground speed in cm/s. If unknown, set to: 65535 (uint16_t)
vn : GPS velocity in cm/s in NORTH direction in earth-fixed NED frame (int16_t)
ve : GPS velocity in cm/s in EAST direction in earth-fixed NED frame (int16_t)
vd : GPS velocity in cm/s in DOWN direction in earth-fixed NED frame (int16_t)
cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 (uint16_t)
satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t)
'''
return MAVLink_hil_gps_message(time_usec, fix_type, lat, lon, alt, eph, epv, vel, vn, ve, vd, cog, satellites_visible)
def hil_gps_send(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, vn, ve, vd, cog, satellites_visible, force_mavlink1=False):
'''
The global position, as returned by the Global Positioning System
(GPS). This is NOT the global
position estimate of the sytem, but rather a RAW
sensor value. See message GLOBAL_POSITION for the
global position estimate.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
fix_type : 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) (int32_t)
eph : GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 (uint16_t)
epv : GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 (uint16_t)
vel : GPS ground speed in cm/s. If unknown, set to: 65535 (uint16_t)
vn : GPS velocity in cm/s in NORTH direction in earth-fixed NED frame (int16_t)
ve : GPS velocity in cm/s in EAST direction in earth-fixed NED frame (int16_t)
vd : GPS velocity in cm/s in DOWN direction in earth-fixed NED frame (int16_t)
cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 (uint16_t)
satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t)
'''
return self.send(self.hil_gps_encode(time_usec, fix_type, lat, lon, alt, eph, epv, vel, vn, ve, vd, cog, satellites_visible), force_mavlink1=force_mavlink1)
def hil_optical_flow_encode(self, time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance):
'''
Simulated optical flow from a flow sensor (e.g. PX4FLOW or optical
mouse sensor)
time_usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
sensor_id : Sensor ID (uint8_t)
integration_time_us : Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. (uint32_t)
integrated_x : Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) (float)
integrated_y : Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) (float)
integrated_xgyro : RH rotation around X axis (rad) (float)
integrated_ygyro : RH rotation around Y axis (rad) (float)
integrated_zgyro : RH rotation around Z axis (rad) (float)
temperature : Temperature * 100 in centi-degrees Celsius (int16_t)
quality : Optical flow quality / confidence. 0: no valid flow, 255: maximum quality (uint8_t)
time_delta_distance_us : Time in microseconds since the distance was sampled. (uint32_t)
distance : Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. (float)
'''
return MAVLink_hil_optical_flow_message(time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance)
def hil_optical_flow_send(self, time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance, force_mavlink1=False):
'''
Simulated optical flow from a flow sensor (e.g. PX4FLOW or optical
mouse sensor)
time_usec : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
sensor_id : Sensor ID (uint8_t)
integration_time_us : Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. (uint32_t)
integrated_x : Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) (float)
integrated_y : Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) (float)
integrated_xgyro : RH rotation around X axis (rad) (float)
integrated_ygyro : RH rotation around Y axis (rad) (float)
integrated_zgyro : RH rotation around Z axis (rad) (float)
temperature : Temperature * 100 in centi-degrees Celsius (int16_t)
quality : Optical flow quality / confidence. 0: no valid flow, 255: maximum quality (uint8_t)
time_delta_distance_us : Time in microseconds since the distance was sampled. (uint32_t)
distance : Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. (float)
'''
return self.send(self.hil_optical_flow_encode(time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance), force_mavlink1=force_mavlink1)
def hil_state_quaternion_encode(self, time_usec, attitude_quaternion, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc):
'''
Sent from simulation to autopilot, avoids in contrast to HIL_STATE
singularities. This packet is useful for high
throughput applications such as hardware in the loop
simulations.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
attitude_quaternion : Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation) (float)
rollspeed : Body frame roll / phi angular speed (rad/s) (float)
pitchspeed : Body frame pitch / theta angular speed (rad/s) (float)
yawspeed : Body frame yaw / psi angular speed (rad/s) (float)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
alt : Altitude in meters, expressed as * 1000 (millimeters) (int32_t)
vx : Ground X Speed (Latitude), expressed as cm/s (int16_t)
vy : Ground Y Speed (Longitude), expressed as cm/s (int16_t)
vz : Ground Z Speed (Altitude), expressed as cm/s (int16_t)
ind_airspeed : Indicated airspeed, expressed as cm/s (uint16_t)
true_airspeed : True airspeed, expressed as cm/s (uint16_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
'''
return MAVLink_hil_state_quaternion_message(time_usec, attitude_quaternion, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc)
def hil_state_quaternion_send(self, time_usec, attitude_quaternion, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc, force_mavlink1=False):
'''
Sent from simulation to autopilot, avoids in contrast to HIL_STATE
singularities. This packet is useful for high
throughput applications such as hardware in the loop
simulations.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
attitude_quaternion : Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation) (float)
rollspeed : Body frame roll / phi angular speed (rad/s) (float)
pitchspeed : Body frame pitch / theta angular speed (rad/s) (float)
yawspeed : Body frame yaw / psi angular speed (rad/s) (float)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
alt : Altitude in meters, expressed as * 1000 (millimeters) (int32_t)
vx : Ground X Speed (Latitude), expressed as cm/s (int16_t)
vy : Ground Y Speed (Longitude), expressed as cm/s (int16_t)
vz : Ground Z Speed (Altitude), expressed as cm/s (int16_t)
ind_airspeed : Indicated airspeed, expressed as cm/s (uint16_t)
true_airspeed : True airspeed, expressed as cm/s (uint16_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
'''
return self.send(self.hil_state_quaternion_encode(time_usec, attitude_quaternion, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc), force_mavlink1=force_mavlink1)
def scaled_imu2_encode(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
'''
The RAW IMU readings for secondary 9DOF sensor setup. This message
should contain the scaled values to the described
units
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
xgyro : Angular speed around X axis (millirad /sec) (int16_t)
ygyro : Angular speed around Y axis (millirad /sec) (int16_t)
zgyro : Angular speed around Z axis (millirad /sec) (int16_t)
xmag : X Magnetic field (milli tesla) (int16_t)
ymag : Y Magnetic field (milli tesla) (int16_t)
zmag : Z Magnetic field (milli tesla) (int16_t)
'''
return MAVLink_scaled_imu2_message(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag)
def scaled_imu2_send(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, force_mavlink1=False):
'''
The RAW IMU readings for secondary 9DOF sensor setup. This message
should contain the scaled values to the described
units
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
xgyro : Angular speed around X axis (millirad /sec) (int16_t)
ygyro : Angular speed around Y axis (millirad /sec) (int16_t)
zgyro : Angular speed around Z axis (millirad /sec) (int16_t)
xmag : X Magnetic field (milli tesla) (int16_t)
ymag : Y Magnetic field (milli tesla) (int16_t)
zmag : Z Magnetic field (milli tesla) (int16_t)
'''
return self.send(self.scaled_imu2_encode(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag), force_mavlink1=force_mavlink1)
def log_request_list_encode(self, target_system, target_component, start, end):
'''
Request a list of available logs. On some systems calling this may
stop on-board logging until LOG_REQUEST_END is called.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
start : First log id (0 for first available) (uint16_t)
end : Last log id (0xffff for last available) (uint16_t)
'''
return MAVLink_log_request_list_message(target_system, target_component, start, end)
def log_request_list_send(self, target_system, target_component, start, end, force_mavlink1=False):
'''
Request a list of available logs. On some systems calling this may
stop on-board logging until LOG_REQUEST_END is called.
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
start : First log id (0 for first available) (uint16_t)
end : Last log id (0xffff for last available) (uint16_t)
'''
return self.send(self.log_request_list_encode(target_system, target_component, start, end), force_mavlink1=force_mavlink1)
def log_entry_encode(self, id, num_logs, last_log_num, time_utc, size):
'''
Reply to LOG_REQUEST_LIST
id : Log id (uint16_t)
num_logs : Total number of logs (uint16_t)
last_log_num : High log number (uint16_t)
time_utc : UTC timestamp of log in seconds since 1970, or 0 if not available (uint32_t)
size : Size of the log (may be approximate) in bytes (uint32_t)
'''
return MAVLink_log_entry_message(id, num_logs, last_log_num, time_utc, size)
def log_entry_send(self, id, num_logs, last_log_num, time_utc, size, force_mavlink1=False):
'''
Reply to LOG_REQUEST_LIST
id : Log id (uint16_t)
num_logs : Total number of logs (uint16_t)
last_log_num : High log number (uint16_t)
time_utc : UTC timestamp of log in seconds since 1970, or 0 if not available (uint32_t)
size : Size of the log (may be approximate) in bytes (uint32_t)
'''
return self.send(self.log_entry_encode(id, num_logs, last_log_num, time_utc, size), force_mavlink1=force_mavlink1)
def log_request_data_encode(self, target_system, target_component, id, ofs, count):
'''
Request a chunk of a log
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
id : Log id (from LOG_ENTRY reply) (uint16_t)
ofs : Offset into the log (uint32_t)
count : Number of bytes (uint32_t)
'''
return MAVLink_log_request_data_message(target_system, target_component, id, ofs, count)
def log_request_data_send(self, target_system, target_component, id, ofs, count, force_mavlink1=False):
'''
Request a chunk of a log
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
id : Log id (from LOG_ENTRY reply) (uint16_t)
ofs : Offset into the log (uint32_t)
count : Number of bytes (uint32_t)
'''
return self.send(self.log_request_data_encode(target_system, target_component, id, ofs, count), force_mavlink1=force_mavlink1)
def log_data_encode(self, id, ofs, count, data):
'''
Reply to LOG_REQUEST_DATA
id : Log id (from LOG_ENTRY reply) (uint16_t)
ofs : Offset into the log (uint32_t)
count : Number of bytes (zero for end of log) (uint8_t)
data : log data (uint8_t)
'''
return MAVLink_log_data_message(id, ofs, count, data)
def log_data_send(self, id, ofs, count, data, force_mavlink1=False):
'''
Reply to LOG_REQUEST_DATA
id : Log id (from LOG_ENTRY reply) (uint16_t)
ofs : Offset into the log (uint32_t)
count : Number of bytes (zero for end of log) (uint8_t)
data : log data (uint8_t)
'''
return self.send(self.log_data_encode(id, ofs, count, data), force_mavlink1=force_mavlink1)
def log_erase_encode(self, target_system, target_component):
'''
Erase all logs
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return MAVLink_log_erase_message(target_system, target_component)
def log_erase_send(self, target_system, target_component, force_mavlink1=False):
'''
Erase all logs
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.log_erase_encode(target_system, target_component), force_mavlink1=force_mavlink1)
def log_request_end_encode(self, target_system, target_component):
'''
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return MAVLink_log_request_end_message(target_system, target_component)
def log_request_end_send(self, target_system, target_component, force_mavlink1=False):
'''
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
return self.send(self.log_request_end_encode(target_system, target_component), force_mavlink1=force_mavlink1)
def gps_inject_data_encode(self, target_system, target_component, len, data):
'''
data for injecting into the onboard GPS (used for DGPS)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
len : data length (uint8_t)
data : raw data (110 is enough for 12 satellites of RTCMv2) (uint8_t)
'''
return MAVLink_gps_inject_data_message(target_system, target_component, len, data)
def gps_inject_data_send(self, target_system, target_component, len, data, force_mavlink1=False):
'''
data for injecting into the onboard GPS (used for DGPS)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
len : data length (uint8_t)
data : raw data (110 is enough for 12 satellites of RTCMv2) (uint8_t)
'''
return self.send(self.gps_inject_data_encode(target_system, target_component, len, data), force_mavlink1=force_mavlink1)
def gps2_raw_encode(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, dgps_numch, dgps_age):
'''
Second GPS data.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
fix_type : See the GPS_FIX_TYPE enum. (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) (int32_t)
eph : GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX (uint16_t)
epv : GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX (uint16_t)
vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t)
cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)
satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t)
dgps_numch : Number of DGPS satellites (uint8_t)
dgps_age : Age of DGPS info (uint32_t)
'''
return MAVLink_gps2_raw_message(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, dgps_numch, dgps_age)
def gps2_raw_send(self, time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, dgps_numch, dgps_age, force_mavlink1=False):
'''
Second GPS data.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
fix_type : See the GPS_FIX_TYPE enum. (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) (int32_t)
eph : GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX (uint16_t)
epv : GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX (uint16_t)
vel : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t)
cog : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)
satellites_visible : Number of satellites visible. If unknown, set to 255 (uint8_t)
dgps_numch : Number of DGPS satellites (uint8_t)
dgps_age : Age of DGPS info (uint32_t)
'''
return self.send(self.gps2_raw_encode(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, dgps_numch, dgps_age), force_mavlink1=force_mavlink1)
def power_status_encode(self, Vcc, Vservo, flags):
'''
Power supply status
Vcc : 5V rail voltage in millivolts (uint16_t)
Vservo : servo rail voltage in millivolts (uint16_t)
flags : power supply status flags (see MAV_POWER_STATUS enum) (uint16_t)
'''
return MAVLink_power_status_message(Vcc, Vservo, flags)
def power_status_send(self, Vcc, Vservo, flags, force_mavlink1=False):
'''
Power supply status
Vcc : 5V rail voltage in millivolts (uint16_t)
Vservo : servo rail voltage in millivolts (uint16_t)
flags : power supply status flags (see MAV_POWER_STATUS enum) (uint16_t)
'''
return self.send(self.power_status_encode(Vcc, Vservo, flags), force_mavlink1=force_mavlink1)
def serial_control_encode(self, device, flags, timeout, baudrate, count, data):
'''
Control a serial port. This can be used for raw access to an onboard
serial peripheral such as a GPS or telemetry radio. It
is designed to make it possible to update the devices
firmware via MAVLink messages or change the devices
settings. A message with zero bytes can be used to
change just the baudrate.
device : See SERIAL_CONTROL_DEV enum (uint8_t)
flags : See SERIAL_CONTROL_FLAG enum (uint8_t)
timeout : Timeout for reply data in milliseconds (uint16_t)
baudrate : Baudrate of transfer. Zero means no change. (uint32_t)
count : how many bytes in this transfer (uint8_t)
data : serial data (uint8_t)
'''
return MAVLink_serial_control_message(device, flags, timeout, baudrate, count, data)
def serial_control_send(self, device, flags, timeout, baudrate, count, data, force_mavlink1=False):
'''
Control a serial port. This can be used for raw access to an onboard
serial peripheral such as a GPS or telemetry radio. It
is designed to make it possible to update the devices
firmware via MAVLink messages or change the devices
settings. A message with zero bytes can be used to
change just the baudrate.
device : See SERIAL_CONTROL_DEV enum (uint8_t)
flags : See SERIAL_CONTROL_FLAG enum (uint8_t)
timeout : Timeout for reply data in milliseconds (uint16_t)
baudrate : Baudrate of transfer. Zero means no change. (uint32_t)
count : how many bytes in this transfer (uint8_t)
data : serial data (uint8_t)
'''
return self.send(self.serial_control_encode(device, flags, timeout, baudrate, count, data), force_mavlink1=force_mavlink1)
def gps_rtk_encode(self, time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses):
'''
RTK GPS data. Gives information on the relative baseline calculation
the GPS is reporting
time_last_baseline_ms : Time since boot of last baseline message received in ms. (uint32_t)
rtk_receiver_id : Identification of connected RTK receiver. (uint8_t)
wn : GPS Week Number of last baseline (uint16_t)
tow : GPS Time of Week of last baseline (uint32_t)
rtk_health : GPS-specific health report for RTK data. (uint8_t)
rtk_rate : Rate of baseline messages being received by GPS, in HZ (uint8_t)
nsats : Current number of sats used for RTK calculation. (uint8_t)
baseline_coords_type : Coordinate system of baseline (uint8_t)
baseline_a_mm : Current baseline in ECEF x or NED north component in mm. (int32_t)
baseline_b_mm : Current baseline in ECEF y or NED east component in mm. (int32_t)
baseline_c_mm : Current baseline in ECEF z or NED down component in mm. (int32_t)
accuracy : Current estimate of baseline accuracy. (uint32_t)
iar_num_hypotheses : Current number of integer ambiguity hypotheses. (int32_t)
'''
return MAVLink_gps_rtk_message(time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses)
def gps_rtk_send(self, time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses, force_mavlink1=False):
'''
RTK GPS data. Gives information on the relative baseline calculation
the GPS is reporting
time_last_baseline_ms : Time since boot of last baseline message received in ms. (uint32_t)
rtk_receiver_id : Identification of connected RTK receiver. (uint8_t)
wn : GPS Week Number of last baseline (uint16_t)
tow : GPS Time of Week of last baseline (uint32_t)
rtk_health : GPS-specific health report for RTK data. (uint8_t)
rtk_rate : Rate of baseline messages being received by GPS, in HZ (uint8_t)
nsats : Current number of sats used for RTK calculation. (uint8_t)
baseline_coords_type : Coordinate system of baseline (uint8_t)
baseline_a_mm : Current baseline in ECEF x or NED north component in mm. (int32_t)
baseline_b_mm : Current baseline in ECEF y or NED east component in mm. (int32_t)
baseline_c_mm : Current baseline in ECEF z or NED down component in mm. (int32_t)
accuracy : Current estimate of baseline accuracy. (uint32_t)
iar_num_hypotheses : Current number of integer ambiguity hypotheses. (int32_t)
'''
return self.send(self.gps_rtk_encode(time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses), force_mavlink1=force_mavlink1)
def gps2_rtk_encode(self, time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses):
'''
RTK GPS data. Gives information on the relative baseline calculation
the GPS is reporting
time_last_baseline_ms : Time since boot of last baseline message received in ms. (uint32_t)
rtk_receiver_id : Identification of connected RTK receiver. (uint8_t)
wn : GPS Week Number of last baseline (uint16_t)
tow : GPS Time of Week of last baseline (uint32_t)
rtk_health : GPS-specific health report for RTK data. (uint8_t)
rtk_rate : Rate of baseline messages being received by GPS, in HZ (uint8_t)
nsats : Current number of sats used for RTK calculation. (uint8_t)
baseline_coords_type : Coordinate system of baseline (uint8_t)
baseline_a_mm : Current baseline in ECEF x or NED north component in mm. (int32_t)
baseline_b_mm : Current baseline in ECEF y or NED east component in mm. (int32_t)
baseline_c_mm : Current baseline in ECEF z or NED down component in mm. (int32_t)
accuracy : Current estimate of baseline accuracy. (uint32_t)
iar_num_hypotheses : Current number of integer ambiguity hypotheses. (int32_t)
'''
return MAVLink_gps2_rtk_message(time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses)
def gps2_rtk_send(self, time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses, force_mavlink1=False):
'''
RTK GPS data. Gives information on the relative baseline calculation
the GPS is reporting
time_last_baseline_ms : Time since boot of last baseline message received in ms. (uint32_t)
rtk_receiver_id : Identification of connected RTK receiver. (uint8_t)
wn : GPS Week Number of last baseline (uint16_t)
tow : GPS Time of Week of last baseline (uint32_t)
rtk_health : GPS-specific health report for RTK data. (uint8_t)
rtk_rate : Rate of baseline messages being received by GPS, in HZ (uint8_t)
nsats : Current number of sats used for RTK calculation. (uint8_t)
baseline_coords_type : Coordinate system of baseline (uint8_t)
baseline_a_mm : Current baseline in ECEF x or NED north component in mm. (int32_t)
baseline_b_mm : Current baseline in ECEF y or NED east component in mm. (int32_t)
baseline_c_mm : Current baseline in ECEF z or NED down component in mm. (int32_t)
accuracy : Current estimate of baseline accuracy. (uint32_t)
iar_num_hypotheses : Current number of integer ambiguity hypotheses. (int32_t)
'''
return self.send(self.gps2_rtk_encode(time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses), force_mavlink1=force_mavlink1)
def scaled_imu3_encode(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag):
'''
The RAW IMU readings for 3rd 9DOF sensor setup. This message should
contain the scaled values to the described units
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
xgyro : Angular speed around X axis (millirad /sec) (int16_t)
ygyro : Angular speed around Y axis (millirad /sec) (int16_t)
zgyro : Angular speed around Z axis (millirad /sec) (int16_t)
xmag : X Magnetic field (milli tesla) (int16_t)
ymag : Y Magnetic field (milli tesla) (int16_t)
zmag : Z Magnetic field (milli tesla) (int16_t)
'''
return MAVLink_scaled_imu3_message(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag)
def scaled_imu3_send(self, time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, force_mavlink1=False):
'''
The RAW IMU readings for 3rd 9DOF sensor setup. This message should
contain the scaled values to the described units
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
xacc : X acceleration (mg) (int16_t)
yacc : Y acceleration (mg) (int16_t)
zacc : Z acceleration (mg) (int16_t)
xgyro : Angular speed around X axis (millirad /sec) (int16_t)
ygyro : Angular speed around Y axis (millirad /sec) (int16_t)
zgyro : Angular speed around Z axis (millirad /sec) (int16_t)
xmag : X Magnetic field (milli tesla) (int16_t)
ymag : Y Magnetic field (milli tesla) (int16_t)
zmag : Z Magnetic field (milli tesla) (int16_t)
'''
return self.send(self.scaled_imu3_encode(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag), force_mavlink1=force_mavlink1)
def data_transmission_handshake_encode(self, type, size, width, height, packets, payload, jpg_quality):
'''
type : type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h) (uint8_t)
size : total data size in bytes (set on ACK only) (uint32_t)
width : Width of a matrix or image (uint16_t)
height : Height of a matrix or image (uint16_t)
packets : number of packets beeing sent (set on ACK only) (uint16_t)
payload : payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only) (uint8_t)
jpg_quality : JPEG quality out of [1,100] (uint8_t)
'''
return MAVLink_data_transmission_handshake_message(type, size, width, height, packets, payload, jpg_quality)
def data_transmission_handshake_send(self, type, size, width, height, packets, payload, jpg_quality, force_mavlink1=False):
'''
type : type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h) (uint8_t)
size : total data size in bytes (set on ACK only) (uint32_t)
width : Width of a matrix or image (uint16_t)
height : Height of a matrix or image (uint16_t)
packets : number of packets beeing sent (set on ACK only) (uint16_t)
payload : payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only) (uint8_t)
jpg_quality : JPEG quality out of [1,100] (uint8_t)
'''
return self.send(self.data_transmission_handshake_encode(type, size, width, height, packets, payload, jpg_quality), force_mavlink1=force_mavlink1)
def encapsulated_data_encode(self, seqnr, data):
'''
seqnr : sequence number (starting with 0 on every transmission) (uint16_t)
data : image data bytes (uint8_t)
'''
return MAVLink_encapsulated_data_message(seqnr, data)
def encapsulated_data_send(self, seqnr, data, force_mavlink1=False):
'''
seqnr : sequence number (starting with 0 on every transmission) (uint16_t)
data : image data bytes (uint8_t)
'''
return self.send(self.encapsulated_data_encode(seqnr, data), force_mavlink1=force_mavlink1)
def distance_sensor_encode(self, time_boot_ms, min_distance, max_distance, current_distance, type, id, orientation, covariance):
'''
time_boot_ms : Time since system boot (uint32_t)
min_distance : Minimum distance the sensor can measure in centimeters (uint16_t)
max_distance : Maximum distance the sensor can measure in centimeters (uint16_t)
current_distance : Current distance reading (uint16_t)
type : Type from MAV_DISTANCE_SENSOR enum. (uint8_t)
id : Onboard ID of the sensor (uint8_t)
orientation : Direction the sensor faces from MAV_SENSOR_ORIENTATION enum. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270 (uint8_t)
covariance : Measurement covariance in centimeters, 0 for unknown / invalid readings (uint8_t)
'''
return MAVLink_distance_sensor_message(time_boot_ms, min_distance, max_distance, current_distance, type, id, orientation, covariance)
def distance_sensor_send(self, time_boot_ms, min_distance, max_distance, current_distance, type, id, orientation, covariance, force_mavlink1=False):
'''
time_boot_ms : Time since system boot (uint32_t)
min_distance : Minimum distance the sensor can measure in centimeters (uint16_t)
max_distance : Maximum distance the sensor can measure in centimeters (uint16_t)
current_distance : Current distance reading (uint16_t)
type : Type from MAV_DISTANCE_SENSOR enum. (uint8_t)
id : Onboard ID of the sensor (uint8_t)
orientation : Direction the sensor faces from MAV_SENSOR_ORIENTATION enum. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270 (uint8_t)
covariance : Measurement covariance in centimeters, 0 for unknown / invalid readings (uint8_t)
'''
return self.send(self.distance_sensor_encode(time_boot_ms, min_distance, max_distance, current_distance, type, id, orientation, covariance), force_mavlink1=force_mavlink1)
def terrain_request_encode(self, lat, lon, grid_spacing, mask):
'''
Request for terrain data and terrain status
lat : Latitude of SW corner of first grid (degrees *10^7) (int32_t)
lon : Longitude of SW corner of first grid (in degrees *10^7) (int32_t)
grid_spacing : Grid spacing in meters (uint16_t)
mask : Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits) (uint64_t)
'''
return MAVLink_terrain_request_message(lat, lon, grid_spacing, mask)
def terrain_request_send(self, lat, lon, grid_spacing, mask, force_mavlink1=False):
'''
Request for terrain data and terrain status
lat : Latitude of SW corner of first grid (degrees *10^7) (int32_t)
lon : Longitude of SW corner of first grid (in degrees *10^7) (int32_t)
grid_spacing : Grid spacing in meters (uint16_t)
mask : Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits) (uint64_t)
'''
return self.send(self.terrain_request_encode(lat, lon, grid_spacing, mask), force_mavlink1=force_mavlink1)
def terrain_data_encode(self, lat, lon, grid_spacing, gridbit, data):
'''
Terrain data sent from GCS. The lat/lon and grid_spacing must be the
same as a lat/lon from a TERRAIN_REQUEST
lat : Latitude of SW corner of first grid (degrees *10^7) (int32_t)
lon : Longitude of SW corner of first grid (in degrees *10^7) (int32_t)
grid_spacing : Grid spacing in meters (uint16_t)
gridbit : bit within the terrain request mask (uint8_t)
data : Terrain data in meters AMSL (int16_t)
'''
return MAVLink_terrain_data_message(lat, lon, grid_spacing, gridbit, data)
def terrain_data_send(self, lat, lon, grid_spacing, gridbit, data, force_mavlink1=False):
'''
Terrain data sent from GCS. The lat/lon and grid_spacing must be the
same as a lat/lon from a TERRAIN_REQUEST
lat : Latitude of SW corner of first grid (degrees *10^7) (int32_t)
lon : Longitude of SW corner of first grid (in degrees *10^7) (int32_t)
grid_spacing : Grid spacing in meters (uint16_t)
gridbit : bit within the terrain request mask (uint8_t)
data : Terrain data in meters AMSL (int16_t)
'''
return self.send(self.terrain_data_encode(lat, lon, grid_spacing, gridbit, data), force_mavlink1=force_mavlink1)
def terrain_check_encode(self, lat, lon):
'''
Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data
needed for a mission.
lat : Latitude (degrees *10^7) (int32_t)
lon : Longitude (degrees *10^7) (int32_t)
'''
return MAVLink_terrain_check_message(lat, lon)
def terrain_check_send(self, lat, lon, force_mavlink1=False):
'''
Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data
needed for a mission.
lat : Latitude (degrees *10^7) (int32_t)
lon : Longitude (degrees *10^7) (int32_t)
'''
return self.send(self.terrain_check_encode(lat, lon), force_mavlink1=force_mavlink1)
def terrain_report_encode(self, lat, lon, spacing, terrain_height, current_height, pending, loaded):
'''
Response from a TERRAIN_CHECK request
lat : Latitude (degrees *10^7) (int32_t)
lon : Longitude (degrees *10^7) (int32_t)
spacing : grid spacing (zero if terrain at this location unavailable) (uint16_t)
terrain_height : Terrain height in meters AMSL (float)
current_height : Current vehicle height above lat/lon terrain height (meters) (float)
pending : Number of 4x4 terrain blocks waiting to be received or read from disk (uint16_t)
loaded : Number of 4x4 terrain blocks in memory (uint16_t)
'''
return MAVLink_terrain_report_message(lat, lon, spacing, terrain_height, current_height, pending, loaded)
def terrain_report_send(self, lat, lon, spacing, terrain_height, current_height, pending, loaded, force_mavlink1=False):
'''
Response from a TERRAIN_CHECK request
lat : Latitude (degrees *10^7) (int32_t)
lon : Longitude (degrees *10^7) (int32_t)
spacing : grid spacing (zero if terrain at this location unavailable) (uint16_t)
terrain_height : Terrain height in meters AMSL (float)
current_height : Current vehicle height above lat/lon terrain height (meters) (float)
pending : Number of 4x4 terrain blocks waiting to be received or read from disk (uint16_t)
loaded : Number of 4x4 terrain blocks in memory (uint16_t)
'''
return self.send(self.terrain_report_encode(lat, lon, spacing, terrain_height, current_height, pending, loaded), force_mavlink1=force_mavlink1)
def scaled_pressure2_encode(self, time_boot_ms, press_abs, press_diff, temperature):
'''
Barometer readings for 2nd barometer
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
press_abs : Absolute pressure (hectopascal) (float)
press_diff : Differential pressure 1 (hectopascal) (float)
temperature : Temperature measurement (0.01 degrees celsius) (int16_t)
'''
return MAVLink_scaled_pressure2_message(time_boot_ms, press_abs, press_diff, temperature)
def scaled_pressure2_send(self, time_boot_ms, press_abs, press_diff, temperature, force_mavlink1=False):
'''
Barometer readings for 2nd barometer
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
press_abs : Absolute pressure (hectopascal) (float)
press_diff : Differential pressure 1 (hectopascal) (float)
temperature : Temperature measurement (0.01 degrees celsius) (int16_t)
'''
return self.send(self.scaled_pressure2_encode(time_boot_ms, press_abs, press_diff, temperature), force_mavlink1=force_mavlink1)
def att_pos_mocap_encode(self, time_usec, q, x, y, z, covariance=0):
'''
Motion capture attitude and position
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
q : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
x : X position in meters (NED) (float)
y : Y position in meters (NED) (float)
z : Z position in meters (NED) (float)
covariance : Pose covariance matrix upper right triangular (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return MAVLink_att_pos_mocap_message(time_usec, q, x, y, z, covariance)
def att_pos_mocap_send(self, time_usec, q, x, y, z, covariance=0, force_mavlink1=False):
'''
Motion capture attitude and position
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
q : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
x : X position in meters (NED) (float)
y : Y position in meters (NED) (float)
z : Z position in meters (NED) (float)
covariance : Pose covariance matrix upper right triangular (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return self.send(self.att_pos_mocap_encode(time_usec, q, x, y, z, covariance), force_mavlink1=force_mavlink1)
def set_actuator_control_target_encode(self, time_usec, group_mlx, target_system, target_component, controls):
'''
Set the vehicle attitude and body angular rates.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
group_mlx : Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. (uint8_t)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
controls : Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. (float)
'''
return MAVLink_set_actuator_control_target_message(time_usec, group_mlx, target_system, target_component, controls)
def set_actuator_control_target_send(self, time_usec, group_mlx, target_system, target_component, controls, force_mavlink1=False):
'''
Set the vehicle attitude and body angular rates.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
group_mlx : Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. (uint8_t)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
controls : Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. (float)
'''
return self.send(self.set_actuator_control_target_encode(time_usec, group_mlx, target_system, target_component, controls), force_mavlink1=force_mavlink1)
def actuator_control_target_encode(self, time_usec, group_mlx, controls):
'''
Set the vehicle attitude and body angular rates.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
group_mlx : Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. (uint8_t)
controls : Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. (float)
'''
return MAVLink_actuator_control_target_message(time_usec, group_mlx, controls)
def actuator_control_target_send(self, time_usec, group_mlx, controls, force_mavlink1=False):
'''
Set the vehicle attitude and body angular rates.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
group_mlx : Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. (uint8_t)
controls : Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. (float)
'''
return self.send(self.actuator_control_target_encode(time_usec, group_mlx, controls), force_mavlink1=force_mavlink1)
def altitude_encode(self, time_usec, altitude_monotonic, altitude_amsl, altitude_local, altitude_relative, altitude_terrain, bottom_clearance):
'''
The current system altitude.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
altitude_monotonic : This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights. (float)
altitude_amsl : This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output AMSL by default and not the WGS84 altitude. (float)
altitude_local : This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive. (float)
altitude_relative : This is the altitude above the home position. It resets on each change of the current home position. (float)
altitude_terrain : This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown. (float)
bottom_clearance : This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available. (float)
'''
return MAVLink_altitude_message(time_usec, altitude_monotonic, altitude_amsl, altitude_local, altitude_relative, altitude_terrain, bottom_clearance)
def altitude_send(self, time_usec, altitude_monotonic, altitude_amsl, altitude_local, altitude_relative, altitude_terrain, bottom_clearance, force_mavlink1=False):
'''
The current system altitude.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
altitude_monotonic : This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights. (float)
altitude_amsl : This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output AMSL by default and not the WGS84 altitude. (float)
altitude_local : This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive. (float)
altitude_relative : This is the altitude above the home position. It resets on each change of the current home position. (float)
altitude_terrain : This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown. (float)
bottom_clearance : This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available. (float)
'''
return self.send(self.altitude_encode(time_usec, altitude_monotonic, altitude_amsl, altitude_local, altitude_relative, altitude_terrain, bottom_clearance), force_mavlink1=force_mavlink1)
def resource_request_encode(self, request_id, uri_type, uri, transfer_type, storage):
'''
The autopilot is requesting a resource (file, binary, other type of
data)
request_id : Request ID. This ID should be re-used when sending back URI contents (uint8_t)
uri_type : The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary (uint8_t)
uri : The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) (uint8_t)
transfer_type : The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. (uint8_t)
storage : The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). (uint8_t)
'''
return MAVLink_resource_request_message(request_id, uri_type, uri, transfer_type, storage)
def resource_request_send(self, request_id, uri_type, uri, transfer_type, storage, force_mavlink1=False):
'''
The autopilot is requesting a resource (file, binary, other type of
data)
request_id : Request ID. This ID should be re-used when sending back URI contents (uint8_t)
uri_type : The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary (uint8_t)
uri : The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) (uint8_t)
transfer_type : The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. (uint8_t)
storage : The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). (uint8_t)
'''
return self.send(self.resource_request_encode(request_id, uri_type, uri, transfer_type, storage), force_mavlink1=force_mavlink1)
def scaled_pressure3_encode(self, time_boot_ms, press_abs, press_diff, temperature):
'''
Barometer readings for 3rd barometer
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
press_abs : Absolute pressure (hectopascal) (float)
press_diff : Differential pressure 1 (hectopascal) (float)
temperature : Temperature measurement (0.01 degrees celsius) (int16_t)
'''
return MAVLink_scaled_pressure3_message(time_boot_ms, press_abs, press_diff, temperature)
def scaled_pressure3_send(self, time_boot_ms, press_abs, press_diff, temperature, force_mavlink1=False):
'''
Barometer readings for 3rd barometer
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
press_abs : Absolute pressure (hectopascal) (float)
press_diff : Differential pressure 1 (hectopascal) (float)
temperature : Temperature measurement (0.01 degrees celsius) (int16_t)
'''
return self.send(self.scaled_pressure3_encode(time_boot_ms, press_abs, press_diff, temperature), force_mavlink1=force_mavlink1)
def follow_target_encode(self, timestamp, est_capabilities, lat, lon, alt, vel, acc, attitude_q, rates, position_cov, custom_state):
'''
current motion information from a designated system
timestamp : Timestamp in milliseconds since system boot (uint64_t)
est_capabilities : bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3) (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : AMSL, in meters (float)
vel : target velocity (0,0,0) for unknown (float)
acc : linear target acceleration (0,0,0) for unknown (float)
attitude_q : (1 0 0 0 for unknown) (float)
rates : (0 0 0 for unknown) (float)
position_cov : eph epv (float)
custom_state : button states or switches of a tracker device (uint64_t)
'''
return MAVLink_follow_target_message(timestamp, est_capabilities, lat, lon, alt, vel, acc, attitude_q, rates, position_cov, custom_state)
def follow_target_send(self, timestamp, est_capabilities, lat, lon, alt, vel, acc, attitude_q, rates, position_cov, custom_state, force_mavlink1=False):
'''
current motion information from a designated system
timestamp : Timestamp in milliseconds since system boot (uint64_t)
est_capabilities : bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3) (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : AMSL, in meters (float)
vel : target velocity (0,0,0) for unknown (float)
acc : linear target acceleration (0,0,0) for unknown (float)
attitude_q : (1 0 0 0 for unknown) (float)
rates : (0 0 0 for unknown) (float)
position_cov : eph epv (float)
custom_state : button states or switches of a tracker device (uint64_t)
'''
return self.send(self.follow_target_encode(timestamp, est_capabilities, lat, lon, alt, vel, acc, attitude_q, rates, position_cov, custom_state), force_mavlink1=force_mavlink1)
def control_system_state_encode(self, time_usec, x_acc, y_acc, z_acc, x_vel, y_vel, z_vel, x_pos, y_pos, z_pos, airspeed, vel_variance, pos_variance, q, roll_rate, pitch_rate, yaw_rate):
'''
The smoothed, monotonic system state used to feed the control loops of
the system.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
x_acc : X acceleration in body frame (float)
y_acc : Y acceleration in body frame (float)
z_acc : Z acceleration in body frame (float)
x_vel : X velocity in body frame (float)
y_vel : Y velocity in body frame (float)
z_vel : Z velocity in body frame (float)
x_pos : X position in local frame (float)
y_pos : Y position in local frame (float)
z_pos : Z position in local frame (float)
airspeed : Airspeed, set to -1 if unknown (float)
vel_variance : Variance of body velocity estimate (float)
pos_variance : Variance in local position (float)
q : The attitude, represented as Quaternion (float)
roll_rate : Angular rate in roll axis (float)
pitch_rate : Angular rate in pitch axis (float)
yaw_rate : Angular rate in yaw axis (float)
'''
return MAVLink_control_system_state_message(time_usec, x_acc, y_acc, z_acc, x_vel, y_vel, z_vel, x_pos, y_pos, z_pos, airspeed, vel_variance, pos_variance, q, roll_rate, pitch_rate, yaw_rate)
def control_system_state_send(self, time_usec, x_acc, y_acc, z_acc, x_vel, y_vel, z_vel, x_pos, y_pos, z_pos, airspeed, vel_variance, pos_variance, q, roll_rate, pitch_rate, yaw_rate, force_mavlink1=False):
'''
The smoothed, monotonic system state used to feed the control loops of
the system.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
x_acc : X acceleration in body frame (float)
y_acc : Y acceleration in body frame (float)
z_acc : Z acceleration in body frame (float)
x_vel : X velocity in body frame (float)
y_vel : Y velocity in body frame (float)
z_vel : Z velocity in body frame (float)
x_pos : X position in local frame (float)
y_pos : Y position in local frame (float)
z_pos : Z position in local frame (float)
airspeed : Airspeed, set to -1 if unknown (float)
vel_variance : Variance of body velocity estimate (float)
pos_variance : Variance in local position (float)
q : The attitude, represented as Quaternion (float)
roll_rate : Angular rate in roll axis (float)
pitch_rate : Angular rate in pitch axis (float)
yaw_rate : Angular rate in yaw axis (float)
'''
return self.send(self.control_system_state_encode(time_usec, x_acc, y_acc, z_acc, x_vel, y_vel, z_vel, x_pos, y_pos, z_pos, airspeed, vel_variance, pos_variance, q, roll_rate, pitch_rate, yaw_rate), force_mavlink1=force_mavlink1)
def battery_status_encode(self, id, battery_function, type, temperature, voltages, current_battery, current_consumed, energy_consumed, battery_remaining, time_remaining=0, charge_state=0):
'''
Battery information
id : Battery ID (uint8_t)
battery_function : Function of the battery (uint8_t)
type : Type (chemistry) of the battery (uint8_t)
temperature : Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature. (int16_t)
voltages : Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value. (uint16_t)
current_battery : Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current (int16_t)
current_consumed : Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate (int32_t)
energy_consumed : Consumed energy, in HectoJoules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate (int32_t)
battery_remaining : Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery (int8_t)
time_remaining : Remaining battery time, in seconds (1 = 1s = 0% energy left), 0: autopilot does not provide remaining battery time estimate (int32_t)
charge_state : State for extent of discharge, provided by autopilot for warning or external reactions (uint8_t)
'''
return MAVLink_battery_status_message(id, battery_function, type, temperature, voltages, current_battery, current_consumed, energy_consumed, battery_remaining, time_remaining, charge_state)
def battery_status_send(self, id, battery_function, type, temperature, voltages, current_battery, current_consumed, energy_consumed, battery_remaining, time_remaining=0, charge_state=0, force_mavlink1=False):
'''
Battery information
id : Battery ID (uint8_t)
battery_function : Function of the battery (uint8_t)
type : Type (chemistry) of the battery (uint8_t)
temperature : Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature. (int16_t)
voltages : Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value. (uint16_t)
current_battery : Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current (int16_t)
current_consumed : Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate (int32_t)
energy_consumed : Consumed energy, in HectoJoules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate (int32_t)
battery_remaining : Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery (int8_t)
time_remaining : Remaining battery time, in seconds (1 = 1s = 0% energy left), 0: autopilot does not provide remaining battery time estimate (int32_t)
charge_state : State for extent of discharge, provided by autopilot for warning or external reactions (uint8_t)
'''
return self.send(self.battery_status_encode(id, battery_function, type, temperature, voltages, current_battery, current_consumed, energy_consumed, battery_remaining, time_remaining, charge_state), force_mavlink1=force_mavlink1)
def autopilot_version_encode(self, capabilities, flight_sw_version, middleware_sw_version, os_sw_version, board_version, flight_custom_version, middleware_custom_version, os_custom_version, vendor_id, product_id, uid, uid2=0):
'''
Version and capability of autopilot software
capabilities : bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum) (uint64_t)
flight_sw_version : Firmware version number (uint32_t)
middleware_sw_version : Middleware version number (uint32_t)
os_sw_version : Operating system version number (uint32_t)
board_version : HW / board version (last 8 bytes should be silicon ID, if any) (uint32_t)
flight_custom_version : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
middleware_custom_version : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
os_custom_version : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
vendor_id : ID of the board vendor (uint16_t)
product_id : ID of the product (uint16_t)
uid : UID if provided by hardware (see uid2) (uint64_t)
uid2 : UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) (uint8_t)
'''
return MAVLink_autopilot_version_message(capabilities, flight_sw_version, middleware_sw_version, os_sw_version, board_version, flight_custom_version, middleware_custom_version, os_custom_version, vendor_id, product_id, uid, uid2)
def autopilot_version_send(self, capabilities, flight_sw_version, middleware_sw_version, os_sw_version, board_version, flight_custom_version, middleware_custom_version, os_custom_version, vendor_id, product_id, uid, uid2=0, force_mavlink1=False):
'''
Version and capability of autopilot software
capabilities : bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum) (uint64_t)
flight_sw_version : Firmware version number (uint32_t)
middleware_sw_version : Middleware version number (uint32_t)
os_sw_version : Operating system version number (uint32_t)
board_version : HW / board version (last 8 bytes should be silicon ID, if any) (uint32_t)
flight_custom_version : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
middleware_custom_version : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
os_custom_version : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
vendor_id : ID of the board vendor (uint16_t)
product_id : ID of the product (uint16_t)
uid : UID if provided by hardware (see uid2) (uint64_t)
uid2 : UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid) (uint8_t)
'''
return self.send(self.autopilot_version_encode(capabilities, flight_sw_version, middleware_sw_version, os_sw_version, board_version, flight_custom_version, middleware_custom_version, os_custom_version, vendor_id, product_id, uid, uid2), force_mavlink1=force_mavlink1)
def landing_target_encode(self, time_usec, target_num, frame, angle_x, angle_y, distance, size_x, size_y, x=0, y=0, z=0, q=0, type=0, position_valid=0):
'''
The location of a landing area captured from a downward facing camera
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
target_num : The ID of the target if multiple targets are present (uint8_t)
frame : MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc. (uint8_t)
angle_x : X-axis angular offset (in radians) of the target from the center of the image (float)
angle_y : Y-axis angular offset (in radians) of the target from the center of the image (float)
distance : Distance to the target from the vehicle in meters (float)
size_x : Size in radians of target along x-axis (float)
size_y : Size in radians of target along y-axis (float)
x : X Position of the landing target on MAV_FRAME (float)
y : Y Position of the landing target on MAV_FRAME (float)
z : Z Position of the landing target on MAV_FRAME (float)
q : Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
type : LANDING_TARGET_TYPE enum specifying the type of landing target (uint8_t)
position_valid : Boolean indicating known position (1) or default unkown position (0), for validation of positioning of the landing target (uint8_t)
'''
return MAVLink_landing_target_message(time_usec, target_num, frame, angle_x, angle_y, distance, size_x, size_y, x, y, z, q, type, position_valid)
def landing_target_send(self, time_usec, target_num, frame, angle_x, angle_y, distance, size_x, size_y, x=0, y=0, z=0, q=0, type=0, position_valid=0, force_mavlink1=False):
'''
The location of a landing area captured from a downward facing camera
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
target_num : The ID of the target if multiple targets are present (uint8_t)
frame : MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc. (uint8_t)
angle_x : X-axis angular offset (in radians) of the target from the center of the image (float)
angle_y : Y-axis angular offset (in radians) of the target from the center of the image (float)
distance : Distance to the target from the vehicle in meters (float)
size_x : Size in radians of target along x-axis (float)
size_y : Size in radians of target along y-axis (float)
x : X Position of the landing target on MAV_FRAME (float)
y : Y Position of the landing target on MAV_FRAME (float)
z : Z Position of the landing target on MAV_FRAME (float)
q : Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
type : LANDING_TARGET_TYPE enum specifying the type of landing target (uint8_t)
position_valid : Boolean indicating known position (1) or default unkown position (0), for validation of positioning of the landing target (uint8_t)
'''
return self.send(self.landing_target_encode(time_usec, target_num, frame, angle_x, angle_y, distance, size_x, size_y, x, y, z, q, type, position_valid), force_mavlink1=force_mavlink1)
def estimator_status_encode(self, time_usec, flags, vel_ratio, pos_horiz_ratio, pos_vert_ratio, mag_ratio, hagl_ratio, tas_ratio, pos_horiz_accuracy, pos_vert_accuracy):
'''
Estimator status message including flags, innovation test ratios and
estimated accuracies. The flags message is an integer
bitmask containing information on which EKF outputs
are valid. See the ESTIMATOR_STATUS_FLAGS enum
definition for further information. The innovaton test
ratios show the magnitude of the sensor innovation
divided by the innovation check threshold. Under
normal operation the innovaton test ratios should be
below 0.5 with occasional values up to 1.0. Values
greater than 1.0 should be rare under normal operation
and indicate that a measurement has been rejected by
the filter. The user should be notified if an
innovation test ratio greater than 1.0 is recorded.
Notifications for values in the range between 0.5 and
1.0 should be optional and controllable by the user.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
flags : Integer bitmask indicating which EKF outputs are valid. See definition for ESTIMATOR_STATUS_FLAGS. (uint16_t)
vel_ratio : Velocity innovation test ratio (float)
pos_horiz_ratio : Horizontal position innovation test ratio (float)
pos_vert_ratio : Vertical position innovation test ratio (float)
mag_ratio : Magnetometer innovation test ratio (float)
hagl_ratio : Height above terrain innovation test ratio (float)
tas_ratio : True airspeed innovation test ratio (float)
pos_horiz_accuracy : Horizontal position 1-STD accuracy relative to the EKF local origin (m) (float)
pos_vert_accuracy : Vertical position 1-STD accuracy relative to the EKF local origin (m) (float)
'''
return MAVLink_estimator_status_message(time_usec, flags, vel_ratio, pos_horiz_ratio, pos_vert_ratio, mag_ratio, hagl_ratio, tas_ratio, pos_horiz_accuracy, pos_vert_accuracy)
def estimator_status_send(self, time_usec, flags, vel_ratio, pos_horiz_ratio, pos_vert_ratio, mag_ratio, hagl_ratio, tas_ratio, pos_horiz_accuracy, pos_vert_accuracy, force_mavlink1=False):
'''
Estimator status message including flags, innovation test ratios and
estimated accuracies. The flags message is an integer
bitmask containing information on which EKF outputs
are valid. See the ESTIMATOR_STATUS_FLAGS enum
definition for further information. The innovaton test
ratios show the magnitude of the sensor innovation
divided by the innovation check threshold. Under
normal operation the innovaton test ratios should be
below 0.5 with occasional values up to 1.0. Values
greater than 1.0 should be rare under normal operation
and indicate that a measurement has been rejected by
the filter. The user should be notified if an
innovation test ratio greater than 1.0 is recorded.
Notifications for values in the range between 0.5 and
1.0 should be optional and controllable by the user.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
flags : Integer bitmask indicating which EKF outputs are valid. See definition for ESTIMATOR_STATUS_FLAGS. (uint16_t)
vel_ratio : Velocity innovation test ratio (float)
pos_horiz_ratio : Horizontal position innovation test ratio (float)
pos_vert_ratio : Vertical position innovation test ratio (float)
mag_ratio : Magnetometer innovation test ratio (float)
hagl_ratio : Height above terrain innovation test ratio (float)
tas_ratio : True airspeed innovation test ratio (float)
pos_horiz_accuracy : Horizontal position 1-STD accuracy relative to the EKF local origin (m) (float)
pos_vert_accuracy : Vertical position 1-STD accuracy relative to the EKF local origin (m) (float)
'''
return self.send(self.estimator_status_encode(time_usec, flags, vel_ratio, pos_horiz_ratio, pos_vert_ratio, mag_ratio, hagl_ratio, tas_ratio, pos_horiz_accuracy, pos_vert_accuracy), force_mavlink1=force_mavlink1)
def wind_cov_encode(self, time_usec, wind_x, wind_y, wind_z, var_horiz, var_vert, wind_alt, horiz_accuracy, vert_accuracy):
'''
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
wind_x : Wind in X (NED) direction in m/s (float)
wind_y : Wind in Y (NED) direction in m/s (float)
wind_z : Wind in Z (NED) direction in m/s (float)
var_horiz : Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate. (float)
var_vert : Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate. (float)
wind_alt : AMSL altitude (m) this measurement was taken at (float)
horiz_accuracy : Horizontal speed 1-STD accuracy (float)
vert_accuracy : Vertical speed 1-STD accuracy (float)
'''
return MAVLink_wind_cov_message(time_usec, wind_x, wind_y, wind_z, var_horiz, var_vert, wind_alt, horiz_accuracy, vert_accuracy)
def wind_cov_send(self, time_usec, wind_x, wind_y, wind_z, var_horiz, var_vert, wind_alt, horiz_accuracy, vert_accuracy, force_mavlink1=False):
'''
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
wind_x : Wind in X (NED) direction in m/s (float)
wind_y : Wind in Y (NED) direction in m/s (float)
wind_z : Wind in Z (NED) direction in m/s (float)
var_horiz : Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate. (float)
var_vert : Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate. (float)
wind_alt : AMSL altitude (m) this measurement was taken at (float)
horiz_accuracy : Horizontal speed 1-STD accuracy (float)
vert_accuracy : Vertical speed 1-STD accuracy (float)
'''
return self.send(self.wind_cov_encode(time_usec, wind_x, wind_y, wind_z, var_horiz, var_vert, wind_alt, horiz_accuracy, vert_accuracy), force_mavlink1=force_mavlink1)
def gps_input_encode(self, time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible):
'''
GPS sensor input message. This is a raw sensor value sent by the GPS.
This is NOT the global position estimate of the sytem.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
gps_id : ID of the GPS for multiple GPS inputs (uint8_t)
ignore_flags : Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided. (uint16_t)
time_week_ms : GPS time (milliseconds from start of GPS week) (uint32_t)
time_week : GPS week number (uint16_t)
fix_type : 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in m (positive for up) (float)
hdop : GPS HDOP horizontal dilution of position in m (float)
vdop : GPS VDOP vertical dilution of position in m (float)
vn : GPS velocity in m/s in NORTH direction in earth-fixed NED frame (float)
ve : GPS velocity in m/s in EAST direction in earth-fixed NED frame (float)
vd : GPS velocity in m/s in DOWN direction in earth-fixed NED frame (float)
speed_accuracy : GPS speed accuracy in m/s (float)
horiz_accuracy : GPS horizontal accuracy in m (float)
vert_accuracy : GPS vertical accuracy in m (float)
satellites_visible : Number of satellites visible. (uint8_t)
'''
return MAVLink_gps_input_message(time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible)
def gps_input_send(self, time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible, force_mavlink1=False):
'''
GPS sensor input message. This is a raw sensor value sent by the GPS.
This is NOT the global position estimate of the sytem.
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
gps_id : ID of the GPS for multiple GPS inputs (uint8_t)
ignore_flags : Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided. (uint16_t)
time_week_ms : GPS time (milliseconds from start of GPS week) (uint32_t)
time_week : GPS week number (uint16_t)
fix_type : 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK (uint8_t)
lat : Latitude (WGS84), in degrees * 1E7 (int32_t)
lon : Longitude (WGS84), in degrees * 1E7 (int32_t)
alt : Altitude (AMSL, not WGS84), in m (positive for up) (float)
hdop : GPS HDOP horizontal dilution of position in m (float)
vdop : GPS VDOP vertical dilution of position in m (float)
vn : GPS velocity in m/s in NORTH direction in earth-fixed NED frame (float)
ve : GPS velocity in m/s in EAST direction in earth-fixed NED frame (float)
vd : GPS velocity in m/s in DOWN direction in earth-fixed NED frame (float)
speed_accuracy : GPS speed accuracy in m/s (float)
horiz_accuracy : GPS horizontal accuracy in m (float)
vert_accuracy : GPS vertical accuracy in m (float)
satellites_visible : Number of satellites visible. (uint8_t)
'''
return self.send(self.gps_input_encode(time_usec, gps_id, ignore_flags, time_week_ms, time_week, fix_type, lat, lon, alt, hdop, vdop, vn, ve, vd, speed_accuracy, horiz_accuracy, vert_accuracy, satellites_visible), force_mavlink1=force_mavlink1)
def gps_rtcm_data_encode(self, flags, len, data):
'''
RTCM message for injecting into the onboard GPS (used for DGPS)
flags : LSB: 1 means message is fragmented, next 2 bits are the fragment ID, the remaining 5 bits are used for the sequence ID. Messages are only to be flushed to the GPS when the entire message has been reconstructed on the autopilot. The fragment ID specifies which order the fragments should be assembled into a buffer, while the sequence ID is used to detect a mismatch between different buffers. The buffer is considered fully reconstructed when either all 4 fragments are present, or all the fragments before the first fragment with a non full payload is received. This management is used to ensure that normal GPS operation doesn't corrupt RTCM data, and to recover from a unreliable transport delivery order. (uint8_t)
len : data length (uint8_t)
data : RTCM message (may be fragmented) (uint8_t)
'''
return MAVLink_gps_rtcm_data_message(flags, len, data)
def gps_rtcm_data_send(self, flags, len, data, force_mavlink1=False):
'''
RTCM message for injecting into the onboard GPS (used for DGPS)
flags : LSB: 1 means message is fragmented, next 2 bits are the fragment ID, the remaining 5 bits are used for the sequence ID. Messages are only to be flushed to the GPS when the entire message has been reconstructed on the autopilot. The fragment ID specifies which order the fragments should be assembled into a buffer, while the sequence ID is used to detect a mismatch between different buffers. The buffer is considered fully reconstructed when either all 4 fragments are present, or all the fragments before the first fragment with a non full payload is received. This management is used to ensure that normal GPS operation doesn't corrupt RTCM data, and to recover from a unreliable transport delivery order. (uint8_t)
len : data length (uint8_t)
data : RTCM message (may be fragmented) (uint8_t)
'''
return self.send(self.gps_rtcm_data_encode(flags, len, data), force_mavlink1=force_mavlink1)
def high_latency_encode(self, base_mode, custom_mode, landed_state, roll, pitch, heading, throttle, heading_sp, latitude, longitude, altitude_amsl, altitude_sp, airspeed, airspeed_sp, groundspeed, climb_rate, gps_nsat, gps_fix_type, battery_remaining, temperature, temperature_air, failsafe, wp_num, wp_distance):
'''
Message appropriate for high latency connections like Iridium
base_mode : System mode bitfield, as defined by MAV_MODE_FLAG enum. (uint8_t)
custom_mode : A bitfield for use for autopilot-specific flags. (uint32_t)
landed_state : The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. (uint8_t)
roll : roll (centidegrees) (int16_t)
pitch : pitch (centidegrees) (int16_t)
heading : heading (centidegrees) (uint16_t)
throttle : throttle (percentage) (int8_t)
heading_sp : heading setpoint (centidegrees) (int16_t)
latitude : Latitude, expressed as degrees * 1E7 (int32_t)
longitude : Longitude, expressed as degrees * 1E7 (int32_t)
altitude_amsl : Altitude above mean sea level (meters) (int16_t)
altitude_sp : Altitude setpoint relative to the home position (meters) (int16_t)
airspeed : airspeed (m/s) (uint8_t)
airspeed_sp : airspeed setpoint (m/s) (uint8_t)
groundspeed : groundspeed (m/s) (uint8_t)
climb_rate : climb rate (m/s) (int8_t)
gps_nsat : Number of satellites visible. If unknown, set to 255 (uint8_t)
gps_fix_type : See the GPS_FIX_TYPE enum. (uint8_t)
battery_remaining : Remaining battery (percentage) (uint8_t)
temperature : Autopilot temperature (degrees C) (int8_t)
temperature_air : Air temperature (degrees C) from airspeed sensor (int8_t)
failsafe : failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence) (uint8_t)
wp_num : current waypoint number (uint8_t)
wp_distance : distance to target (meters) (uint16_t)
'''
return MAVLink_high_latency_message(base_mode, custom_mode, landed_state, roll, pitch, heading, throttle, heading_sp, latitude, longitude, altitude_amsl, altitude_sp, airspeed, airspeed_sp, groundspeed, climb_rate, gps_nsat, gps_fix_type, battery_remaining, temperature, temperature_air, failsafe, wp_num, wp_distance)
def high_latency_send(self, base_mode, custom_mode, landed_state, roll, pitch, heading, throttle, heading_sp, latitude, longitude, altitude_amsl, altitude_sp, airspeed, airspeed_sp, groundspeed, climb_rate, gps_nsat, gps_fix_type, battery_remaining, temperature, temperature_air, failsafe, wp_num, wp_distance, force_mavlink1=False):
'''
Message appropriate for high latency connections like Iridium
base_mode : System mode bitfield, as defined by MAV_MODE_FLAG enum. (uint8_t)
custom_mode : A bitfield for use for autopilot-specific flags. (uint32_t)
landed_state : The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. (uint8_t)
roll : roll (centidegrees) (int16_t)
pitch : pitch (centidegrees) (int16_t)
heading : heading (centidegrees) (uint16_t)
throttle : throttle (percentage) (int8_t)
heading_sp : heading setpoint (centidegrees) (int16_t)
latitude : Latitude, expressed as degrees * 1E7 (int32_t)
longitude : Longitude, expressed as degrees * 1E7 (int32_t)
altitude_amsl : Altitude above mean sea level (meters) (int16_t)
altitude_sp : Altitude setpoint relative to the home position (meters) (int16_t)
airspeed : airspeed (m/s) (uint8_t)
airspeed_sp : airspeed setpoint (m/s) (uint8_t)
groundspeed : groundspeed (m/s) (uint8_t)
climb_rate : climb rate (m/s) (int8_t)
gps_nsat : Number of satellites visible. If unknown, set to 255 (uint8_t)
gps_fix_type : See the GPS_FIX_TYPE enum. (uint8_t)
battery_remaining : Remaining battery (percentage) (uint8_t)
temperature : Autopilot temperature (degrees C) (int8_t)
temperature_air : Air temperature (degrees C) from airspeed sensor (int8_t)
failsafe : failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence) (uint8_t)
wp_num : current waypoint number (uint8_t)
wp_distance : distance to target (meters) (uint16_t)
'''
return self.send(self.high_latency_encode(base_mode, custom_mode, landed_state, roll, pitch, heading, throttle, heading_sp, latitude, longitude, altitude_amsl, altitude_sp, airspeed, airspeed_sp, groundspeed, climb_rate, gps_nsat, gps_fix_type, battery_remaining, temperature, temperature_air, failsafe, wp_num, wp_distance), force_mavlink1=force_mavlink1)
def vibration_encode(self, time_usec, vibration_x, vibration_y, vibration_z, clipping_0, clipping_1, clipping_2):
'''
Vibration levels and accelerometer clipping
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
vibration_x : Vibration levels on X-axis (float)
vibration_y : Vibration levels on Y-axis (float)
vibration_z : Vibration levels on Z-axis (float)
clipping_0 : first accelerometer clipping count (uint32_t)
clipping_1 : second accelerometer clipping count (uint32_t)
clipping_2 : third accelerometer clipping count (uint32_t)
'''
return MAVLink_vibration_message(time_usec, vibration_x, vibration_y, vibration_z, clipping_0, clipping_1, clipping_2)
def vibration_send(self, time_usec, vibration_x, vibration_y, vibration_z, clipping_0, clipping_1, clipping_2, force_mavlink1=False):
'''
Vibration levels and accelerometer clipping
time_usec : Timestamp (micros since boot or Unix epoch) (uint64_t)
vibration_x : Vibration levels on X-axis (float)
vibration_y : Vibration levels on Y-axis (float)
vibration_z : Vibration levels on Z-axis (float)
clipping_0 : first accelerometer clipping count (uint32_t)
clipping_1 : second accelerometer clipping count (uint32_t)
clipping_2 : third accelerometer clipping count (uint32_t)
'''
return self.send(self.vibration_encode(time_usec, vibration_x, vibration_y, vibration_z, clipping_0, clipping_1, clipping_2), force_mavlink1=force_mavlink1)
def home_position_encode(self, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec=0):
'''
This message can be requested by sending the MAV_CMD_GET_HOME_POSITION
command. The position the system will return to and
land on. The position is set automatically by the
system during the takeoff in case it was not
explicitely set by the operator before or after. The
position the system will return to and land on. The
global and local positions encode the position in the
respective coordinate frames, while the q parameter
encodes the orientation of the surface. Under normal
conditions it describes the heading and terrain slope,
which can be used by the aircraft to adjust the
approach. The approach 3D vector describes the point
to which the system should fly in normal flight mode
and then perform a landing sequence along the vector.
latitude : Latitude (WGS84), in degrees * 1E7 (int32_t)
longitude : Longitude (WGS84, in degrees * 1E7 (int32_t)
altitude : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)
x : Local X position of this position in the local coordinate frame (float)
y : Local Y position of this position in the local coordinate frame (float)
z : Local Z position of this position in the local coordinate frame (float)
q : World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground (float)
approach_x : Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
approach_y : Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
approach_z : Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
'''
return MAVLink_home_position_message(latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec)
def home_position_send(self, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec=0, force_mavlink1=False):
'''
This message can be requested by sending the MAV_CMD_GET_HOME_POSITION
command. The position the system will return to and
land on. The position is set automatically by the
system during the takeoff in case it was not
explicitely set by the operator before or after. The
position the system will return to and land on. The
global and local positions encode the position in the
respective coordinate frames, while the q parameter
encodes the orientation of the surface. Under normal
conditions it describes the heading and terrain slope,
which can be used by the aircraft to adjust the
approach. The approach 3D vector describes the point
to which the system should fly in normal flight mode
and then perform a landing sequence along the vector.
latitude : Latitude (WGS84), in degrees * 1E7 (int32_t)
longitude : Longitude (WGS84, in degrees * 1E7 (int32_t)
altitude : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)
x : Local X position of this position in the local coordinate frame (float)
y : Local Y position of this position in the local coordinate frame (float)
z : Local Z position of this position in the local coordinate frame (float)
q : World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground (float)
approach_x : Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
approach_y : Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
approach_z : Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
'''
return self.send(self.home_position_encode(latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec), force_mavlink1=force_mavlink1)
def set_home_position_encode(self, target_system, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec=0):
'''
The position the system will return to and land on. The position is
set automatically by the system during the takeoff in
case it was not explicitely set by the operator before
or after. The global and local positions encode the
position in the respective coordinate frames, while
the q parameter encodes the orientation of the
surface. Under normal conditions it describes the
heading and terrain slope, which can be used by the
aircraft to adjust the approach. The approach 3D
vector describes the point to which the system should
fly in normal flight mode and then perform a landing
sequence along the vector.
target_system : System ID. (uint8_t)
latitude : Latitude (WGS84), in degrees * 1E7 (int32_t)
longitude : Longitude (WGS84, in degrees * 1E7 (int32_t)
altitude : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)
x : Local X position of this position in the local coordinate frame (float)
y : Local Y position of this position in the local coordinate frame (float)
z : Local Z position of this position in the local coordinate frame (float)
q : World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground (float)
approach_x : Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
approach_y : Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
approach_z : Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
'''
return MAVLink_set_home_position_message(target_system, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec)
def set_home_position_send(self, target_system, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec=0, force_mavlink1=False):
'''
The position the system will return to and land on. The position is
set automatically by the system during the takeoff in
case it was not explicitely set by the operator before
or after. The global and local positions encode the
position in the respective coordinate frames, while
the q parameter encodes the orientation of the
surface. Under normal conditions it describes the
heading and terrain slope, which can be used by the
aircraft to adjust the approach. The approach 3D
vector describes the point to which the system should
fly in normal flight mode and then perform a landing
sequence along the vector.
target_system : System ID. (uint8_t)
latitude : Latitude (WGS84), in degrees * 1E7 (int32_t)
longitude : Longitude (WGS84, in degrees * 1E7 (int32_t)
altitude : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)
x : Local X position of this position in the local coordinate frame (float)
y : Local Y position of this position in the local coordinate frame (float)
z : Local Z position of this position in the local coordinate frame (float)
q : World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground (float)
approach_x : Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
approach_y : Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
approach_z : Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. (float)
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
'''
return self.send(self.set_home_position_encode(target_system, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z, time_usec), force_mavlink1=force_mavlink1)
def message_interval_encode(self, message_id, interval_us):
'''
This interface replaces DATA_STREAM
message_id : The ID of the requested MAVLink message. v1.0 is limited to 254 messages. (uint16_t)
interval_us : The interval between two messages, in microseconds. A value of -1 indicates this stream is disabled, 0 indicates it is not available, > 0 indicates the interval at which it is sent. (int32_t)
'''
return MAVLink_message_interval_message(message_id, interval_us)
def message_interval_send(self, message_id, interval_us, force_mavlink1=False):
'''
This interface replaces DATA_STREAM
message_id : The ID of the requested MAVLink message. v1.0 is limited to 254 messages. (uint16_t)
interval_us : The interval between two messages, in microseconds. A value of -1 indicates this stream is disabled, 0 indicates it is not available, > 0 indicates the interval at which it is sent. (int32_t)
'''
return self.send(self.message_interval_encode(message_id, interval_us), force_mavlink1=force_mavlink1)
def extended_sys_state_encode(self, vtol_state, landed_state):
'''
Provides state for additional features
vtol_state : The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. (uint8_t)
landed_state : The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. (uint8_t)
'''
return MAVLink_extended_sys_state_message(vtol_state, landed_state)
def extended_sys_state_send(self, vtol_state, landed_state, force_mavlink1=False):
'''
Provides state for additional features
vtol_state : The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. (uint8_t)
landed_state : The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. (uint8_t)
'''
return self.send(self.extended_sys_state_encode(vtol_state, landed_state), force_mavlink1=force_mavlink1)
def adsb_vehicle_encode(self, ICAO_address, lat, lon, altitude_type, altitude, heading, hor_velocity, ver_velocity, callsign, emitter_type, tslc, flags, squawk):
'''
The location and information of an ADSB vehicle
ICAO_address : ICAO address (uint32_t)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
altitude_type : Type from ADSB_ALTITUDE_TYPE enum (uint8_t)
altitude : Altitude(ASL) in millimeters (int32_t)
heading : Course over ground in centidegrees (uint16_t)
hor_velocity : The horizontal velocity in centimeters/second (uint16_t)
ver_velocity : The vertical velocity in centimeters/second, positive is up (int16_t)
callsign : The callsign, 8+null (char)
emitter_type : Type from ADSB_EMITTER_TYPE enum (uint8_t)
tslc : Time since last communication in seconds (uint8_t)
flags : Flags to indicate various statuses including valid data fields (uint16_t)
squawk : Squawk code (uint16_t)
'''
return MAVLink_adsb_vehicle_message(ICAO_address, lat, lon, altitude_type, altitude, heading, hor_velocity, ver_velocity, callsign, emitter_type, tslc, flags, squawk)
def adsb_vehicle_send(self, ICAO_address, lat, lon, altitude_type, altitude, heading, hor_velocity, ver_velocity, callsign, emitter_type, tslc, flags, squawk, force_mavlink1=False):
'''
The location and information of an ADSB vehicle
ICAO_address : ICAO address (uint32_t)
lat : Latitude, expressed as degrees * 1E7 (int32_t)
lon : Longitude, expressed as degrees * 1E7 (int32_t)
altitude_type : Type from ADSB_ALTITUDE_TYPE enum (uint8_t)
altitude : Altitude(ASL) in millimeters (int32_t)
heading : Course over ground in centidegrees (uint16_t)
hor_velocity : The horizontal velocity in centimeters/second (uint16_t)
ver_velocity : The vertical velocity in centimeters/second, positive is up (int16_t)
callsign : The callsign, 8+null (char)
emitter_type : Type from ADSB_EMITTER_TYPE enum (uint8_t)
tslc : Time since last communication in seconds (uint8_t)
flags : Flags to indicate various statuses including valid data fields (uint16_t)
squawk : Squawk code (uint16_t)
'''
return self.send(self.adsb_vehicle_encode(ICAO_address, lat, lon, altitude_type, altitude, heading, hor_velocity, ver_velocity, callsign, emitter_type, tslc, flags, squawk), force_mavlink1=force_mavlink1)
def collision_encode(self, src, id, action, threat_level, time_to_minimum_delta, altitude_minimum_delta, horizontal_minimum_delta):
'''
Information about a potential collision
src : Collision data source (uint8_t)
id : Unique identifier, domain based on src field (uint32_t)
action : Action that is being taken to avoid this collision (uint8_t)
threat_level : How concerned the aircraft is about this collision (uint8_t)
time_to_minimum_delta : Estimated time until collision occurs (seconds) (float)
altitude_minimum_delta : Closest vertical distance in meters between vehicle and object (float)
horizontal_minimum_delta : Closest horizontal distance in meteres between vehicle and object (float)
'''
return MAVLink_collision_message(src, id, action, threat_level, time_to_minimum_delta, altitude_minimum_delta, horizontal_minimum_delta)
def collision_send(self, src, id, action, threat_level, time_to_minimum_delta, altitude_minimum_delta, horizontal_minimum_delta, force_mavlink1=False):
'''
Information about a potential collision
src : Collision data source (uint8_t)
id : Unique identifier, domain based on src field (uint32_t)
action : Action that is being taken to avoid this collision (uint8_t)
threat_level : How concerned the aircraft is about this collision (uint8_t)
time_to_minimum_delta : Estimated time until collision occurs (seconds) (float)
altitude_minimum_delta : Closest vertical distance in meters between vehicle and object (float)
horizontal_minimum_delta : Closest horizontal distance in meteres between vehicle and object (float)
'''
return self.send(self.collision_encode(src, id, action, threat_level, time_to_minimum_delta, altitude_minimum_delta, horizontal_minimum_delta), force_mavlink1=force_mavlink1)
def v2_extension_encode(self, target_network, target_system, target_component, message_type, payload):
'''
Message implementing parts of the V2 payload specs in V1 frames for
transitional support.
target_network : Network ID (0 for broadcast) (uint8_t)
target_system : System ID (0 for broadcast) (uint8_t)
target_component : Component ID (0 for broadcast) (uint8_t)
message_type : A code that identifies the software component that understands this message (analogous to usb device classes or mime type strings). If this code is less than 32768, it is considered a 'registered' protocol extension and the corresponding entry should be added to https://github.com/mavlink/mavlink/extension-message-ids.xml. Software creators can register blocks of message IDs as needed (useful for GCS specific metadata, etc...). Message_types greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. (uint16_t)
payload : Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. (uint8_t)
'''
return MAVLink_v2_extension_message(target_network, target_system, target_component, message_type, payload)
def v2_extension_send(self, target_network, target_system, target_component, message_type, payload, force_mavlink1=False):
'''
Message implementing parts of the V2 payload specs in V1 frames for
transitional support.
target_network : Network ID (0 for broadcast) (uint8_t)
target_system : System ID (0 for broadcast) (uint8_t)
target_component : Component ID (0 for broadcast) (uint8_t)
message_type : A code that identifies the software component that understands this message (analogous to usb device classes or mime type strings). If this code is less than 32768, it is considered a 'registered' protocol extension and the corresponding entry should be added to https://github.com/mavlink/mavlink/extension-message-ids.xml. Software creators can register blocks of message IDs as needed (useful for GCS specific metadata, etc...). Message_types greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. (uint16_t)
payload : Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. (uint8_t)
'''
return self.send(self.v2_extension_encode(target_network, target_system, target_component, message_type, payload), force_mavlink1=force_mavlink1)
def memory_vect_encode(self, address, ver, type, value):
'''
Send raw controller memory. The use of this message is discouraged for
normal packets, but a quite efficient way for testing
new messages and getting experimental debug output.
address : Starting address of the debug variables (uint16_t)
ver : Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below (uint8_t)
type : Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14 (uint8_t)
value : Memory contents at specified address (int8_t)
'''
return MAVLink_memory_vect_message(address, ver, type, value)
def memory_vect_send(self, address, ver, type, value, force_mavlink1=False):
'''
Send raw controller memory. The use of this message is discouraged for
normal packets, but a quite efficient way for testing
new messages and getting experimental debug output.
address : Starting address of the debug variables (uint16_t)
ver : Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below (uint8_t)
type : Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14 (uint8_t)
value : Memory contents at specified address (int8_t)
'''
return self.send(self.memory_vect_encode(address, ver, type, value), force_mavlink1=force_mavlink1)
def debug_vect_encode(self, name, time_usec, x, y, z):
'''
name : Name (char)
time_usec : Timestamp (uint64_t)
x : x (float)
y : y (float)
z : z (float)
'''
return MAVLink_debug_vect_message(name, time_usec, x, y, z)
def debug_vect_send(self, name, time_usec, x, y, z, force_mavlink1=False):
'''
name : Name (char)
time_usec : Timestamp (uint64_t)
x : x (float)
y : y (float)
z : z (float)
'''
return self.send(self.debug_vect_encode(name, time_usec, x, y, z), force_mavlink1=force_mavlink1)
def named_value_float_encode(self, time_boot_ms, name, value):
'''
Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for
testing new messages and getting experimental debug
output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Floating point value (float)
'''
return MAVLink_named_value_float_message(time_boot_ms, name, value)
def named_value_float_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for
testing new messages and getting experimental debug
output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Floating point value (float)
'''
return self.send(self.named_value_float_encode(time_boot_ms, name, value), force_mavlink1=force_mavlink1)
def named_value_int_encode(self, time_boot_ms, name, value):
'''
Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient
way for testing new messages and getting experimental
debug output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Signed integer value (int32_t)
'''
return MAVLink_named_value_int_message(time_boot_ms, name, value)
def named_value_int_send(self, time_boot_ms, name, value, force_mavlink1=False):
'''
Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient
way for testing new messages and getting experimental
debug output.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
name : Name of the debug variable (char)
value : Signed integer value (int32_t)
'''
return self.send(self.named_value_int_encode(time_boot_ms, name, value), force_mavlink1=force_mavlink1)
def statustext_encode(self, severity, text):
'''
Status text message. These messages are printed in yellow in the COMM
console of QGroundControl. WARNING: They consume quite
some bandwidth, so use only for important status and
error messages. If implemented wisely, these messages
are buffered on the MCU and sent only at a limited
rate (e.g. 10 Hz).
severity : Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY. (uint8_t)
text : Status text message, without null termination character (char)
'''
return MAVLink_statustext_message(severity, text)
def statustext_send(self, severity, text, force_mavlink1=False):
'''
Status text message. These messages are printed in yellow in the COMM
console of QGroundControl. WARNING: They consume quite
some bandwidth, so use only for important status and
error messages. If implemented wisely, these messages
are buffered on the MCU and sent only at a limited
rate (e.g. 10 Hz).
severity : Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY. (uint8_t)
text : Status text message, without null termination character (char)
'''
return self.send(self.statustext_encode(severity, text), force_mavlink1=force_mavlink1)
def debug_encode(self, time_boot_ms, ind, value):
'''
Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as
DEBUG N.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
ind : index of debug variable (uint8_t)
value : DEBUG value (float)
'''
return MAVLink_debug_message(time_boot_ms, ind, value)
def debug_send(self, time_boot_ms, ind, value, force_mavlink1=False):
'''
Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as
DEBUG N.
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
ind : index of debug variable (uint8_t)
value : DEBUG value (float)
'''
return self.send(self.debug_encode(time_boot_ms, ind, value), force_mavlink1=force_mavlink1)
def setup_signing_encode(self, target_system, target_component, secret_key, initial_timestamp):
'''
Setup a MAVLink2 signing key. If called with secret_key of all zero
and zero initial_timestamp will disable signing
target_system : system id of the target (uint8_t)
target_component : component ID of the target (uint8_t)
secret_key : signing key (uint8_t)
initial_timestamp : initial timestamp (uint64_t)
'''
return MAVLink_setup_signing_message(target_system, target_component, secret_key, initial_timestamp)
def setup_signing_send(self, target_system, target_component, secret_key, initial_timestamp, force_mavlink1=False):
'''
Setup a MAVLink2 signing key. If called with secret_key of all zero
and zero initial_timestamp will disable signing
target_system : system id of the target (uint8_t)
target_component : component ID of the target (uint8_t)
secret_key : signing key (uint8_t)
initial_timestamp : initial timestamp (uint64_t)
'''
return self.send(self.setup_signing_encode(target_system, target_component, secret_key, initial_timestamp), force_mavlink1=force_mavlink1)
def button_change_encode(self, time_boot_ms, last_change_ms, state):
'''
Report button state change
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
last_change_ms : Time of last change of button state (uint32_t)
state : Bitmap state of buttons (uint8_t)
'''
return MAVLink_button_change_message(time_boot_ms, last_change_ms, state)
def button_change_send(self, time_boot_ms, last_change_ms, state, force_mavlink1=False):
'''
Report button state change
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
last_change_ms : Time of last change of button state (uint32_t)
state : Bitmap state of buttons (uint8_t)
'''
return self.send(self.button_change_encode(time_boot_ms, last_change_ms, state), force_mavlink1=force_mavlink1)
def play_tune_encode(self, target_system, target_component, tune):
'''
Control vehicle tone generation (buzzer)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
tune : tune in board specific format (char)
'''
return MAVLink_play_tune_message(target_system, target_component, tune)
def play_tune_send(self, target_system, target_component, tune, force_mavlink1=False):
'''
Control vehicle tone generation (buzzer)
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
tune : tune in board specific format (char)
'''
return self.send(self.play_tune_encode(target_system, target_component, tune), force_mavlink1=force_mavlink1)
def camera_information_encode(self, time_boot_ms, camera_id, vendor_name, model_name, focal_length, sensor_size_h, sensor_size_v, resolution_h, resolution_v, lense_id):
'''
WIP: Information about a camera
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
camera_id : Camera ID if there are multiple (uint8_t)
vendor_name : Name of the camera vendor (uint8_t)
model_name : Name of the camera model (uint8_t)
focal_length : Focal length in mm (float)
sensor_size_h : Image sensor size horizontal in mm (float)
sensor_size_v : Image sensor size vertical in mm (float)
resolution_h : Image resolution in pixels horizontal (uint16_t)
resolution_v : Image resolution in pixels vertical (uint16_t)
lense_id : Reserved for a lense ID (uint8_t)
'''
return MAVLink_camera_information_message(time_boot_ms, camera_id, vendor_name, model_name, focal_length, sensor_size_h, sensor_size_v, resolution_h, resolution_v, lense_id)
def camera_information_send(self, time_boot_ms, camera_id, vendor_name, model_name, focal_length, sensor_size_h, sensor_size_v, resolution_h, resolution_v, lense_id, force_mavlink1=False):
'''
WIP: Information about a camera
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
camera_id : Camera ID if there are multiple (uint8_t)
vendor_name : Name of the camera vendor (uint8_t)
model_name : Name of the camera model (uint8_t)
focal_length : Focal length in mm (float)
sensor_size_h : Image sensor size horizontal in mm (float)
sensor_size_v : Image sensor size vertical in mm (float)
resolution_h : Image resolution in pixels horizontal (uint16_t)
resolution_v : Image resolution in pixels vertical (uint16_t)
lense_id : Reserved for a lense ID (uint8_t)
'''
return self.send(self.camera_information_encode(time_boot_ms, camera_id, vendor_name, model_name, focal_length, sensor_size_h, sensor_size_v, resolution_h, resolution_v, lense_id), force_mavlink1=force_mavlink1)
def camera_settings_encode(self, time_boot_ms, camera_id, aperture, aperture_locked, shutter_speed, shutter_speed_locked, iso_sensitivity, iso_sensitivity_locked, white_balance, white_balance_locked, mode_id, color_mode_id, image_format_id):
'''
WIP: Settings of a camera, can be requested using
MAV_CMD_REQUEST_CAMERA_SETTINGS and written using
MAV_CMD_SET_CAMERA_SETTINGS
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
camera_id : Camera ID if there are multiple (uint8_t)
aperture : Aperture is 1/value (float)
aperture_locked : Aperture locked (0: auto, 1: locked) (uint8_t)
shutter_speed : Shutter speed in s (float)
shutter_speed_locked : Shutter speed locked (0: auto, 1: locked) (uint8_t)
iso_sensitivity : ISO sensitivity (float)
iso_sensitivity_locked : ISO sensitivity locked (0: auto, 1: locked) (uint8_t)
white_balance : Color temperature in degrees Kelvin (float)
white_balance_locked : Color temperature locked (0: auto, 1: locked) (uint8_t)
mode_id : Reserved for a camera mode ID (uint8_t)
color_mode_id : Reserved for a color mode ID (uint8_t)
image_format_id : Reserved for image format ID (uint8_t)
'''
return MAVLink_camera_settings_message(time_boot_ms, camera_id, aperture, aperture_locked, shutter_speed, shutter_speed_locked, iso_sensitivity, iso_sensitivity_locked, white_balance, white_balance_locked, mode_id, color_mode_id, image_format_id)
def camera_settings_send(self, time_boot_ms, camera_id, aperture, aperture_locked, shutter_speed, shutter_speed_locked, iso_sensitivity, iso_sensitivity_locked, white_balance, white_balance_locked, mode_id, color_mode_id, image_format_id, force_mavlink1=False):
'''
WIP: Settings of a camera, can be requested using
MAV_CMD_REQUEST_CAMERA_SETTINGS and written using
MAV_CMD_SET_CAMERA_SETTINGS
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
camera_id : Camera ID if there are multiple (uint8_t)
aperture : Aperture is 1/value (float)
aperture_locked : Aperture locked (0: auto, 1: locked) (uint8_t)
shutter_speed : Shutter speed in s (float)
shutter_speed_locked : Shutter speed locked (0: auto, 1: locked) (uint8_t)
iso_sensitivity : ISO sensitivity (float)
iso_sensitivity_locked : ISO sensitivity locked (0: auto, 1: locked) (uint8_t)
white_balance : Color temperature in degrees Kelvin (float)
white_balance_locked : Color temperature locked (0: auto, 1: locked) (uint8_t)
mode_id : Reserved for a camera mode ID (uint8_t)
color_mode_id : Reserved for a color mode ID (uint8_t)
image_format_id : Reserved for image format ID (uint8_t)
'''
return self.send(self.camera_settings_encode(time_boot_ms, camera_id, aperture, aperture_locked, shutter_speed, shutter_speed_locked, iso_sensitivity, iso_sensitivity_locked, white_balance, white_balance_locked, mode_id, color_mode_id, image_format_id), force_mavlink1=force_mavlink1)
def storage_information_encode(self, time_boot_ms, storage_id, status, total_capacity, used_capacity, available_capacity, read_speed, write_speed):
'''
WIP: Information about a storage medium
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
storage_id : Storage ID if there are multiple (uint8_t)
status : Status of storage (0 not available, 1 unformatted, 2 formatted) (uint8_t)
total_capacity : Total capacity in MiB (float)
used_capacity : Used capacity in MiB (float)
available_capacity : Available capacity in MiB (float)
read_speed : Read speed in MiB/s (float)
write_speed : Write speed in MiB/s (float)
'''
return MAVLink_storage_information_message(time_boot_ms, storage_id, status, total_capacity, used_capacity, available_capacity, read_speed, write_speed)
def storage_information_send(self, time_boot_ms, storage_id, status, total_capacity, used_capacity, available_capacity, read_speed, write_speed, force_mavlink1=False):
'''
WIP: Information about a storage medium
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
storage_id : Storage ID if there are multiple (uint8_t)
status : Status of storage (0 not available, 1 unformatted, 2 formatted) (uint8_t)
total_capacity : Total capacity in MiB (float)
used_capacity : Used capacity in MiB (float)
available_capacity : Available capacity in MiB (float)
read_speed : Read speed in MiB/s (float)
write_speed : Write speed in MiB/s (float)
'''
return self.send(self.storage_information_encode(time_boot_ms, storage_id, status, total_capacity, used_capacity, available_capacity, read_speed, write_speed), force_mavlink1=force_mavlink1)
def camera_capture_status_encode(self, time_boot_ms, camera_id, image_status, video_status, image_interval, video_framerate, image_resolution_h, image_resolution_v, video_resolution_h, video_resolution_v, recording_time_ms, available_capacity):
'''
WIP: Information about the status of a capture
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
camera_id : Camera ID if there are multiple (uint8_t)
image_status : Current status of image capturing (0: not running, 1: interval capture in progress) (uint8_t)
video_status : Current status of video capturing (0: not running, 1: capture in progress) (uint8_t)
image_interval : Image capture interval in seconds (float)
video_framerate : Video frame rate in Hz (float)
image_resolution_h : Image resolution in pixels horizontal (uint16_t)
image_resolution_v : Image resolution in pixels vertical (uint16_t)
video_resolution_h : Video resolution in pixels horizontal (uint16_t)
video_resolution_v : Video resolution in pixels vertical (uint16_t)
recording_time_ms : Time in milliseconds since recording started (uint32_t)
available_capacity : Available storage capacity in MiB (float)
'''
return MAVLink_camera_capture_status_message(time_boot_ms, camera_id, image_status, video_status, image_interval, video_framerate, image_resolution_h, image_resolution_v, video_resolution_h, video_resolution_v, recording_time_ms, available_capacity)
def camera_capture_status_send(self, time_boot_ms, camera_id, image_status, video_status, image_interval, video_framerate, image_resolution_h, image_resolution_v, video_resolution_h, video_resolution_v, recording_time_ms, available_capacity, force_mavlink1=False):
'''
WIP: Information about the status of a capture
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
camera_id : Camera ID if there are multiple (uint8_t)
image_status : Current status of image capturing (0: not running, 1: interval capture in progress) (uint8_t)
video_status : Current status of video capturing (0: not running, 1: capture in progress) (uint8_t)
image_interval : Image capture interval in seconds (float)
video_framerate : Video frame rate in Hz (float)
image_resolution_h : Image resolution in pixels horizontal (uint16_t)
image_resolution_v : Image resolution in pixels vertical (uint16_t)
video_resolution_h : Video resolution in pixels horizontal (uint16_t)
video_resolution_v : Video resolution in pixels vertical (uint16_t)
recording_time_ms : Time in milliseconds since recording started (uint32_t)
available_capacity : Available storage capacity in MiB (float)
'''
return self.send(self.camera_capture_status_encode(time_boot_ms, camera_id, image_status, video_status, image_interval, video_framerate, image_resolution_h, image_resolution_v, video_resolution_h, video_resolution_v, recording_time_ms, available_capacity), force_mavlink1=force_mavlink1)
def camera_image_captured_encode(self, time_boot_ms, time_utc, camera_id, lat, lon, alt, relative_alt, q, image_index, capture_result, file_url):
'''
Information about a captured image
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
time_utc : Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. (uint64_t)
camera_id : Camera ID (1 for first, 2 for second, etc.) (uint8_t)
lat : Latitude, expressed as degrees * 1E7 where image was taken (int32_t)
lon : Longitude, expressed as degrees * 1E7 where capture was taken (int32_t)
alt : Altitude in meters, expressed as * 1E3 (AMSL, not WGS84) where image was taken (int32_t)
relative_alt : Altitude above ground in meters, expressed as * 1E3 where image was taken (int32_t)
q : Quaternion of camera orientation (w, x, y, z order, zero-rotation is 0, 0, 0, 0) (float)
image_index : Zero based index of this image (image count since armed -1) (int32_t)
capture_result : Boolean indicating success (1) or failure (0) while capturing this image. (int8_t)
file_url : URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface. (char)
'''
return MAVLink_camera_image_captured_message(time_boot_ms, time_utc, camera_id, lat, lon, alt, relative_alt, q, image_index, capture_result, file_url)
def camera_image_captured_send(self, time_boot_ms, time_utc, camera_id, lat, lon, alt, relative_alt, q, image_index, capture_result, file_url, force_mavlink1=False):
'''
Information about a captured image
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
time_utc : Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. (uint64_t)
camera_id : Camera ID (1 for first, 2 for second, etc.) (uint8_t)
lat : Latitude, expressed as degrees * 1E7 where image was taken (int32_t)
lon : Longitude, expressed as degrees * 1E7 where capture was taken (int32_t)
alt : Altitude in meters, expressed as * 1E3 (AMSL, not WGS84) where image was taken (int32_t)
relative_alt : Altitude above ground in meters, expressed as * 1E3 where image was taken (int32_t)
q : Quaternion of camera orientation (w, x, y, z order, zero-rotation is 0, 0, 0, 0) (float)
image_index : Zero based index of this image (image count since armed -1) (int32_t)
capture_result : Boolean indicating success (1) or failure (0) while capturing this image. (int8_t)
file_url : URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface. (char)
'''
return self.send(self.camera_image_captured_encode(time_boot_ms, time_utc, camera_id, lat, lon, alt, relative_alt, q, image_index, capture_result, file_url), force_mavlink1=force_mavlink1)
def flight_information_encode(self, time_boot_ms, arming_time_utc, takeoff_time_utc, flight_uuid):
'''
WIP: Information about flight since last arming
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
arming_time_utc : Timestamp at arming (microseconds since UNIX epoch) in UTC, 0 for unknown (uint64_t)
takeoff_time_utc : Timestamp at takeoff (microseconds since UNIX epoch) in UTC, 0 for unknown (uint64_t)
flight_uuid : Universally unique identifier (UUID) of flight, should correspond to name of logfiles (uint64_t)
'''
return MAVLink_flight_information_message(time_boot_ms, arming_time_utc, takeoff_time_utc, flight_uuid)
def flight_information_send(self, time_boot_ms, arming_time_utc, takeoff_time_utc, flight_uuid, force_mavlink1=False):
'''
WIP: Information about flight since last arming
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
arming_time_utc : Timestamp at arming (microseconds since UNIX epoch) in UTC, 0 for unknown (uint64_t)
takeoff_time_utc : Timestamp at takeoff (microseconds since UNIX epoch) in UTC, 0 for unknown (uint64_t)
flight_uuid : Universally unique identifier (UUID) of flight, should correspond to name of logfiles (uint64_t)
'''
return self.send(self.flight_information_encode(time_boot_ms, arming_time_utc, takeoff_time_utc, flight_uuid), force_mavlink1=force_mavlink1)
def mount_orientation_encode(self, time_boot_ms, roll, pitch, yaw, yaw_absolute=0):
'''
Orientation of a mount
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
roll : Roll in global frame in degrees (set to NaN for invalid). (float)
pitch : Pitch in global frame in degrees (set to NaN for invalid). (float)
yaw : Yaw relative to vehicle in degrees (set to NaN for invalid). (float)
yaw_absolute : Yaw in absolute frame in degrees, North is 0 (set to NaN for invalid). (float)
'''
return MAVLink_mount_orientation_message(time_boot_ms, roll, pitch, yaw, yaw_absolute)
def mount_orientation_send(self, time_boot_ms, roll, pitch, yaw, yaw_absolute=0, force_mavlink1=False):
'''
Orientation of a mount
time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t)
roll : Roll in global frame in degrees (set to NaN for invalid). (float)
pitch : Pitch in global frame in degrees (set to NaN for invalid). (float)
yaw : Yaw relative to vehicle in degrees (set to NaN for invalid). (float)
yaw_absolute : Yaw in absolute frame in degrees, North is 0 (set to NaN for invalid). (float)
'''
return self.send(self.mount_orientation_encode(time_boot_ms, roll, pitch, yaw, yaw_absolute), force_mavlink1=force_mavlink1)
def logging_data_encode(self, target_system, target_component, sequence, length, first_message_offset, data):
'''
A message containing logged data (see also MAV_CMD_LOGGING_START)
target_system : system ID of the target (uint8_t)
target_component : component ID of the target (uint8_t)
sequence : sequence number (can wrap) (uint16_t)
length : data length (uint8_t)
first_message_offset : offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). (uint8_t)
data : logged data (uint8_t)
'''
return MAVLink_logging_data_message(target_system, target_component, sequence, length, first_message_offset, data)
def logging_data_send(self, target_system, target_component, sequence, length, first_message_offset, data, force_mavlink1=False):
'''
A message containing logged data (see also MAV_CMD_LOGGING_START)
target_system : system ID of the target (uint8_t)
target_component : component ID of the target (uint8_t)
sequence : sequence number (can wrap) (uint16_t)
length : data length (uint8_t)
first_message_offset : offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). (uint8_t)
data : logged data (uint8_t)
'''
return self.send(self.logging_data_encode(target_system, target_component, sequence, length, first_message_offset, data), force_mavlink1=force_mavlink1)
def logging_data_acked_encode(self, target_system, target_component, sequence, length, first_message_offset, data):
'''
A message containing logged data which requires a LOGGING_ACK to be
sent back
target_system : system ID of the target (uint8_t)
target_component : component ID of the target (uint8_t)
sequence : sequence number (can wrap) (uint16_t)
length : data length (uint8_t)
first_message_offset : offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). (uint8_t)
data : logged data (uint8_t)
'''
return MAVLink_logging_data_acked_message(target_system, target_component, sequence, length, first_message_offset, data)
def logging_data_acked_send(self, target_system, target_component, sequence, length, first_message_offset, data, force_mavlink1=False):
'''
A message containing logged data which requires a LOGGING_ACK to be
sent back
target_system : system ID of the target (uint8_t)
target_component : component ID of the target (uint8_t)
sequence : sequence number (can wrap) (uint16_t)
length : data length (uint8_t)
first_message_offset : offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). (uint8_t)
data : logged data (uint8_t)
'''
return self.send(self.logging_data_acked_encode(target_system, target_component, sequence, length, first_message_offset, data), force_mavlink1=force_mavlink1)
def logging_ack_encode(self, target_system, target_component, sequence):
'''
An ack for a LOGGING_DATA_ACKED message
target_system : system ID of the target (uint8_t)
target_component : component ID of the target (uint8_t)
sequence : sequence number (must match the one in LOGGING_DATA_ACKED) (uint16_t)
'''
return MAVLink_logging_ack_message(target_system, target_component, sequence)
def logging_ack_send(self, target_system, target_component, sequence, force_mavlink1=False):
'''
An ack for a LOGGING_DATA_ACKED message
target_system : system ID of the target (uint8_t)
target_component : component ID of the target (uint8_t)
sequence : sequence number (must match the one in LOGGING_DATA_ACKED) (uint16_t)
'''
return self.send(self.logging_ack_encode(target_system, target_component, sequence), force_mavlink1=force_mavlink1)
def wifi_config_ap_encode(self, ssid, password):
'''
Configure AP SSID and Password.
ssid : Name of Wi-Fi network (SSID). Leave it blank to leave it unchanged. (char)
password : Password. Leave it blank for an open AP. (char)
'''
return MAVLink_wifi_config_ap_message(ssid, password)
def wifi_config_ap_send(self, ssid, password, force_mavlink1=False):
'''
Configure AP SSID and Password.
ssid : Name of Wi-Fi network (SSID). Leave it blank to leave it unchanged. (char)
password : Password. Leave it blank for an open AP. (char)
'''
return self.send(self.wifi_config_ap_encode(ssid, password), force_mavlink1=force_mavlink1)
def uavcan_node_status_encode(self, time_usec, uptime_sec, health, mode, sub_mode, vendor_specific_status_code):
'''
General status information of an UAVCAN node. Please refer to the
definition of the UAVCAN message
"uavcan.protocol.NodeStatus" for the background
information. The UAVCAN specification is available at
http://uavcan.org.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
uptime_sec : The number of seconds since the start-up of the node. (uint32_t)
health : Generalized node health status. (uint8_t)
mode : Generalized operating mode. (uint8_t)
sub_mode : Not used currently. (uint8_t)
vendor_specific_status_code : Vendor-specific status information. (uint16_t)
'''
return MAVLink_uavcan_node_status_message(time_usec, uptime_sec, health, mode, sub_mode, vendor_specific_status_code)
def uavcan_node_status_send(self, time_usec, uptime_sec, health, mode, sub_mode, vendor_specific_status_code, force_mavlink1=False):
'''
General status information of an UAVCAN node. Please refer to the
definition of the UAVCAN message
"uavcan.protocol.NodeStatus" for the background
information. The UAVCAN specification is available at
http://uavcan.org.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
uptime_sec : The number of seconds since the start-up of the node. (uint32_t)
health : Generalized node health status. (uint8_t)
mode : Generalized operating mode. (uint8_t)
sub_mode : Not used currently. (uint8_t)
vendor_specific_status_code : Vendor-specific status information. (uint16_t)
'''
return self.send(self.uavcan_node_status_encode(time_usec, uptime_sec, health, mode, sub_mode, vendor_specific_status_code), force_mavlink1=force_mavlink1)
def uavcan_node_info_encode(self, time_usec, uptime_sec, name, hw_version_major, hw_version_minor, hw_unique_id, sw_version_major, sw_version_minor, sw_vcs_commit):
'''
General information describing a particular UAVCAN node. Please refer
to the definition of the UAVCAN service
"uavcan.protocol.GetNodeInfo" for the background
information. This message should be emitted by the
system whenever a new node appears online, or an
existing node reboots. Additionally, it can be emitted
upon request from the other end of the MAVLink channel
(see MAV_CMD_UAVCAN_GET_NODE_INFO). It is also not
prohibited to emit this message unconditionally at a
low frequency. The UAVCAN specification is available
at http://uavcan.org.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
uptime_sec : The number of seconds since the start-up of the node. (uint32_t)
name : Node name string. For example, "sapog.px4.io". (char)
hw_version_major : Hardware major version number. (uint8_t)
hw_version_minor : Hardware minor version number. (uint8_t)
hw_unique_id : Hardware unique 128-bit ID. (uint8_t)
sw_version_major : Software major version number. (uint8_t)
sw_version_minor : Software minor version number. (uint8_t)
sw_vcs_commit : Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown. (uint32_t)
'''
return MAVLink_uavcan_node_info_message(time_usec, uptime_sec, name, hw_version_major, hw_version_minor, hw_unique_id, sw_version_major, sw_version_minor, sw_vcs_commit)
def uavcan_node_info_send(self, time_usec, uptime_sec, name, hw_version_major, hw_version_minor, hw_unique_id, sw_version_major, sw_version_minor, sw_vcs_commit, force_mavlink1=False):
'''
General information describing a particular UAVCAN node. Please refer
to the definition of the UAVCAN service
"uavcan.protocol.GetNodeInfo" for the background
information. This message should be emitted by the
system whenever a new node appears online, or an
existing node reboots. Additionally, it can be emitted
upon request from the other end of the MAVLink channel
(see MAV_CMD_UAVCAN_GET_NODE_INFO). It is also not
prohibited to emit this message unconditionally at a
low frequency. The UAVCAN specification is available
at http://uavcan.org.
time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
uptime_sec : The number of seconds since the start-up of the node. (uint32_t)
name : Node name string. For example, "sapog.px4.io". (char)
hw_version_major : Hardware major version number. (uint8_t)
hw_version_minor : Hardware minor version number. (uint8_t)
hw_unique_id : Hardware unique 128-bit ID. (uint8_t)
sw_version_major : Software major version number. (uint8_t)
sw_version_minor : Software minor version number. (uint8_t)
sw_vcs_commit : Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown. (uint32_t)
'''
return self.send(self.uavcan_node_info_encode(time_usec, uptime_sec, name, hw_version_major, hw_version_minor, hw_unique_id, sw_version_major, sw_version_minor, sw_vcs_commit), force_mavlink1=force_mavlink1)
def obstacle_distance_encode(self, time_usec, sensor_type, distances, increment, min_distance, max_distance):
'''
Obstacle distances in front of the sensor, starting from the left in
increment degrees to the right
time_usec : Timestamp (microseconds since system boot or since UNIX epoch). (uint64_t)
sensor_type : Class id of the distance sensor type. (uint8_t)
distances : Distance of obstacles around the UAV with index 0 corresponding to local North. A value of 0 means that the obstacle is right in front of the sensor. A value of max_distance +1 means no obstacle is present. A value of UINT16_MAX for unknown/not used. In a array element, one unit corresponds to 1cm. (uint16_t)
increment : Angular width in degrees of each array element. (uint8_t)
min_distance : Minimum distance the sensor can measure in centimeters. (uint16_t)
max_distance : Maximum distance the sensor can measure in centimeters. (uint16_t)
'''
return MAVLink_obstacle_distance_message(time_usec, sensor_type, distances, increment, min_distance, max_distance)
def obstacle_distance_send(self, time_usec, sensor_type, distances, increment, min_distance, max_distance, force_mavlink1=False):
'''
Obstacle distances in front of the sensor, starting from the left in
increment degrees to the right
time_usec : Timestamp (microseconds since system boot or since UNIX epoch). (uint64_t)
sensor_type : Class id of the distance sensor type. (uint8_t)
distances : Distance of obstacles around the UAV with index 0 corresponding to local North. A value of 0 means that the obstacle is right in front of the sensor. A value of max_distance +1 means no obstacle is present. A value of UINT16_MAX for unknown/not used. In a array element, one unit corresponds to 1cm. (uint16_t)
increment : Angular width in degrees of each array element. (uint8_t)
min_distance : Minimum distance the sensor can measure in centimeters. (uint16_t)
max_distance : Maximum distance the sensor can measure in centimeters. (uint16_t)
'''
return self.send(self.obstacle_distance_encode(time_usec, sensor_type, distances, increment, min_distance, max_distance), force_mavlink1=force_mavlink1)
def odometry_encode(self, time_usec, frame_id, child_frame_id, x, y, z, q, vx, vy, vz, rollspeed, pitchspeed, yawspeed, pose_covariance, twist_covariance):
'''
Odometry message to communicate odometry information with an external
interface. Fits ROS REP 147 standard for aerial
vehicles (http://www.ros.org/reps/rep-0147.html).
time_usec : Timestamp (microseconds since system boot or since UNIX epoch). (uint64_t)
frame_id : Coordinate frame of reference for the pose data, as defined by MAV_FRAME enum. (uint8_t)
child_frame_id : Coordinate frame of reference for the velocity in free space (twist) data, as defined by MAV_FRAME enum. (uint8_t)
x : X Position (float)
y : Y Position (float)
z : Z Position (float)
q : Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) (float)
vx : X linear speed (float)
vy : Y linear speed (float)
vz : Z linear speed (float)
rollspeed : Roll angular speed (float)
pitchspeed : Pitch angular speed (float)
yawspeed : Yaw angular speed (float)
pose_covariance : Pose (states: x, y, z, roll, pitch, yaw) covariance matrix upper right triangle (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
twist_covariance : Twist (states: vx, vy, vz, rollspeed, pitchspeed, yawspeed) covariance matrix upper right triangle (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return MAVLink_odometry_message(time_usec, frame_id, child_frame_id, x, y, z, q, vx, vy, vz, rollspeed, pitchspeed, yawspeed, pose_covariance, twist_covariance)
def odometry_send(self, time_usec, frame_id, child_frame_id, x, y, z, q, vx, vy, vz, rollspeed, pitchspeed, yawspeed, pose_covariance, twist_covariance, force_mavlink1=False):
'''
Odometry message to communicate odometry information with an external
interface. Fits ROS REP 147 standard for aerial
vehicles (http://www.ros.org/reps/rep-0147.html).
time_usec : Timestamp (microseconds since system boot or since UNIX epoch). (uint64_t)
frame_id : Coordinate frame of reference for the pose data, as defined by MAV_FRAME enum. (uint8_t)
child_frame_id : Coordinate frame of reference for the velocity in free space (twist) data, as defined by MAV_FRAME enum. (uint8_t)
x : X Position (float)
y : Y Position (float)
z : Z Position (float)
q : Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) (float)
vx : X linear speed (float)
vy : Y linear speed (float)
vz : Z linear speed (float)
rollspeed : Roll angular speed (float)
pitchspeed : Pitch angular speed (float)
yawspeed : Yaw angular speed (float)
pose_covariance : Pose (states: x, y, z, roll, pitch, yaw) covariance matrix upper right triangle (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
twist_covariance : Twist (states: vx, vy, vz, rollspeed, pitchspeed, yawspeed) covariance matrix upper right triangle (first six entries are the first ROW, next five entries are the second ROW, etc.) (float)
'''
return self.send(self.odometry_encode(time_usec, frame_id, child_frame_id, x, y, z, q, vx, vy, vz, rollspeed, pitchspeed, yawspeed, pose_covariance, twist_covariance), force_mavlink1=force_mavlink1)
| [
"emb_mario@hotmail.com"
] | emb_mario@hotmail.com |
de06873e9ac5e35c2c78389c58693ec007c55023 | 436177bf038f9941f67e351796668700ffd1cef2 | /venv/Lib/site-packages/sklearn/feature_selection/tests/test_feature_select.py | d58dd44faa8189c222dc572ef2799ff1e0cec20c | [] | no_license | python019/matplotlib_simple | 4359d35f174cd2946d96da4d086026661c3d1f9c | 32e9a8e773f9423153d73811f69822f9567e6de4 | refs/heads/main | 2023-08-22T18:17:38.883274 | 2021-10-07T15:55:50 | 2021-10-07T15:55:50 | 380,471,961 | 29 | 0 | null | null | null | null | UTF-8 | Python | false | false | 26,540 | py | """
Todo: cross-check the F-value with stats model
"""
import itertools
import warnings
import numpy as np
from scipy import stats, sparse
import pytest
from sklearn.utils._testing import assert_almost_equal
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_array_almost_equal
from sklearn.utils._testing import assert_warns
from sklearn.utils._testing import ignore_warnings
from sklearn.utils._testing import assert_warns_message
from sklearn.utils import safe_mask
from sklearn.datasets import make_classification, make_regression
from sklearn.feature_selection import (
chi2, f_classif, f_oneway, f_regression, mutual_info_classif,
mutual_info_regression, SelectPercentile, SelectKBest, SelectFpr,
SelectFdr, SelectFwe, GenericUnivariateSelect)
##############################################################################
# Test the score functions
def test_f_oneway_vs_scipy_stats():
# Test that our f_oneway gives the same result as scipy.stats
rng = np.random.RandomState(0)
X1 = rng.randn(10, 3)
X2 = 1 + rng.randn(10, 3)
f, pv = stats.f_oneway(X1, X2)
f2, pv2 = f_oneway(X1, X2)
assert np.allclose(f, f2)
assert np.allclose(pv, pv2)
def test_f_oneway_ints():
# Smoke test f_oneway on integers: that it does raise casting errors
# with recent numpys
rng = np.random.RandomState(0)
X = rng.randint(10, size=(10, 10))
y = np.arange(10)
fint, pint = f_oneway(X, y)
# test that is gives the same result as with float
f, p = f_oneway(X.astype(float), y)
assert_array_almost_equal(f, fint, decimal=4)
assert_array_almost_equal(p, pint, decimal=4)
def test_f_classif():
# Test whether the F test yields meaningful results
# on a simple simulated classification problem
X, y = make_classification(n_samples=200, n_features=20,
n_informative=3, n_redundant=2,
n_repeated=0, n_classes=8,
n_clusters_per_class=1, flip_y=0.0,
class_sep=10, shuffle=False, random_state=0)
F, pv = f_classif(X, y)
F_sparse, pv_sparse = f_classif(sparse.csr_matrix(X), y)
assert (F > 0).all()
assert (pv > 0).all()
assert (pv < 1).all()
assert (pv[:5] < 0.05).all()
assert (pv[5:] > 1.e-4).all()
assert_array_almost_equal(F_sparse, F)
assert_array_almost_equal(pv_sparse, pv)
def test_f_regression():
# Test whether the F test yields meaningful results
# on a simple simulated regression problem
X, y = make_regression(n_samples=200, n_features=20, n_informative=5,
shuffle=False, random_state=0)
F, pv = f_regression(X, y)
assert (F > 0).all()
assert (pv > 0).all()
assert (pv < 1).all()
assert (pv[:5] < 0.05).all()
assert (pv[5:] > 1.e-4).all()
# with centering, compare with sparse
F, pv = f_regression(X, y, center=True)
F_sparse, pv_sparse = f_regression(sparse.csr_matrix(X), y, center=True)
assert_array_almost_equal(F_sparse, F)
assert_array_almost_equal(pv_sparse, pv)
# again without centering, compare with sparse
F, pv = f_regression(X, y, center=False)
F_sparse, pv_sparse = f_regression(sparse.csr_matrix(X), y, center=False)
assert_array_almost_equal(F_sparse, F)
assert_array_almost_equal(pv_sparse, pv)
def test_f_regression_input_dtype():
# Test whether f_regression returns the same value
# for any numeric data_type
rng = np.random.RandomState(0)
X = rng.rand(10, 20)
y = np.arange(10).astype(int)
F1, pv1 = f_regression(X, y)
F2, pv2 = f_regression(X, y.astype(float))
assert_array_almost_equal(F1, F2, 5)
assert_array_almost_equal(pv1, pv2, 5)
def test_f_regression_center():
# Test whether f_regression preserves dof according to 'center' argument
# We use two centered variates so we have a simple relationship between
# F-score with variates centering and F-score without variates centering.
# Create toy example
X = np.arange(-5, 6).reshape(-1, 1) # X has zero mean
n_samples = X.size
Y = np.ones(n_samples)
Y[::2] *= -1.
Y[0] = 0. # have Y mean being null
F1, _ = f_regression(X, Y, center=True)
F2, _ = f_regression(X, Y, center=False)
assert_array_almost_equal(F1 * (n_samples - 1.) / (n_samples - 2.), F2)
assert_almost_equal(F2[0], 0.232558139) # value from statsmodels OLS
def test_f_classif_multi_class():
# Test whether the F test yields meaningful results
# on a simple simulated classification problem
X, y = make_classification(n_samples=200, n_features=20,
n_informative=3, n_redundant=2,
n_repeated=0, n_classes=8,
n_clusters_per_class=1, flip_y=0.0,
class_sep=10, shuffle=False, random_state=0)
F, pv = f_classif(X, y)
assert (F > 0).all()
assert (pv > 0).all()
assert (pv < 1).all()
assert (pv[:5] < 0.05).all()
assert (pv[5:] > 1.e-4).all()
def test_select_percentile_classif():
# Test whether the relative univariate feature selection
# gets the correct items in a simple classification problem
# with the percentile heuristic
X, y = make_classification(n_samples=200, n_features=20,
n_informative=3, n_redundant=2,
n_repeated=0, n_classes=8,
n_clusters_per_class=1, flip_y=0.0,
class_sep=10, shuffle=False, random_state=0)
univariate_filter = SelectPercentile(f_classif, percentile=25)
X_r = univariate_filter.fit(X, y).transform(X)
X_r2 = GenericUnivariateSelect(f_classif, mode='percentile',
param=25).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(20)
gtruth[:5] = 1
assert_array_equal(support, gtruth)
def test_select_percentile_classif_sparse():
# Test whether the relative univariate feature selection
# gets the correct items in a simple classification problem
# with the percentile heuristic
X, y = make_classification(n_samples=200, n_features=20,
n_informative=3, n_redundant=2,
n_repeated=0, n_classes=8,
n_clusters_per_class=1, flip_y=0.0,
class_sep=10, shuffle=False, random_state=0)
X = sparse.csr_matrix(X)
univariate_filter = SelectPercentile(f_classif, percentile=25)
X_r = univariate_filter.fit(X, y).transform(X)
X_r2 = GenericUnivariateSelect(f_classif, mode='percentile',
param=25).fit(X, y).transform(X)
assert_array_equal(X_r.toarray(), X_r2.toarray())
support = univariate_filter.get_support()
gtruth = np.zeros(20)
gtruth[:5] = 1
assert_array_equal(support, gtruth)
X_r2inv = univariate_filter.inverse_transform(X_r2)
assert sparse.issparse(X_r2inv)
support_mask = safe_mask(X_r2inv, support)
assert X_r2inv.shape == X.shape
assert_array_equal(X_r2inv[:, support_mask].toarray(), X_r.toarray())
# Check other columns are empty
assert X_r2inv.getnnz() == X_r.getnnz()
##############################################################################
# Test univariate selection in classification settings
def test_select_kbest_classif():
# Test whether the relative univariate feature selection
# gets the correct items in a simple classification problem
# with the k best heuristic
X, y = make_classification(n_samples=200, n_features=20,
n_informative=3, n_redundant=2,
n_repeated=0, n_classes=8,
n_clusters_per_class=1, flip_y=0.0,
class_sep=10, shuffle=False, random_state=0)
univariate_filter = SelectKBest(f_classif, k=5)
X_r = univariate_filter.fit(X, y).transform(X)
X_r2 = GenericUnivariateSelect(
f_classif, mode='k_best', param=5).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(20)
gtruth[:5] = 1
assert_array_equal(support, gtruth)
def test_select_kbest_all():
# Test whether k="all" correctly returns all features.
X, y = make_classification(n_samples=20, n_features=10,
shuffle=False, random_state=0)
univariate_filter = SelectKBest(f_classif, k='all')
X_r = univariate_filter.fit(X, y).transform(X)
assert_array_equal(X, X_r)
def test_select_kbest_zero():
# Test whether k=0 correctly returns no features.
X, y = make_classification(n_samples=20, n_features=10,
shuffle=False, random_state=0)
univariate_filter = SelectKBest(f_classif, k=0)
univariate_filter.fit(X, y)
support = univariate_filter.get_support()
gtruth = np.zeros(10, dtype=bool)
assert_array_equal(support, gtruth)
X_selected = assert_warns_message(UserWarning, 'No features were selected',
univariate_filter.transform, X)
assert X_selected.shape == (20, 0)
def test_select_heuristics_classif():
# Test whether the relative univariate feature selection
# gets the correct items in a simple classification problem
# with the fdr, fwe and fpr heuristics
X, y = make_classification(n_samples=200, n_features=20,
n_informative=3, n_redundant=2,
n_repeated=0, n_classes=8,
n_clusters_per_class=1, flip_y=0.0,
class_sep=10, shuffle=False, random_state=0)
univariate_filter = SelectFwe(f_classif, alpha=0.01)
X_r = univariate_filter.fit(X, y).transform(X)
gtruth = np.zeros(20)
gtruth[:5] = 1
for mode in ['fdr', 'fpr', 'fwe']:
X_r2 = GenericUnivariateSelect(
f_classif, mode=mode, param=0.01).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
assert_array_almost_equal(support, gtruth)
##############################################################################
# Test univariate selection in regression settings
def assert_best_scores_kept(score_filter):
scores = score_filter.scores_
support = score_filter.get_support()
assert_array_almost_equal(np.sort(scores[support]),
np.sort(scores)[-support.sum():])
def test_select_percentile_regression():
# Test whether the relative univariate feature selection
# gets the correct items in a simple regression problem
# with the percentile heuristic
X, y = make_regression(n_samples=200, n_features=20,
n_informative=5, shuffle=False, random_state=0)
univariate_filter = SelectPercentile(f_regression, percentile=25)
X_r = univariate_filter.fit(X, y).transform(X)
assert_best_scores_kept(univariate_filter)
X_r2 = GenericUnivariateSelect(
f_regression, mode='percentile', param=25).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(20)
gtruth[:5] = 1
assert_array_equal(support, gtruth)
X_2 = X.copy()
X_2[:, np.logical_not(support)] = 0
assert_array_equal(X_2, univariate_filter.inverse_transform(X_r))
# Check inverse_transform respects dtype
assert_array_equal(X_2.astype(bool),
univariate_filter.inverse_transform(X_r.astype(bool)))
def test_select_percentile_regression_full():
# Test whether the relative univariate feature selection
# selects all features when '100%' is asked.
X, y = make_regression(n_samples=200, n_features=20,
n_informative=5, shuffle=False, random_state=0)
univariate_filter = SelectPercentile(f_regression, percentile=100)
X_r = univariate_filter.fit(X, y).transform(X)
assert_best_scores_kept(univariate_filter)
X_r2 = GenericUnivariateSelect(
f_regression, mode='percentile', param=100).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.ones(20)
assert_array_equal(support, gtruth)
def test_invalid_percentile():
X, y = make_regression(n_samples=10, n_features=20,
n_informative=2, shuffle=False, random_state=0)
with pytest.raises(ValueError):
SelectPercentile(percentile=-1).fit(X, y)
with pytest.raises(ValueError):
SelectPercentile(percentile=101).fit(X, y)
with pytest.raises(ValueError):
GenericUnivariateSelect(mode='percentile', param=-1).fit(X, y)
with pytest.raises(ValueError):
GenericUnivariateSelect(mode='percentile', param=101).fit(X, y)
def test_select_kbest_regression():
# Test whether the relative univariate feature selection
# gets the correct items in a simple regression problem
# with the k best heuristic
X, y = make_regression(n_samples=200, n_features=20, n_informative=5,
shuffle=False, random_state=0, noise=10)
univariate_filter = SelectKBest(f_regression, k=5)
X_r = univariate_filter.fit(X, y).transform(X)
assert_best_scores_kept(univariate_filter)
X_r2 = GenericUnivariateSelect(
f_regression, mode='k_best', param=5).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(20)
gtruth[:5] = 1
assert_array_equal(support, gtruth)
def test_select_heuristics_regression():
# Test whether the relative univariate feature selection
# gets the correct items in a simple regression problem
# with the fpr, fdr or fwe heuristics
X, y = make_regression(n_samples=200, n_features=20, n_informative=5,
shuffle=False, random_state=0, noise=10)
univariate_filter = SelectFpr(f_regression, alpha=0.01)
X_r = univariate_filter.fit(X, y).transform(X)
gtruth = np.zeros(20)
gtruth[:5] = 1
for mode in ['fdr', 'fpr', 'fwe']:
X_r2 = GenericUnivariateSelect(
f_regression, mode=mode, param=0.01).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
assert_array_equal(support[:5], np.ones((5, ), dtype=bool))
assert np.sum(support[5:] == 1) < 3
def test_boundary_case_ch2():
# Test boundary case, and always aim to select 1 feature.
X = np.array([[10, 20], [20, 20], [20, 30]])
y = np.array([[1], [0], [0]])
scores, pvalues = chi2(X, y)
assert_array_almost_equal(scores, np.array([4., 0.71428571]))
assert_array_almost_equal(pvalues, np.array([0.04550026, 0.39802472]))
filter_fdr = SelectFdr(chi2, alpha=0.1)
filter_fdr.fit(X, y)
support_fdr = filter_fdr.get_support()
assert_array_equal(support_fdr, np.array([True, False]))
filter_kbest = SelectKBest(chi2, k=1)
filter_kbest.fit(X, y)
support_kbest = filter_kbest.get_support()
assert_array_equal(support_kbest, np.array([True, False]))
filter_percentile = SelectPercentile(chi2, percentile=50)
filter_percentile.fit(X, y)
support_percentile = filter_percentile.get_support()
assert_array_equal(support_percentile, np.array([True, False]))
filter_fpr = SelectFpr(chi2, alpha=0.1)
filter_fpr.fit(X, y)
support_fpr = filter_fpr.get_support()
assert_array_equal(support_fpr, np.array([True, False]))
filter_fwe = SelectFwe(chi2, alpha=0.1)
filter_fwe.fit(X, y)
support_fwe = filter_fwe.get_support()
assert_array_equal(support_fwe, np.array([True, False]))
@pytest.mark.parametrize("alpha", [0.001, 0.01, 0.1])
@pytest.mark.parametrize("n_informative", [1, 5, 10])
def test_select_fdr_regression(alpha, n_informative):
# Test that fdr heuristic actually has low FDR.
def single_fdr(alpha, n_informative, random_state):
X, y = make_regression(n_samples=150, n_features=20,
n_informative=n_informative, shuffle=False,
random_state=random_state, noise=10)
with warnings.catch_warnings(record=True):
# Warnings can be raised when no features are selected
# (low alpha or very noisy data)
univariate_filter = SelectFdr(f_regression, alpha=alpha)
X_r = univariate_filter.fit(X, y).transform(X)
X_r2 = GenericUnivariateSelect(
f_regression, mode='fdr', param=alpha).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
num_false_positives = np.sum(support[n_informative:] == 1)
num_true_positives = np.sum(support[:n_informative] == 1)
if num_false_positives == 0:
return 0.
false_discovery_rate = (num_false_positives /
(num_true_positives + num_false_positives))
return false_discovery_rate
# As per Benjamini-Hochberg, the expected false discovery rate
# should be lower than alpha:
# FDR = E(FP / (TP + FP)) <= alpha
false_discovery_rate = np.mean([single_fdr(alpha, n_informative,
random_state) for
random_state in range(100)])
assert alpha >= false_discovery_rate
# Make sure that the empirical false discovery rate increases
# with alpha:
if false_discovery_rate != 0:
assert false_discovery_rate > alpha / 10
def test_select_fwe_regression():
# Test whether the relative univariate feature selection
# gets the correct items in a simple regression problem
# with the fwe heuristic
X, y = make_regression(n_samples=200, n_features=20,
n_informative=5, shuffle=False, random_state=0)
univariate_filter = SelectFwe(f_regression, alpha=0.01)
X_r = univariate_filter.fit(X, y).transform(X)
X_r2 = GenericUnivariateSelect(
f_regression, mode='fwe', param=0.01).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(20)
gtruth[:5] = 1
assert_array_equal(support[:5], np.ones((5, ), dtype=bool))
assert np.sum(support[5:] == 1) < 2
def test_selectkbest_tiebreaking():
# Test whether SelectKBest actually selects k features in case of ties.
# Prior to 0.11, SelectKBest would return more features than requested.
Xs = [[0, 1, 1], [0, 0, 1], [1, 0, 0], [1, 1, 0]]
y = [1]
dummy_score = lambda X, y: (X[0], X[0])
for X in Xs:
sel = SelectKBest(dummy_score, k=1)
X1 = ignore_warnings(sel.fit_transform)([X], y)
assert X1.shape[1] == 1
assert_best_scores_kept(sel)
sel = SelectKBest(dummy_score, k=2)
X2 = ignore_warnings(sel.fit_transform)([X], y)
assert X2.shape[1] == 2
assert_best_scores_kept(sel)
def test_selectpercentile_tiebreaking():
# Test if SelectPercentile selects the right n_features in case of ties.
Xs = [[0, 1, 1], [0, 0, 1], [1, 0, 0], [1, 1, 0]]
y = [1]
dummy_score = lambda X, y: (X[0], X[0])
for X in Xs:
sel = SelectPercentile(dummy_score, percentile=34)
X1 = ignore_warnings(sel.fit_transform)([X], y)
assert X1.shape[1] == 1
assert_best_scores_kept(sel)
sel = SelectPercentile(dummy_score, percentile=67)
X2 = ignore_warnings(sel.fit_transform)([X], y)
assert X2.shape[1] == 2
assert_best_scores_kept(sel)
def test_tied_pvalues():
# Test whether k-best and percentiles work with tied pvalues from chi2.
# chi2 will return the same p-values for the following features, but it
# will return different scores.
X0 = np.array([[10000, 9999, 9998], [1, 1, 1]])
y = [0, 1]
for perm in itertools.permutations((0, 1, 2)):
X = X0[:, perm]
Xt = SelectKBest(chi2, k=2).fit_transform(X, y)
assert Xt.shape == (2, 2)
assert 9998 not in Xt
Xt = SelectPercentile(chi2, percentile=67).fit_transform(X, y)
assert Xt.shape == (2, 2)
assert 9998 not in Xt
def test_scorefunc_multilabel():
# Test whether k-best and percentiles works with multilabels with chi2.
X = np.array([[10000, 9999, 0], [100, 9999, 0], [1000, 99, 0]])
y = [[1, 1], [0, 1], [1, 0]]
Xt = SelectKBest(chi2, k=2).fit_transform(X, y)
assert Xt.shape == (3, 2)
assert 0 not in Xt
Xt = SelectPercentile(chi2, percentile=67).fit_transform(X, y)
assert Xt.shape == (3, 2)
assert 0 not in Xt
def test_tied_scores():
# Test for stable sorting in k-best with tied scores.
X_train = np.array([[0, 0, 0], [1, 1, 1]])
y_train = [0, 1]
for n_features in [1, 2, 3]:
sel = SelectKBest(chi2, k=n_features).fit(X_train, y_train)
X_test = sel.transform([[0, 1, 2]])
assert_array_equal(X_test[0], np.arange(3)[-n_features:])
def test_nans():
# Assert that SelectKBest and SelectPercentile can handle NaNs.
# First feature has zero variance to confuse f_classif (ANOVA) and
# make it return a NaN.
X = [[0, 1, 0], [0, -1, -1], [0, .5, .5]]
y = [1, 0, 1]
for select in (SelectKBest(f_classif, k=2),
SelectPercentile(f_classif, percentile=67)):
ignore_warnings(select.fit)(X, y)
assert_array_equal(select.get_support(indices=True), np.array([1, 2]))
def test_score_func_error():
X = [[0, 1, 0], [0, -1, -1], [0, .5, .5]]
y = [1, 0, 1]
for SelectFeatures in [SelectKBest, SelectPercentile, SelectFwe,
SelectFdr, SelectFpr, GenericUnivariateSelect]:
with pytest.raises(TypeError):
SelectFeatures(score_func=10).fit(X, y)
def test_invalid_k():
X = [[0, 1, 0], [0, -1, -1], [0, .5, .5]]
y = [1, 0, 1]
with pytest.raises(ValueError):
SelectKBest(k=-1).fit(X, y)
with pytest.raises(ValueError):
SelectKBest(k=4).fit(X, y)
with pytest.raises(ValueError):
GenericUnivariateSelect(mode='k_best', param=-1).fit(X, y)
with pytest.raises(ValueError):
GenericUnivariateSelect(mode='k_best', param=4).fit(X, y)
def test_f_classif_constant_feature():
# Test that f_classif warns if a feature is constant throughout.
X, y = make_classification(n_samples=10, n_features=5)
X[:, 0] = 2.0
assert_warns(UserWarning, f_classif, X, y)
def test_no_feature_selected():
rng = np.random.RandomState(0)
# Generate random uncorrelated data: a strict univariate test should
# rejects all the features
X = rng.rand(40, 10)
y = rng.randint(0, 4, size=40)
strict_selectors = [
SelectFwe(alpha=0.01).fit(X, y),
SelectFdr(alpha=0.01).fit(X, y),
SelectFpr(alpha=0.01).fit(X, y),
SelectPercentile(percentile=0).fit(X, y),
SelectKBest(k=0).fit(X, y),
]
for selector in strict_selectors:
assert_array_equal(selector.get_support(), np.zeros(10))
X_selected = assert_warns_message(
UserWarning, 'No features were selected', selector.transform, X)
assert X_selected.shape == (40, 0)
def test_mutual_info_classif():
X, y = make_classification(n_samples=100, n_features=5,
n_informative=1, n_redundant=1,
n_repeated=0, n_classes=2,
n_clusters_per_class=1, flip_y=0.0,
class_sep=10, shuffle=False, random_state=0)
# Test in KBest mode.
univariate_filter = SelectKBest(mutual_info_classif, k=2)
X_r = univariate_filter.fit(X, y).transform(X)
X_r2 = GenericUnivariateSelect(
mutual_info_classif, mode='k_best', param=2).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(5)
gtruth[:2] = 1
assert_array_equal(support, gtruth)
# Test in Percentile mode.
univariate_filter = SelectPercentile(mutual_info_classif, percentile=40)
X_r = univariate_filter.fit(X, y).transform(X)
X_r2 = GenericUnivariateSelect(
mutual_info_classif, mode='percentile', param=40).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(5)
gtruth[:2] = 1
assert_array_equal(support, gtruth)
def test_mutual_info_regression():
X, y = make_regression(n_samples=100, n_features=10, n_informative=2,
shuffle=False, random_state=0, noise=10)
# Test in KBest mode.
univariate_filter = SelectKBest(mutual_info_regression, k=2)
X_r = univariate_filter.fit(X, y).transform(X)
assert_best_scores_kept(univariate_filter)
X_r2 = GenericUnivariateSelect(
mutual_info_regression, mode='k_best', param=2).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(10)
gtruth[:2] = 1
assert_array_equal(support, gtruth)
# Test in Percentile mode.
univariate_filter = SelectPercentile(mutual_info_regression, percentile=20)
X_r = univariate_filter.fit(X, y).transform(X)
X_r2 = GenericUnivariateSelect(mutual_info_regression, mode='percentile',
param=20).fit(X, y).transform(X)
assert_array_equal(X_r, X_r2)
support = univariate_filter.get_support()
gtruth = np.zeros(10)
gtruth[:2] = 1
assert_array_equal(support, gtruth)
| [
"82611064+python019@users.noreply.github.com"
] | 82611064+python019@users.noreply.github.com |
6357f1bd09258e62dd0025f8e951d747a4d8a5c9 | 87894ccd1c2c4aa6dd8fc59e7a4ceec4358e97f8 | /shared/misc/fix-rules.py | 2c3416da1e0f7ad2e609b6a75da66730aee7513b | [
"BSD-3-Clause"
] | permissive | fkhadra/scap-security-guide | 4f09e26589dc29577e3bde30b6ee31c6cae98c74 | 2ba78385dba40eb9f00542975ad166ece671e889 | refs/heads/master | 2023-04-27T07:25:47.970384 | 2018-06-08T20:00:11 | 2018-06-08T20:00:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 17,382 | py | #!/usr/bin/env python2
import sys
import os
import jinja2
# Put shared python modules in path
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
"modules"))
from ssgcommon import required_yaml_key
import ssgcommon
def has_empty_identifier(yaml_file, product_yaml=None):
rule = ssgcommon.open_and_macro_expand_yaml(yaml_file, product_yaml)
if 'identifiers' in rule and rule['identifiers'] is None:
return True
if 'identifiers' in rule and rule['identifiers'] is not None:
for _, value in rule['identifiers'].items():
if str(value).strip() == "":
return True
return False
def has_empty_references(yaml_file, product_yaml=None):
rule = ssgcommon.open_and_macro_expand_yaml(yaml_file, product_yaml)
if 'references' in rule and rule['references'] is None:
return True
if 'references' in rule and rule['references'] is not None:
for _, value in rule['references'].items():
if str(value).strip() == "":
return True
return False
def has_prefix_cce(yaml_file, product_yaml=None):
rule = ssgcommon.open_and_macro_expand_yaml(yaml_file, product_yaml)
if 'identifiers' in rule and rule['identifiers'] is not None:
for i_type, i_value in rule['identifiers'].items():
if i_type[0:3] == 'cce':
has_prefix = i_value[0:3].upper() == 'CCE'
remainder_valid = ssgcommon.cce_is_valid("CCE-" + i_value[3:])
remainder_valid |= ssgcommon.cce_is_valid("CCE-" + i_value[4:])
return has_prefix and remainder_valid
return False
def has_invalid_cce(yaml_file, product_yaml=None):
rule = ssgcommon.open_and_macro_expand_yaml(yaml_file, product_yaml)
if 'identifiers' in rule and rule['identifiers'] is not None:
for i_type, i_value in rule['identifiers'].items():
if i_type[0:3] == 'cce':
if not ssgcommon.cce_is_valid("CCE-" + i_value):
return True
return False
def has_int_identifier(yaml_file, product_yaml=None):
rule = ssgcommon.open_and_macro_expand_yaml(yaml_file, product_yaml)
if 'identifiers' in rule and rule['identifiers'] is not None:
for _, value in rule['identifiers'].items():
if type(value) != str:
return True
return False
def has_int_reference(yaml_file, product_yaml=None):
rule = ssgcommon.open_and_macro_expand_yaml(yaml_file, product_yaml)
if 'references' in rule and rule['references'] is not None:
for _, value in rule['references'].items():
if type(value) != str:
return True
return False
def find_rules(directory, func):
# Iterates over passed directory to correctly parse rules (which are
# YAML files with internal macros). The most recently seen product.yml
# takes precedence over previous product.yml, e.g.:
#
# a/product.yml
# a/b/product.yml -- will be selected for the following rule:
# a/b/c/something.rule
#
# The corresponding rule and contents of the product.yml are then passed
# into func(/path/to/rule, product_yaml_contents); if the result evalutes
# to true, the tuple (/path/to/rule, /path/to/product.yml) is saved as a
# result.
#
# This process mimics the build system and allows us to find rule files
# which satisfy the constraints of the passed func.
results = []
product_yamls = {}
product_yaml_paths = {}
for root, dirs, files in os.walk(directory):
product_yaml = None
product_yaml_path = None
if "product.yml" in files:
product_yaml_path = os.path.join(root, "product.yml")
product_yaml = ssgcommon.open_yaml(product_yaml_path)
product_yamls[root] = product_yaml
product_yaml_paths[root] = product_yaml_path
for d in dirs:
product_yamls[os.path.join(root, d)] = product_yaml
product_yaml_paths[os.path.join(root, d)] = product_yaml_path
elif root in product_yamls:
product_yaml = product_yamls[root]
product_yaml_path = product_yaml_paths[root]
for d in dirs:
product_yamls[os.path.join(root, d)] = product_yaml
product_yaml_paths[os.path.join(root, d)] = product_yaml_path
else:
pass
for filename in files:
path = os.path.join(root, filename)
if len(path) < 5 or path[-5:] != '.rule':
continue
try:
if func(path, product_yaml):
results.append((path, product_yaml_path))
except jinja2.exceptions.UndefinedError:
print("Failed to parse file %s (with product.yaml: %s). Skipping"
% (path, product_yaml_path))
pass
return results
def print_file(file_contents):
for line_num in range(0, len(file_contents)):
print("%d: %s" % (line_num, file_contents[line_num]))
def find_section_lines(file_contents, sec):
# Hack to find a global key ("section"/sec) in a YAML-like file.
# All indented lines until the next global key are included in the range.
# For example:
#
# 0: not_it:
# 1: - value
# 2: this_one:
# 3: - 2
# 4: - 5
# 5:
# 6: nor_this:
#
# for the section "this_one", the result [(2, 5)] will be returned.
# Note that multiple sections may exist in a file and each will be
# identified and returned.
sec_ranges = []
sec_id = sec + ":"
sec_len = len(sec_id)
end_num = len(file_contents)
line_num = 0
while line_num < end_num:
if len(file_contents[line_num]) >= sec_len:
if file_contents[line_num][0:sec_len] == sec_id:
begin = line_num
line_num += 1
while line_num < end_num:
if len(file_contents[line_num]) > 0 and file_contents[line_num][0] != ' ':
break
line_num += 1
end = line_num - 1
sec_ranges.append((begin, end))
line_num += 1
return sec_ranges
def remove_lines(file_contents, lines):
# Returns a series of lines and returns a new copy
new_file = []
for line_num in range(0, len(file_contents)):
if line_num not in lines:
new_file.append(file_contents[line_num])
return new_file
def remove_section_keys(file_contents, yaml_contents, section, removed_keys):
# Remove a series of keys from a section. Refuses to operate if there is more
# than one instance of the section. If the section is empty (because all keys
# are removed), then the section is also removed. Otherwise, only matching keys
# are removed. Note that all instances of the keys will be removed, if it appears
# more than once.
sec_ranges = find_section_lines(file_contents, section)
if len(sec_ranges) != 1:
raise RuntimeError("Refusing to fix file: %s -- could not find one section: %d"
% (path, sec_ranges))
begin, end = sec_ranges[0]
r_lines = set()
if (yaml_contents[section] is None or len(yaml_contents[section].keys()) == len(removed_keys)):
r_lines = set(range(begin, end+1))
print("Removing entire section since all keys are empty")
else:
# Don't include section header
for line_num in range(begin+1, end+1):
line = file_contents[line_num].strip()
len_line = len(line)
for key in removed_keys:
k_l = len(key)+1
k_i = key + ":"
if len_line >= k_l and line[0:k_l] == k_i:
r_lines.add(line_num)
break
return remove_lines(file_contents, r_lines)
def rewrite_value_int_str(line):
# Rewrites a key's value to explicitly be a string. Assumes it starts
# as an integer. Takes a line.
key_end = line.index(':')
key = line[0:key_end]
value = line[key_end+1:].strip()
str_value = '"' + value + '"'
return key + ": " + str_value
def rewrite_value_remove_prefix(line):
# Rewrites a key's value to remove a "CCE" prefix.
key_end = line.index(':')
key = line[0:key_end]
value = line[key_end+1:].strip()
new_value = value
if ssgcommon.cce_is_valid("CCE-" + value[3:]):
new_value = value[3:]
elif ssgcommon.cce_is_valid("CCE-" + value[4:]):
new_value = value[4:]
return key + ": " + new_value
def rewrite_section_value(file_contents, yaml_contents, section, keys, transform):
# For a given section, rewrite the keys in int_keys to be strings. Refuses to
# operate if the given section appears more than once in the file. Assumes all
# instances of key are an integer; all will get updated.
new_contents = file_contents[:]
sec_ranges = find_section_lines(file_contents, section)
if len(sec_ranges) != 1:
raise RuntimeError("Refusing to fix file: %s -- could not find one section: %d"
% (path, sec_ranges))
begin, end = sec_ranges[0]
r_lines = set()
# Don't include section header
for line_num in range(begin+1, end+1):
line = file_contents[line_num].strip()
len_line = len(line)
for key in keys:
k_l = len(key)+1
k_i = key + ":"
if len_line >= k_l and line[0:k_l] == k_i:
new_contents[line_num] = transform(file_contents[line_num])
break
return new_contents
def rewrite_section_value_int_str(file_contents, yaml_contents, section, int_keys):
return rewrite_section_value(file_contents, yaml_contents, section, int_keys,
rewrite_value_int_str)
def fix_empty_identifier(file_contents, yaml_contents):
section = 'identifiers'
empty_identifiers = []
if yaml_contents[section] is not None:
for i_type, i_value in yaml_contents[section].items():
if str(i_value).strip() == "":
empty_identifiers.append(i_type)
return remove_section_keys(file_contents, yaml_contents, section, empty_identifiers)
def fix_empty_reference(file_contents, yaml_contents):
section = 'references'
empty_identifiers = []
if yaml_contents[section] is not None:
for i_type, i_value in yaml_contents[section].items():
if str(i_value).strip() == "":
empty_identifiers.append(i_type)
return remove_section_keys(file_contents, yaml_contents, section, empty_identifiers)
def fix_prefix_cce(file_contents, yaml_contents):
section = 'identifiers'
prefixed_identifiers = []
if yaml_contents[section] is not None:
for i_type, i_value in yaml_contents[section].items():
if i_type[0:3] == 'cce':
has_prefix = i_value[0:3].upper() == 'CCE'
remainder_valid = ssgcommon.cce_is_valid("CCE-" + i_value[3:])
remainder_valid |= ssgcommon.cce_is_valid("CCE-" + i_value[4:])
if has_prefix and remainder_valid:
prefixed_identifiers.append(i_type)
return rewrite_section_value(file_contents, yaml_contents, section, prefixed_identifiers,
rewrite_value_remove_prefix)
def fix_invalid_cce(file_contents, yaml_contents):
section = 'identifiers'
invalid_identifiers = []
if yaml_contents[section] is not None:
for i_type, i_value in yaml_contents[section].items():
if i_type[0:3] == 'cce':
if not ssgcommon.cce_is_valid("CCE-" + i_value):
invalid_identifiers.append(i_type)
return remove_section_keys(file_contents, yaml_contents, section, invalid_identifiers)
def fix_int_identifier(file_contents, yaml_contents):
section = 'identifiers'
int_identifiers = []
for i_type, i_value in yaml_contents[section].items():
if type(i_value) != str:
int_identifiers.append(i_type)
return rewrite_section_value_int_str(file_contents, yaml_contents, section, int_identifiers)
def fix_int_reference(file_contents, yaml_contents):
section = 'references'
int_identifiers = []
for i_type, i_value in yaml_contents[section].items():
if type(i_value) != str:
int_identifiers.append(i_type)
return rewrite_section_value_int_str(file_contents, yaml_contents, section, int_identifiers)
def fix_file(path, product_yaml, func):
file_contents = open(path, 'r').read().split("\n")
if file_contents[-1] == '':
file_contents = file_contents[:-1]
yaml_contents = ssgcommon.open_and_macro_expand_yaml(path, product_yaml)
print("====BEGIN BEFORE====")
print_file(file_contents)
print("====END BEFORE====")
file_contents = func(file_contents, yaml_contents)
print("====BEGIN AFTER====")
print_file(file_contents)
print("====END AFTER====")
response = raw_input("Confirm writing output to %s: (y/n): " % path)
if response.strip() == 'y':
f = open(path, 'w')
for line in file_contents:
f.write(line)
f.write("\n")
f.flush()
f.close()
def fix_empty_identifiers(directory):
results = find_rules(directory, has_empty_identifier)
print("Number of rules with empty identifiers: %d" % len(results))
for result in results:
rule_path = result[0]
product_yaml_path = result[1]
product_yaml = None
if product_yaml_path is not None:
product_yaml = ssgcommon.open_yaml(product_yaml_path)
fix_file(rule_path, product_yaml, fix_empty_identifier)
def fix_empty_references(directory):
results = find_rules(directory, has_empty_references)
print("Number of rules with empty references: %d" % len(results))
for result in results:
rule_path = result[0]
product_yaml_path = result[1]
product_yaml = None
if product_yaml_path is not None:
product_yaml = ssgcommon.open_yaml(product_yaml_path)
fix_file(rule_path, product_yaml, fix_empty_reference)
def find_prefix_cce(directory):
results = find_rules(directory, has_prefix_cce)
print("Number of rules with prefixed CCEs: %d" % len(results))
for result in results:
rule_path = result[0]
rule_path = result[0]
product_yaml_path = result[1]
product_yaml = None
if product_yaml_path is not None:
product_yaml = ssgcommon.open_yaml(product_yaml_path)
fix_file(rule_path, product_yaml, fix_prefix_cce)
def find_invalid_cce(directory):
results = find_rules(directory, has_invalid_cce)
print("Number of rules with invalid CCEs: %d" % len(results))
for result in results:
rule_path = result[0]
rule_path = result[0]
product_yaml_path = result[1]
product_yaml = None
if product_yaml_path is not None:
product_yaml = ssgcommon.open_yaml(product_yaml_path)
fix_file(rule_path, product_yaml, fix_invalid_cce)
def find_int_identifiers(directory):
results = find_rules(directory, has_int_identifier)
print("Number of rules with integer identifiers: %d" % len(results))
for result in results:
rule_path = result[0]
product_yaml_path = result[1]
product_yaml = None
if product_yaml_path is not None:
product_yaml = ssgcommon.open_yaml(product_yaml_path)
fix_file(rule_path, product_yaml, fix_int_identifier)
def find_int_references(directory):
results = find_rules(directory, has_int_reference)
print("Number of rules with integer references: %d" % len(results))
for result in results:
rule_path = result[0]
product_yaml_path = result[1]
product_yaml = None
if product_yaml_path is not None:
product_yaml = ssgcommon.open_yaml(product_yaml_path)
fix_file(rule_path, product_yaml, fix_int_reference)
def __main__():
if sys.argv[1] == 'empty_identifiers':
fix_empty_identifiers(sys.argv[2])
elif sys.argv[1] == 'prefixed_identifiers':
find_prefix_cce(sys.argv[2])
elif sys.argv[1] == 'invalid_identifiers':
find_invalid_cce(sys.argv[2])
elif sys.argv[1] == 'int_identifiers':
find_int_identifiers(sys.argv[2])
elif sys.argv[1] == 'empty_references':
fix_empty_references(sys.argv[2])
elif sys.argv[1] == 'int_references':
find_int_references(sys.argv[2])
else:
print("Usage: %s mode /full/path/to/src/directory" % sys.argv[0])
print("Modes:")
print("\tempty_identifiers - check and fix rules with empty identifiers")
print("\tprefixed_identifiers - check and fix rules with prefixed (CCE-) identifiers")
print("\tinvalid_identifiers - check and fix rules with invalid identifiers")
print("\tint_identifiers - check and fix rules with pseudo-integer identifiers")
print("\tempty_references - check and fix rules with empty references")
print("\tint_references - check and fix rules with pseduo-integer references")
if __name__ == "__main__":
__main__()
| [
"ascheel@redhat.com"
] | ascheel@redhat.com |
6f91b03566136db683a3d86141888b7a9833cd10 | 69c33fcad69a2e61cc60209401215530d033e712 | /Python/Python Basics/61.bug.py | 7042666dc52065c03ab0862676b4ab06c3b63872 | [] | no_license | KULDEEPMALIKM41/Practices | 7659b895ea959c7df2cdbc79c0b982b36f2bde63 | 193abe262ff281a384aac7895bb66dc39ee6e88d | refs/heads/master | 2023-08-17T11:01:11.694282 | 2021-09-30T08:12:41 | 2021-09-30T08:12:41 | 289,527,102 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 59 | py | i=1
while i<11:
print(i,end='') #indentation error
i+=1 | [
"Kuldeepmalikm41@gmail.com"
] | Kuldeepmalikm41@gmail.com |
2fdee872e07185a565e9e9da20a9ca5dab3dde8a | fc4eb0b7ffe2c0f2f7d578355cb7f4725005f40b | /kafkaComponents/producer.py | fab595241e57046cdca3c6e05abdb03f46a2b13c | [] | no_license | WaleedAKhan/WAMI | 5d6a22bdd1bd5e9865a1b2b4693aab00b6fd60a1 | 64984caffa4145654b8459298917e30fbfbbbdbf | refs/heads/master | 2020-04-28T12:59:18.644271 | 2019-05-02T13:55:19 | 2019-05-02T13:55:19 | 175,293,627 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,134 | py | import twitter
import json
from kafka import KafkaProducer
from kafka.client import SimpleClient
from kafka.consumer import SimpleConsumer
from kafka.producer import SimpleProducer
#client = SimpleClient("localhost:9092")
#producer = SimpleProducer(client)
producer = KafkaProducer(value_serializer=lambda v: json.dumps(v).encode('utf-8'))
api = twitter.Api(consumer_key='zfoaXqtplRFtSgjC8RVs1sEbm',
consumer_secret='Fz9HzQQToC5b1BjXJ1EwhhwSsib2siM96EVk2oCXkGXcK25eIm',
access_token_key='1096068391721287680-gME3FNmXEdp4r7Fb51oDBwAdBVfyob',
access_token_secret='AKUN4AQoAOkVGAbzSwqDuMbACtAXR2rELex7PGwDos1Zh',
tweet_mode='extended')
s = api.GetStreamFilter(track=['CIHI', 'health canada', 'Canadian Institute for Health Information'],languages=['en'])
for t in s:
if not t.get('retweeted_status'):
try:
print(t)
#print(t.get('id'))
tweet = api.GetStatus(t.get('id'))
#Serialize to JSON
data = {}
data['id'] = tweet.id
data['text'] = tweet.full_text
data['hashtags'] = str(tweet.hashtags)
data['userName'] = tweet.user.name
data['userScreenName'] = tweet.user.screen_name
data['createdAt'] = tweet.created_at
data['userLocation'] = tweet.user.location
data['userFollowers'] = tweet.user.followers_count
data['userFollowing'] = tweet.user.friends_count
if t.get('quoted_status'):
data['quoted_status'] = tweet.quoted_status.text
data['quoted_status_full'] = tweet.quoted_status
print("\n" + data['quoted_status'])
jsonData = json.dumps(data)
print(tweet)
#producer.send_messages('test', t.get('full_text').encode('utf-8'))
#producer.send_messages('test', tweet.full_text.encode('utf-8'))
producer.send('test', jsonData)
except Exception as e:
print("Error occured" + str(e))
| [
"wkhan@wkhan.com"
] | wkhan@wkhan.com |
1bc5bfe0093dafca4e694e1f48a3517bedeab02c | 5cd6a7fa7be3b00ff63e60935bc1be9fa1cfebf4 | /projects/mid_atlantic/study/plot_FigS3_Distance_v_Depth_By_State.py | 32b02836b5905138d01abb24b202eb0527cf62b4 | [
"MIT"
] | permissive | EnergyModels/caes | 214e1c7cded4498f33670da7eeebccbaa665e930 | 5e994c198657226925161db1980ebfa704d0c90b | refs/heads/master | 2023-08-23T15:05:53.594530 | 2021-11-06T01:00:57 | 2021-11-06T01:00:57 | 261,201,284 | 3 | 3 | null | null | null | null | UTF-8 | Python | false | false | 4,026 | py | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes, mark_inset
df = pd.read_csv('all_analysis.csv')
# f, a = plt.subplots(2,1)
# a = a.ravel()
#
# sns.scatterplot(data=df, x='NEAR_DIST',y='feasible_fr', hue='NEAR_FC', ax=a[0])
#
# sns.scatterplot(data=df, x='NEAR_DIST',y='RASTERVALU', hue='NEAR_FC', ax=a[1])
# conversions and column renaming
df.loc[:, 'Distance to shore (km)'] = df.loc[:, 'NEAR_DIST'] / 1000.0
df.loc[:, 'Water depth (m)'] = df.loc[:, 'RASTERVALU']
df.loc[:, 'Feasibility (%)'] = df.loc[:, 'feasible_fr'] * 100.0
df.loc[:, 'Formation (-)'] = df.loc[:, 'formation']
df.loc[:, 'Nearest State (-)'] = df.loc[:, 'NEAR_FC']
loc_dict = {'VA_shore': 'Virginia', 'MD_shore': 'Maryland', 'NJ_shore': 'New Jersey', 'DE_shore': 'Delaware',
'NY_shore': 'New York', 'MA_shore': 'Massachusetts', 'RI_shore': 'Rhode Island'}
formation_dict = {'LK1': 'Lower Cretaceous', 'MK1-3': 'Middle Cretaceous', 'UJ1': 'Upper Jurassic'}
# rename
for loc in df.loc[:, 'Nearest State (-)'].unique():
ind = df.loc[:, 'Nearest State (-)'] == loc
df.loc[ind, 'Nearest State (-)'] = loc_dict[loc]
# rename
for formation in df.loc[:, 'Formation (-)'].unique():
ind = df.loc[:, 'Formation (-)'] == formation
df.loc[ind, 'Formation (-)'] = formation_dict[formation]
# Filter data with feasibility greater than 0.8
# df = df[df.loc[:,'Feasibility (%)']>=0.8]
# Filter data with mean RTE greater than 0.5
df = df[df.loc[:, 'RTE_mean'] >= 0.5]
# sns.scatterplot(data=df, x='Distance to shore (km)', y='Water depth (m)', hue='Nearest State (-)',
# size='Feasibility (%)', style='Formation (-)')
#
# # a[1].set_ylim(top=0.0,bottom=-100.0)
#
# sns.scatterplot(data=df, x='Distance to shore (km)', y='Water depth (m)', hue='Nearest State (-)',
# size='Feasibility (%)', style='Formation (-)', ax=a[1])
#
# a[1].set_xlim(left=0.0,right=100.0)
# a[1].set_ylim(top=0.0,bottom=-100.0)
# create figure
f, a = plt.subplots(1, 1)
axins = zoomed_inset_axes(a, zoom=2.2, loc='upper center', bbox_to_anchor=(0.5, -0.2), bbox_transform=a.transAxes)
# Main plot
sns.scatterplot(data=df, x='Distance to shore (km)', y='Water depth (m)', hue='Nearest State (-)',
style='Formation (-)', ax=a)
a.set_xlim(left=0.0, right=300.0)
a.set_ylim(top=0, bottom=-400.0)
# a.set_yscale('symlog')
# Inset
x_lims = [0.0, 100.0]
y_lims = [0, -60.0]
rect = plt.Rectangle((x_lims[0] + 1, y_lims[0]), x_lims[1] - x_lims[0] + 1, y_lims[1] - y_lims[0], fill=False,
facecolor="black",
edgecolor='black', linestyle='--')
a.add_patch(rect)
sns.scatterplot(data=df, x='Distance to shore (km)', y='Water depth (m)', hue='Nearest State (-)',
style='Formation (-)', legend=False, ax=axins)
axins.set_xlim(left=x_lims[0], right=x_lims[1])
axins.set_ylim(top=y_lims[0], bottom=y_lims[1])
# axins.set_yscale('symlog')
axins.yaxis.set_major_locator(plt.MaxNLocator(3))
a.legend(bbox_to_anchor=(1.025, 0.0), loc="center left", ncol=1)
a.text(-0.1, 1.0, 'a', horizontalalignment='center', verticalalignment='center',
transform=a.transAxes, fontsize='medium', fontweight='bold')
axins.text(-0.3, 1.0, 'b', horizontalalignment='center', verticalalignment='center',
transform=axins.transAxes, fontsize='medium', fontweight='bold')
# Add rectangle that represents subplot2
# Column width guidelines https://www.elsevier.com/authors/author-schemas/artwork-and-media-instructions/artwork-sizing
# Single column: 90mm = 3.54 in
# 1.5 column: 140 mm = 5.51 in
# 2 column: 190 mm = 7.48 i
width = 7.48 # inches
height = 7.0 # inches
# Set size
f.set_size_inches(width, height)
plt.subplots_adjust(top=0.95,
bottom=0.5,
left=0.12,
right=0.7,
hspace=0.2,
wspace=0.2)
# save
plt.savefig('FigS3_Distance_v_Depth_By_State.png', dpi=300)
| [
"jab6ft@virginia.edu"
] | jab6ft@virginia.edu |
a932f56ccdaa2f7a20185a3e05e0b8bd78a019c7 | 1ec6fe8811cb2b21b68eca7d75ac6b3c88e0f8ba | /Week_05/G20200389010182/write_to_mysql.py | 160f78ec8d3fe2b0c9b00e033f9c9b0d433af34a | [] | no_license | hopeqpy/Python000-class01 | 5f0aa8f3aaba7da97819ec073fd9d16c0cd902e8 | 73b8f8606c5cce0ea8982aed3705ad4cfc70cc70 | refs/heads/master | 2022-06-26T13:36:58.766271 | 2020-05-07T07:24:24 | 2020-05-07T07:24:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 617 | py | import pymysql
import pandas as pd
from sqlalchemy import create_engine
conn = create_engine('mysql+pymysql://root:root@localhost:3306/test',encoding='utf8')
df1 = pd.read_csv('book.csv')
# pd.io.sql.to_sql(df, 'shuping', conn, if_exists = 'replace')
# ALTER DATABASE skills CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
# ALTER TABLE shuping CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
df1.to_sql('shuping', conn, if_exists = 'append', index=False)
# mapd={'testcol':["date"],'dd':['2017/01/01']}
# df=pd.DataFrame(mapd)
# df.to_sql('testpd',con=conn, if_exists='append', index=False) | [
"chuanwj@163.com"
] | chuanwj@163.com |
d6e3c866e4c2dee2198877c7ca12e01faf377365 | 29b83640a5563e0a409c7ca72dd46b915bb25089 | /setup.py | caca3d93b1e7cb7b59e55e1f18840850a12bd706 | [] | no_license | ArjanPronk/tiktok-api | d18dfae55c9a7c805b9524ca9909447fe1f388c2 | 9f720ad5791414c25db16cdec1221c5aa7f32c70 | refs/heads/master | 2020-11-27T03:50:03.233267 | 2019-12-20T15:55:36 | 2019-12-20T15:55:36 | 229,293,166 | 0 | 0 | null | 2019-12-20T15:53:38 | 2019-12-20T15:53:37 | null | UTF-8 | Python | false | false | 1,257 | py | from codecs import open
from os import path
from setuptools import find_packages, setup
setup(
name="tiktok-api",
version="0.10.3",
description="Tiktok Api.",
# description="tiktok api",
author="Steffan Jensen",
author_email="brominercom2@gmail.com",
license="Apache Software License 2.0",
url="https://github.com/instabotai/tiktok-api",
keywords=["tiktok", "bot", "api"],
install_requires=[
"requests",
],
entry_points={
'console_scripts': ['tiktok-api=tiktokapi:api'],
},
classifiers=[
# How mature is this project? Common values are
"Development Status :: 5 - Production/Stable",
# Indicate who your project is intended for
"Intended Audience :: Information Technology",
# Pick your license as you wish (should match "license" above)
"License :: OSI Approved :: Apache Software License",
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
packages=find_packages(),
)
| [
"noreply@github.com"
] | noreply@github.com |
ac3142959ea8cad01113bded21db613df639e564 | 9da8754002fa402ad8e6f25659978bd269bbcec8 | /src/326A/test_cdf_326A.py | 64e36fcaf81aaefde3dcff7e62890268fa2c84a8 | [
"MIT"
] | permissive | kopok2/CodeforcesSolutionsPython | a00f706dbf368ba0846c8ae86d4145b5dd3e1613 | 35bec0dbcff47765b123b5fe60476014376153df | refs/heads/master | 2023-02-02T03:08:22.097651 | 2020-12-17T22:00:50 | 2020-12-17T22:00:50 | 196,035,812 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 185 | py | import unittest
from unittest.mock import patch
from cdf_326A import CodeforcesTask326ASolution
class TestCDF326A(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
| [
"oleszek.karol@gmail.com"
] | oleszek.karol@gmail.com |
b1aeb27d52fb9e199f756150fd1144e856437728 | 8f014951337cb776ae383b7b0193ead4d7bb7892 | /Python/Machine Learning intro/DecisionTreeClassifier/main.py | ac61404d559dec171d1830f69a2aacf17f1a5e5a | [] | no_license | frankcbw/miscellaneous | d26823ecca2e73a0297ab67bf4f82a366a687d2c | 6e12bb562141682c84ca1b176d26bde85a22145c | refs/heads/master | 2023-02-16T03:53:03.185120 | 2021-01-12T01:38:41 | 2021-01-12T01:38:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 938 | py | """
CSC311 Assignment_1 Q2 main
"""
from sklearn.tree import export_graphviz
from DecisionTreeClassifier.load_data import load_data
from DecisionTreeClassifier.select_model import select_model
from DecisionTreeClassifier.compute_information_gain import compute_information_gain
if __name__ == "__main__":
features, *data_set = load_data("clean_fake.txt", "clean_real.txt")
depth = list(range(10, 15))
best_model = select_model(data_set[0], data_set[1], data_set[2], data_set[3], depth)
export_graphviz(best_model, feature_names=features, max_depth=2, out_file="tree.dot")
print(compute_information_gain(features, data_set[0], data_set[1], "trump", 0.5))
print(compute_information_gain(features, data_set[0], data_set[1], "donald", 0.5))
print(compute_information_gain(features, data_set[0], data_set[1], "clinton", 0.5))
print(compute_information_gain(features, data_set[0], data_set[1], "hillary", 0.5))
| [
"frankchen0717@gmail.com"
] | frankchen0717@gmail.com |
1d616197582dd22b64ec5698a1002ce7bf525ac4 | 0c482c3e1468bc9444ce5faea1e45bfce1ee2433 | /Atmoscare_Web/final_test 拷貝/atmoscare/settings.py | b4d931392dbbad74b09287cbe1ba7053cade28d1 | [] | no_license | qo45p/Atomosphere- | 49112e02321eb8ac60d16ce1ae4f36313eb1f57b | 6750a8f6633a170b15787f6d57d1fec373ad8ee6 | refs/heads/master | 2020-05-14T23:39:01.100901 | 2019-04-18T02:35:04 | 2019-04-18T02:35:04 | 182,000,067 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,425 | py | # -*- coding: utf-8 -*-
"""
Django settings for atmoscare project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '26+5l6izvonpvcw=4kiweb#wc-vcu71x-crg+aj)+(qo6elgrl'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'overview',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'atmoscare.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR,'templates').replace('\\','/')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'atmoscare.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
STATIC_URL = '/static/'#for deploy
STATIC_ROOT = 'static'
SESSION_COOKIE_AGE = 60*60 #set as 10 minutes temporary
| [
"smilewish1030@gmail.com"
] | smilewish1030@gmail.com |
e9defd4ba632168dbf3f64d8b13304ef8887e1cb | f5c1885a794a8a3ca5e145cbf97df7ae07360ed3 | /api/app.py | 35d33e599b156cf54296ae63794f7e5d6356c768 | [] | no_license | comarasj/spotipy | 17e41c2211534a6703c6386286e44d0b5eacf22e | 510c15e290ed8c7b251db95d6bfa91b464f21d22 | refs/heads/master | 2023-02-05T00:41:54.560446 | 2020-04-25T04:29:58 | 2020-04-25T04:29:58 | 171,753,825 | 0 | 1 | null | 2023-01-23T22:22:09 | 2019-02-20T21:42:42 | Python | UTF-8 | Python | false | false | 686 | py | from flask import Flask, request, redirect, render_template, flash, Blueprint
app = Flask(__name__)
app.secret_key = 'development key'
#Blueprints
from blueprints.artist.artist import artist
from blueprints.recommended.recommended import recommended
from blueprints.recent.recent import recent
app.register_blueprint( artist, url_prefix='/artist' )
app.register_blueprint( recommended, url_prefix='/recommended' )
app.register_blueprint( recent, url_prefix='/recent' )
@app.route('/')
def index():
return redirect('/home')
@app.route('/home')
def home():
return render_template('home.html')
if __name__ == '__main__':
app.run(host='localhost', port='5000', debug=True) | [
"comarasj@mail.uc.edu"
] | comarasj@mail.uc.edu |
52d1c28922e88cb117653d8f324d56c3787b6b40 | a573a1f4ca6ceec4cecbf730971a0d803f302e53 | /Lane Finding Project/Finding_White_Color.py | 47140958e339e7939b28957e29bbce735be8b141 | [] | no_license | BruceChanJianLe/SelfDrivingCars | 1a96fbf454c96e5eefae685ee7d4f5777fa2d10c | f0052f9ec6ca38a5b8ac6eee1589a95cf5e95ca8 | refs/heads/master | 2020-06-15T03:59:31.798411 | 2019-07-05T07:03:01 | 2019-07-05T07:03:01 | 195,197,670 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 862 | py | import cv2
import numpy as np
# Load the image
img = cv2.imread('Finding_White_Color.jpg')
# Print the associated information in the loaded image
print(f'This image is of type: {type(img)}, with dimension of: {img.shape}')
# Obtain the size of the image
img_height = img.shape[0]
img_width = img.shape[1]
# Make a deep copy of the image
img_copy = img.copy()
# Set the color threshold for the image
R_threshold = 200
G_threshold = 200
B_threshold = 200
RGB_threshold = [R_threshold, G_threshold, B_threshold]
# Detect the pixel below the threshold
thresholds = (img[:, :, 0] < RGB_threshold[0]) | (img[:, :, 1] < RGB_threshold[1]) | (img[:, :, 2] < RGB_threshold[2])
img_copy[thresholds] = [0, 0, 0]
# Show the original img with the thresholded one
cv2.imshow('Original_and_Threshold', np.hstack([img, img_copy]))
cv2.waitKey(0)
cv2.destroyAllWindows()
| [
"jianle001@e.ntu.edu.sg"
] | jianle001@e.ntu.edu.sg |
4bb93dc738f95e826f73590895bf89db9e617dd8 | 73eb45fc2b9e3cf321e35743ea7d442bb9a9e521 | /signature-extraction/ASG/ASG.py | 86133b97dcb85eea9387f70c2d2a43c712375a7b | [
"Apache-2.0"
] | permissive | fasguard/fasguard | 1bc097a5f20b567368a533b5c430b61025a325c5 | e24ed8264e65d24a4e3a3ef79224f30ca570ae4e | refs/heads/master | 2021-05-04T11:43:03.760628 | 2017-09-18T21:00:39 | 2017-09-18T21:00:39 | 43,983,230 | 2 | 1 | null | null | null | null | UTF-8 | Python | false | false | 5,632 | py | #!/usr/bin/env python2.7
"""
SYNOPSIS
This is the actual Automatic Signature Generator (ASG) that takes a STIX/
CybOX XML file from the detector as input and produces Suricata (Snort) rules.
DESCRIPTION
We first use the DetectorEvent class to receive XML from the detector and
transform it into an internal representation. The packet and metadata is then
transmitted to the C/C++ language ASG module.
"""
import logging
import sys
import os
import os.path
import argparse
import re
import asg.asgEngine
#import boost_log
import ctypes
import pkgutil
import xml.etree.ElementTree as ET
from asg.properties.envProperties import EnvProperties
from asg.DetectorReports.detectorEvent import DetectorEvent
from asg.DetectorReports.detector_xmt_ext import DetectorReport
from asg.stixFromDb import StixFromDb
from asg.fasguardStixRule import FASGuardStixRule
def process_detection(filename,properties,debug):
# de = DetectorEvent(filename)
# xml_again = de.toStixXml()
# ofh = open('stix_again.xml','w')
# ofh.write(xml_again)
# ofh.close()
# dr = DetectorReport()
# for attack in de.attackInstanceList:
# dr.appendAttack()
# for attack_packet in attack.packetList:
# dr.appendPacket(attack_packet.timeStamp, attack_packet.protocol,
# attack_packet.Sport, attack_packet.Dport,
# attack_packet.payload, attack_packet.probAttack)
max_depth = int(properties.getProperty('ASG.MaxDepth'))
asg_e = asg.asgEngine.PyAsgEngine(filename,properties,debug)
asg_e.loadDetectorEvent()
asg_e.makeCandidateSignatureStringSet()
#asg_e.makeTries()
def setup():
parser = argparse.ArgumentParser(
description='Takes homegrown file for description of an event and '+
'converts it to a FASGuard STIX XML file')
parser.add_argument("in_file",nargs='?',
help='File with homebrew attack info',
default='stix.xml')
parser.add_argument('-d','--debug',required=False,action='store_true',
help='run with debug logging')
parser.add_argument('-s','--sqldb',required=False,action='store_true',
help='retrieve FASGuard STIX XML file from sql db')
parser.add_argument('-p','--properties',type=str,required=False,
default=None, help='properties file')
args = parser.parse_args()
#print "In file: ",args.in_file
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging_level = logging.DEBUG if args.debug else logging.INFO
logger = logging.getLogger('simple_example')
logger.setLevel(logging_level)
#formatter = logging.Formatter(FORMAT)
ch = logging.StreamHandler()
ch.setLevel(logging_level)
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
#logger.setLevel(logging_level)
#logger.setLevel(logging.DEBUG)
#ch.setFormatter(formatter)
print 'logging.DEBUG',logging.DEBUG
logger.addHandler(ch)
logger.debug('debug message')
if args.properties is None:
propdata = pkgutil.get_data('asg', 'asg.properties')
else:
with open(args.properties, 'r') as f:
propdata = f.read()
properties = EnvProperties(propdata)
if args.sqldb:
# Connect to database
stx_frm_db = StixFromDb(properties)
logger.debug('Created StixFromDb')
stix_xml_filename = properties.getProperty('StixFromDb.StixXmlFilename')
joined_xmit = False
snippet_xmit = False
cluster_xmit = False
xmit_string = properties.getProperty('ASG.TransmitRuleSets')
xmit_list = xmit_string.split(',')
for rule_type in xmit_list:
if rule_type == 'Joined':
joined_xmit = True
elif rule_type == 'Snippet':
snippet_xmit = True
elif rule_type == 'Cluster':
cluster_xmit = True
joined_rule_file = properties.getProperty('ASG.SuricataRuleFile')
snippet_rule_file = properties.getProperty('ASG.SuricataPcreRuleFile')
cluster_rule_file = properties.getProperty(
'ASG.SuricataUnsupervisedClusterRuleFile')
ruleDir = properties.getProperty('ASG.FASGuardStixRuleDir')
while stx_frm_db.processStix():
process_detection(stix_xml_filename,properties,args.debug)
rule_list = []
# Xmit requested rule sets
if joined_xmit and os.path.isfile(joined_rule_file):
for rule in open(joined_rule_file,'r'):
if re.search(r'(pass|drop|reject|alert)',rule):
rule_list.append(rule)
if snippet_xmit and os.path.isfile(snippet_rule_file):
for rule in open(snippet_rule_file,'r'):
if re.search(r'(pass|drop|reject|alert)',rule):
rule_list.append(rule)
if cluster_xmit and os.path.isfile(cluster_rule_file):
for rule in open(cluster_rule_file,'r'):
if re.search(r'(pass|drop|reject|alert)',rule):
rule_list.append(rule)
fsr = FASGuardStixRule(rule_list)
xml = fsr.toStixXml("High","Low")
fh = open(ruleDir+'/stix-rules.xml','w')
fh.write(xml)
fh.close()
sys.exit(-1)
logger.debug("In file: %s",args.in_file)
#sys.exit(-1)
process_detection(args.in_file,properties,args.debug)
if __name__ == '__main__':
setup()
| [
"rhansen@bbn.com"
] | rhansen@bbn.com |
69453aa15355f0072ca02b83b6c7f4e7ff305250 | 2407690f9e04b517096a826cd63634b346e1770f | /Cleanup20160624/Main Code 9/constants.py | 403be24d7accf48ebf191c38e5dd202279818ebb | [] | no_license | tylerlau07/romance_nominal_change | b9a94ff6b47056ed0f858a5fe61ec48dcce835c8 | 1c33aaf2cba7b045f162bde9008d65b53925098a | refs/heads/master | 2020-05-21T16:45:44.633613 | 2016-09-30T06:45:25 | 2016-09-30T06:45:25 | 61,847,094 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,877 | py | # -*- coding: utf-8 -*-
# Author: Tyler Lau
# Main Code 9
from math import log
from math import ceil
from numpy import identity
import functions
##########
# Corpus #
##########
corpus_file = "../Corpus Preparation/latin_corpus.txt"
##############
# Parameters #
##############
# Trial number
trial = "21"
# Generations to run simulation
total_generations = 10
# Make false to test with no token frequency
token_freq = True
# Number of times to introduce training set: P&VE uses 3, HareEllman uses 10
epochs = 3
# Case and number treated separately or together?
casenum_sep = True
# Binary or identity vectors
vectors = 'Binary'
# Apply sound changes--Common Romance, Italian, or Romanian
language = 'Common'
# Implement second sound change (only for Italian or Romanian)?
secondsoundchange = 0
########################
# Frequency Adjustment #
########################
# Adjust type frequencies depending on case and human/nonhuman
# New case frequencies using Delatte et al 1981
# TOTAL ACROSS PROSE AND POETRY
case_raw = {
'Nom.Sg': 41617, 'Nom.Pl': 12738,
'Acc.Sg': 42709, 'Acc.Pl': 30327,
# 'Gen.Sg': 21639, 'Gen.Pl': 10467,
# 'Dat.Sg': 8222, 'Dat.Pl': 5056,
# 'Abl.Sg': 39345, 'Abl.Pl': 14440,
# 'Voc.Sg': 2243, 'Voc.Pl': 611
}
case_freqs = {key:float(value)/float(min(case_raw.values())) for key, value in case_raw.items()}
ncases = len(case_freqs)/2
#####################
# Layer Information #
#####################
#########
# INPUT #
#########
# Input layer will contain:
# 1) Root identifier (9 bits = log_2(500))
# 2) Human identifier (male, female, non-human) (2 bits)
# 3) Declension, Gender?, Case, Number (3 bits, 2 bits, 3 bits, 1 bit)
human = ['nh', 'mh', 'fh']
declensions = [str(i) for i in range(1, 6)]
genders = ['m', 'f', 'n']
if casenum_sep == True:
cases = list(set(map(lambda x: x[:3], case_raw.keys())))
numbers = list(set(map(lambda x: x[4:], case_raw.keys())))
else:
cases = case_raw.keys()
if vectors == 'Binary':
# Take log base 2 to figure out how many bits we need for each
human_size = int(ceil(log(len(human), 2))) # 2
dec_size = int(ceil(log(len(declensions), 2))) # 3
gen_size = int(ceil(log(len(genders), 2))) # 2
case_size = int(ceil(log(len(cases), 2))) # 3
if casenum_sep == True:
num_size = int(ceil(log(len(numbers), 2))) # 1
# Now make two way dictionary with bit vectors
human_dict = functions.binaryDict(human)
dec_dict = functions.binaryDict(declensions)
dec_dict.update(functions.invert(dec_dict))
gen_dict = functions.binaryDict(genders)
gen_dict.update(functions.invert(gen_dict))
case_dict = functions.binaryDict(cases)
case_dict.update(functions.invert(case_dict))
if casenum_sep == True:
num_dict = functions.binaryDict(numbers)
num_dict.update(functions.invert(num_dict))
# Identity vectors
else:
human_size = len(human)
dec_size = len(declensions)
gen_size = len(genders)
case_size = len(cases)
if casenum_sep == True:
num_size = len(numbers)
human_dict = dict(zip(human, map(tuple, identity(human_size))))
dec_dict = dict(zip(declensions, map(tuple, identity(dec_size))))
gen_dict = dict(zip(genders, map(tuple, identity(gen_size))))
case_dict = dict(zip(cases, map(tuple, identity(case_size))))
if casenum_sep == True:
num_dict = dict(zip(numbers, map(tuple, identity(num_size))))
##########
# HIDDEN #
##########
# Number of hidden layers: P&VE uses 30, HareEllman uses 10 for the first layer
# P&VE suggest 60
# Arithmetic mean between inputs (20) and outputs (77) is 48.5
# Geometric mean is 39.24
# IF IDENTITY
# Arithmetic mean between 30 and 77 is 57
# Geometric mean is 50
# MINIMAL FEATURES
# Arithmetic mean between 20 and 42 is 31
# Geometric mean between 20 and 42 is 28.98
hidden_nodes = 30
##########################
# Coding the output file #
##########################
# Number of generations
out_file = 'stats_%s%s_Cases%s_Epochs%s_Gens%s' % (str(language), str(secondsoundchange), str(ncases), str(epochs), str(total_generations))
# Token Frequency?
if token_freq == False:
out_file += '_TokFreqF'
else:
out_file += '_TokFreqT'
# # Case and number separate or together?
# if casenum_sep == True:
# out_file += '_CaseNumSepT'
# else:
# out_file += '_CaseNumSepF'
# Binary or Identity Vectors?
if vectors == 'Binary':
out_file += '_BinVec'
else:
out_file += '_IdVec'
# Number of epochs, number of hidden nodes, trial number
out_file += '_Trial%s.txt' % str(trial)
#############################################
# Organize data to make it easier to handle #
#############################################
# Map phonemes to Chomsky and Halle values (1968) --> Hayes 2009:
son=lab=hgh=low=frt=bck = (0.0, 1.0, -1.0)
# MINIMALLY DISTINGUISHING FEATURES
phon_to_feat = {
"b": (son[-1], lab[1], hgh[0], low[0], frt[0], bck[0]), # <- actually v/β after sound changes
"s": (son[-1], lab[-1], hgh[0], low[0], frt[0], bck[0]),
"r": (son[1], lab[-1], hgh[0], low[0], frt[0], bck[0]),
"i": (son[0], lab[0], hgh[1], low[-1], frt[1], bck[-1]),
"u": (son[0], lab[0], hgh[1], low[-1], frt[-1], bck[1]),
"e": (son[0], lab[0], hgh[-1], low[-1], frt[1], bck[-1]),
"o": (son[0], lab[0], hgh[-1], low[-1], frt[-1], bck[1]),
"a": (son[0], lab[0], hgh[-1], low[1], frt[-1], bck[-1])
}
##########
# OUTPUT #
##########
# Max suffix VVC CVVC
n_sufphon = 7
# Arbitrarily take length of first feature matrix (all equal) to determine number of features
n_feat = len(phon_to_feat.values()[0])
# Tuple of 0 length of features for "-"
phon_to_feat["-"] = (0.0,) * n_feat
# Get number of output nodes
output_nodes = n_sufphon * n_feat
# Invert dictionary
feat_to_phon = functions.invert(phon_to_feat) | [
"tyler.lau.07@gmail.com"
] | tyler.lau.07@gmail.com |
19e3a5906d5b2c087307460428df0f10cb0f1dc3 | 8da169c8e1c325ac326f81d366bb5f75179e2e30 | /project/public/asset/matrix/duplicate.py | 564dfd1cba4b3445844209ec937b66bea70e5d0f | [
"Apache-2.0"
] | permissive | XLab-Tongji/Xlab-k8s-gpu | 644b2ebb865a2341862f6b8aebe37547624b5172 | b258f9610d2416a047f8f9545b1d6f66a7e88df3 | refs/heads/master | 2022-11-11T23:01:43.312765 | 2020-06-30T09:19:40 | 2020-06-30T09:19:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 390 | py | import pandas as pd
csv=pd.read_csv('./kddcup.newtestdata_10_percent_unlabeled.csv',low_memory=False,error_bad_lines=False)#读取csv中的数据
df = pd.DataFrame(csv)
print(df.shape)#打印行数
f=df.drop_duplicates(keep=False)#去重
print(f.shape)#打印去重后的行数
f.to_csv('./duplicated kddcup.newtestdata_10_percent_unlabeled.csv',index=None)#写到一个新的文件
| [
"vodkasoul@icloud.com"
] | vodkasoul@icloud.com |
edfff1660685d7183157e9c4eabb87fc68c573dc | b3f1197e21fb676fd69c95f96e0ac5ae1538ef16 | /practice/sample9.py | 5b2493d9ed43b1d6e19ea70291695eae7dca789b | [] | no_license | hyunbeen/python--training | 15572e6af000503ef039d468d25909e6bf2767a4 | e3fbb6a28e3d89bbf01a1fae040ef28df6babbf7 | refs/heads/master | 2020-12-15T08:36:33.836430 | 2020-01-20T08:28:17 | 2020-01-20T08:28:17 | 235,048,832 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 32 | py | dict = {"1":1,"2":2}
print(dict) | [
"bigpig93@naver.com"
] | bigpig93@naver.com |
e1114b1b68f20fa2b3397825e10101d919a04ac2 | bb301b3de3e4e18123f75029098ec8cee918126d | /validar_resultados.py | b02f8c80520a0cfa9cff4570d33723b488ad76e1 | [
"MIT"
] | permissive | weybsonalves/menorcaminhosp | f646789b20ed512830cac04c615087aa13171d17 | 9923b92b4ec338ebf470a1fdaaba670bc3bc2963 | refs/heads/main | 2023-04-10T11:27:48.312500 | 2021-04-11T22:27:35 | 2021-04-11T22:27:35 | 356,981,309 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 530 | py | from random import randint
from graph_utils import make_graph, dijkstra, bellmanford
def validate(graph):
vertexes = list(graph.adjacency_list.keys())
for _ in range(1000):
i = randint(0, len(vertexes)-1)
j = randint(0, len(vertexes)-1)
if dijkstra(graph, vertexes[i], vertexes[j]) != bellmanford(graph, vertexes[i], vertexes[j]):
return False
return True
if __name__ == '__main__':
g = make_graph('municipios_sp.txt', 'distancias_municipios_sp.txt')
print(validate(g))
| [
"was5@cin.ufpe.br"
] | was5@cin.ufpe.br |
5008d77f3a9df8ec23514360f2c0b0d0c23f6ba1 | 6c2a621395672f42a5270ff48c97a5bed2a3faf1 | /find()方法.py | 05fcb399a57852835ba7ceb3cf4cf9ccd0abc69b | [] | no_license | pzy636588/wodedaima | be7cfefe68128f8cbd3e907349bed250082a3b77 | 411bc424c8f0725e724b8af82e8800995f11cf1d | refs/heads/master | 2020-12-20T16:09:44.878792 | 2020-04-28T04:15:41 | 2020-04-28T04:15:41 | 236,131,951 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 269 | py | #str.find(sub[,start[,end])
str1='@minggj @就打飞机空间'
print('字符串"',str1,'" 中*符号首次出现的位置索引为:',str1.find('*'))
str1='@minggj @就打飞机空间'
print('字符串"',str1,'" 中@符号首次出现的位置索引为:',str1.find('@')) | [
"13530696246@163.com"
] | 13530696246@163.com |
c627d11901172be613f2a3cb21b1e77eb5b47eed | cb29705c7b41cb011469e9e92f4b6f7d263ef502 | /blogit/admin.py | 26e26bb32744ff851dbcb63803ce92c874524c09 | [
"MIT"
] | permissive | jimmcgaw/gleaner | 4d3496a86f15bdf7af71dfbb07211fc47b56f9f1 | 15ca6de907d45009e551e53c55ed16e2a62c6c93 | refs/heads/master | 2016-09-13T01:48:39.575616 | 2016-06-05T18:49:21 | 2016-06-05T18:49:21 | 59,175,870 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 700 | py | from django.contrib import admin
# Register your models here.
from django.contrib import admin
from django.db import models as dmodels
from blogit import models
#get the models from myproject.models]
mods = [x for x in models.__dict__.values() if issubclass(type(x), dmodels.base.ModelBase)]
admins = []
#for each model in our models module, prepare an admin class
#that will edit our model (Admin<model_name>, model)
for c in mods:
admins.append(("%sAdmin"%c.__name__, c))
#create the admin class and register it
for (ac, c) in admins:
try: #pass gracefully on duplicate registration errors
admin.site.register(c, type(ac, (admin.ModelAdmin,), dict()))
except:
pass
| [
"jpmcgaw@gmail.com"
] | jpmcgaw@gmail.com |
9ff38e693a8bc09d379d83944d781fe48d5d98d3 | 52fe4ec6ac7d591d969851250da86b7a2cd7373c | /carcare/migrations/0006_deliverymodel_user.py | 2786d9bfde797b2fa6d5c363523fbb4e9da0da5c | [] | no_license | Narongded/Carecare | 2b2753f4f5793782d88fb9babf8bcfc45779c194 | 7b71be056f88d63324afe37f4d1cc0647020e85c | refs/heads/main | 2023-04-11T10:00:31.160255 | 2021-04-22T15:25:02 | 2021-04-22T15:25:02 | 360,565,101 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 607 | py | # Generated by Django 2.1.7 on 2019-05-02 20:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('carcare', '0005_remove_deliverymodel_reservation'),
]
operations = [
migrations.AddField(
model_name='deliverymodel',
name='user',
field=models.ForeignKey(default=2, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
| [
"32951598+Narongded@users.noreply.github.com"
] | 32951598+Narongded@users.noreply.github.com |
3cc9b135372b24193ee4847ccbc1dce57229d2fe | 25ac8a638fa333a454a0859e1cf05ff650dc1376 | /h.py | d5e529a0cc53b0af62991c07583b167fe288e8b2 | [] | no_license | Prativa98/master_academy | 9ec809c6e2aca834a69586699721e3af1c03f7d2 | 9d6281be4d3d5386bcee9b0eaca3916c9159e38c | refs/heads/main | 2023-05-28T14:33:28.404206 | 2021-06-13T10:53:29 | 2021-06-13T10:53:29 | 376,513,295 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 40 | py | print("hello")
print("hello bangladesh") | [
"ihprativa@gmail.com"
] | ihprativa@gmail.com |
80f37d189ca2d33e501cdf16817001a8c6d4908c | aceb92d46c82c24e0e5c814a1586b765bfff84d4 | /venv/SeleniumSessions/BackAndForward8a.py | 535a2a7e4f173396b1b49670c334f0687dde2be2 | [] | no_license | AnjaliAdlakha/SeleniumPythonSessions | c271001559c6f31c02e66628c45e95f2dde2f0dd | b56c9ed7c7ecc09fe9b2f707a5720bd33f6e73ea | refs/heads/master | 2023-06-04T13:21:09.628034 | 2021-06-23T00:03:55 | 2021-06-23T00:03:55 | 379,429,791 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 502 | py | from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
import time
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.implicitly_wait(10)
driver.get('https://amazon.in')
driver.find_element(By.LINK_TEXT, 'Best Sellers').click()
time.sleep(2)
driver.back()
time.sleep(2)
driver.forward()
time.sleep(2)
driver.back()
time.sleep(2)
driver.refresh()
driver.quit() | [
"75857615+anjalihans2020@users.noreply.github.com"
] | 75857615+anjalihans2020@users.noreply.github.com |
a14c03bc628896e88a3a715353f4b5c93d9778c3 | 98e1716c1c3d071b2fedef0ac029eb410f55762c | /part13-introduction-data-visualization/No07-Using-legend.py | bd1fef91573279e954aa0db684577e0a61040372 | [] | no_license | iamashu/Data-Camp-exercise-PythonTrack | 564531bcf1dff119949cbb75e1fd63d89cb2779f | c72a4e806494f0e263ced9594597dc8882c2131c | refs/heads/master | 2020-07-22T00:23:12.024386 | 2019-04-12T09:24:42 | 2019-04-12T09:24:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,461 | py | #Using legend()
'''
Legends are useful for distinguishing between multiple datasets displayed on common axes. The relevant data are created using specific line colors or markers in various plot commands. Using the keyword argument label in the plotting function associates a string to use in a legend.
For example, here, you will plot enrollment of women in the Physical Sciences and in Computer Science over time. You can label each curve by passing a label argument to the plotting call, and request a legend using plt.legend(). Specifying the keyword argument loc determines where the legend will be placed.
Instructions
Modify the plot command provided that draws the enrollment of women in Computer Science over time so that the curve is labelled 'Computer Science' in the legend.
Modify the plot command provided that draws the enrollment of women in the Physical Sciences over time so that the curve is labelled 'Physical Sciences' in the legend.
Add a legend at the lower center (i.e., loc='lower center').
'''
# Code
# Specify the label 'Computer Science'
plt.plot(year, computer_science, color='red', label='Computer Science')
# Specify the label 'Physical Sciences'
plt.plot(year, physical_sciences, color='blue', label='Physical Sciences')
# Add a legend at the lower center
plt.legend(loc='lower center')
# Add axis labels and title
plt.xlabel('Year')
plt.ylabel('Enrollment (%)')
plt.title('Undergraduate enrollment of women')
plt.show()
| [
"beiran@hotmail.com"
] | beiran@hotmail.com |
ac4f97b353097716f47914b595314277c40a43fb | 199c8528bb115302c0c7e72acd980fa8865920eb | /refactor/after_refactor.py | 8320493dd7accbc405d28bc66e599647f6c8455d | [] | no_license | sorvihead/patterns-python | 81281413dacaebf49bed8d2d4595a9532e6939a5 | 000785af961140872ee1a01d09a16900e901d031 | refs/heads/master | 2020-09-10T23:25:34.181652 | 2020-02-26T23:47:07 | 2020-02-26T23:47:07 | 221,864,175 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 12,202 | py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
По умолчанию при старте программы опорные точки отсутствуют и программа находится в состоянии паузы
(движение кривой выключено). Для добавления точек сделайте несколько кликов левой кнопкой мыши. Отрисовка
кривой произойдет, когда точек на экране станет больше двух. Кнопка P запустит движение кривой.
Задача:
1. Изучить документацию к библиотеке pygame и код программы. Понять механизм работы программы (как
происходит отрисовка кривой, перерасчет точек сглаживания и другие нюансы реализации программы)
2. Произвести рефакторинг кода, переписать программу в ООП стиле с использованием классов и наследования.
* Реализовать класс 2-мерных векторов Vec2d. В классе следует определить методы __add__, __sub__,
__mul__(произведение на число). А также добавить возможность вычислять длину вектора с использованием
len(a), и метод int_pair, который возвращает кортеж из двух целых чисел
* Реализовать класс замкнутых ломаных Polyline с методами отвечающими за добавление в ломаную точки,
с её скоростью, пересчет координат точек (set_points) и отрисовку ломаной draw_points.
* Реализовать класс Knot(населдник класса Polyline), в котором добавление и пересчёт координат инициируют
вызов функции get_knot для расчета точек кривой по добавляемым опорным точкам.
* Все классы должны быть самостоятельными и не использовать внешних функций.
* Реализовать дополнительный функционал. К дополнительным задачам относятся: реализовать возможность
удаления опорной точки из кривой, реализовать возможность отрисовки на экране нескольких кривых,
реализовать возможность ускорения/замедления скорости движения кривой.
"""
import math
import random
import pygame
class Vec2d:
def __init__(self, x, y):
self.__x = x
self.__y = y
def __add__(self, other: 'Vec2d') -> 'Vec2d':
result = Vec2d(self.__x + other.x, self.__y + other.y)
return result
def __sub__(self, other: 'Vec2d') -> 'Vec2d':
result = Vec2d(self.__x - other.x, self.__y - other.y)
return result
def __mul__(self, other: int) -> 'Vec2d':
result = Vec2d(self.__x * other, self.__y * other)
return result
def __len__(self) -> float:
return math.sqrt(self.__x * self.__x + self.__y * self.__y)
@property
def int_pair(self) -> tuple:
return self.__x, self.__y
@int_pair.setter
def int_pair(self, point: tuple):
self.__x, self.__y = point
@property
def x(self):
return self.__x
@property
def y(self):
return self.__y
def __repr__(self):
return f"<Vec2d: x->{self.__x}, y->{self.__y}>"
class Polyline:
def __init__(self, points: list = None, speeds: list = None):
self.points = points or []
self.speeds = speeds or []
self.max_speed = 9.0
self.min_speed = 0.05
def set_points(self, screen_dim: Vec2d) -> None:
for point in range(len(self.points)):
self.points[point] = self.points[point] + self.speeds[point]
if self.points[point].x > screen_dim.x or self.points[point].x < 0:
self.speeds[point].int_pair = (-self.speeds[point].x, self.speeds[point].y)
if self.points[point].y > screen_dim.y or self.points[point].y < 0:
self.speeds[point].int_pair = (self.speeds[point].x, -self.speeds[point].y)
def delete_point(self):
if self.points:
return self.points.pop(random.randint(0, len(self.points)-1))
else:
return
def increase_speeds(self):
for idx in range(len(self.speeds)):
self.speeds[idx] = self.speeds[idx] * 1.25
if self.speeds[idx].x > self.max_speed:
self.speeds[idx].int_pair = self.max_speed, self.speeds[idx].y
if self.speeds[idx].y > self.max_speed:
self.speeds[idx].int_pair = self.speeds[idx].x, self.max_speed
def decrease_speeds(self): # TODO ABS
for idx in range(len(self.speeds)):
print("before: " + repr(self.speeds[idx]))
self.speeds[idx] = self.speeds[idx] * 0.825
if self.speeds[idx].x < self.min_speed:
self.speeds[idx].int_pair = self.min_speed, self.speeds[idx].y
if self.speeds[idx].y < self.min_speed:
self.speeds[idx].int_pair = self.speeds[idx].x, self.min_speed
print("after: " + repr(self.speeds[idx]))
@staticmethod
def draw_points(points, game_display, style="points", width=3, color=(255, 255, 255)) -> None:
if style == "line":
for p_n in range(-1, len(points) - 1):
pygame.draw.line(game_display, color,
(int(points[p_n].x), int(points[p_n].y)),
(int(points[p_n + 1].x), int(points[p_n + 1].y)), width)
elif style == "points":
for p in points:
pygame.draw.circle(game_display, color,
(int(p.x), int(p.y)), width)
class Knot(Polyline):
@staticmethod
def get_point(points, alpha, deg=None):
if deg is None:
deg = len(points) - 1
if deg == 0:
return points[0]
return points[deg] * alpha + Knot.get_point(points, alpha, deg - 1) * (1 - alpha)
@staticmethod
def get_points(base_points, count):
alpha = 1 / count
res = []
for i in range(count):
res.append(Knot.get_point(base_points, i * alpha))
return res
def get_knot(self, count):
if len(self.points) < 3:
return []
res = []
for i in range(-2, len(self.points) - 2):
ptn = [(self.points[i] + self.points[i + 1]) * 0.5,
self.points[i + 1],
(self.points[i + 1] + self.points[i + 2]) * 0.5]
res.extend(Knot.get_points(ptn, count))
return res
def reset(self):
self.points = []
self.speeds = []
class Helper:
def __init__(self, game_display, font1, font2):
self.__data = []
self.__color_help = (255, 50, 50, 255)
self.__pointlist_help = [(0, 0), (800, 0), (800, 600), (0, 600)]
self.__width_help = 5
self.__color_font = (128, 128, 255)
self.__game_display = game_display
self.__font1 = font1
self.__font2 = font2
def draw_help(self, steps):
self.__game_display.fill((50, 50, 50))
self.__data.append(["F1", "Show Help"])
self.__data.append(["R", "Restart"])
self.__data.append(["P", "Pause/Play"])
self.__data.append(["Num+", "More points"])
self.__data.append(["Num-", "Less points"])
self.__data.append(["", ""])
self.__data.append([str(steps), "Current points"])
pygame.draw.lines(self.__game_display,
(255, 50, 50, 255),
True,
[(0, 0), (800, 0), (800, 600), (0, 600)],
5)
for i, text in enumerate(self.__data):
self.__game_display.blit(self.__font1.render(text[0],
True,
(128, 128, 255)),
(100, 100 + 30 * i))
self.__game_display.blit(self.__font2.render(text[1],
True,
(128, 128, 255)),
(200, 100 + 30 * i))
self.__data.clear()
class ScreenSaver:
def __init__(self, screen_dim, steps):
self.__knot = Knot()
self.__screen_dim = Vec2d(screen_dim[0], screen_dim[1])
self.__steps = steps
self.__show_help = False
self.__pause = True
self.__hue = 0
self.__game_display = None
self.__working = False
def _init_pygame(self):
pygame.init()
self.__game_display = pygame.display.set_mode(self.__screen_dim.int_pair)
pygame.display.set_caption('MyScreenSaver')
self.__working = True
self.__color = pygame.Color(0)
self.__font1 = pygame.font.SysFont("courier", 24)
self.__font2 = pygame.font.SysFont("serif", 24)
self.__helper = Helper(self.__game_display, self.__font1, self.__font2)
def _event_loop(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.__working = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.__working = False
if event.key == pygame.K_r:
self.__knot.reset()
if event.key == pygame.K_p:
self.__pause = not self.__pause
if event.key == pygame.K_KP_PLUS:
self.__steps += 1
if event.key == pygame.K_F1:
self.__show_help = not self.__show_help
if event.key == pygame.K_KP_MINUS:
self.__steps -= 1 if self.__steps > 1 else 0
if event.key == pygame.K_DELETE:
self.__knot.delete_point()
if event.key == pygame.K_i:
self.__knot.increase_speeds()
if event.key == pygame.K_d:
self.__knot.decrease_speeds()
if event.type == pygame.MOUSEBUTTONDOWN:
self.__knot.points.append(Vec2d(event.pos[0], event.pos[1]))
self.__knot.speeds.append(Vec2d(random.random() * 2, random.random() * 2))
def _change_color(self):
self.__hue = (self.__hue + 1) % 360
self.__color.hsla = (self.__hue, 100, 50, 100)
def _draw(self):
Knot.draw_points(self.__knot.points,
self.__game_display)
Knot.draw_points(self.__knot.get_knot(self.__steps),
self.__game_display,
"line",
3,
self.__color)
def _close_pygame(self):
pygame.display.quit()
pygame.quit()
exit(0)
def run(self):
self._init_pygame()
while self.__working:
self._event_loop()
self.__game_display.fill((0, 0, 0))
self._change_color()
self._draw()
if not self.__pause:
self.__knot.set_points(self.__screen_dim)
if self.__show_help:
self.__helper.draw_help(self.__steps)
pygame.display.flip()
self._close_pygame()
if __name__ == '__main__':
g = ScreenSaver((800, 600), 35)
g.run()
k = Knot()
k.points = [Vec2d(500, 600), Vec2d(400, 463), Vec2d(300, 323)]
print(k.points[0] + k.points[1])
print(k.points)
| [
"novoid86@yandex.ru"
] | novoid86@yandex.ru |
72385aef0f88fb44670c62fe09108881b5ca1cdd | a934a51f68592785a7aed1eeb31e5be45dd087d3 | /Learning/Network_process_WA/Day1/2020_Jul23/subprocess_old/run_ls01.py | ba2d553ef730e9191baf52a2201f2e782ccafa17 | [] | no_license | nsshayan/Python | 9bf0dcb9a6890419873428a2dde7a802e715be2b | 0cf5420eecac3505071326c90b28bd942205ea54 | refs/heads/master | 2021-06-03T18:41:06.203334 | 2020-09-28T07:28:48 | 2020-09-28T07:28:48 | 35,269,825 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 215 | py | from subprocess import Popen
#p = Popen("echo $PATH", shell=True)
with open("ls.out", "w") as lsout:
p = Popen(["ls", "-l", "/usr"], stdout=lsout)
ret = p.wait()
print("ls exited with code =", ret)
| [
"nsshayan89@gmail.com"
] | nsshayan89@gmail.com |
9894d2f9702f015e3d66e504a84b16a9cb4f8c7a | abc9f71b38ff9b797cfc64986309f7421325417a | /subsystems/odometry.py | f37753ef4ac96df60a47bc307f90b1c090c0708d | [] | no_license | FRC1458/PyRobotCode | a2cad56708f8d2f0c16a20a02c2657d69639139a | b0a3a58c5805954096742cdace0dc55c7d58aece | refs/heads/master | 2020-07-11T15:13:16.313003 | 2019-09-17T06:18:55 | 2019-09-17T06:18:55 | 204,580,206 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,167 | py | from math import cos, sin, pi
from wpilib import Encoder
from navx import AHRS
# TODO Check angle constrain function
def constrain_angle(x):
return (x + pi) % (2 * pi) - pi
class Pose2D(object):
def __init__(self, x, y, theta):
self.x = x
self.y = y
self.theta = constrain_angle(theta)
@staticmethod # TODO Maybe should just be a function not in a class
def linear_interp(pose0, pose1, ratio=1.0):
# TODO literally just rotation matrix rn, change to some probabalistic sampling later
return Pose2D(pose0.x + ((pose1.x - pose0.x) * ratio), pose0.y + ((pose1.y - pose0.y) * ratio),
constrain_angle(pose0.theta + ((pose1.theta - pose0.theta) * ratio)))
class EncoderOdometry(object):
left_encoder: Encoder
right_encoder: Encoder
gyro: AHRS
def __init__(self, left_encoder, right_encoder, gyro, starting_pose=Pose2D(x=0.0, y=0.0, theta=0.0)):
self.left_encoder = left_encoder
self.right_encoder = right_encoder
self.gyro = gyro
self.pose = starting_pose
self.last_left = 0.0
self.left = 0.0
self.last_right = 0.0
self.right = 0.0
def reset(self, pose=Pose2D(x=0.0, y=0.0, theta=0.0)):
self.pose = pose
self.last_left = 0.0
self.last_right = 0.0
def setup(self, reset_encoders=True):
if reset_encoders:
self.right_encoder.reset()
self.left_encoder.reset()
self.last_left = self.left_encoder.getDistance()
self.last_right = self.right_encoder.getDistance()
# TODO FINISH!!!
def update(self):
self.left = self.left_encoder.getDistance()
self.right = self.right_encoder.getDistance()
dl = self.left - self.last_left
dr = self.right - self.last_right
self.last_left = self.left
self.last_right = self.right
fwd = (dl + dr) / 2.0
gyro_rads = constrain_angle(self.gyro.getFusedHeading() * 0.0174533)
theta = constrain_angle(gyro_rads)
self.pose = Pose2D(self.pose.x + fwd * cos(theta), self.pose.y + fwd * sin(theta), gyro_rads)
| [
"ndp1234567890@gmail.com"
] | ndp1234567890@gmail.com |
30965eb40de98acf331d58db74af0f8f602f227d | ca7aa979e7059467e158830b76673f5b77a0f5a3 | /Python_codes/p03085/s149035990.py | 1c1c597445598c94f69ba81db215767cac8dae30 | [] | no_license | Aasthaengg/IBMdataset | 7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901 | f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8 | refs/heads/main | 2023-04-22T10:22:44.763102 | 2021-05-13T17:27:22 | 2021-05-13T17:27:22 | 367,112,348 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 458 | py | # A - Double Helix
# A:アデニン T:チミン G:グアニン C:シトシン
# 対になる組み合わせ A-T G-C
# 標準入力
base = input()
# print(base)
# 条件分岐し、結果を answer に代入
if base == 'A':
# print('T')
answer = 'T'
elif base == 'T':
# print('A')
answer = 'A'
elif base == 'G':
# print('C')
answer = 'C'
elif base == 'C':
# print('G')
answer = 'G'
# 結果の出力
print(answer)
| [
"66529651+Aastha2104@users.noreply.github.com"
] | 66529651+Aastha2104@users.noreply.github.com |
27dd36a05f8ec411c38a2ef81d20935aef743fed | ce058047e9c20d7e70a98d2f5d897f0a7efd5409 | /srs/reg/migrations/0001_initial.py | ba793fe4f16b5980a626bc59c88919ff1eb4fbfb | [
"MIT"
] | permissive | Ramguru94/python_django_school | e3e7bc60adaa7eea2c307199c78db9ef4be7d575 | bedaba575f8986fd17aaf7dcb920769224a9fc07 | refs/heads/master | 2020-08-27T20:12:27.270816 | 2019-10-27T17:08:18 | 2019-10-27T17:08:18 | 217,478,892 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 751 | py | # Generated by Django 2.2.6 on 2019-10-27 15:32
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RegisterUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('firstname', models.CharField(max_length=250)),
('lastname', models.CharField(max_length=250)),
('password', models.CharField(max_length=20)),
('email', models.CharField(max_length=50)),
('phone_number', models.CharField(max_length=20)),
],
),
]
| [
"raamguruvishnu94@gmail.com"
] | raamguruvishnu94@gmail.com |
e46e39a01e13cb2eea5a6f5add4fb61accae3bf1 | c99be9a7a55c6dc3dade46147f116ee6729a19d1 | /tikzplotlib/__about__.py | 4d3b2067e4529f6a610d20626f3fcbed193b58ca | [
"MIT"
] | permissive | theRealSuperMario/tikzplotlib | 3001cbe11856b1e7d87aa308c0ef99bbd28d1bec | 3c1e08e78cb87ecf4b475f506244813bf99ac705 | refs/heads/master | 2020-12-11T09:36:37.399842 | 2020-11-01T10:27:21 | 2020-11-01T10:27:21 | 233,809,790 | 2 | 0 | MIT | 2020-01-14T09:54:53 | 2020-01-14T09:54:53 | null | UTF-8 | Python | false | false | 221 | py | try:
# Python 3.8
from importlib import metadata
except ImportError:
import importlib_metadata as metadata
try:
__version__ = metadata.version("tikzplotlib")
except Exception:
__version__ = "unknown"
| [
"nico.schloemer@gmail.com"
] | nico.schloemer@gmail.com |
4747034fb6d4867271d8e2d367412c1bd6a0ad5e | 64782f990f274fc4c1203a3ac174e06a83ee1b07 | /DDEs_models_test/hoppensteadtWaltman.py | 7509957fc02448ea89e31109d7437672a33fff94 | [
"BSD-2-Clause",
"MIT",
"Qhull",
"BSD-3-Clause",
"Python-2.0",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jrmejansen/scipy | bd5d0d00428715474fcb1c17e24c63e8d201270f | 77f4f5172f8e718de96b89bf3f015a8729a7613c | refs/heads/master | 2021-07-19T09:06:13.767541 | 2020-12-26T14:07:09 | 2020-12-26T14:07:09 | 229,077,589 | 1 | 0 | BSD-3-Clause | 2020-12-26T14:07:11 | 2019-12-19T14:59:45 | Python | UTF-8 | Python | false | false | 2,982 | py | from scipy.integrate import solve_dde
import matplotlib.pyplot as plt
import numpy as np
from jitcdde import jitcdde
from jitcdde import y as y_jit
from jitcdde import t as t_jit
import warnings
warnings.simplefilter("ignore")
"""
The Hoppensteadt-Waltman model (Example 5 from Oberle et al 1981
Numerical Treatment of Delay Differential Equations by Hermite Interpolation)
Tested features:
- piecewise DDEs
Comparison with dde23, jitcdde and ref value from Oberle.
"""
r = 0.5
mu = r / 10.0
c = np.sqrt(2)**-1
def fun(t,y,Z):
if t <= 1 - c:
f = -r * y[0] * 0.4 * (1 - t)
elif t <= 1:
f = -r * y[0] * (0.4 * (1 - t) + 10.0 - np.exp(mu) * y[0])
elif t <= 2 - c:
f = -r * y[0] * (10. - np.exp(mu) * y[0])
else:
f = -r * np.exp(mu) * y[0] * (Z[:,0] - y[0])
return [f]
tau = 1.0
y0 = [10.0]
jumps = [1.0 - c, 1.0, 2.0 - c]
t0 = 0.0
tf = 10.0
atol = 1e-8
rtol = 1e-5
tspan = [t0, tf]
delays = [tau]
sol = solve_dde(fun, tspan, delays, y0, y0,
method='RK23', jumps=jumps, atol=atol, rtol=rtol)
t = sol.t
y = sol.y[0,:]
yp = sol.yp[0,:]
# #jitcdde
from symengine import exp
ts = [1-c,1,2-c,tf]
fs = [
[-r * y_jit(0) * 0.4 * (1 - t_jit)],
[-r * y_jit(0) * (0.4 * (1 - t_jit) + 10.0 - exp(mu) * y_jit(0))],
[-r * y_jit(0) * (10. - exp(mu) *y_jit(0))],
[-r * exp(mu) * y_jit(0) * ( y_jit(0,t_jit-tau) - y_jit(0))]
]
from chspy import CubicHermiteSpline
histo = CubicHermiteSpline(n=1)
histo.constant(y0)
print(ts)
y_jit = []
dt_jit = []
t_jit = []
for target_time,f in zip(ts,fs):
DDE = jitcdde(f,max_delay=tau)
DDE.set_integration_parameters(atol=atol,rtol=rtol)
DDE.add_past_points(histo)
DDE.adjust_diff()
for ti in np.linspace(DDE.t,target_time,100):
t_jit.append(ti)
y_jit.append(DDE.integrate(ti)[0])
dt_jit.append(DDE.dt)
histo = DDE.get_state()
histo.truncate(target_time)
mat = 0.06301980845
ref = 0.06302089869
f90 = np.loadtxt('data_dde_solver_fortran/hoppensteadtWaltman.dat')
t_f90 = f90[:,0]
y_f90 = f90[:,1]
print(' solve_dde = ', y[-1], 'err', np.abs(y[-1]-ref)/ref)
print(' dde23 y(10) = ', mat, 'err', np.abs(mat-ref)/ref)
print(' jitcdde y(10) = ', y_jit[-1], 'err', np.abs(y_jit[-1]-ref)/ref)
print(' f90 y(10) = ', y_f90[-1], 'err', np.abs(y_f90[-1]-ref)/ref)
print(' Reference solution y(10) = ', ref)
I = -(1/r)*(yp / y)
plt.figure()
plt.plot(t, y, label='solve_dde')
plt.plot(t_jit, y_jit, label='jit')
plt.plot(t_f90, y_f90, label='f90')
plt.xlabel(r'$t$')
plt.ylabel(r'$y(t)$')
plt.legend()
plt.savefig('figures/hoppensteadtWaltman/y')
plt.figure()
plt.plot(t[:-1], np.diff(t), label='solve_dde')
plt.plot(t_jit, dt_jit, label='jit')
plt.plot(t_f90[:-1], np.diff(t_f90), label='f90')
plt.xlabel(r'$t$')
plt.ylabel(r'$\Delta t$')
plt.legend()
plt.savefig('figures/hoppensteadtWaltman/dt')
plt.figure()
plt.plot(t, I, label='I(t)')
plt.legend()
plt.xlabel(r'$t$')
plt.ylabel(r'$I(t)$')
plt.savefig('figures/hoppensteadtWaltman/I')
plt.show()
| [
"jrme.jansen@gamil.com"
] | jrme.jansen@gamil.com |
8905a4ce955d4e3c54e1f913c7fffe893dfcb4ae | ad49a4290ea5eb2d465c9b8d39b6baae942f83bc | /company.py | 742054d13bc2da0fdde95f034c9b6fc1c2274683 | [] | no_license | soobin93/scrapping-alba-jobs | f41f1728437553db8d36aeb770df87209593603b | 63a0ab2a8abf80bb49dabcd144b9d05d4ab16bf8 | refs/heads/master | 2023-02-03T08:43:16.764558 | 2020-12-21T15:18:53 | 2020-12-21T15:18:53 | 323,372,722 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 908 | py | import requests
from bs4 import BeautifulSoup
URL = "http://www.alba.co.kr"
def extract_companies():
response = requests.get(URL)
soup = BeautifulSoup(response.text, "html.parser")
super_brands = soup.find("div", {"id": "MainSuperBrand"})
company_container = super_brands.find("ul", {"class": "goodsBox"})
return company_container.find_all("li", {"class": "impact"})
def extract_company(html):
company_header = html.find("a", {"class": "goodsBox-info"})
company_name = company_header.find("span", {"class": "company"}).get_text()
company_link = company_header["href"]
return {
"name": company_name,
"link": company_link
}
def get_companies():
company_list = []
companies = extract_companies()
for company_html in companies:
company = extract_company(company_html)
company_list.append(company)
return company_list | [
"ssbin93@gmail.com"
] | ssbin93@gmail.com |
802701e44809d3532bfe2c447dd3a04e2ee0dd5a | 82f65143c125e6e8fb41bc89775630a246c0d465 | /torchcmh/dataset/base/quadruplet.py | c5fb189446447690851e742a33c6de44ddbbc529 | [
"MIT"
] | permissive | ZCyueternal/deep-cross-modal-hashing | bab0d9bf43591349fa2fa85d78bd20496088782d | 9784397c1076c81b43ebd856cb24b8a67cf8f41e | refs/heads/master | 2023-08-18T00:04:32.514805 | 2021-10-07T08:14:30 | 2021-10-07T08:14:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,033 | py | # -*- coding: utf-8 -*-
# @Time : 2019/7/10
# @Author : Godder
# @Github : https://github.com/WangGodder
from .base import CrossModalTrainBase
import numpy as np
import torch
def calc_neighbor(label1, label2):
# calculate the similar matrix
Sim = label1.matmul(label2.transpose(0, 1)) > 0
return Sim.float()
class CrossModalQuadrupletTrain(CrossModalTrainBase):
"""
Quadruplet: return one sample(s), one positive(p), two negative(n1, n2) which n1 and n2 are negative each other.
"""
def __init__(self, img_dir: str, img_names: np.ndarray, txt_matrix: np.ndarray, label_matrix: np.ndarray,
img_transform, batch_size):
super(CrossModalQuadrupletTrain, self).__init__(img_dir, img_names, txt_matrix, label_matrix, img_transform)
self.batch_size = batch_size
self.sim = calc_neighbor(self.get_all_label(), self.get_all_label())
self.triplet_indexes = self.__get_triplet_indexes()
self.re_random_item()
def __get_triplet_indexes(self):
indexes = []
for ind in range(self.length):
pos_ind = self.__get_positive_index(ind)
neg_ind = np.setdiff1d(np.arange(self.length), pos_ind)
neg_ind = np.setdiff1d(neg_ind, ind)
index = [pos_ind, neg_ind]
indexes.append(index)
return indexes
def __get_positive_index(self, ind, include_self=False):
current_sim = self.sim[ind]
index = torch.nonzero(current_sim)
if len(index.shape) > 1:
index = index.reshape(-1)
if include_self:
return index.numpy()
index = np.setdiff1d(index.numpy(), ind)
return index
def re_random_item(self):
self.random_item = []
for _ in range(self.length // self.batch_size):
random_ind = np.random.permutation(range(self.length))
self.random_item.append(random_ind[:self.batch_size])
def get_random_item(self, item):
return self.random_item[item // self.batch_size][item % self.batch_size]
def _get_random_quadruplet_index(self, query_ind):
"""
randomly get a positive instance and two negative instances which two negative instances are not similar from train set
:param query_ind: the index of query instance in train indexes
:return: positive index and two negative indexes in train indexes
"""
pos_indexes = self.triplet_indexes[query_ind][0]
neg_indexes = self.triplet_indexes[query_ind][1]
pos_ind = np.random.choice(pos_indexes)
neg_ind1 = np.random.choice(neg_indexes)
neg_ind2 = np.random.choice(np.setdiff1d(neg_indexes, self.__get_positive_index(neg_ind1, True)))
return pos_ind, neg_ind1, neg_ind2
def __getitem__(self, item):
"""
item dataset return query instance with M1 positive instances and M2 negative instances
if use DataLoader to get item, then return of positive(negative) with shape (batch size, M1(2), model shape)
:param item:
:return:
"""
query_ind = self.get_random_item(item)
positive_ind, negative_ind1, negative_ind2 = self._get_random_quadruplet_index(query_ind)
if self.img_read:
img = self.read_img(query_ind)
pos_img = self.read_img(positive_ind)
neg_img1 = self.read_img(negative_ind1)
neg_img2 = self.read_img(negative_ind2)
if self.txt_read:
txt = torch.Tensor(self.txt[query_ind][np.newaxis, :, np.newaxis])
pos_txt = torch.Tensor(self.txt[positive_ind][np.newaxis, :, np.newaxis])
neg_txt1 = torch.Tensor(self.txt[negative_ind1][np.newaxis, :, np.newaxis])
neg_txt2 = torch.Tensor(self.txt[negative_ind2][np.newaxis, :, np.newaxis])
label = torch.Tensor(self.label[query_ind])
query_ind = torch.from_numpy(np.array(query_ind))
positive_ind = torch.from_numpy(np.array(positive_ind))
negative_ind1 = torch.from_numpy(np.array(negative_ind1))
negative_ind2 = torch.from_numpy(np.array(negative_ind2))
if self.img_read is False:
return {'index': query_ind, 'pos_index': positive_ind, 'neg_index1': negative_ind1,
'neg_index2': negative_ind2,
'txt': txt, 'pos_txt': pos_txt, 'neg_txt1': neg_txt1, 'neg_txt2': neg_txt2, 'label': label}
if self.txt_read is False:
return {'index': query_ind, 'pos_index': positive_ind, 'neg_index1': negative_ind1,
'neg_index2': negative_ind2,
'img': img, 'pos_img': pos_img, 'neg_img1': neg_img1, 'neg_img2': neg_img2, 'label': label}
return {'index': query_ind, 'pos_index': positive_ind, 'neg_index1': negative_ind1, 'neg_index2': negative_ind2,
'txt': txt, 'pos_txt': pos_txt, 'neg_txt1': neg_txt1, 'neg_txt2': neg_txt2,
'img': img, 'pos_img': pos_img, 'neg_img1': neg_img1, 'neg_img2': neg_img2, 'label': label}
| [
"wangxinzhi1997@vip.qq.com"
] | wangxinzhi1997@vip.qq.com |
ac3da4ddaec41acd4f789b5188f844ab20ee99c4 | 5166385cd0f32e7a262af5c8e916dc061baa70f7 | /profiles_api/migrations/0001_initial.py | e30396664602d53b59444b7151b64d101711a3ff | [
"MIT"
] | permissive | Mohd-Saddam/profile-rest-api | 32fd68f05c237048df468ea10e2f13dc2db90d84 | e80178d7ab9a0842fc5bf5ea8191ee80586b1a2e | refs/heads/master | 2022-05-04T19:10:53.464543 | 2020-07-09T08:10:04 | 2020-07-09T08:10:04 | 247,447,132 | 0 | 0 | MIT | 2022-04-22T23:07:11 | 2020-03-15T10:48:02 | Python | UTF-8 | Python | false | false | 1,705 | py | # Generated by Django 2.2 on 2020-05-21 10:12
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('email', models.EmailField(max_length=255, unique=True)),
('name', models.CharField(max_length=255)),
('is_active', models.BooleanField(default=True)),
('is_staff', models.BooleanField(default=True)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'abstract': False,
},
),
]
| [
"msaddam2786@gmail.com"
] | msaddam2786@gmail.com |
1e33395d87fe083db02435d22c5cbe4fbcfd41d6 | 26a9a079a544e33286a1cd6c3b0eab5216c1f6dd | /createTablePlayerMeta.py | d20ee7fc63ea0f4a01beff45dfc20806eccdd61b | [] | no_license | jabarimyles/bts2 | f7f268150fa411508b7b6c0cd2692387b58afe22 | 72d7ed2c173d2ea1ad098a5fa8f4d5219c218355 | refs/heads/main | 2023-04-27T23:26:28.484536 | 2021-05-19T00:43:59 | 2021-05-19T00:43:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,791 | py |
#-- Base packages
import os
import pdb
#-- Pypi packages
import pandas as pd
pd.set_option('display.max_columns', 100)
from baseball_scraper import statcast
# takes potential input of particular players (matchups for prod)
def get_player_meta(table_dict={}):
if table_dict == {}:
orig_data = pd.read_csv('./data/statcast.csv')
else:
orig_data = table_dict['statcast']
batter_cols = ['batter', 'game_date', 'inning_topbot','home_team', 'away_team']
batters = orig_data[batter_cols].sort_values('game_date', ascending=True).drop_duplicates()
# Derives home/away team from batting order
batters['cur_team'] = ""
batters.loc[batters['inning_topbot']=='Bot', 'cur_team'] = batters.loc[batters['inning_topbot']=='Bot', 'home_team']
batters.loc[batters['inning_topbot']=='Top', 'cur_team'] = batters.loc[batters['inning_topbot']=='Top', 'away_team']
# Keeps batter id, away/home and game date
keep_cols = ['batter', 'cur_team', 'game_date']
batters= batters[keep_cols]
# Keeps the most current game date for each player
batters.groupby(['batter', 'cur_team'])['game_date'].first().reset_index()
batters['pos'] = 'batter'
stance = orig_data[['batter', 'stand']].drop_duplicates()
print(stance['stand'].value_counts())
stance['stand'] = stance['stand'].astype(str)
stance = stance.groupby('batter')['stand'].unique().reset_index()
stance['stand'] = stance['stand'].apply(lambda x: ", ".join(sorted(x)))
# Changes instances to both be 'S' for switch hitter
stance['stand'] = stance['stand'].rename({'L, R': 'S', 'B': 'S'})
batters = pd.merge(batters, stance, how='left', on='batter')
batters = batters.rename(columns={'batter': 'player'})
# Essentially does similar operations but for pitchers
pit_cols = ['pitcher', 'game_date', 'inning_topbot', 'home_team', 'away_team', 'p_throws']
pitchers = orig_data[pit_cols].sort_values('game_date', ascending=True).drop_duplicates()
pitchers['cur_team'] = ""
pitchers.loc[pitchers['inning_topbot']=='Bot', 'cur_team'] = pitchers.loc[pitchers['inning_topbot']=='Bot', 'away_team']
pitchers.loc[pitchers['inning_topbot']=='Top', 'cur_team'] = pitchers.loc[pitchers['inning_topbot']=='Top', 'home_team']
keep_cols = ['pitcher', 'cur_team', 'p_throws', 'game_date']
pitchers = pitchers[keep_cols]
pitchers.groupby(['pitcher', 'cur_team', 'p_throws'])['game_date'].first().reset_index()
pitchers['pos'] = 'pitcher'
pitchers = pitchers.rename(columns={'pitcher': 'player'})
players = pd.concat([batters, pitchers], axis=0, ignore_index=True)
if type(orig_data) == type(None):
players.to_csv('./data/player_meta.csv', index=False)
else:
return players
return None
| [
"noreply@github.com"
] | noreply@github.com |
ad137dcf652e2988817767f054eca20926ee6d91 | f1121c7b44153e87ab4a110a33648ae70ea20970 | /app.py | a45f2e56043ab60598c0777380ec39f0a72fc90f | [] | no_license | doped-semiconductor/imageEncryptionGUIApp | 018f1b69151c6bd243925b66e3a72d523325a59c | 13dc831c941325a5e62af9644f79d23ee83834d5 | refs/heads/master | 2023-02-05T22:14:17.599842 | 2021-01-02T05:17:10 | 2021-01-02T05:17:10 | 326,114,088 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,201 | py | from tkinter import Tk, Frame, Button, Canvas, NW, N, S, E, W, PhotoImage, TOP, BOTTOM, LEFT, RIGHT
from tkinter.filedialog import askopenfile
from PIL import ImageTk,Image
class ImageEncApp:
def __init__(self, master):
self.master = master
master.title("Encryption")
self.create_basic_layout()
def create_basic_layout(self):
self.menuFrame = Frame(self.master)
self.menuFrame.pack(side=LEFT)
self.canvasFrame = Frame(self.master)
self.canvasFrame.pack(side=RIGHT)
self.canvas = Canvas(self.canvasFrame,width = 500, height = 500, bg="white")
self.canvas.pack(side=LEFT)
self.uploadButton = Button(self.menuFrame, text="Upload", command=self.openImage)
self.uploadButton.pack(side=TOP)
def openImage(self):
self.filePath = askopenfile()#"1.jpeg"
self.img = ImageTk.PhotoImage(Image.open(self.filePath.name))
self.canvas['width']=self.img.width()+20
self.canvas['height']=self.img.height()+20
self.canvas.create_image(15, 15, image=self.img, anchor=NW)
root=Tk()
# root.state('zoomed')
win = ImageEncApp(root)
root.mainloop() | [
"getsreya@gmail.com"
] | getsreya@gmail.com |
99f2714c3fba9228c05928fad3b4c365ac9aa7b1 | 356151747d2a6c65429e48592385166ab48c334c | /backend/customer/threads/order_now/th_get_menu.py | 5e181b84ea83adbffe87077606958d72b475afed | [] | no_license | therealrahulsahu/se_project | c82b2d9d467decd30a24388f66427c7805c23252 | c9f9fd5594191ab7dce0504ca0ab3025aa26a0c1 | refs/heads/master | 2020-06-25T02:51:30.355677 | 2020-04-20T13:01:36 | 2020-04-20T13:01:36 | 199,175,627 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,666 | py | from PyQt5.QtCore import QThread, pyqtSignal
class ThreadGetMenu(QThread):
signal = pyqtSignal('PyQt_PyObject')
def __init__(self, parent_class):
super().__init__()
self.parent_class = parent_class
def run(self):
if self.check_for_veg():
food_query = {
'veg': True,
'region': self.check_for_region(),
'type': self.check_for_type(),
'available': True
}
else:
food_query = {
'region': self.check_for_region(),
'type': self.check_for_type(),
'available': True
}
myc = self.parent_class.MW.DB.food
from pymongo.errors import AutoReconnect
from errors import FoodNotFoundError
try:
data_list = list(myc.find(food_query, {'_id': 1, 'name': 1, 'price': 1}))
if data_list:
self.parent_class.searched_food_list = data_list
self.signal.emit(True)
else:
raise FoodNotFoundError
except FoodNotFoundError as ob:
self.parent_class.MW.mess(str(ob))
except AutoReconnect:
self.parent_class.MW.mess('-->> Network Error <<--')
finally:
self.parent_class.curr_wid.bt_get.setEnabled(True)
def check_for_veg(self):
return self.parent_class.curr_wid.rbt_veg.isChecked()
def check_for_region(self):
if self.parent_class.curr_wid.rbt_north_ind.isChecked():
return 'nid'
elif self.parent_class.curr_wid.rbt_italian.isChecked():
return 'ita'
elif self.parent_class.curr_wid.rbt_south_ind.isChecked():
return 'sid'
elif self.parent_class.curr_wid.rbt_conti.isChecked():
return 'conti'
elif self.parent_class.curr_wid.rbt_thai.isChecked():
return 'thi'
elif self.parent_class.curr_wid.rbt_china.isChecked():
return 'chi'
elif self.parent_class.curr_wid.rbt_rajas.isChecked():
return 'raj'
elif self.parent_class.curr_wid.rbt_none.isChecked():
return 'none'
def check_for_type(self):
if self.parent_class.curr_wid.rbt_starter.isChecked():
return 'sta'
elif self.parent_class.curr_wid.rbt_main.isChecked():
return 'mcs'
elif self.parent_class.curr_wid.rbt_refresh.isChecked():
return 'ref'
elif self.parent_class.curr_wid.rbt_dessert.isChecked():
return 'des'
elif self.parent_class.curr_wid.rbt_bread.isChecked():
return 'bre'
| [
"43601158+therealrahulsahu@users.noreply.github.com"
] | 43601158+therealrahulsahu@users.noreply.github.com |
257f43d1ad758ad82fa725fac44517dad1c463b9 | b63ae9d939f83c38607ff44baa59f88945eab416 | /agents/batch.py | adfdc676d59a0b704e8dc759570045b2bb8d4bd8 | [] | no_license | nosyndicate/ContinuousControl-Tensorflow | c6c6438613e51b38087e6d8788f80fb6dcb8ac42 | c24d8940936d23b9f3f62cf8c4096d91656b89fa | refs/heads/master | 2020-09-21T17:53:11.613155 | 2017-02-07T20:22:52 | 2017-02-07T20:22:52 | 67,618,852 | 3 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,654 | py | class BatchPolopt(RLAlgorithm):
def __init__(
self,
env,
policy,
baseline,
scope=None,
n_itr=500,
start_itr=0,
batch_size=5000,
max_path_length=500,
discount=0.99,
gae_lambda=1,
plot=False,
pause_for_plot=False,
center_adv=True,
positive_adv=False,
store_paths=False,
whole_paths=True,
sampler_cls=None,
sampler_args=None,
**kwargs
):
"""
:param env: Environment
:param policy: Policy
:type policy: Policy
:param baseline: Baseline
:param scope: Scope for identifying the algorithm. Must be specified if running multiple algorithms
simultaneously, each using different environments and policies
:param n_itr: Number of iterations.
:param start_itr: Starting iteration.
:param batch_size: Number of samples per iteration.
:param max_path_length: Maximum length of a single rollout.
:param discount: Discount.
:param gae_lambda: Lambda used for generalized advantage estimation.
:param plot: Plot evaluation run after each iteration.
:param pause_for_plot: Whether to pause before contiuing when plotting.
:param center_adv: Whether to rescale the advantages so that they have mean 0 and standard deviation 1.
:param positive_adv: Whether to shift the advantages so that they are always positive. When used in
conjunction with center_adv the advantages will be standardized before shifting.
:param store_paths: Whether to save all paths data to the snapshot.
"""
self.env = env
self.policy = policy
self.baseline = baseline
self.scope = scope
self.n_itr = n_itr
self.current_itr = start_itr
self.batch_size = batch_size
self.max_path_length = max_path_length
self.discount = discount
self.gae_lambda = gae_lambda
self.plot = plot
self.pause_for_plot = pause_for_plot
self.center_adv = center_adv
self.positive_adv = positive_adv
self.store_paths = store_paths
self.whole_paths = whole_paths
if sampler_cls is None:
sampler_cls = BatchSampler
if sampler_args is None:
sampler_args = dict()
self.sampler = sampler_cls(self, **sampler_args)
def start_worker(self):
self.sampler.start_worker()
if self.plot:
plotter.init_plot(self.env, self.policy)
def shutdown_worker(self):
self.sampler.shutdown_worker()
def train(self):
self.start_worker()
self.init_opt()
for itr in xrange(self.current_itr, self.n_itr):
with logger.prefix('itr #%d | ' % itr):
paths = self.sampler.obtain_samples(itr)
samples_data = self.sampler.process_samples(itr, paths)
self.log_diagnostics(paths)
self.optimize_policy(itr, samples_data)
logger.log("saving snapshot...")
params = self.get_itr_snapshot(itr, samples_data)
self.current_itr = itr + 1
params["algo"] = self
if self.store_paths:
params["paths"] = samples_data["paths"]
logger.save_itr_params(itr, params)
logger.log("saved")
logger.dump_tabular(with_prefix=False)
if self.plot:
self.update_plot()
if self.pause_for_plot:
raw_input("Plotting evaluation run: Press Enter to "
"continue...")
self.shutdown_worker()
def log_diagnostics(self, paths):
self.env.log_diagnostics(paths)
self.policy.log_diagnostics(paths)
self.baseline.log_diagnostics(paths)
def init_opt(self):
"""
Initialize the optimization procedure. If using theano / cgt, this may
include declaring all the variables and compiling functions
"""
raise NotImplementedError
def get_itr_snapshot(self, itr, samples_data):
"""
Returns all the data that should be saved in the snapshot for this
iteration.
"""
raise NotImplementedError
def optimize_policy(self, itr, samples_data):
raise NotImplementedError
def update_plot(self):
if self.plot:
plotter.update_plot(self.policy, self.max_path_length) | [
"nosyndicate@gmail.com"
] | nosyndicate@gmail.com |
f5287122ca297433c1b6b1e2f5db68c67c93ae78 | 5685760a7e3aec97f81df87a4f5ff075029864bf | /src/at/uibk/epc/clustering/kmedoids/kmedoids_clustering_per_England.py | b687370f3083595a78194c42867c73a8d6318114 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | angelapopa/thesis-practical-part-python | 71cd308ac349198db8bff2905220cbb13428122e | cce51c1dff5130247903dcbadae57c07e2e60d65 | refs/heads/master | 2023-04-10T12:55:48.734878 | 2021-04-19T14:44:50 | 2021-04-19T14:44:50 | 272,254,296 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,438 | py | from db_data_per_country import getRawData
from kmedoids_clustering_per_country import kmedoids_clustering
from sklearn_extra.cluster import KMedoids
from sklearn.preprocessing import StandardScaler
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
from pathlib import Path
# limit 40.000 is ok but takes a lot of time to process and cluster 3 is empty for k=5.
# limit 10.000, cluster=5, inertia aprox 5300
#limit = 10000
#clusters = 5
# due to memory issues, the same amount of input data as for k-means is not usable for kmedoids
country = 'England'
connectionString = 'mongodb+srv://engl_1:GY9s0BNDrTNjvLFK@cluster0.ojmf2.mongodb.net/EPC?retryWrites=true&w=majority'
queryLimit = 20000
queryThermalDataFields = 'ratedDwelling.thermalData.finalEnergyDemand.value'
dbData = getRawData(
country, connectionString, queryThermalDataFields, queryLimit)
k = 5
thermalFields = 'ratedDwelling_thermalData_finalEnergyDemand_value'
# Defining border for outlier elimination
floor_area_outlier_upper_border = 15
energy_consumption_upper_border = 12
energy_consumption_lower_border = -5
floor_area_outlier_borders = [
floor_area_outlier_upper_border]
energy_consumption_outlier_borders = [
energy_consumption_upper_border, energy_consumption_lower_border]
kmedoids_clustering(country, dbData, thermalFields, k,
floor_area_outlier_borders, energy_consumption_outlier_borders)
| [
"angela.popa@student.uibk.ac.at"
] | angela.popa@student.uibk.ac.at |
2a525f8adfe353e0fb617ccf19a80dea1f75d9f2 | ada5553e4020137b9ea05869029684e2b73c6515 | /pbm_api/pbm_bonds/models.py | 626b5eeb25a7034ae28d8b7d0754e6ad24fa9adc | [] | no_license | rizwanbutt314/pbm_backend | f99a7851f16bb49456f52907b9d5f4b9ffdebc75 | 4b6baeefa5806e6f0b7efd86ffb434f990427116 | refs/heads/master | 2022-04-30T17:04:18.263758 | 2019-11-28T06:51:43 | 2019-11-28T06:51:43 | 210,325,223 | 0 | 0 | null | 2022-04-22T22:37:29 | 2019-09-23T10:15:07 | Python | UTF-8 | Python | false | false | 3,938 | py | import datetime
from django.db import models
class BondCategory(models.Model):
category = models.CharField(
max_length=255,
unique=True,
help_text="Name of Bond e.g. 750 or 200 etc")
first_prize = models.CharField(
max_length=255,
help_text="First prize in Rs.")
second_prize = models.CharField(
max_length=255,
help_text="Second prize in Rs.")
third_prize = models.CharField(
max_length=255,
help_text="Third prize in Rs.")
class BondDrawDates(models.Model):
year = models.IntegerField(
default=0,
help_text="Year of prize bond announced"
)
date = models.DateField(default=datetime.date.today)
bond_category = models.ForeignKey(
BondCategory,
null=True,
on_delete=models.CASCADE)
class Bond100(models.Model):
BOND_LEVEL_CHOICES = (
(1, 'First'),
(2, 'Second'),
(3, 'Third'),
)
year = models.IntegerField(
default=0,
help_text="Year of prize bond announced"
)
date = models.DateField(default=datetime.date.today)
bond_number = models.IntegerField(
default=0,
help_text="Prize bond number"
)
bond_level = models.IntegerField(choices=BOND_LEVEL_CHOICES)
bond_category = models.ForeignKey(
BondCategory,
null=True,
on_delete=models.CASCADE)
def as_dict(self):
return {
"year": self.year,
"date": self.date,
"bond_number": self.bond_number,
"bond_level": self.bond_level,
}
class Bond200(models.Model):
BOND_LEVEL_CHOICES = (
(1, 'First'),
(2, 'Second'),
(3, 'Third'),
)
year = models.IntegerField(
default=0,
help_text="Year of prize bond announced"
)
date = models.DateField(default=datetime.date.today)
bond_number = models.IntegerField(
default=0,
help_text="Prize bond number"
)
bond_level = models.IntegerField(choices=BOND_LEVEL_CHOICES)
bond_category = models.ForeignKey(
BondCategory,
null=True,
on_delete=models.CASCADE)
def as_dict(self):
return {
"year": self.year,
"date": self.date,
"bond_number": self.bond_number,
"bond_level": self.bond_level,
}
class Bond750(models.Model):
BOND_LEVEL_CHOICES = (
(1, 'First'),
(2, 'Second'),
(3, 'Third'),
)
year = models.IntegerField(
default=0,
help_text="Year of prize bond announced"
)
date = models.DateField(default=datetime.date.today)
bond_number = models.IntegerField(
default=0,
help_text="Prize bond number"
)
bond_level = models.IntegerField(choices=BOND_LEVEL_CHOICES)
bond_category = models.ForeignKey(
BondCategory,
null=True,
on_delete=models.CASCADE)
def as_dict(self):
return {
"year": self.year,
"date": self.date,
"bond_number": self.bond_number,
"bond_level": self.bond_level,
}
class Bond1500(models.Model):
BOND_LEVEL_CHOICES = (
(1, 'First'),
(2, 'Second'),
(3, 'Third'),
)
year = models.IntegerField(
default=0,
help_text="Year of prize bond announced"
)
date = models.DateField(default=datetime.date.today)
bond_number = models.IntegerField(
default=0,
help_text="Prize bond number"
)
bond_level = models.IntegerField(choices=BOND_LEVEL_CHOICES)
bond_category = models.ForeignKey(
BondCategory,
null=True,
on_delete=models.CASCADE)
def as_dict(self):
return {
"year": self.year,
"date": self.date,
"bond_number": self.bond_number,
"bond_level": self.bond_level,
}
| [
"rizwanbutt314@gmail.com"
] | rizwanbutt314@gmail.com |
6819a55c9040d653a368d00ae6959883a972af63 | 503513cf9b4430458947da8e07e4dd50bb22d18c | /GeneratorFunctionAndObject.py | fda10272d840f89ec3796f0029c6bfa09f14a415 | [] | no_license | maxwagner440/python_generators | b640ad014b33933085258240dbc9e3cacb5ab2f8 | 709dfed3140f2f1b0cf7e220ef728a606c161b6d | refs/heads/main | 2023-07-02T13:19:31.991011 | 2021-07-27T14:33:14 | 2021-07-27T14:33:14 | 390,012,178 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 638 | py | ########################
## Generator Function ##
########################
def even_int_func(n):
result = []
for i in range(n):
if i % 2 == 0:
result.append(i)
return result
results = even_int_func(10)
## will print out the integers ##
print(results)
##############################
## Returns Generator Object ##
##############################
def even_int_func_obj(n):
for i in range(n):
if i % 2 == 0:
yield i
results_obj = even_int_func_obj(10)
## will print out the generator object ##
print(results_obj)
## will print out the integers ##
print(list(results_obj))
| [
"noreply@github.com"
] | noreply@github.com |
23721ad4bfebf2e752102dfd7da2d6e58554374c | 6a0ae86bca2d2ece6c92efd5594c0e3b1777ead7 | /EDBRCommon/python/datasets/test_RSGZZ600_cff.py | aa4a12968a86fc2923e54c5b230e1e8a80ccf6d0 | [] | no_license | wangmengmeng/ExoDiBosonResonances | c4b5d277f744e1b1986df9317ac60b46d202a29f | bf5d2e79f59ad25c7a11e7f97552e2bf6a283428 | refs/heads/master | 2016-09-06T14:54:53.245508 | 2014-06-05T15:02:37 | 2014-06-05T15:02:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,483 | py | import FWCore.ParameterSet.Config as cms
readFiles = cms.untracked.vstring()
source = cms.Source("PoolSource",
noEventSort = cms.untracked.bool(True),
duplicateCheckMode = cms.untracked.string("noDuplicateCheck"),
fileNames = readFiles
)
readFiles.extend([
## '/store/cmst3/user/bonato//patTuple/2012/EXOVVtest/newPatTuple_ZZ_1000_c1.root'
# '/store/cmst3/user/bonato//patTuple/2012/EXOVVtest/patExoWW_M600_10_1_KPf.root'
# '/store/cmst3/user/bonato//patTuple/2012/EXOVVtest/patZZ_M1000_5k_20121212.root'
#'file:/afs/cern.ch/user/b/bonato/scratch0/PhysAnalysis/EXOVV_2012/CMGTools/CMSSW_5_3_9/src/ExoDiBosonResonances/PATtupleProduction/python/patTuple.v2.root'
# 'file:/afs/cern.ch/user/b/bonato/scratch0/PhysAnalysis/EXOVV_2012/CMGTools/CMSSW_5_3_9/src/ExoDiBosonResonances/PATtupleProduction/python/patTuple_XWW.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/ExoDiBosonResonances/PATtupleProduction/python/pattuple_mwp1200_old.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/ExoDiBosonResonances/PATtupleProduction/python/pattuple_mwp1200_new.root'
# 'root://xrootd.unl.edu//store/user/mwang/EXOWH_Wprime_M1000_GENSIM_V2/EXOWH_Wprime_M1000_PATtuple_cc_1204/69a9fa67eebd7bf7213e8a26a2d59023/pattuple_mwp1000_cc_1_1_5pv.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/pattuple_mwp1000cc_new.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/pattuple_mwp1000gg_new.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/pattuple_mwp1000bb_new.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/ExoDiBosonResonances/PATtupleProduction/python/pattuple_mwp1200_new.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/pattuple_M1000_test.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/SingleMu__Run2012A_test.root'
# 'file:/afs/cern.ch/work/m/mwang/public/EXO/1128/CMGTools/CMSSW_5_3_9/src/ExoDiBosonResonances/EDBRCommon/prod/DY.root'
# 'root://eoscms//eos/cms/store/cmst3/group/exovv/mwang/EDBR_PATtuple_edbr_wh_20140210_Summer12MC_DYToLLBinsPtZ_MADGRAPH_20140210_150636/mwang/DYJetsToLL_PtZ-100_TuneZ2star_8TeV_ext-madgraph-tarball/EDBR_PATtuple_edbr_wh_20140210/6dd5c34efa97fc5295a711db48f1622c/DYJetsToLL_PtZ-100_TuneZ2star_8TeV_ext-madgraph-tarball__Summer12_DR53X-PU_S10_START53_V7C-v1__AODSIM_1031_1_JwO.root'
'file:/afs/cern.ch/work/m/mwang/public/ForJennifer/EXOWH_Wprime_M1000_GENSIM_V2__mwang-EXOWH_Wprime_M1000_AODSIM_V2-2c74483358b1f8805e5601fc325d256c__USER_10_2_xXb.root'
# 'root://eoscms//eos/cms/store/cmst3/group/exovv/mwang/EDBR_PATtuple_edbr_wh_20140210_SingleElectron_Run2012A-22Jan2013-v1/mwang/c2d529e1c78e50623ca40825abf53f99/SingleElectron__Run2012A-22Jan2013-v1__AOD_114_2_fIY.root'
# '/store/cmst3/group/exovv/mwang/EDBR_PATtuple_edbr_wh_20140210_Summer12MC_DYToLLBinsPtZ_MADGRAPH_20140210_150636/mwang/DYJetsToLL_PtZ-00_TuneZ2star_8TeV_ext-madgraph-tarball/EDBR_PATtuple_edbr_wh_20140210/6dd5c34efa97fc5295a711db48f1622c/DYJetsToLL_PtZ-100_TuneZ2star_8TeV_ext-madgraph-tarball__Summer12_DR53X-PU_S10_START53_V7C-v1__AODSIM_1181_1_VHx.root'
])
| [
"mengmeng.wang@cern.ch"
] | mengmeng.wang@cern.ch |
9c9d2224936eaf991b77c3147e9c3e77350b573b | e6fab6f6b0415c94fafc3d88c72ac0221b4c8043 | /merge.py | 3c4cec09ba0149024dbfa095369c620d804b3125 | [] | no_license | sfc-quantan/sort_algorithm | d168d08d1a404e3bb93d07d13fe13861e121729d | dab880d258acaddd0ea4a02982c5389265f7d9ba | refs/heads/master | 2021-01-21T08:05:54.942763 | 2017-09-24T23:26:50 | 2017-09-24T23:26:50 | 101,953,628 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,232 | py | import random
from parser_n import parse
def merge2(a):
a =[a[i:i+2] for i in range(0,len(a),2)]
return a
def merge(array): # line1
mid = len(array) # line2
if mid > 1: # line3
left = merge(array[:(mid/2)]) # line4
right = merge(array[(mid/2):]) # line5
array = [] # line6
while len(left) != 0 and len(right) != 0: # line7
if left[0] < right[0]: # line8
array.append(left.pop(0)) # line9
else: # line10
array.append(right.pop(0)) # line11
if len(left) != 0: # line12
array.extend(left) # line13
elif len(right) != 0: # line14
array.extend(right) # line15
return array # line16
def main():
n = parse()
a = list(range(1, 1 +n))
random.shuffle(a)
a = merge(a)
print(a)
if __name__ == "__main__":
main()
| [
"quantan@ht.sfc.keio.ac.jp"
] | quantan@ht.sfc.keio.ac.jp |
40d149d8c61831532ac9fe9d2499e42926f1330e | 688ddbf29fdeeb048b9397ee24407ce326875dcb | /investigator/migrations/0004_auto_20170530_0923.py | e582f840b0e7d3069102b458814e24600eb190ef | [] | no_license | anishsaha12/rapidsignnow | 7f656c3146c31eaa6940d6f16f0d1372d8c81a2e | 16ad8c6326817e2df0419d84f1229b9afdc0a214 | refs/heads/master | 2022-04-30T07:30:50.458929 | 2018-09-01T12:58:24 | 2018-09-01T12:58:24 | 139,947,155 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 653 | py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('investigator', '0003_investigator_rates'),
]
operations = [
migrations.AddField(
model_name='investigator',
name='more_info',
field=models.TextField(default=''),
preserve_default=False,
),
migrations.AlterField(
model_name='investigator',
name='photograph',
field=models.ImageField(null=True, upload_to=b'investigator-photos', blank=True),
),
]
| [
"anish.saha@42hertz.com"
] | anish.saha@42hertz.com |
2c1287dcb22aba0e962ed781f9ccfe15fbc8cd09 | 64172a04fda7a585c4d111b779f30ecda58cef19 | /16.py | 5a388a7fc24d60538ff1a986ce1b3717197269ab | [] | no_license | pi7807pa/super-funicular | 983b4ee13f399bf299233d50af38020d01dd692d | 0d5c9ab95ec1b2ff08983e66588a89d96394b97a | refs/heads/master | 2021-01-17T18:07:18.786383 | 2017-06-27T09:55:00 | 2017-06-27T09:55:00 | 95,541,061 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 231 | py | #16th Program
from sys import argv
script, first, second, third = argv
print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third
| [
"pi7807pa@gmail.com"
] | pi7807pa@gmail.com |
4fb655f2d240906d9de3c076a510820cb7f6f02e | bc57038da93bbcc6ff7f9034bc87ed39e95496a1 | /example/multi-run/run.py | fc5a97eb976dcebf5279c790d2b2878d6b62e45c | [] | no_license | haiyufirefish/ns3-ai | 5e542b59b63765dcd0574237f11545122ca1aeda | 5c00de628029146629027fffa803c885a1bb4a08 | refs/heads/master | 2023-04-15T13:04:17.741288 | 2021-04-26T17:59:42 | 2021-04-26T17:59:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 663 | py | from py_interface import *
from ctypes import *
import sys
import ns3_util
import time
class Env(Structure):
_pack_ = 1
_fields_ = [
('a', c_int),
('b', c_int)
]
class Act(Structure):
_pack_ = 1
_fields_ = [
('c', c_int)
]
ns3Settings = {'a': '20', 'b': '30'}
exp = Experiment(1234, 4096, 'multi-run', '../../')
for i in range(2):
exp.reset()
rl = Ns3AIRL(2333, Env, Act)
pro = exp.run(setting=ns3Settings, show_output=True)
while not rl.isFinish():
with rl as data:
if data == None:
break
data.act.c = data.env.a+data.env.b
pro.wait()
del exp
| [
"haoyin@uw.edu"
] | haoyin@uw.edu |
664a0baff5829d1c6a0ce4bf3f098bafd1cb63d0 | 3fa9700725c3c58fde3d0be2cd502858780f7c97 | /hw3/utils/replay_buffer.py | f930ef8e91ebd19fc5cdf2c5f5ff71d864117da7 | [
"MIT"
] | permissive | CTinRay/ADLxMLDS2017 | dbbc74b56cc31527a07f0ba0892507f74d0f5a1d | 9c5e2955c9c0d8408715f987ad4ba4ce895b2edc | refs/heads/master | 2021-03-22T03:03:17.028228 | 2018-01-07T14:59:48 | 2018-01-07T14:59:48 | 106,155,911 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,328 | py | import pdb
import numpy as np
class ReplayBuffer:
def __init__(self, size, alpha=1):
self.states0 = np.array([None] * size)
self.states1 = np.array([None] * size)
self.rewards = np.zeros(size, dtype=np.float32)
self.actions = np.zeros(size, dtype=int)
self.dones = np.zeros(size, dtype=np.float32)
self.priorities = np.zeros(size)
self.max_size = size
self.next_index = 0
self.size = 0
self._alpha = alpha
self._max_priority = 1.0
def add(self, state0, action, reward, state1, done):
# save experience
self.states0[self.next_index] = state0
self.actions[self.next_index] = action
self.rewards[self.next_index] = reward
self.states1[self.next_index] = state1
self.dones[self.next_index] = done
self.priorities[self.next_index] = self._max_priority ** self._alpha
# update data structure parameters
self.next_index = (self.next_index + 1) % self.max_size
self.size = min(self.size + 1, self.max_size)
def sample(self, n_samples, beta=1):
# calculate sample probability
sample_probs = self.priorities / np.sum(self.priorities)
# sample indices according with sample probability
indices = np.where(
np.random.multinomial(
1,
sample_probs,
n_samples) == 1)[1]
# calculate weights
weights = (sample_probs[indices] * self.size) ** (-beta)
# normalize with max_weight
min_prob = np.min(sample_probs[:self.size])
max_weight = (min_prob * self.size) ** (-beta)
weights /= max_weight
# convert lazy frame into np array
states0 = np.array(list(map(np.array, self.states0[indices])))
states1 = np.array(list(map(np.array, self.states1[indices])))
return \
states0, \
self.actions[indices], \
self.rewards[indices], \
states1, \
self.dones[indices], \
indices, \
weights.astype(np.float32)
def update_priorities(self, indices, priorities):
# self.priorities[indices] = priorities ** self._alpha
# self._max_priority = max(self._max_priority, np.max(priorities))
pass
| [
"b03902072@ntu.edu.tw"
] | b03902072@ntu.edu.tw |
66b63fd8bd38481454862f9cb1eeed6473fff4ca | 6549e0f52793ec2a763e73492b9dc5c6bacb63b5 | /guest_api/serializers.py | e63d4c73c07e83536b7a96cb0788686e9acc2fbb | [] | no_license | Hardikpoudel/Django-Hotel | ecf3f97356543956a2570affb24516fc60f3c98f | aebd8a8150b4309f48b53bc551463be2e323aab2 | refs/heads/main | 2023-05-14T17:00:15.831882 | 2021-06-02T16:55:32 | 2021-06-02T16:55:32 | 339,623,489 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 189 | py | from rest_framework import serializers
from guest.models import guest
class guestSerializer(serializers.ModelSerializer):
class Meta:
model = guest
fields = '__all__'
| [
"hardikpoudel25@gmail.com"
] | hardikpoudel25@gmail.com |
8aa721207ee800c741e83e6e7d8d77e4213cfa6f | b2ebc3803f056e19cf5bce8f4f592baa89b014ef | /usresident.py | 06fd3edc06af57fbd84a9daf61c01f67ff0d4b9a | [] | no_license | caiespin/edx_Introduction_to_Computer_Science_Using_Python | 7121afd27eafbd560306c745deaa29bedc3fadc2 | effa88eff6a45f91ab4c0dfbcdb06d1623e1dcf4 | refs/heads/master | 2020-08-07T04:46:35.707116 | 2019-10-07T05:28:06 | 2019-10-07T05:28:06 | 213,301,890 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,042 | py | ## DO NOT MODIFY THE IMPLEMENTATION OF THE Person CLASS ##
class Person(object):
def __init__(self, name):
#create a person with name name
self.name = name
try:
firstBlank = name.rindex(' ')
self.lastName = name[firstBlank+1:]
except:
self.lastName = name
self.age = None
def getLastName(self):
#return self's last name
return self.lastName
def setAge(self, age):
#assumes age is an int greater than 0
#sets self's age to age (in years)
self.age = age
def getAge(self):
#assumes that self's age has been set
#returns self's current age in years
if self.age == None:
raise ValueError
return self.age
def __lt__(self, other):
#return True if self's name is lexicographically less
#than other's name, and False otherwise
if self.lastName == other.lastName:
return self.name < other.name
return self.lastName < other.lastName
def __str__(self):
#return self's name
return self.name
class USResident(Person):
"""
A Person who resides in the US.
"""
def __init__(self, name, status):
"""
Initializes a Person object. A USResident object inherits
from Person and has one additional attribute:
status: a string, one of "citizen", "legal_resident", "illegal_resident"
Raises a ValueError if status is not one of those 3 strings
"""
Person.__init__(self, name)
validStatus = ["citizen", "legal_resident", "illegal_resident"]
self.status = ''
if status not in validStatus:
raise ValueError('Not a valid status string')
else:
self.status = status
def getStatus(self):
"""
Returns the status
"""
return self.status
a = USResident('Tim Beaver', 'citizen')
print(a.getStatus())
#b = USResident('Tim Horton', 'non-resident') | [
"caiespin@ucsc.edu"
] | caiespin@ucsc.edu |
149150cf593dd2e09119bd451e110aa046ff5cd7 | 7caf1d687d4191a5507aad6534caaed6a8100542 | /timentor/views.py | 79db861399b622eaa811bd2bb5e5d563f71ed8f8 | [] | no_license | takutotacos/timentor | 32d58159c9beff460028da3a3275c4351de53956 | c9b8d791067a3b94336dc7a11479095030be6e57 | refs/heads/master | 2021-01-12T05:01:55.952951 | 2017-01-05T21:23:18 | 2017-01-05T21:23:18 | 77,829,744 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,425 | py | from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.urls import reverse
from django.views import generic
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from .forms import RegisterForm, ParentTaskForm, ChildTaskForm, BaseTaskFormSet
from .models import ChildTask, ParentTask
from django.forms import formset_factory
from django.utils.timezone import datetime
from django.contrib import messages
from django.shortcuts import get_list_or_404, get_object_or_404
def main(request):
today = datetime.now().strftime("%Y/%m/%d")
try:
parent_tasks = ParentTask.objects.filter(task_date=today)
except ParentTask.DoesNotExist:
error_message = today + "'s task does not exist"
return render(request, 'timentor/main.html', {'today': today,
'error_message': error_message})
return render(request, 'timentor/main.html', {'parent_tasks': parent_tasks,
'today': today})
def main_child_tasks(request, task_no):
today = datetime.now().strftime("%Y/%m/%d")
parent_task = get_object_or_404(ParentTask, task_date=today, task_no=task_no)
child_tasks = get_list_or_404(ChildTask, parent_task=parent_task)
if request.method == 'POST':
parent_task = ParentTask(id=parent_task.id, task_no=parent_task.task_no, task_date=parent_task.task_date,
time=parent_task.time, time_start=parent_task.time_start, time_end=parent_task.time_end,
task_name=parent_task.task_name, time_started=request.POST['started'])
parent_task.save()
return render(request, 'timentor/main_child_tasks.html', {
'child_tasks': child_tasks,
'parent_task': parent_task
})
def new_todo_parent(request):
ParentTaskFormSet = formset_factory(ParentTaskForm, formset=BaseTaskFormSet)
if request.method == 'POST':
# create a form instance and populate it with data from the request:
formset = ParentTaskFormSet(request.POST)
if formset.is_valid():
for form in formset:
cd = form.cleaned_data
parent_task = ParentTask(task_date=cd['task_date'], task_no=cd['task_no'], task_name=cd['task_name'],
time=cd['time'], time_start=cd['time_start'], time_end=cd['time_end'])
parent_task.save()
messages.success(request, 'You have created the tasks')
task_date_string = "".join(parent_task.task_date.split("/"))
return HttpResponseRedirect(reverse('timentor:list_daily_edit', args=(task_date_string,)))
else:
print(formset.errors)
messages.error(request, "You have something wrong with the tasks you made")
return HttpResponseRedirect(reverse('timentor:new_todo_parent'))
else:
formset = ParentTaskFormSet(initial=[
{'task_date': datetime.now().strftime("%Y/%m/%d")}
])
return render(request, 'timentor/new_todo_parent.html', {'formset': formset})
def new_todo_child(request, task_date, task_no):
task_date_string = task_date[:4] + "/" + task_date[4:6] + "/" + task_date[6:]
daily_task_with_task_no = get_object_or_404(ParentTask, task_date=task_date_string, task_no=task_no)
ChildTaskFormSet = formset_factory(ChildTaskForm, formset=BaseTaskFormSet)
if request.method == 'POST':
formset = ChildTaskFormSet(request.POST)
if formset.is_valid():
for form in formset:
cd = form.cleaned_data
child_task = ChildTask(task_no=cd['task_no'], task_name=cd['task_name'], time=cd['time'],
time_start=cd['time_start'], time_end=cd['time_end'],
classification=cd['classification'], parent_task=daily_task_with_task_no)
child_task.save()
return HttpResponseRedirect(reverse('timentor:list_daily_task_edit', args=(task_date, task_no)))
else:
messages.error(request, "You have something wrong with the tasks you made")
return HttpResponseRedirect(reverse('timentor:new_todo_child'))
else:
formset = ChildTaskFormSet()
return render(request, 'timentor/new_todo_child.html', {
'formset': formset,
'parent_task': daily_task_with_task_no,
})
def list_daily_edit(request, task_date):
task_date_string = task_date[:4] + "/" + task_date[4:6] + "/" + task_date[6:]
parent_tasks = get_list_or_404(ParentTask, task_date=task_date_string)
return render(request, 'timentor/list_daily_edit.html', {
'parent_tasks': parent_tasks,
'task_date': task_date
})
def list_daily_task_edit(request, task_date, task_no):
task_date_string = task_date[:4] + "/" + task_date[4:6] + "/" + task_date[6:]
parent_task = get_object_or_404(ParentTask, task_date=task_date_string, task_no=task_no)
child_tasks = get_list_or_404(ChildTask, parent_task=parent_task)
return render(request, 'timentor/list_daily_task_edit.html', {
'child_tasks': child_tasks,
'parent_task': parent_task
})
| [
"s.takuto0214@gmail.com"
] | s.takuto0214@gmail.com |
7a47ff1141dbe143b2bd25caa9a648e3e2ec8d11 | bde42563906f89eb2b1eb54fbc30d98cec98a1da | /archived_websites.py | 110e8f0c24d9719d3aa13ae474f3cc51fe08bfdf | [] | no_license | lapl-digitization/sc-workflow-scripts | 198a7a9e1483a1d73d17bfd426ed28d3e852368c | c6b31496df5b2f3cc94c32a2870d383998a9b8dc | refs/heads/master | 2023-03-22T18:01:48.123019 | 2021-03-12T17:55:11 | 2021-03-12T17:55:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,355 | py | import csv
from asnake.client import ASnakeClient
from asnake.aspace import ASpace
#This script has been modified from a script created by Noah Huffman at Duke. It can be used to add archival objects as children to different resources or archival objects.
#The script adds title, level, some date metadata, extent metadata, and a scope and contents note. It is currently configured for a project adding archived websites to ArchivesSpace in bulk. The JSON on line 74 will need editing for other types of materials or for different metadata additions.
#Script currently is pointed toward repository number 2. Edit the number if you need to make updates in a different repository.
#Script takes as input a csv with the columns identified below. See lines 58-71.
import asnake.logging as logging
logging.setup_logging(level='DEBUG', filename="batch_add_aos.log", filemode="a")
secretsVersion = input('To edit production server, enter the name of the \
secrets file: ')
if secretsVersion != '':
try:
secrets = __import__(secretsVersion)
print('Editing Production')
except ImportError:
secrets = __import__('secrets')
print('Editing Development')
else:
print('Editing Development')
aspace = ASpace(baseurl=secrets.baseURL,
username=secrets.user,
password=secrets.password)
#Log Into ASpace and set repo
aspace_client = ASnakeClient(baseurl=secrets.baseURL,
username=secrets.user,
password=secrets.password)
aspace_client.authorize()
#Set target repo
repo = aspace_client.get("repositories/2").json()
print("Logged into: " + repo['name'])
ssc_repo = aspace.repositories(2)
#input is CSV with existing resource URIs (column 1) and AO URIs (or resource URIs repeated, if you want to add the new ao as a direct child of the resource) (column1) and other columns for new AO metadata
input_csv = input("Path to CSV Input: ")
#output will be input CSV plus some extra columns for reporting on actions taken, errors, etc.
output_csv = input("Path to CSV Output: ")
#Open Input CSV and iterate over rows
with open(input_csv,'rt') as csvfile, open(output_csv,'wt') as csvout:
csvin = csv.reader(csvfile)
next(csvin, None) #ignore header row
csvout = csv.writer(csvout)
for row in csvin:
resource_uri = row[0]
archival_object_parent_uri = row[1]
#ARCHIVAL OBJECT STUFF
# Use metadata from CSV to create archival object children of existing archival object
new_ao_level = row[2]
new_ao_title = row[3]
new_ao_date_begin = row[4]
new_ao_date_type = row[5]
new_ao_date_expression = row[6]
new_ao_extent = row[7]
new_ao_extent_type = row[8]
new_ao_scope_contents = row[9]
#Form the new Archival Object JSON - this will need to be edited if, for example, you don't want to add a scope and contents note.
new_ao_data = {"children": [{"title":new_ao_title , "level": new_ao_level, "publish": True, "extents":[{"number": new_ao_extent, "portion": "whole", "extent_type": new_ao_extent_type}], "notes": [{"jsonmodel_type": "note_multipart", "type": "scopecontent", "subnotes": [{"jsonmodel_type": "note_text", "content":new_ao_scope_contents, "publish": True }], "publish": True }], "dates": [{"expression":new_ao_date_expression, "begin":new_ao_date_begin, "label": "event", "date_type": "single" }], "resource":{"ref":resource_uri}}]}
#print (new_ao_data)
#For later....Make some JSON for the Top Container
top_container_data = {}
#post archival object as child of specified parent using /children endpoint
new_ao_post = aspace_client.post(archival_object_parent_uri + '/children', json=new_ao_data).json()
print (new_ao_post)
row.append(new_ao_post)
print ('Created new AO child of: ', new_ao_post['id'])
# Write a new csv with all the info from the initial csv + the ArchivesSpace uris for the archival and digital objects
with open(output_csv,'at') as csvout:
writer = csv.writer(csvout)
writer.writerow(row)
#print a new line for readability in console
print ('\n')
| [
"noreply@github.com"
] | noreply@github.com |
328ecc8c6a133314695a3f5e71fe57df6876cc9c | bdb206758815fa598285e05c23d81829f3ad60a9 | /addons/at2166/controllers/controllers.py | 4e907a688dc832b0d2a90c58e410c59f80a51a82 | [] | no_license | kulius/odoo10_test | 75a9645fbd64ba5fd6901fb441f2e7141f610032 | 5a01107e2337fd0bbe35d87d53a0fe12eff7c59e | refs/heads/master | 2021-07-26T15:05:58.074345 | 2017-11-08T09:04:11 | 2017-11-08T09:04:11 | 109,943,776 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 684 | py | # -*- coding: utf-8 -*-
from odoo import http
# class At2166(http.Controller):
# @http.route('/at2166/at2166/', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/at2166/at2166/objects/', auth='public')
# def list(self, **kw):
# return http.request.render('at2166.listing', {
# 'root': '/at2166/at2166',
# 'objects': http.request.env['at2166.at2166'].search([]),
# })
# @http.route('/at2166/at2166/objects/<model("at2166.at2166"):obj>/', auth='public')
# def object(self, obj, **kw):
# return http.request.render('at2166.object', {
# 'object': obj
# }) | [
"kulius@gmail.com"
] | kulius@gmail.com |
a9057e32cb12b0a2fa829f5489ec474f6efc01a3 | 7fa0ec5b7bba8b45ecf5890a7d346c4f79f3cd65 | /src/MyCalculator.py | bcd957d19061c7e932d67e6556b6d753d47bbaee | [] | no_license | tivole/Ti_SimpleCalculator | 3aa1aa5e056e6dedcbc5804c212b432f8e930a2a | dbeb73ce8647e7c161b80955c72b1beef46e533e | refs/heads/master | 2020-07-04T03:52:35.880647 | 2019-09-13T14:24:48 | 2019-09-13T14:24:48 | 202,146,258 | 4 | 0 | null | null | null | null | UTF-8 | Python | false | false | 4,573 | py | from PyQt5 import QtWidgets, QtGui
from calculator_ui import Ui_MainWindow
class CalculatorWindow(QtWidgets.QMainWindow, Ui_MainWindow):
FirstNumber = None
UserIsTypingSecondNumber = False
def __init__(self):
super().__init__()
self.setupUi(self)
self.setWindowIcon(QtGui.QIcon('img/icon.png'))
self.setWindowTitle('Calculator')
self.show()
# Connecting buttons
self.button_0.clicked.connect(self.digit_pressed)
self.button_1.clicked.connect(self.digit_pressed)
self.button_2.clicked.connect(self.digit_pressed)
self.button_3.clicked.connect(self.digit_pressed)
self.button_4.clicked.connect(self.digit_pressed)
self.button_5.clicked.connect(self.digit_pressed)
self.button_6.clicked.connect(self.digit_pressed)
self.button_7.clicked.connect(self.digit_pressed)
self.button_8.clicked.connect(self.digit_pressed)
self.button_9.clicked.connect(self.digit_pressed)
self.button_dot.clicked.connect(self.decimal_pressed)
self.button_PlusMinus.clicked.connect(self.unary_operation_pressed)
self.button_percent.clicked.connect(self.unary_operation_pressed)
self.button_add.clicked.connect(self.binary_operator_pressed)
self.button_subtract.clicked.connect(self.binary_operator_pressed)
self.button_multiply.clicked.connect(self.binary_operator_pressed)
self.button_divide.clicked.connect(self.binary_operator_pressed)
self.button_equals.clicked.connect(self.equals_pressed)
self.button_clear.clicked.connect(self.clear_pressed)
self.button_add.setCheckable(True)
self.button_subtract.setCheckable(True)
self.button_multiply.setCheckable(True)
self.button_divide.setCheckable(True)
def digit_pressed(self):
button = self.sender()
if ((self.button_add.isChecked() or self.button_subtract.isChecked() or self.button_multiply.isChecked() or self.button_divide.isChecked()) and (not self.UserIsTypingSecondNumber)):
newLabel = format(float(button.text()), '.15g')
self.UserIsTypingSecondNumber = True
else:
if (('.' in self.display.text()) and (button.text() == '0')):
newLabel = newLabel = format(self.display.text() + button.text(), '.15')
else:
newLabel = format(float(self.display.text() + button.text()), '.15g')
self.display.setText(newLabel)
def decimal_pressed(self):
if (not '.' in self.display.text()):
self.display.setText(self.display.text() + '.')
def unary_operation_pressed(self):
button = self.sender()
labelNumber = float(self.display.text())
if button.text() == '+/-':
labelNumber *= (-1)
elif button.text() == '%':
labelNumber *= 0.01
newLabel = format(labelNumber, '.15g')
self.display.setText(newLabel)
def binary_operator_pressed(self):
button = self.sender()
self.FirstNumber = float(self.display.text())
button.setChecked(True)
def equals_pressed(self):
SecondNumber = float(self.display.text())
if self.button_add.isChecked():
labelNumber = self.FirstNumber + SecondNumber
newLabel = format(labelNumber, '.15g')
self.display.setText(newLabel)
self.button_add.setChecked(False)
elif self.button_subtract.isChecked():
labelNumber = self.FirstNumber - SecondNumber
newLabel = format(labelNumber, '.15g')
self.display.setText(newLabel)
self.button_subtract.setChecked(False)
elif self.button_multiply.isChecked():
labelNumber = self.FirstNumber * SecondNumber
newLabel = format(labelNumber, '.15g')
self.display.setText(newLabel)
self.button_multiply.setChecked(False)
elif self.button_divide.isChecked():
labelNumber = self.FirstNumber / SecondNumber
newLabel = format(labelNumber, '.15g')
self.display.setText(newLabel)
self.button_divide.setChecked(False)
self.UserIsTypingSecondNumber = False
def clear_pressed(self):
self.button_add.setChecked(False)
self.button_subtract.setChecked(False)
self.button_multiply.setChecked(False)
self.button_divide.setChecked(False)
self.UserIsTypingSecondNumber = False
self.display.setText('0') | [
"tivole@localhost.localdomain"
] | tivole@localhost.localdomain |
dddff59acc7e38efe8dbcebd0b1f610d0fb996bd | 9c96829cffbbff055e81b7888e6108799b394bc8 | /joke.py | 47d099d7f20e5aafa88cdc207027f8d22bbbb9a4 | [] | no_license | prosvirakov/joke | b42008acf13784ac28dabd1166789bbe45eda7b5 | d524c6f92e32a4673821b8f3621d35e16feea037 | refs/heads/main | 2023-02-27T01:23:15.168964 | 2021-01-24T10:42:53 | 2021-01-24T10:42:53 | 332,422,935 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 288 | py | import pygame as pg
FPS = 30
pg.init()
skreen = pg.display.set_mode((640, 480))
clock = pg.time.clock()
running = True
while running:
clock.tick(FPS)
for event in pg.event.get():
if event.type == QUIT:
running = False
pg.quit()
| [
"noreply@github.com"
] | noreply@github.com |
3c6fbbd40a445a027d4f85a15efb5f1a5fe41108 | d225ac649a6959f1cb27f506b91518329442c17e | /code by chapter/Chapter 2/ch2_trav_sale.py | 9f3933eed006998f005531f16441b19d80fb29e4 | [] | no_license | ShengjieXu667/modeling-master | 1827f3ace6c7c329a8594816edd74ff45938c6ca | 73c6f35813bf19b758e915e06fe48d0990c2423e | refs/heads/master | 2023-08-21T19:45:09.968560 | 2021-10-15T10:06:56 | 2021-10-15T10:06:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,581 | py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 18 19:49:42 2021
@author: tom verguts
The travelling salesperson, with some help from Hopfield
"""
import numpy as np
import tensorflow as tf
d12, d13, d23 = 1, 4, 4
d = np.array([[0, d12, d13], [d12, 0, d23], [d13, d23, 0]]) # distances
g = 3 # importance of sum constraint
W = np.zeros((9, 9), dtype = np.double)
W[0, 0] = 2*g
W[1, 0:2] = [g, 2*g]
W[2, 0:3] = [g, g, 2*g]
W[3, 0:4] = [g, d[0, 1], 0, 2*g]
W[4, 0:5] = [d[0, 1], g, d[0, 1], g, 2*g]
W[5, 0:6] = [0, d[0, 1], g, g, g, 2*g]
W[6, 0:7] = [g, d[0, 2], 0, g, d[1, 2], 0, 2*g]
W[7, 0:8] = [d[0, 2], g, d[0, 2], d[1, 2], g, d[1, 2], g, 2*g]
W[8, 0:9] = [0, d[0, 2], g, 0, d[1, 2], g, g, g, 2*g]
W = -W
W = W + W.T - np.diag(np.diag(W))
start_pattern = (np.random.random(9)>0.5)*1 # start in random state
start_pattern = start_pattern[:, np.newaxis]
print(start_pattern)
# a function to sample the network iteratively
def hopfield(start_pattern = None, n_sample = 0):
pattern = tf.cast(start_pattern, dtype = tf.double)
for loop in range(n_sample):
net_input = tf.matmul(W, pattern) + tf.multiply(pattern, +4*g)
clipped = tf.cast(tf.math.greater(net_input, 0), tf.double)
pattern = clipped
return pattern
pattern = hopfield(start_pattern = start_pattern, n_sample = 10)
pattern = np.array(pattern)
print(pattern)
path = np.ndarray(3)
for loop in range(3):
v = pattern[3*loop + np.array(range(3))]
path[loop] = np.argmax(v)
print("path: ",path)
print("energy: ",-(np.matmul(np.matmul(pattern.T,W),pattern) + np.sum(pattern)*4*g)) | [
"tom.verguts@ugent.be"
] | tom.verguts@ugent.be |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.