Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/autotest/param_metadata/param.py
Views: 1799
1class Parameter(object):2def __init__(self, name, real_path):3self.name = name4self.real_path = real_path56def change_name(self, name):7self.name = name8910class Vehicle(object):11def __init__(self, name, path, reference=None):12self.name = name13self.path = path14self.reference = reference15if reference is None:16self.reference = self.truename17self.params = []181920class Library(object):21def __init__(self, name, reference=None, not_rst=False, check_duplicates=False):22self.set_name(name)23self.params = []24if reference is not None:25self.reference = reference26self.not_rst = not_rst27self.check_duplicates = check_duplicates2829def set_name(self, name):30self.name = name31self.reference = name3233def has_param(self, pname):34for p in self.params:35if pname == p.name:36return True37return False3839known_param_fields = [40'Description',41'DisplayName',42'Values',43'Range',44'Units',45'Increment',46'User',47'RebootRequired',48'Bitmask',49'Volatile',50'ReadOnly',51'Calibration',52'Vector3Parameter',53'SortValues',54'Legacy',55]5657# Follow SI units conventions from:58# http://physics.nist.gov/cuu/Units/units.html59# http://physics.nist.gov/cuu/Units/outside.html60# and61# http://physics.nist.gov/cuu/Units/checklist.html62# http://www.bipm.org/en/publications/si-brochure/63# http://www1.bipm.org/en/CGPM/db/3/2/ g_n unit for G-force64# one further constrain is that only printable (7bit) ASCII characters are allowed65known_units = {66# abreviation : full-text (used in .html .rst and .wiki files)67# time68's' : 'seconds' ,69'ds' : 'deciseconds' ,70'cs' : 'centiseconds' ,71'ms' : 'milliseconds' ,72'us' : 'microseconds' ,73'PWM' : 'PWM in microseconds' , # should be microseconds, this is NOT a SI unit, but follows https://github.com/ArduPilot/ardupilot/pull/5538#issuecomment-27194306174'Hz' : 'hertz' ,75'kHz' : 'kilohertz' ,76'1/s' : 'per second' , # Not SI but in some situations more user-friendly than hertz77# distance78'km' : 'kilometers' , # metre is the SI unit name, meter is the american spelling of it79'm' : 'meters' , # metre is the SI unit name, meter is the american spelling of it80'm/s' : 'meters per second' , # metre is the SI unit name, meter is the american spelling of it81'm/s/s' : 'meters per square second' , # metre is the SI unit name, meter is the american spelling of it82'm/s/s/s' : 'meters per cubic second' , # metre is the SI unit name, meter is the american spelling of it83'cm' : 'centimeters' , # metre is the SI unit name, meter is the american spelling of it84'cm/s' : 'centimeters per second' , # metre is the SI unit name, meter is the american spelling of it85'cm/s/s' : 'centimeters per square second', # metre is the SI unit name, meter is the american spelling of it86'cm/s/s/s': 'centimeters per cubic second' , # metre is the SI unit name, meter is the american spelling of it87'mm' : 'millimeters' , # metre is the SI unit name, meter is the american spelling of it88# temperature89'degC' : 'degrees Celsius' , # Not SI, but Kelvin is too cumbersome for most users90# angle91'deg' : 'degrees' , # Not SI, but is some situations more user-friendly than radians92'deg/s' : 'degrees per second' , # Not SI, but is some situations more user-friendly than radians93'deg/s/s' : 'degrees per square second', # Not SI, but is some situations more user-friendly than radians94'deg/s/s/s' : 'degrees per cube second', # Not SI, but is some situations more user-friendly than radians95'cdeg' : 'centidegrees' , # Not SI, but is some situations more user-friendly than radians96'cdeg/s' : 'centidegrees per second', # Not SI, but is some situations more user-friendly than radians97'cdeg/s/s': 'centidegrees per square second' , # Not SI, but is some situations more user-friendly than radians98'rad' : 'radians' ,99'rad/s' : 'radians per second' ,100'rad/s/s' : 'radians per square second' ,101# electricity102'A' : 'ampere' ,103'V' : 'volt' ,104'W' : 'watt' ,105# magnetism106'Gauss' : 'gauss' , # Gauss is not an SI unit, but 1 tesla = 10000 gauss so a simple replacement is not possible here107'Gauss/s' : 'gauss per second' , # Gauss is not an SI unit, but 1 tesla = 10000 gauss so a simple replacement is not possible here108'mGauss' : 'milligauss' , # Gauss is not an SI unit, but 1 tesla = 10000 gauss so a simple replacement is not possible here109# pressure110'Pa' : 'pascal' ,111'hPa' : 'hectopascal' ,112# ratio113'%' : 'percent' ,114'%/s' : 'percent per second' ,115'd%' : 'decipercent' , # decipercent is strange, but "per-mille" is even more exotic116'dB' : 'decibel' ,117# compound118119'kB' : 'kilobytes' ,120'MB' : 'megabyte' ,121'm.m/s/s' : 'square meter per square second',122'deg/m/s' : 'degrees per meter per second' ,123'm/s/m' : 'meters per second per meter' , # Why not use Hz here ????124'mGauss/A': 'milligauss per ampere' ,125'mAh' : 'milliampere hour' ,126'Ah' : 'ampere hour' ,127'A/V' : 'ampere per volt' ,128'm/V' : 'meters per volt' ,129'gravities': 'standard acceleration due to gravity' , # g_n would be a more correct unit, but IMHO no one understands what g_n means130'octal' : 'octal' ,131'RPM' : 'Revolutions Per Minute',132'kg' : 'kilograms',133'kg/m/m' : 'kilograms per square meter', # metre is the SI unit name, meter is the american spelling of it134'kg/m/m/m': 'kilograms per cubic meter',135'litres' : 'litres',136'Ohm' : 'Ohm',137'N' : 'Newtons',138}139140required_param_fields = [141'Description',142'DisplayName',143'User',144]145146required_library_param_fields = [147'Description',148'DisplayName',149]150151known_group_fields = [152'Path',153]154155156