mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 00:23:33 +08:00
Merge branch 'beta' into offboard2
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
parameters.wiki
|
parameters.wiki
|
||||||
parameters.xml
|
parameters.xml
|
||||||
|
parameters.wikirpc.xml
|
||||||
cookies.txt
|
cookies.txt
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
import output
|
|
||||||
from xml.sax.saxutils import escape
|
|
||||||
|
|
||||||
class DokuWikiOutput(output.Output):
|
|
||||||
def Generate(self, groups):
|
|
||||||
pre_text = """<?xml version='1.0'?>
|
|
||||||
<methodCall>
|
|
||||||
<methodName>wiki.putPage</methodName>
|
|
||||||
<params>
|
|
||||||
<param>
|
|
||||||
<value>
|
|
||||||
<string>:firmware:parameters</string>
|
|
||||||
</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<value>
|
|
||||||
<string>"""
|
|
||||||
result = "====== Parameter Reference ======\nThis list is auto-generated every few minutes and contains the most recent parameter names and default values."
|
|
||||||
for group in groups:
|
|
||||||
result += "==== %s ====\n\n" % group.GetName()
|
|
||||||
result += "|< 100% 20% 20% 10% 10% 10% 30%>|\n"
|
|
||||||
result += "^ Name ^ Description ^ Min ^ Max ^ Default ^ Comment ^\n"
|
|
||||||
for param in group.GetParams():
|
|
||||||
code = param.GetFieldValue("code")
|
|
||||||
name = param.GetFieldValue("short_desc")
|
|
||||||
name = name.replace("\n", "")
|
|
||||||
result += "| %s | %s " % (code, name)
|
|
||||||
min_val = param.GetFieldValue("min")
|
|
||||||
if min_val is not None:
|
|
||||||
result += " | %s " % min_val
|
|
||||||
else:
|
|
||||||
result += " | "
|
|
||||||
max_val = param.GetFieldValue("max")
|
|
||||||
if max_val is not None:
|
|
||||||
result += " | %s " % max_val
|
|
||||||
else:
|
|
||||||
result += " | "
|
|
||||||
def_val = param.GetFieldValue("default")
|
|
||||||
if def_val is not None:
|
|
||||||
result += "| %s " % def_val
|
|
||||||
else:
|
|
||||||
result += " | "
|
|
||||||
long_desc = param.GetFieldValue("long_desc")
|
|
||||||
if long_desc is not None:
|
|
||||||
long_desc = long_desc.replace("\n", "")
|
|
||||||
result += "| %s " % long_desc
|
|
||||||
else:
|
|
||||||
result += " | "
|
|
||||||
result += " |\n"
|
|
||||||
result += "\n"
|
|
||||||
post_text = """</string>
|
|
||||||
</value>
|
|
||||||
</param>
|
|
||||||
<param>
|
|
||||||
<value>
|
|
||||||
<name>sum</name>
|
|
||||||
<string>Updated parameters automagically from code.</string>
|
|
||||||
</value>
|
|
||||||
</param>
|
|
||||||
</params>
|
|
||||||
</methodCall>"""
|
|
||||||
return pre_text + escape(result) + post_text
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
class Output(object):
|
|
||||||
def Save(self, groups, fn):
|
|
||||||
data = self.Generate(groups)
|
|
||||||
with open(fn, 'w') as f:
|
|
||||||
f.write(data)
|
|
||||||
+8
-4
@@ -1,7 +1,7 @@
|
|||||||
import output
|
import codecs
|
||||||
|
|
||||||
class DokuWikiOutput(output.Output):
|
class DokuWikiListingsOutput():
|
||||||
def Generate(self, groups):
|
def __init__(self, groups):
|
||||||
result = ""
|
result = ""
|
||||||
for group in groups:
|
for group in groups:
|
||||||
result += "==== %s ====\n\n" % group.GetName()
|
result += "==== %s ====\n\n" % group.GetName()
|
||||||
@@ -24,4 +24,8 @@ class DokuWikiOutput(output.Output):
|
|||||||
if def_val is not None:
|
if def_val is not None:
|
||||||
result += "* Default value: %s\n" % def_val
|
result += "* Default value: %s\n" % def_val
|
||||||
result += "\n"
|
result += "\n"
|
||||||
return result
|
self.output = result
|
||||||
|
|
||||||
|
def Save(self, filename):
|
||||||
|
with codecs.open(filename, 'w', 'utf-8') as f:
|
||||||
|
f.write(self.output)
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
from xml.sax.saxutils import escape
|
||||||
|
import codecs
|
||||||
|
|
||||||
|
class DokuWikiTablesOutput():
|
||||||
|
def __init__(self, groups):
|
||||||
|
result = "====== Parameter Reference ======\nThis list is auto-generated every few minutes and contains the most recent parameter names and default values.\n\n"
|
||||||
|
for group in groups:
|
||||||
|
result += "==== %s ====\n\n" % group.GetName()
|
||||||
|
result += "|< 100% 20% 20% 10% 10% 10% 30%>|\n"
|
||||||
|
result += "^ Name ^ Description ^ Min ^ Max ^ Default ^ Comment ^\n"
|
||||||
|
for param in group.GetParams():
|
||||||
|
code = param.GetFieldValue("code")
|
||||||
|
name = param.GetFieldValue("short_desc")
|
||||||
|
min_val = param.GetFieldValue("min")
|
||||||
|
max_val = param.GetFieldValue("max")
|
||||||
|
def_val = param.GetFieldValue("default")
|
||||||
|
long_desc = param.GetFieldValue("long_desc")
|
||||||
|
|
||||||
|
name = name.replace("\n", " ")
|
||||||
|
result += "| %s | %s |" % (code, name)
|
||||||
|
|
||||||
|
if min_val is not None:
|
||||||
|
result += " %s |" % min_val
|
||||||
|
else:
|
||||||
|
result += " |"
|
||||||
|
|
||||||
|
if max_val is not None:
|
||||||
|
result += " %s |" % max_val
|
||||||
|
else:
|
||||||
|
result += " |"
|
||||||
|
|
||||||
|
if def_val is not None:
|
||||||
|
result += " %s |" % def_val
|
||||||
|
else:
|
||||||
|
result += " |"
|
||||||
|
|
||||||
|
if long_desc is not None:
|
||||||
|
long_desc = long_desc.replace("\n", " ")
|
||||||
|
result += " %s |" % long_desc
|
||||||
|
else:
|
||||||
|
result += " |"
|
||||||
|
|
||||||
|
result += "\n"
|
||||||
|
result += "\n"
|
||||||
|
self.output = result;
|
||||||
|
|
||||||
|
def Save(self, filename):
|
||||||
|
with codecs.open(filename, 'w', 'utf-8') as f:
|
||||||
|
f.write(self.output)
|
||||||
|
|
||||||
|
def SaveRpc(self, filename):
|
||||||
|
with codecs.open(filename, 'w', 'utf-8') as f:
|
||||||
|
f.write("""<?xml version='1.0'?>
|
||||||
|
<methodCall>
|
||||||
|
<methodName>wiki.putPage</methodName>
|
||||||
|
<params>
|
||||||
|
<param>
|
||||||
|
<value>
|
||||||
|
<string>:firmware:parameters</string>
|
||||||
|
</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<value>
|
||||||
|
<string>""")
|
||||||
|
f.write(escape(self.output))
|
||||||
|
f.write("""</string>
|
||||||
|
</value>
|
||||||
|
</param>
|
||||||
|
<param>
|
||||||
|
<value>
|
||||||
|
<name>sum</name>
|
||||||
|
<string>Updated parameters automagically from code.</string>
|
||||||
|
</value>
|
||||||
|
</param>
|
||||||
|
</params>
|
||||||
|
</methodCall>""")
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import output
|
|
||||||
from xml.dom.minidom import getDOMImplementation
|
from xml.dom.minidom import getDOMImplementation
|
||||||
|
import codecs
|
||||||
|
|
||||||
class XMLOutput(output.Output):
|
class XMLOutput():
|
||||||
def Generate(self, groups):
|
def __init__(self, groups):
|
||||||
impl = getDOMImplementation()
|
impl = getDOMImplementation()
|
||||||
xml_document = impl.createDocument(None, "parameters", None)
|
xml_document = impl.createDocument(None, "parameters", None)
|
||||||
xml_parameters = xml_document.documentElement
|
xml_parameters = xml_document.documentElement
|
||||||
@@ -19,4 +19,8 @@ class XMLOutput(output.Output):
|
|||||||
xml_param.appendChild(xml_field)
|
xml_param.appendChild(xml_field)
|
||||||
xml_value = xml_document.createTextNode(value)
|
xml_value = xml_document.createTextNode(value)
|
||||||
xml_field.appendChild(xml_value)
|
xml_field.appendChild(xml_value)
|
||||||
return xml_document.toprettyxml(indent=" ", newl="\n", encoding="utf-8")
|
self.xml_document = xml_document
|
||||||
|
|
||||||
|
def Save(self, filename):
|
||||||
|
with codecs.open(filename, 'w', 'utf-8') as f:
|
||||||
|
self.xml_document.writexml(f, indent=" ", addindent=" ", newl="\n")
|
||||||
@@ -40,22 +40,28 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import scanner
|
import scanner
|
||||||
import parser
|
import srcparser
|
||||||
import xmlout
|
import output_xml
|
||||||
import dokuwikiout
|
import output_dokuwiki_tables
|
||||||
|
import output_dokuwiki_listings
|
||||||
|
|
||||||
# Initialize parser
|
# Initialize parser
|
||||||
prs = parser.Parser()
|
prs = srcparser.Parser()
|
||||||
|
|
||||||
# Scan directories, and parse the files
|
# Scan directories, and parse the files
|
||||||
sc = scanner.Scanner()
|
sc = scanner.Scanner()
|
||||||
sc.ScanDir("../../src", prs)
|
sc.ScanDir("../../src", prs)
|
||||||
output = prs.GetParamGroups()
|
groups = prs.GetParamGroups()
|
||||||
|
|
||||||
# Output into XML
|
# Output into XML
|
||||||
out = xmlout.XMLOutput()
|
out = output_xml.XMLOutput(groups)
|
||||||
out.Save(output, "parameters.xml")
|
out.Save("parameters.xml")
|
||||||
|
|
||||||
# Output into DokuWiki
|
# Output to DokuWiki listings
|
||||||
out = dokuwikiout.DokuWikiOutput()
|
#out = output_dokuwiki_listings.DokuWikiListingsOutput(groups)
|
||||||
out.Save(output, "parameters.wiki")
|
#out.Save("parameters.wiki")
|
||||||
|
|
||||||
|
# Output to DokuWiki tables
|
||||||
|
out = output_dokuwiki_tables.DokuWikiTablesOutput(groups)
|
||||||
|
out.Save("parameters.wiki")
|
||||||
|
out.SaveRpc("parameters.wikirpc.xml")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import codecs
|
||||||
|
|
||||||
class Scanner(object):
|
class Scanner(object):
|
||||||
"""
|
"""
|
||||||
@@ -29,6 +30,6 @@ class Scanner(object):
|
|||||||
Scans provided file and passes its contents to the parser using
|
Scans provided file and passes its contents to the parser using
|
||||||
parser.Parse method.
|
parser.Parse method.
|
||||||
"""
|
"""
|
||||||
with open(path, 'r') as f:
|
with codecs.open(path, 'r', 'utf-8') as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
parser.Parse(contents)
|
parser.Parse(contents)
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ class ParameterGroup(object):
|
|||||||
state of the parser.
|
state of the parser.
|
||||||
"""
|
"""
|
||||||
return sorted(self.params,
|
return sorted(self.params,
|
||||||
cmp=lambda x, y: cmp(x.GetFieldValue("code"),
|
key=lambda x: x.GetFieldValue("code"))
|
||||||
y.GetFieldValue("code")))
|
|
||||||
|
|
||||||
class Parameter(object):
|
class Parameter(object):
|
||||||
"""
|
"""
|
||||||
@@ -61,9 +60,10 @@ class Parameter(object):
|
|||||||
"""
|
"""
|
||||||
Return list of existing field codes in convenient order
|
Return list of existing field codes in convenient order
|
||||||
"""
|
"""
|
||||||
return sorted(self.fields.keys(),
|
keys = self.fields.keys()
|
||||||
cmp=lambda x, y: cmp(self.priority.get(y, 0),
|
keys = sorted(keys)
|
||||||
self.priority.get(x, 0)) or cmp(x, y))
|
keys = sorted(keys, key=lambda x: self.priority.get(x, 0), reverse=True)
|
||||||
|
return keys
|
||||||
|
|
||||||
def GetFieldValue(self, code):
|
def GetFieldValue(self, code):
|
||||||
"""
|
"""
|
||||||
@@ -197,7 +197,7 @@ class Parser(object):
|
|||||||
if tag == "group":
|
if tag == "group":
|
||||||
group = tags[tag]
|
group = tags[tag]
|
||||||
elif tag not in self.valid_tags:
|
elif tag not in self.valid_tags:
|
||||||
sys.stderr.write("Skipping invalid"
|
sys.stderr.write("Skipping invalid "
|
||||||
"documentation tag: '%s'\n" % tag)
|
"documentation tag: '%s'\n" % tag)
|
||||||
else:
|
else:
|
||||||
param.SetField(tag, tags[tag])
|
param.SetField(tag, tags[tag])
|
||||||
@@ -214,7 +214,7 @@ class Parser(object):
|
|||||||
object. Note that returned object is not a copy. Modifications affect
|
object. Note that returned object is not a copy. Modifications affect
|
||||||
state of the parser.
|
state of the parser.
|
||||||
"""
|
"""
|
||||||
return sorted(self.param_groups.values(),
|
groups = self.param_groups.values()
|
||||||
cmp=lambda x, y: cmp(self.priority.get(y.GetName(), 0),
|
groups = sorted(groups, key=lambda x: x.GetName())
|
||||||
self.priority.get(x.GetName(), 0)) or cmp(x.GetName(),
|
groups = sorted(groups, key=lambda x: self.priority.get(x.GetName(), 0), reverse=True)
|
||||||
y.GetName()))
|
return groups
|
||||||
@@ -2,4 +2,4 @@ python px_process_params.py
|
|||||||
|
|
||||||
rm cookies.txt
|
rm cookies.txt
|
||||||
curl --cookie cookies.txt --cookie-jar cookies.txt --user-agent Mozilla/4.0 --data "u=$XMLRPCUSER&p=$XMLRPCPASS" https://pixhawk.org/start?do=login
|
curl --cookie cookies.txt --cookie-jar cookies.txt --user-agent Mozilla/4.0 --data "u=$XMLRPCUSER&p=$XMLRPCPASS" https://pixhawk.org/start?do=login
|
||||||
curl -k --cookie cookies.txt -H "Content-Type: application/xml" -X POST --data-binary @parameters.wiki "https://pixhawk.org/lib/exe/xmlrpc.php"
|
curl -k --cookie cookies.txt -H "Content-Type: application/xml" -X POST --data-binary @parameters.wikirpc.xml "https://pixhawk.org/lib/exe/xmlrpc.php"
|
||||||
|
|||||||
@@ -141,9 +141,9 @@
|
|||||||
|
|
||||||
#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
#define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
#define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
#define STM32_APB2_TIM10_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
#define STM32_APB2_TIM10_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
#define STM32_APB2_TIM11_CLKIN (2*STM32_PCLK1_FREQUENCY)
|
#define STM32_APB2_TIM11_CLKIN (2*STM32_PCLK2_FREQUENCY)
|
||||||
|
|
||||||
/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
|
/* Timer Frequencies, if APBx is set to 1, frequency is same to APBx
|
||||||
* otherwise frequency is 2xAPBx.
|
* otherwise frequency is 2xAPBx.
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
|
|
||||||
#include <drivers/airspeed/airspeed.h>
|
#include <drivers/airspeed/airspeed.h>
|
||||||
|
|
||||||
Airspeed::Airspeed(int bus, int address, unsigned conversion_interval) :
|
Airspeed::Airspeed(int bus, int address, unsigned conversion_interval, const char* path) :
|
||||||
I2C("Airspeed", AIRSPEED_DEVICE_PATH, bus, address, 100000),
|
I2C("Airspeed", path, bus, address, 100000),
|
||||||
_reports(nullptr),
|
_reports(nullptr),
|
||||||
_buffer_overflows(perf_alloc(PC_COUNT, "airspeed_buffer_overflows")),
|
_buffer_overflows(perf_alloc(PC_COUNT, "airspeed_buffer_overflows")),
|
||||||
_max_differential_pressure_pa(0),
|
_max_differential_pressure_pa(0),
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ static const int ERROR = -1;
|
|||||||
class __EXPORT Airspeed : public device::I2C
|
class __EXPORT Airspeed : public device::I2C
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Airspeed(int bus, int address, unsigned conversion_interval);
|
Airspeed(int bus, int address, unsigned conversion_interval, const char* path);
|
||||||
virtual ~Airspeed();
|
virtual ~Airspeed();
|
||||||
|
|
||||||
virtual int init();
|
virtual int init();
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
|
|
||||||
/* I2C bus address */
|
/* I2C bus address */
|
||||||
#define I2C_ADDRESS 0x75 /* 7-bit address. 8-bit address is 0xEA */
|
#define I2C_ADDRESS 0x75 /* 7-bit address. 8-bit address is 0xEA */
|
||||||
|
#define ETS_PATH "/dev/ets_airspeed"
|
||||||
|
|
||||||
/* Register address */
|
/* Register address */
|
||||||
#define READ_CMD 0x07 /* Read the data */
|
#define READ_CMD 0x07 /* Read the data */
|
||||||
@@ -93,7 +94,7 @@
|
|||||||
class ETSAirspeed : public Airspeed
|
class ETSAirspeed : public Airspeed
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ETSAirspeed(int bus, int address = I2C_ADDRESS);
|
ETSAirspeed(int bus, int address = I2C_ADDRESS, const char* path = ETS_PATH);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -112,8 +113,8 @@ protected:
|
|||||||
*/
|
*/
|
||||||
extern "C" __EXPORT int ets_airspeed_main(int argc, char *argv[]);
|
extern "C" __EXPORT int ets_airspeed_main(int argc, char *argv[]);
|
||||||
|
|
||||||
ETSAirspeed::ETSAirspeed(int bus, int address) : Airspeed(bus, address,
|
ETSAirspeed::ETSAirspeed(int bus, int address, const char* path) : Airspeed(bus, address,
|
||||||
CONVERSION_INTERVAL)
|
CONVERSION_INTERVAL, path)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
* - Interfacing to MEAS Digital Pressure Modules (http://www.meas-spec.com/downloads/Interfacing_to_MEAS_Digital_Pressure_Modules.pdf)
|
* - Interfacing to MEAS Digital Pressure Modules (http://www.meas-spec.com/downloads/Interfacing_to_MEAS_Digital_Pressure_Modules.pdf)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <drivers/device/i2c.h>
|
#include <drivers/device/i2c.h>
|
||||||
@@ -89,8 +90,10 @@
|
|||||||
|
|
||||||
/* I2C bus address is 1010001x */
|
/* I2C bus address is 1010001x */
|
||||||
#define I2C_ADDRESS_MS4525DO 0x28 //0x51 /* 7-bit address. */
|
#define I2C_ADDRESS_MS4525DO 0x28 //0x51 /* 7-bit address. */
|
||||||
|
#define PATH_MS4525 "/dev/ms4525"
|
||||||
/* The MS5525DSO address is 111011Cx, where C is the complementary value of the pin CSB */
|
/* The MS5525DSO address is 111011Cx, where C is the complementary value of the pin CSB */
|
||||||
#define I2C_ADDRESS_MS5525DSO 0x77 //0x77/* 7-bit address, addr. pin pulled low */
|
#define I2C_ADDRESS_MS5525DSO 0x77 //0x77/* 7-bit address, addr. pin pulled low */
|
||||||
|
#define PATH_MS5525 "/dev/ms5525"
|
||||||
|
|
||||||
/* Register address */
|
/* Register address */
|
||||||
#define ADDR_READ_MR 0x00 /* write to this address to start conversion */
|
#define ADDR_READ_MR 0x00 /* write to this address to start conversion */
|
||||||
@@ -101,7 +104,7 @@
|
|||||||
class MEASAirspeed : public Airspeed
|
class MEASAirspeed : public Airspeed
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MEASAirspeed(int bus, int address = I2C_ADDRESS_MS4525DO);
|
MEASAirspeed(int bus, int address = I2C_ADDRESS_MS4525DO, const char* path = PATH_MS4525);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -120,8 +123,8 @@ protected:
|
|||||||
*/
|
*/
|
||||||
extern "C" __EXPORT int meas_airspeed_main(int argc, char *argv[]);
|
extern "C" __EXPORT int meas_airspeed_main(int argc, char *argv[]);
|
||||||
|
|
||||||
MEASAirspeed::MEASAirspeed(int bus, int address) : Airspeed(bus, address,
|
MEASAirspeed::MEASAirspeed(int bus, int address, const char* path) : Airspeed(bus, address,
|
||||||
CONVERSION_INTERVAL)
|
CONVERSION_INTERVAL, path)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -304,7 +307,7 @@ start(int i2c_bus)
|
|||||||
errx(1, "already started");
|
errx(1, "already started");
|
||||||
|
|
||||||
/* create the driver, try the MS4525DO first */
|
/* create the driver, try the MS4525DO first */
|
||||||
g_dev = new MEASAirspeed(i2c_bus, I2C_ADDRESS_MS4525DO);
|
g_dev = new MEASAirspeed(i2c_bus, I2C_ADDRESS_MS4525DO, PATH_MS4525);
|
||||||
|
|
||||||
/* check if the MS4525DO was instantiated */
|
/* check if the MS4525DO was instantiated */
|
||||||
if (g_dev == nullptr)
|
if (g_dev == nullptr)
|
||||||
@@ -313,7 +316,7 @@ start(int i2c_bus)
|
|||||||
/* try the MS5525DSO next if init fails */
|
/* try the MS5525DSO next if init fails */
|
||||||
if (OK != g_dev->Airspeed::init()) {
|
if (OK != g_dev->Airspeed::init()) {
|
||||||
delete g_dev;
|
delete g_dev;
|
||||||
g_dev = new MEASAirspeed(i2c_bus, I2C_ADDRESS_MS5525DSO);
|
g_dev = new MEASAirspeed(i2c_bus, I2C_ADDRESS_MS5525DSO, PATH_MS5525);
|
||||||
|
|
||||||
/* check if the MS5525DSO was instantiated */
|
/* check if the MS5525DSO was instantiated */
|
||||||
if (g_dev == nullptr)
|
if (g_dev == nullptr)
|
||||||
@@ -386,7 +389,7 @@ test()
|
|||||||
err(1, "immediate read failed");
|
err(1, "immediate read failed");
|
||||||
|
|
||||||
warnx("single read");
|
warnx("single read");
|
||||||
warnx("diff pressure: %d pa", (double)report.differential_pressure_pa);
|
warnx("diff pressure: %8.4f pa", (double)report.differential_pressure_pa);
|
||||||
|
|
||||||
/* start the sensor polling at 2Hz */
|
/* start the sensor polling at 2Hz */
|
||||||
if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2))
|
if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2))
|
||||||
@@ -411,7 +414,7 @@ test()
|
|||||||
err(1, "periodic read failed");
|
err(1, "periodic read failed");
|
||||||
|
|
||||||
warnx("periodic read %u", i);
|
warnx("periodic read %u", i);
|
||||||
warnx("diff pressure: %d pa", report.differential_pressure_pa);
|
warnx("diff pressure: %8.4f pa", (double)report.differential_pressure_pa);
|
||||||
warnx("temperature: %d C (0x%02x)", (int)report.temperature, (unsigned) report.temperature);
|
warnx("temperature: %d C (0x%02x)", (int)report.temperature, (unsigned) report.temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1353,6 +1353,7 @@ MPU6000::print_info()
|
|||||||
MPU6000_gyro::MPU6000_gyro(MPU6000 *parent) :
|
MPU6000_gyro::MPU6000_gyro(MPU6000 *parent) :
|
||||||
CDev("MPU6000_gyro", MPU_DEVICE_PATH_GYRO),
|
CDev("MPU6000_gyro", MPU_DEVICE_PATH_GYRO),
|
||||||
_parent(parent),
|
_parent(parent),
|
||||||
|
_gyro_topic(-1),
|
||||||
_gyro_class_instance(-1)
|
_gyro_class_instance(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,28 +45,46 @@
|
|||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Launch detection parameters, accessible via MAVLink
|
* Catapult launch detection parameters, accessible via MAVLink
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Catapult Launch detection */
|
/**
|
||||||
|
* Enable launch detection.
|
||||||
// @DisplayName Switch to enable launchdetection
|
*
|
||||||
// @Description if set to 1 launchdetection is enabled
|
* @min 0
|
||||||
// @Range 0 or 1
|
* @max 1
|
||||||
|
* @group Launch detection
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(LAUN_ALL_ON, 0);
|
PARAM_DEFINE_INT32(LAUN_ALL_ON, 0);
|
||||||
|
|
||||||
// @DisplayName Catapult Accelerometer Threshold
|
/**
|
||||||
// @Description LAUN_CAT_A * LAUN_CAT_T serves as threshold to trigger launch detection
|
* Catapult accelerometer theshold.
|
||||||
// @Range > 0
|
*
|
||||||
|
* LAUN_CAT_A * LAUN_CAT_T serves as threshold to trigger launch detection.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @group Launch detection
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(LAUN_CAT_A, 30.0f);
|
PARAM_DEFINE_FLOAT(LAUN_CAT_A, 30.0f);
|
||||||
|
|
||||||
// @DisplayName Catapult Time Threshold
|
/**
|
||||||
// @Description LAUN_CAT_A * LAUN_CAT_T serves as threshold to trigger launch detection
|
* Catapult time theshold.
|
||||||
// @Range > 0, in seconds
|
*
|
||||||
|
* LAUN_CAT_A * LAUN_CAT_T serves as threshold to trigger launch detection.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @group Launch detection
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(LAUN_CAT_T, 0.05f);
|
PARAM_DEFINE_FLOAT(LAUN_CAT_T, 0.05f);
|
||||||
|
|
||||||
// @DisplayName Throttle setting while detecting the launch
|
/**
|
||||||
// @Description The throttle is set to this value while the system is waiting for the takeoff
|
* Throttle setting while detecting launch.
|
||||||
// @Range 0 to 1
|
*
|
||||||
|
* The throttle is set to this value while the system is waiting for the take-off.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 1
|
||||||
|
* @group Launch detection
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(LAUN_THR_PRE, 0.0f);
|
PARAM_DEFINE_FLOAT(LAUN_THR_PRE, 0.0f);
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ bool handle_command(struct vehicle_status_s *status, const struct safety_s *safe
|
|||||||
arming_res = TRANSITION_NOT_CHANGED;
|
arming_res = TRANSITION_NOT_CHANGED;
|
||||||
|
|
||||||
if (base_mode & MAV_MODE_FLAG_SAFETY_ARMED) {
|
if (base_mode & MAV_MODE_FLAG_SAFETY_ARMED) {
|
||||||
if ((safety->safety_switch_available && !safety->safety_off) && status->hil_state == HIL_STATE_OFF) {
|
if (safety->safety_switch_available && !safety->safety_off && status->hil_state == HIL_STATE_OFF) {
|
||||||
print_reject_arm("NOT ARMING: Press safety switch first.");
|
print_reject_arm("NOT ARMING: Press safety switch first.");
|
||||||
arming_res = TRANSITION_DENIED;
|
arming_res = TRANSITION_DENIED;
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ bool handle_command(struct vehicle_status_s *status, const struct safety_s *safe
|
|||||||
transition_result_t arming_res = TRANSITION_NOT_CHANGED;
|
transition_result_t arming_res = TRANSITION_NOT_CHANGED;
|
||||||
|
|
||||||
if (!armed->armed && ((int)(cmd->param1 + 0.5f)) == 1) {
|
if (!armed->armed && ((int)(cmd->param1 + 0.5f)) == 1) {
|
||||||
if (safety->safety_switch_available && !safety->safety_off) {
|
if (safety->safety_switch_available && !safety->safety_off && status->hil_state == HIL_STATE_OFF) {
|
||||||
print_reject_arm("NOT ARMING: Press safety switch first.");
|
print_reject_arm("NOT ARMING: Press safety switch first.");
|
||||||
arming_res = TRANSITION_DENIED;
|
arming_res = TRANSITION_DENIED;
|
||||||
|
|
||||||
@@ -1162,7 +1162,7 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
if (status.arming_state == ARMING_STATE_STANDBY &&
|
if (status.arming_state == ARMING_STATE_STANDBY &&
|
||||||
sp_man.yaw > STICK_ON_OFF_LIMIT && sp_man.throttle < STICK_THRUST_RANGE * 0.1f) {
|
sp_man.yaw > STICK_ON_OFF_LIMIT && sp_man.throttle < STICK_THRUST_RANGE * 0.1f) {
|
||||||
if (stick_on_counter > STICK_ON_OFF_COUNTER_LIMIT) {
|
if (stick_on_counter > STICK_ON_OFF_COUNTER_LIMIT) {
|
||||||
if (safety.safety_switch_available && !safety.safety_off) {
|
if (safety.safety_switch_available && !safety.safety_off && status.hil_state == HIL_STATE_OFF) {
|
||||||
print_reject_arm("NOT ARMING: Press safety switch first.");
|
print_reject_arm("NOT ARMING: Press safety switch first.");
|
||||||
|
|
||||||
} else if (status.main_state != MAIN_STATE_MANUAL) {
|
} else if (status.main_state != MAIN_STATE_MANUAL) {
|
||||||
|
|||||||
@@ -48,7 +48,39 @@
|
|||||||
PARAM_DEFINE_FLOAT(TRIM_ROLL, 0.0f);
|
PARAM_DEFINE_FLOAT(TRIM_ROLL, 0.0f);
|
||||||
PARAM_DEFINE_FLOAT(TRIM_PITCH, 0.0f);
|
PARAM_DEFINE_FLOAT(TRIM_PITCH, 0.0f);
|
||||||
PARAM_DEFINE_FLOAT(TRIM_YAW, 0.0f);
|
PARAM_DEFINE_FLOAT(TRIM_YAW, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empty cell voltage.
|
||||||
|
*
|
||||||
|
* Defines the voltage where a single cell of the battery is considered empty.
|
||||||
|
*
|
||||||
|
* @group Battery Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(BAT_V_EMPTY, 3.4f);
|
PARAM_DEFINE_FLOAT(BAT_V_EMPTY, 3.4f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full cell voltage.
|
||||||
|
*
|
||||||
|
* Defines the voltage where a single cell of the battery is considered full.
|
||||||
|
*
|
||||||
|
* @group Battery Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(BAT_V_FULL, 3.9f);
|
PARAM_DEFINE_FLOAT(BAT_V_FULL, 3.9f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of cells.
|
||||||
|
*
|
||||||
|
* Defines the number of cells the attached battery consists of.
|
||||||
|
*
|
||||||
|
* @group Battery Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(BAT_N_CELLS, 3);
|
PARAM_DEFINE_INT32(BAT_N_CELLS, 3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Battery capacity.
|
||||||
|
*
|
||||||
|
* Defines the capacity of the attached battery.
|
||||||
|
*
|
||||||
|
* @group Battery Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(BAT_CAPACITY, -1.0f);
|
PARAM_DEFINE_FLOAT(BAT_CAPACITY, -1.0f);
|
||||||
|
|||||||
@@ -40,12 +40,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Controller parameters, accessible via MAVLink
|
* Controller parameters, accessible via MAVLink
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,58 +117,268 @@ PARAM_DEFINE_FLOAT(FW_P_LIM_MIN, -45.0f);
|
|||||||
*/
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_P_LIM_MAX, 45.0f);
|
PARAM_DEFINE_FLOAT(FW_P_LIM_MAX, 45.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller roll limit
|
||||||
|
*
|
||||||
|
* The maximum roll the controller will output.
|
||||||
|
*
|
||||||
|
* @unit degrees
|
||||||
|
* @min 0.0
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_R_LIM, 45.0f);
|
PARAM_DEFINE_FLOAT(FW_R_LIM, 45.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
PARAM_DEFINE_FLOAT(FW_THR_MIN, 0.0f);
|
* Throttle limit max
|
||||||
|
*
|
||||||
|
* This is the maximum throttle % that can be used by the controller.
|
||||||
|
* For overpowered aircraft, this should be reduced to a value that
|
||||||
|
* provides sufficient thrust to climb at the maximum pitch angle PTCH_MAX.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_THR_MAX, 1.0f);
|
PARAM_DEFINE_FLOAT(FW_THR_MAX, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throttle limit min
|
||||||
|
*
|
||||||
|
* This is the minimum throttle % that can be used by the controller.
|
||||||
|
* For electric aircraft this will normally be set to zero, but can be set
|
||||||
|
* to a small non-zero value if a folding prop is fitted to prevent the
|
||||||
|
* prop from folding and unfolding repeatedly in-flight or to provide
|
||||||
|
* some aerodynamic drag from a turning prop to improve the descent rate.
|
||||||
|
*
|
||||||
|
* For aircraft with internal combustion engine this parameter should be set
|
||||||
|
* for desired idle rpm.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_THR_MIN, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throttle limit value before flare
|
||||||
|
*
|
||||||
|
* This throttle value will be set as throttle limit at FW_LND_TLALT,
|
||||||
|
* before arcraft will flare.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_THR_LND_MAX, 1.0f);
|
PARAM_DEFINE_FLOAT(FW_THR_LND_MAX, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum climb rate
|
||||||
|
*
|
||||||
|
* This is the best climb rate that the aircraft can achieve with
|
||||||
|
* the throttle set to THR_MAX and the airspeed set to the
|
||||||
|
* default value. For electric aircraft make sure this number can be
|
||||||
|
* achieved towards the end of flight when the battery voltage has reduced.
|
||||||
|
* The setting of this parameter can be checked by commanding a positive
|
||||||
|
* altitude change of 100m in loiter, RTL or guided mode. If the throttle
|
||||||
|
* required to climb is close to THR_MAX and the aircraft is maintaining
|
||||||
|
* airspeed, then this parameter is set correctly. If the airspeed starts
|
||||||
|
* to reduce, then the parameter is set to high, and if the throttle
|
||||||
|
* demand required to climb and maintain speed is noticeably less than
|
||||||
|
* FW_THR_MAX, then either FW_T_CLMB_MAX should be increased or
|
||||||
|
* FW_THR_MAX reduced.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_T_CLMB_MAX, 5.0f);
|
PARAM_DEFINE_FLOAT(FW_T_CLMB_MAX, 5.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum descent rate
|
||||||
|
*
|
||||||
|
* This is the sink rate of the aircraft with the throttle
|
||||||
|
* set to THR_MIN and flown at the same airspeed as used
|
||||||
|
* to measure FW_T_CLMB_MAX.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_T_SINK_MIN, 2.0f);
|
PARAM_DEFINE_FLOAT(FW_T_SINK_MIN, 2.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
PARAM_DEFINE_FLOAT(FW_T_TIME_CONST, 5.0f);
|
* Maximum descent rate
|
||||||
|
*
|
||||||
|
* This sets the maximum descent rate that the controller will use.
|
||||||
PARAM_DEFINE_FLOAT(FW_T_THR_DAMP, 0.5f);
|
* If this value is too large, the aircraft can over-speed on descent.
|
||||||
|
* This should be set to a value that can be achieved without
|
||||||
|
* exceeding the lower pitch angle limit and without over-speeding
|
||||||
PARAM_DEFINE_FLOAT(FW_T_INTEG_GAIN, 0.1f);
|
* the aircraft.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
PARAM_DEFINE_FLOAT(FW_T_VERT_ACC, 7.0f);
|
*/
|
||||||
|
|
||||||
|
|
||||||
PARAM_DEFINE_FLOAT(FW_T_HGT_OMEGA, 3.0f);
|
|
||||||
|
|
||||||
|
|
||||||
PARAM_DEFINE_FLOAT(FW_T_SPD_OMEGA, 2.0f);
|
|
||||||
|
|
||||||
|
|
||||||
PARAM_DEFINE_FLOAT(FW_T_RLL2THR, 10.0f);
|
|
||||||
|
|
||||||
|
|
||||||
PARAM_DEFINE_FLOAT(FW_T_SPDWEIGHT, 1.0f);
|
|
||||||
|
|
||||||
|
|
||||||
PARAM_DEFINE_FLOAT(FW_T_PTCH_DAMP, 0.0f);
|
|
||||||
|
|
||||||
|
|
||||||
PARAM_DEFINE_FLOAT(FW_T_SINK_MAX, 5.0f);
|
PARAM_DEFINE_FLOAT(FW_T_SINK_MAX, 5.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TECS time constant
|
||||||
|
*
|
||||||
|
* This is the time constant of the TECS control algorithm (in seconds).
|
||||||
|
* Smaller values make it faster to respond, larger values make it slower
|
||||||
|
* to respond.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_TIME_CONST, 5.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throttle damping factor
|
||||||
|
*
|
||||||
|
* This is the damping gain for the throttle demand loop.
|
||||||
|
* Increase to add damping to correct for oscillations in speed and height.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_THR_DAMP, 0.5f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Integrator gain
|
||||||
|
*
|
||||||
|
* This is the integrator gain on the control loop.
|
||||||
|
* Increasing this gain increases the speed at which speed
|
||||||
|
* and height offsets are trimmed out, but reduces damping and
|
||||||
|
* increases overshoot.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_INTEG_GAIN, 0.1f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum vertical acceleration
|
||||||
|
*
|
||||||
|
* This is the maximum vertical acceleration (in metres/second^2)
|
||||||
|
* either up or down that the controller will use to correct speed
|
||||||
|
* or height errors. The default value of 7 m/s/s (equivalent to +- 0.7 g)
|
||||||
|
* allows for reasonably aggressive pitch changes if required to recover
|
||||||
|
* from under-speed conditions.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_VERT_ACC, 7.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Complementary filter "omega" parameter for height
|
||||||
|
*
|
||||||
|
* This is the cross-over frequency (in radians/second) of the complementary
|
||||||
|
* filter used to fuse vertical acceleration and barometric height to obtain
|
||||||
|
* an estimate of height rate and height. Increasing this frequency weights
|
||||||
|
* the solution more towards use of the barometer, whilst reducing it weights
|
||||||
|
* the solution more towards use of the accelerometer data.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_HGT_OMEGA, 3.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Complementary filter "omega" parameter for speed
|
||||||
|
*
|
||||||
|
* This is the cross-over frequency (in radians/second) of the complementary
|
||||||
|
* filter used to fuse longitudinal acceleration and airspeed to obtain an
|
||||||
|
* improved airspeed estimate. Increasing this frequency weights the solution
|
||||||
|
* more towards use of the arispeed sensor, whilst reducing it weights the
|
||||||
|
* solution more towards use of the accelerometer data.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_SPD_OMEGA, 2.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll -> Throttle feedforward
|
||||||
|
*
|
||||||
|
* Increasing this gain turn increases the amount of throttle that will
|
||||||
|
* be used to compensate for the additional drag created by turning.
|
||||||
|
* Ideally this should be set to approximately 10 x the extra sink rate
|
||||||
|
* in m/s created by a 45 degree bank turn. Increase this gain if
|
||||||
|
* the aircraft initially loses energy in turns and reduce if the
|
||||||
|
* aircraft initially gains energy in turns. Efficient high aspect-ratio
|
||||||
|
* aircraft (eg powered sailplanes) can use a lower value, whereas
|
||||||
|
* inefficient low aspect-ratio models (eg delta wings) can use a higher value.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_RLL2THR, 10.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speed <--> Altitude priority
|
||||||
|
*
|
||||||
|
* This parameter adjusts the amount of weighting that the pitch control
|
||||||
|
* applies to speed vs height errors. Setting it to 0.0 will cause the
|
||||||
|
* pitch control to control height and ignore speed errors. This will
|
||||||
|
* normally improve height accuracy but give larger airspeed errors.
|
||||||
|
* Setting it to 2.0 will cause the pitch control loop to control speed
|
||||||
|
* and ignore height errors. This will normally reduce airspeed errors,
|
||||||
|
* but give larger height errors. The default value of 1.0 allows the pitch
|
||||||
|
* control to simultaneously control height and speed.
|
||||||
|
* Note to Glider Pilots - set this parameter to 2.0 (The glider will
|
||||||
|
* adjust its pitch angle to maintain airspeed, ignoring changes in height).
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_SPDWEIGHT, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pitch damping factor
|
||||||
|
*
|
||||||
|
* This is the damping gain for the pitch demand loop. Increase to add
|
||||||
|
* damping to correct for oscillations in height. The default value of 0.0
|
||||||
|
* will work well provided the pitch to servo controller has been tuned
|
||||||
|
* properly.
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(FW_T_PTCH_DAMP, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Height rate P factor
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_T_HRATE_P, 0.05f);
|
PARAM_DEFINE_FLOAT(FW_T_HRATE_P, 0.05f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speed rate P factor
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_T_SRATE_P, 0.05f);
|
PARAM_DEFINE_FLOAT(FW_T_SRATE_P, 0.05f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Landing slope angle
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_LND_ANG, 5.0f);
|
PARAM_DEFINE_FLOAT(FW_LND_ANG, 5.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Landing slope length
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_LND_SLLR, 0.9f);
|
PARAM_DEFINE_FLOAT(FW_LND_SLLR, 0.9f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_LND_HVIRT, 10.0f);
|
PARAM_DEFINE_FLOAT(FW_LND_HVIRT, 10.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Landing flare altitude (relative)
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_LND_FLALT, 15.0f);
|
PARAM_DEFINE_FLOAT(FW_LND_FLALT, 15.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Landing throttle limit altitude (relative)
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_LND_TLALT, 5.0f);
|
PARAM_DEFINE_FLOAT(FW_LND_TLALT, 5.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Landing heading hold horizontal distance
|
||||||
|
*
|
||||||
|
* @group L1 Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(FW_LND_HHDIST, 15.0f);
|
PARAM_DEFINE_FLOAT(FW_LND_HHDIST, 15.0f);
|
||||||
|
|||||||
@@ -76,8 +76,20 @@
|
|||||||
#include <uORB/topics/mission_result.h>
|
#include <uORB/topics/mission_result.h>
|
||||||
|
|
||||||
/* define MAVLink specific parameters */
|
/* define MAVLink specific parameters */
|
||||||
|
/**
|
||||||
|
* MAVLink system ID
|
||||||
|
* @group MAVLink
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(MAV_SYS_ID, 1);
|
PARAM_DEFINE_INT32(MAV_SYS_ID, 1);
|
||||||
|
/**
|
||||||
|
* MAVLink component ID
|
||||||
|
* @group MAVLink
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(MAV_COMP_ID, 50);
|
PARAM_DEFINE_INT32(MAV_COMP_ID, 50);
|
||||||
|
/**
|
||||||
|
* MAVLink type
|
||||||
|
* @group MAVLink
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(MAV_TYPE, MAV_TYPE_FIXED_WING);
|
PARAM_DEFINE_INT32(MAV_TYPE, MAV_TYPE_FIXED_WING);
|
||||||
|
|
||||||
__EXPORT int mavlink_main(int argc, char *argv[]);
|
__EXPORT int mavlink_main(int argc, char *argv[]);
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ extern "C" __EXPORT int mc_att_control_main(int argc, char *argv[]);
|
|||||||
|
|
||||||
#define MIN_TAKEOFF_THROTTLE 0.3f
|
#define MIN_TAKEOFF_THROTTLE 0.3f
|
||||||
#define YAW_DEADZONE 0.05f
|
#define YAW_DEADZONE 0.05f
|
||||||
#define RATES_I_LIMIT 0.5f
|
#define RATES_I_LIMIT 0.3f
|
||||||
|
|
||||||
class MulticopterAttitudeControl
|
class MulticopterAttitudeControl
|
||||||
{
|
{
|
||||||
@@ -658,7 +658,7 @@ MulticopterAttitudeControl::control_attitude_rates(float dt)
|
|||||||
_rates_prev = rates;
|
_rates_prev = rates;
|
||||||
|
|
||||||
/* update integral only if not saturated on low limit */
|
/* update integral only if not saturated on low limit */
|
||||||
if (_thrust_sp > 0.1f) {
|
if (_thrust_sp > 0.2f) {
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (fabsf(_att_control(i)) < _thrust_sp) {
|
if (fabsf(_att_control(i)) < _thrust_sp) {
|
||||||
float rate_i = _rates_int(i) + _params.rate_i(i) * rates_err(i) * dt;
|
float rate_i = _rates_int(i) + _params.rate_i(i) * rates_err(i) * dt;
|
||||||
|
|||||||
@@ -41,16 +41,135 @@
|
|||||||
|
|
||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll P gain
|
||||||
|
*
|
||||||
|
* Roll proportional gain, i.e. desired angular speed in rad/s for error 1 rad.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_ROLL_P, 6.0f);
|
PARAM_DEFINE_FLOAT(MC_ROLL_P, 6.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll rate P gain
|
||||||
|
*
|
||||||
|
* Roll rate proportional gain, i.e. control output for angular speed error 1 rad/s.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_ROLLRATE_P, 0.1f);
|
PARAM_DEFINE_FLOAT(MC_ROLLRATE_P, 0.1f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll rate I gain
|
||||||
|
*
|
||||||
|
* Roll rate integral gain. Can be set to compensate static thrust difference or gravity center offset.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_ROLLRATE_I, 0.0f);
|
PARAM_DEFINE_FLOAT(MC_ROLLRATE_I, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll rate D gain
|
||||||
|
*
|
||||||
|
* Roll rate differential gain. Small values help reduce fast oscillations. If value is too big oscillations will appear again.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_ROLLRATE_D, 0.002f);
|
PARAM_DEFINE_FLOAT(MC_ROLLRATE_D, 0.002f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pitch P gain
|
||||||
|
*
|
||||||
|
* Pitch proportional gain, i.e. desired angular speed in rad/s for error 1 rad.
|
||||||
|
*
|
||||||
|
* @unit 1/s
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_PITCH_P, 6.0f);
|
PARAM_DEFINE_FLOAT(MC_PITCH_P, 6.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pitch rate P gain
|
||||||
|
*
|
||||||
|
* Pitch rate proportional gain, i.e. control output for angular speed error 1 rad/s.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_PITCHRATE_P, 0.1f);
|
PARAM_DEFINE_FLOAT(MC_PITCHRATE_P, 0.1f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pitch rate I gain
|
||||||
|
*
|
||||||
|
* Pitch rate integral gain. Can be set to compensate static thrust difference or gravity center offset.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_PITCHRATE_I, 0.0f);
|
PARAM_DEFINE_FLOAT(MC_PITCHRATE_I, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pitch rate D gain
|
||||||
|
*
|
||||||
|
* Pitch rate differential gain. Small values help reduce fast oscillations. If value is too big oscillations will appear again.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_PITCHRATE_D, 0.002f);
|
PARAM_DEFINE_FLOAT(MC_PITCHRATE_D, 0.002f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yaw P gain
|
||||||
|
*
|
||||||
|
* Yaw proportional gain, i.e. desired angular speed in rad/s for error 1 rad.
|
||||||
|
*
|
||||||
|
* @unit 1/s
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_YAW_P, 2.0f);
|
PARAM_DEFINE_FLOAT(MC_YAW_P, 2.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yaw rate P gain
|
||||||
|
*
|
||||||
|
* Yaw rate proportional gain, i.e. control output for angular speed error 1 rad/s.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_YAWRATE_P, 0.3f);
|
PARAM_DEFINE_FLOAT(MC_YAWRATE_P, 0.3f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yaw rate I gain
|
||||||
|
*
|
||||||
|
* Yaw rate integral gain. Can be set to compensate static thrust difference or gravity center offset.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_YAWRATE_I, 0.0f);
|
PARAM_DEFINE_FLOAT(MC_YAWRATE_I, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yaw rate D gain
|
||||||
|
*
|
||||||
|
* Yaw rate differential gain. Small values help reduce fast oscillations. If value is too big oscillations will appear again.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_YAWRATE_D, 0.0f);
|
PARAM_DEFINE_FLOAT(MC_YAWRATE_D, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yaw feed forward
|
||||||
|
*
|
||||||
|
* Feed forward weight for manual yaw control. 0 will give slow responce and no overshot, 1 - fast responce and big overshot.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @max 1.0
|
||||||
|
* @group Multicopter Attitude Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MC_YAW_FF, 0.5f);
|
PARAM_DEFINE_FLOAT(MC_YAW_FF, 0.5f);
|
||||||
|
|||||||
@@ -39,20 +39,164 @@
|
|||||||
|
|
||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
|
|
||||||
PARAM_DEFINE_FLOAT(MPC_THR_MIN, 0.0f);
|
/**
|
||||||
|
* Minimum thrust
|
||||||
|
*
|
||||||
|
* Minimum vertical thrust. It's recommended to set it > 0 to avoid free fall with zero thrust.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @max 1.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(MPC_THR_MIN, 0.1f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum thrust
|
||||||
|
*
|
||||||
|
* Limit max allowed thrust.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @max 1.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_THR_MAX, 1.0f);
|
PARAM_DEFINE_FLOAT(MPC_THR_MAX, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proportional gain for vertical position error
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_Z_P, 1.0f);
|
PARAM_DEFINE_FLOAT(MPC_Z_P, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proportional gain for vertical velocity error
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_Z_VEL_P, 0.1f);
|
PARAM_DEFINE_FLOAT(MPC_Z_VEL_P, 0.1f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Integral gain for vertical velocity error
|
||||||
|
*
|
||||||
|
* Non zero value allows hovering thrust estimation on stabilized or autonomous takeoff.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_Z_VEL_I, 0.02f);
|
PARAM_DEFINE_FLOAT(MPC_Z_VEL_I, 0.02f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Differential gain for vertical velocity error
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_Z_VEL_D, 0.0f);
|
PARAM_DEFINE_FLOAT(MPC_Z_VEL_D, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum vertical velocity
|
||||||
|
*
|
||||||
|
* Maximum vertical velocity in AUTO mode and endpoint for stabilized modes (SEATBELT, EASY).
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_Z_VEL_MAX, 5.0f);
|
PARAM_DEFINE_FLOAT(MPC_Z_VEL_MAX, 5.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vertical velocity feed forward
|
||||||
|
*
|
||||||
|
* Feed forward weight for altitude control in stabilized modes (SEATBELT, EASY). 0 will give slow responce and no overshot, 1 - fast responce and big overshot.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @max 1.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_Z_FF, 0.5f);
|
PARAM_DEFINE_FLOAT(MPC_Z_FF, 0.5f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proportional gain for horizontal position error
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_XY_P, 1.0f);
|
PARAM_DEFINE_FLOAT(MPC_XY_P, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proportional gain for horizontal velocity error
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_XY_VEL_P, 0.1f);
|
PARAM_DEFINE_FLOAT(MPC_XY_VEL_P, 0.1f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Integral gain for horizontal velocity error
|
||||||
|
*
|
||||||
|
* Non-zero value allows to resist wind.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_XY_VEL_I, 0.02f);
|
PARAM_DEFINE_FLOAT(MPC_XY_VEL_I, 0.02f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Differential gain for horizontal velocity error. Small values help reduce fast oscillations. If value is too big oscillations will appear again.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_XY_VEL_D, 0.01f);
|
PARAM_DEFINE_FLOAT(MPC_XY_VEL_D, 0.01f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum horizontal velocity
|
||||||
|
*
|
||||||
|
* Maximum horizontal velocity in AUTO mode and endpoint for position stabilized mode (EASY).
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_XY_VEL_MAX, 5.0f);
|
PARAM_DEFINE_FLOAT(MPC_XY_VEL_MAX, 5.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Horizontal velocity feed forward
|
||||||
|
*
|
||||||
|
* Feed forward weight for position control in position control mode (EASY). 0 will give slow responce and no overshot, 1 - fast responce and big overshot.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @max 1.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_XY_FF, 0.5f);
|
PARAM_DEFINE_FLOAT(MPC_XY_FF, 0.5f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum tilt
|
||||||
|
*
|
||||||
|
* Limits maximum tilt in AUTO and EASY modes.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @max 1.57
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_TILT_MAX, 1.0f);
|
PARAM_DEFINE_FLOAT(MPC_TILT_MAX, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Landing descend rate
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_LAND_SPEED, 1.0f);
|
PARAM_DEFINE_FLOAT(MPC_LAND_SPEED, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum landing tilt
|
||||||
|
*
|
||||||
|
* Limits maximum tilt on landing.
|
||||||
|
*
|
||||||
|
* @min 0.0
|
||||||
|
* @max 1.57
|
||||||
|
* @group Multicopter Position Control
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(MPC_LAND_TILT, 0.3f);
|
PARAM_DEFINE_FLOAT(MPC_LAND_TILT, 0.3f);
|
||||||
|
|||||||
@@ -45,11 +45,17 @@
|
|||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* geofence parameters, accessible via MAVLink
|
* Geofence parameters, accessible via MAVLink
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @DisplayName Switch to enable geofence
|
/**
|
||||||
// @Description if set to 1 geofence is enabled, defaults to 1 because geofence is only enabled when the geofence.txt file is present
|
* Enable geofence.
|
||||||
// @Range 0 or 1
|
*
|
||||||
|
* Set to 1 to enable geofence.
|
||||||
|
* Defaults to 1 because geofence is only enabled when the geofence.txt file is present.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 1
|
||||||
|
* @group Geofence
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(GF_ON, 1);
|
PARAM_DEFINE_INT32(GF_ON, 1);
|
||||||
|
|||||||
@@ -305,6 +305,12 @@ private:
|
|||||||
void start_land();
|
void start_land();
|
||||||
void start_land_home();
|
void start_land_home();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fork for state transitions
|
||||||
|
*/
|
||||||
|
void request_loiter_or_ready();
|
||||||
|
void request_mission_if_available();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guards offboard mission
|
* Guards offboard mission
|
||||||
*/
|
*/
|
||||||
@@ -699,24 +705,17 @@ Navigator::task_main()
|
|||||||
} else {
|
} else {
|
||||||
/* MISSION switch */
|
/* MISSION switch */
|
||||||
if (_vstatus.mission_switch == MISSION_SWITCH_LOITER) {
|
if (_vstatus.mission_switch == MISSION_SWITCH_LOITER) {
|
||||||
dispatch(EVENT_LOITER_REQUESTED);
|
request_loiter_or_ready();
|
||||||
stick_mode = true;
|
stick_mode = true;
|
||||||
|
|
||||||
} else if (_vstatus.mission_switch == MISSION_SWITCH_MISSION) {
|
} else if (_vstatus.mission_switch == MISSION_SWITCH_MISSION) {
|
||||||
/* switch to mission only if available */
|
request_mission_if_available();
|
||||||
if (_mission.current_mission_available()) {
|
|
||||||
dispatch(EVENT_MISSION_REQUESTED);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dispatch(EVENT_LOITER_REQUESTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
stick_mode = true;
|
stick_mode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stick_mode && _vstatus.return_switch == RETURN_SWITCH_NORMAL && myState == NAV_STATE_RTL) {
|
if (!stick_mode && _vstatus.return_switch == RETURN_SWITCH_NORMAL && myState == NAV_STATE_RTL) {
|
||||||
/* RETURN switch is in normal mode, no MISSION switch mapped, interrupt if in RTL state */
|
/* RETURN switch is in normal mode, no MISSION switch mapped, interrupt if in RTL state */
|
||||||
dispatch(EVENT_LOITER_REQUESTED);
|
request_mission_if_available();
|
||||||
stick_mode = true;
|
stick_mode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -733,17 +732,11 @@ Navigator::task_main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NAV_STATE_LOITER:
|
case NAV_STATE_LOITER:
|
||||||
dispatch(EVENT_LOITER_REQUESTED);
|
request_loiter_or_ready();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAV_STATE_MISSION:
|
case NAV_STATE_MISSION:
|
||||||
if (_mission.current_mission_available()) {
|
request_mission_if_available();
|
||||||
dispatch(EVENT_MISSION_REQUESTED);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dispatch(EVENT_LOITER_REQUESTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAV_STATE_RTL:
|
case NAV_STATE_RTL:
|
||||||
@@ -770,12 +763,7 @@ Navigator::task_main()
|
|||||||
} else {
|
} else {
|
||||||
/* on first switch to AUTO try mission by default, if none is available fallback to loiter */
|
/* on first switch to AUTO try mission by default, if none is available fallback to loiter */
|
||||||
if (myState == NAV_STATE_NONE) {
|
if (myState == NAV_STATE_NONE) {
|
||||||
if (_mission.current_mission_available()) {
|
request_mission_if_available();
|
||||||
dispatch(EVENT_MISSION_REQUESTED);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dispatch(EVENT_LOITER_REQUESTED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1071,7 +1059,7 @@ Navigator::start_loiter()
|
|||||||
float min_alt_amsl = _parameters.min_altitude + _home_pos.alt;
|
float min_alt_amsl = _parameters.min_altitude + _home_pos.alt;
|
||||||
|
|
||||||
/* use current altitude if above min altitude set by parameter */
|
/* use current altitude if above min altitude set by parameter */
|
||||||
if (_global_pos.alt < min_alt_amsl) {
|
if (_global_pos.alt < min_alt_amsl && !_vstatus.is_rotary_wing) {
|
||||||
_pos_sp_triplet.current.alt = min_alt_amsl;
|
_pos_sp_triplet.current.alt = min_alt_amsl;
|
||||||
mavlink_log_info(_mavlink_fd, "[navigator] loiter %.1fm higher", (double)(min_alt_amsl - _global_pos.alt));
|
mavlink_log_info(_mavlink_fd, "[navigator] loiter %.1fm higher", (double)(min_alt_amsl - _global_pos.alt));
|
||||||
|
|
||||||
@@ -1397,6 +1385,28 @@ Navigator::set_rtl_item()
|
|||||||
_pos_sp_triplet_updated = true;
|
_pos_sp_triplet_updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Navigator::request_loiter_or_ready()
|
||||||
|
{
|
||||||
|
if (_vstatus.condition_landed) {
|
||||||
|
dispatch(EVENT_READY_REQUESTED);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dispatch(EVENT_LOITER_REQUESTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Navigator::request_mission_if_available()
|
||||||
|
{
|
||||||
|
if (_mission.current_mission_available()) {
|
||||||
|
dispatch(EVENT_MISSION_REQUESTED);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
request_loiter_or_ready();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Navigator::position_setpoint_from_mission_item(position_setpoint_s *sp, mission_item_s *item)
|
Navigator::position_setpoint_from_mission_item(position_setpoint_s *sp, mission_item_s *item)
|
||||||
{
|
{
|
||||||
@@ -1555,13 +1565,7 @@ Navigator::on_mission_item_reached()
|
|||||||
/* loiter at last waypoint */
|
/* loiter at last waypoint */
|
||||||
_reset_loiter_pos = false;
|
_reset_loiter_pos = false;
|
||||||
mavlink_log_info(_mavlink_fd, "[navigator] mission completed");
|
mavlink_log_info(_mavlink_fd, "[navigator] mission completed");
|
||||||
|
request_loiter_or_ready();
|
||||||
if (_vstatus.condition_landed) {
|
|
||||||
dispatch(EVENT_READY_REQUESTED);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dispatch(EVENT_LOITER_REQUESTED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (myState == NAV_STATE_RTL) {
|
} else if (myState == NAV_STATE_RTL) {
|
||||||
|
|||||||
@@ -50,15 +50,91 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Navigator parameters, accessible via MAVLink
|
* Navigator parameters, accessible via MAVLink
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum altitude (fixed wing only)
|
||||||
|
*
|
||||||
|
* Minimum altitude above home for LOITER.
|
||||||
|
*
|
||||||
|
* @unit meters
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(NAV_MIN_ALT, 50.0f);
|
PARAM_DEFINE_FLOAT(NAV_MIN_ALT, 50.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waypoint acceptance radius
|
||||||
|
*
|
||||||
|
* Default value of acceptance radius (if not specified in mission item).
|
||||||
|
*
|
||||||
|
* @unit meters
|
||||||
|
* @min 0.0
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(NAV_ACCEPT_RAD, 10.0f);
|
PARAM_DEFINE_FLOAT(NAV_ACCEPT_RAD, 10.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loiter radius (fixed wing only)
|
||||||
|
*
|
||||||
|
* Default value of loiter radius (if not specified in mission item).
|
||||||
|
*
|
||||||
|
* @unit meters
|
||||||
|
* @min 0.0
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(NAV_LOITER_RAD, 50.0f);
|
PARAM_DEFINE_FLOAT(NAV_LOITER_RAD, 50.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable onboard mission
|
||||||
|
*
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(NAV_ONB_MIS_EN, 0);
|
PARAM_DEFINE_INT32(NAV_ONB_MIS_EN, 0);
|
||||||
PARAM_DEFINE_FLOAT(NAV_TAKEOFF_ALT, 10.0f); // default TAKEOFF altitude
|
|
||||||
PARAM_DEFINE_FLOAT(NAV_LAND_ALT, 5.0f); // slow descend from this altitude when landing
|
/**
|
||||||
PARAM_DEFINE_FLOAT(NAV_RTL_ALT, 30.0f); // min altitude for going home in RTL mode
|
* Take-off altitude
|
||||||
PARAM_DEFINE_FLOAT(NAV_RTL_LAND_T, -1.0f); // delay after descend before landing, if set to -1 the system will not land but loiter at NAV_LAND_ALT
|
*
|
||||||
PARAM_DEFINE_INT32(NAV_PARACHUTE_EN, 0); // enable parachute deployment
|
* Even if first waypoint has altitude less then NAV_TAKEOFF_ALT above home position, system will climb to NAV_TAKEOFF_ALT on takeoff, then go to waypoint.
|
||||||
|
*
|
||||||
|
* @unit meters
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(NAV_TAKEOFF_ALT, 10.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Landing altitude
|
||||||
|
*
|
||||||
|
* Stay at this altitude above home position after RTL descending. Land (i.e. slowly descend) from this altitude if autolanding allowed.
|
||||||
|
*
|
||||||
|
* @unit meters
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(NAV_LAND_ALT, 5.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return-To-Launch altitude
|
||||||
|
*
|
||||||
|
* Minimum altitude above home position for going home in RTL mode.
|
||||||
|
*
|
||||||
|
* @unit meters
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(NAV_RTL_ALT, 30.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return-To-Launch delay
|
||||||
|
*
|
||||||
|
* Delay after descend before landing in RTL mode.
|
||||||
|
* If set to -1 the system will not land but loiter at NAV_LAND_ALT.
|
||||||
|
*
|
||||||
|
* @unit seconds
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(NAV_RTL_LAND_T, -1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable parachute deployment
|
||||||
|
*
|
||||||
|
* @group Navigation
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(NAV_PARACHUTE_EN, 0);
|
||||||
|
|||||||
@@ -42,13 +42,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gyro X offset
|
* Gyro X-axis offset
|
||||||
*
|
|
||||||
* This is an X-axis offset for the gyro. Adjust it according to the calibration data.
|
|
||||||
*
|
*
|
||||||
* @min -10.0
|
* @min -10.0
|
||||||
* @max 10.0
|
* @max 10.0
|
||||||
@@ -57,7 +54,7 @@
|
|||||||
PARAM_DEFINE_FLOAT(SENS_GYRO_XOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_GYRO_XOFF, 0.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gyro Y offset
|
* Gyro Y-axis offset
|
||||||
*
|
*
|
||||||
* @min -10.0
|
* @min -10.0
|
||||||
* @max 10.0
|
* @max 10.0
|
||||||
@@ -66,7 +63,7 @@ PARAM_DEFINE_FLOAT(SENS_GYRO_XOFF, 0.0f);
|
|||||||
PARAM_DEFINE_FLOAT(SENS_GYRO_YOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_GYRO_YOFF, 0.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gyro Z offset
|
* Gyro Z-axis offset
|
||||||
*
|
*
|
||||||
* @min -5.0
|
* @min -5.0
|
||||||
* @max 5.0
|
* @max 5.0
|
||||||
@@ -75,9 +72,7 @@ PARAM_DEFINE_FLOAT(SENS_GYRO_YOFF, 0.0f);
|
|||||||
PARAM_DEFINE_FLOAT(SENS_GYRO_ZOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_GYRO_ZOFF, 0.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gyro X scaling
|
* Gyro X-axis scaling factor
|
||||||
*
|
|
||||||
* X-axis scaling.
|
|
||||||
*
|
*
|
||||||
* @min -1.5
|
* @min -1.5
|
||||||
* @max 1.5
|
* @max 1.5
|
||||||
@@ -86,9 +81,7 @@ PARAM_DEFINE_FLOAT(SENS_GYRO_ZOFF, 0.0f);
|
|||||||
PARAM_DEFINE_FLOAT(SENS_GYRO_XSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_GYRO_XSCALE, 1.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gyro Y scaling
|
* Gyro Y-axis scaling factor
|
||||||
*
|
|
||||||
* Y-axis scaling.
|
|
||||||
*
|
*
|
||||||
* @min -1.5
|
* @min -1.5
|
||||||
* @max 1.5
|
* @max 1.5
|
||||||
@@ -97,9 +90,7 @@ PARAM_DEFINE_FLOAT(SENS_GYRO_XSCALE, 1.0f);
|
|||||||
PARAM_DEFINE_FLOAT(SENS_GYRO_YSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_GYRO_YSCALE, 1.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gyro Z scaling
|
* Gyro Z-axis scaling factor
|
||||||
*
|
|
||||||
* Z-axis scaling.
|
|
||||||
*
|
*
|
||||||
* @min -1.5
|
* @min -1.5
|
||||||
* @max 1.5
|
* @max 1.5
|
||||||
@@ -107,10 +98,9 @@ PARAM_DEFINE_FLOAT(SENS_GYRO_YSCALE, 1.0f);
|
|||||||
*/
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_GYRO_ZSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_GYRO_ZSCALE, 1.0f);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magnetometer X offset
|
* Magnetometer X-axis offset
|
||||||
*
|
|
||||||
* This is an X-axis offset for the magnetometer.
|
|
||||||
*
|
*
|
||||||
* @min -500.0
|
* @min -500.0
|
||||||
* @max 500.0
|
* @max 500.0
|
||||||
@@ -119,9 +109,7 @@ PARAM_DEFINE_FLOAT(SENS_GYRO_ZSCALE, 1.0f);
|
|||||||
PARAM_DEFINE_FLOAT(SENS_MAG_XOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_MAG_XOFF, 0.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magnetometer Y offset
|
* Magnetometer Y-axis offset
|
||||||
*
|
|
||||||
* This is an Y-axis offset for the magnetometer.
|
|
||||||
*
|
*
|
||||||
* @min -500.0
|
* @min -500.0
|
||||||
* @max 500.0
|
* @max 500.0
|
||||||
@@ -130,9 +118,7 @@ PARAM_DEFINE_FLOAT(SENS_MAG_XOFF, 0.0f);
|
|||||||
PARAM_DEFINE_FLOAT(SENS_MAG_YOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_MAG_YOFF, 0.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magnetometer Z offset
|
* Magnetometer Z-axis offset
|
||||||
*
|
|
||||||
* This is an Z-axis offset for the magnetometer.
|
|
||||||
*
|
*
|
||||||
* @min -500.0
|
* @min -500.0
|
||||||
* @max 500.0
|
* @max 500.0
|
||||||
@@ -140,24 +126,134 @@ PARAM_DEFINE_FLOAT(SENS_MAG_YOFF, 0.0f);
|
|||||||
*/
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_MAG_ZOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_MAG_ZOFF, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magnetometer X-axis scaling factor
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_MAG_XSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_MAG_XSCALE, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magnetometer Y-axis scaling factor
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_MAG_YSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_MAG_YSCALE, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magnetometer Z-axis scaling factor
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_MAG_ZSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_MAG_ZSCALE, 1.0f);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accelerometer X-axis offset
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_ACC_XOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_ACC_XOFF, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accelerometer Y-axis offset
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_ACC_YOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_ACC_YOFF, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accelerometer Z-axis offset
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_ACC_ZOFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_ACC_ZOFF, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accelerometer X-axis scaling factor
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_ACC_XSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_ACC_XSCALE, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accelerometer Y-axis scaling factor
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_ACC_YSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_ACC_YSCALE, 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accelerometer Z-axis scaling factor
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_ACC_ZSCALE, 1.0f);
|
PARAM_DEFINE_FLOAT(SENS_ACC_ZSCALE, 1.0f);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Differential pressure sensor offset
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(SENS_DPRES_OFF, 0.0f);
|
PARAM_DEFINE_FLOAT(SENS_DPRES_OFF, 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Differential pressure sensor analog enabled
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(SENS_DPRES_ANA, 0);
|
PARAM_DEFINE_INT32(SENS_DPRES_ANA, 0);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Board rotation
|
||||||
|
*
|
||||||
|
* This parameter defines the rotation of the FMU board relative to the platform.
|
||||||
|
* Possible values are:
|
||||||
|
* 0 = No rotation
|
||||||
|
* 1 = Yaw 45°
|
||||||
|
* 2 = Yaw 90°
|
||||||
|
* 3 = Yaw 135°
|
||||||
|
* 4 = Yaw 180°
|
||||||
|
* 5 = Yaw 225°
|
||||||
|
* 6 = Yaw 270°
|
||||||
|
* 7 = Yaw 315°
|
||||||
|
* 8 = Roll 180°
|
||||||
|
* 9 = Roll 180°, Yaw 45°
|
||||||
|
* 10 = Roll 180°, Yaw 90°
|
||||||
|
* 11 = Roll 180°, Yaw 135°
|
||||||
|
* 12 = Pitch 180°
|
||||||
|
* 13 = Roll 180°, Yaw 225°
|
||||||
|
* 14 = Roll 180°, Yaw 270°
|
||||||
|
* 15 = Roll 180°, Yaw 315°
|
||||||
|
* 16 = Roll 90°
|
||||||
|
* 17 = Roll 90°, Yaw 45°
|
||||||
|
* 18 = Roll 90°, Yaw 90°
|
||||||
|
* 19 = Roll 90°, Yaw 135°
|
||||||
|
* 20 = Roll 270°
|
||||||
|
* 21 = Roll 270°, Yaw 45°
|
||||||
|
* 22 = Roll 270°, Yaw 90°
|
||||||
|
* 23 = Roll 270°, Yaw 135°
|
||||||
|
* 24 = Pitch 90°
|
||||||
|
* 25 = Pitch 270°
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(SENS_BOARD_ROT, 0);
|
PARAM_DEFINE_INT32(SENS_BOARD_ROT, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External magnetometer rotation
|
||||||
|
*
|
||||||
|
* This parameter defines the rotation of the external magnetometer relative
|
||||||
|
* to the platform (not relative to the FMU).
|
||||||
|
* See SENS_BOARD_ROT for possible values.
|
||||||
|
*
|
||||||
|
* @group Sensor Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(SENS_EXT_MAG_ROT, 0);
|
PARAM_DEFINE_INT32(SENS_EXT_MAG_ROT, 0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RC Channel 1 Minimum
|
* RC Channel 1 Minimum
|
||||||
*
|
*
|
||||||
@@ -367,20 +463,52 @@ PARAM_DEFINE_FLOAT(RC18_DZ, 0.0f);
|
|||||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
|
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
|
||||||
PARAM_DEFINE_INT32(RC_RL1_DSM_VCC, 0); /* Relay 1 controls DSM VCC */
|
PARAM_DEFINE_INT32(RC_RL1_DSM_VCC, 0); /* Relay 1 controls DSM VCC */
|
||||||
#endif
|
#endif
|
||||||
PARAM_DEFINE_INT32(RC_DSM_BIND, -1); /* -1 = Idle, 0 = Start DSM2 bind, 1 = Start DSMX bind */
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DSM binding trigger.
|
||||||
|
*
|
||||||
|
* -1 = Idle, 0 = Start DSM2 bind, 1 = Start DSMX bind
|
||||||
|
*
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(RC_DSM_BIND, -1);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scaling factor for battery voltage sensor on PX4IO.
|
||||||
|
*
|
||||||
|
* @group Battery Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(BAT_V_SCALE_IO, 10000);
|
PARAM_DEFINE_INT32(BAT_V_SCALE_IO, 10000);
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V2
|
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V2
|
||||||
|
/**
|
||||||
|
* Scaling factor for battery voltage sensor on FMU v2.
|
||||||
|
*
|
||||||
|
* @group Battery Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.0082f);
|
PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.0082f);
|
||||||
#else
|
#else
|
||||||
/* default is conversion factor for the PX4IO / PX4IOAR board, the factor for PX4FMU standalone is different */
|
/**
|
||||||
/* PX4IOAR: 0.00838095238 */
|
* Scaling factor for battery voltage sensor on FMU v1.
|
||||||
/* FMU standalone: 1/(10 / (47+10)) * (3.3 / 4095) = 0.00459340659 */
|
*
|
||||||
/* FMU with PX4IOAR: (3.3f * 52.0f / 5.0f / 4095.0f) */
|
* FMUv1 standalone: 1/(10 / (47+10)) * (3.3 / 4095) = 0.00459340659
|
||||||
|
* FMUv1 with PX4IO: 0.00459340659
|
||||||
|
* FMUv1 with PX4IOAR: (3.3f * 52.0f / 5.0f / 4095.0f) = 0.00838095238
|
||||||
|
*
|
||||||
|
* @group Battery Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.00459340659f);
|
PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.00459340659f);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scaling factor for battery current sensor.
|
||||||
|
*
|
||||||
|
* @group Battery Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(BAT_C_SCALING, 0.0124); /* scaling for 3DR power brick */
|
PARAM_DEFINE_FLOAT(BAT_C_SCALING, 0.0124); /* scaling for 3DR power brick */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Roll control channel mapping.
|
* Roll control channel mapping.
|
||||||
*
|
*
|
||||||
@@ -446,21 +574,126 @@ PARAM_DEFINE_INT32(RC_MAP_YAW, 4);
|
|||||||
* @group Radio Calibration
|
* @group Radio Calibration
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_INT32(RC_MAP_MODE_SW, 0);
|
PARAM_DEFINE_INT32(RC_MAP_MODE_SW, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return switch channel mapping.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 18
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(RC_MAP_RETURN_SW, 0);
|
PARAM_DEFINE_INT32(RC_MAP_RETURN_SW, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assist switch channel mapping.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 18
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(RC_MAP_ASSIST_SW, 0);
|
PARAM_DEFINE_INT32(RC_MAP_ASSIST_SW, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mission switch channel mapping.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 18
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(RC_MAP_MISSIO_SW, 0);
|
PARAM_DEFINE_INT32(RC_MAP_MISSIO_SW, 0);
|
||||||
PARAM_DEFINE_INT32(RC_MAP_OFFB_SW, 0);
|
PARAM_DEFINE_INT32(RC_MAP_OFFB_SW, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flaps channel mapping.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 18
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(RC_MAP_FLAPS, 0);
|
PARAM_DEFINE_INT32(RC_MAP_FLAPS, 0);
|
||||||
|
|
||||||
PARAM_DEFINE_INT32(RC_MAP_AUX1, 0); /**< default function: camera pitch */
|
/**
|
||||||
PARAM_DEFINE_INT32(RC_MAP_AUX2, 0); /**< default function: camera roll */
|
* Auxiliary switch 1 channel mapping.
|
||||||
PARAM_DEFINE_INT32(RC_MAP_AUX3, 0); /**< default function: camera azimuth / yaw */
|
*
|
||||||
|
* Default function: Camera pitch
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 18
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(RC_MAP_AUX1, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auxiliary switch 2 channel mapping.
|
||||||
|
*
|
||||||
|
* Default function: Camera roll
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 18
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(RC_MAP_AUX2, 0); /**< default function: camera roll */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auxiliary switch 3 channel mapping.
|
||||||
|
*
|
||||||
|
* Default function: Camera azimuth / yaw
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 18
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(RC_MAP_AUX3, 0);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll scaling factor
|
||||||
|
*
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(RC_SCALE_ROLL, 0.6f);
|
PARAM_DEFINE_FLOAT(RC_SCALE_ROLL, 0.6f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pitch scaling factor
|
||||||
|
*
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(RC_SCALE_PITCH, 0.6f);
|
PARAM_DEFINE_FLOAT(RC_SCALE_PITCH, 0.6f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yaw scaling factor
|
||||||
|
*
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
PARAM_DEFINE_FLOAT(RC_SCALE_YAW, 2.0f);
|
PARAM_DEFINE_FLOAT(RC_SCALE_YAW, 2.0f);
|
||||||
|
|
||||||
PARAM_DEFINE_INT32(RC_FS_CH, 0); /**< RC failsafe channel, 0 = disable */
|
|
||||||
PARAM_DEFINE_INT32(RC_FS_MODE, 0); /**< RC failsafe mode: 0 = too low means signal loss, 1 = too high means signal loss */
|
/**
|
||||||
PARAM_DEFINE_FLOAT(RC_FS_THR, 800); /**< RC failsafe PWM threshold */
|
* Failsafe channel mapping.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 18
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(RC_FS_CH, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Failsafe channel mode.
|
||||||
|
*
|
||||||
|
* 0 = too low means signal loss,
|
||||||
|
* 1 = too high means signal loss
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 1
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(RC_FS_MODE, 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Failsafe channel PWM threshold.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 1
|
||||||
|
* @group Radio Calibration
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_FLOAT(RC_FS_THR, 800);
|
||||||
|
|||||||
@@ -40,8 +40,23 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
|
|
||||||
// Auto-start script with index #n
|
/**
|
||||||
|
* Auto-start script index.
|
||||||
|
*
|
||||||
|
* Defines the auto-start script used to bootstrap the system.
|
||||||
|
*
|
||||||
|
* @group System
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(SYS_AUTOSTART, 0);
|
PARAM_DEFINE_INT32(SYS_AUTOSTART, 0);
|
||||||
|
|
||||||
// Automatically configure default values
|
/**
|
||||||
|
* Automatically configure default values.
|
||||||
|
*
|
||||||
|
* Set to 1 to set platform-specific parameters to their default
|
||||||
|
* values on next system startup.
|
||||||
|
*
|
||||||
|
* @min 0
|
||||||
|
* @max 1
|
||||||
|
* @group System
|
||||||
|
*/
|
||||||
PARAM_DEFINE_INT32(SYS_AUTOCONFIG, 0);
|
PARAM_DEFINE_INT32(SYS_AUTOCONFIG, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user