forked from Archive/PX4-Autopilot
Merge pull request #222 from PX4/trim_calibration
Fixed wing controller uses global trim values
This commit is contained in:
commit
0ee5293ceb
|
@ -46,7 +46,7 @@
|
||||||
namespace control
|
namespace control
|
||||||
{
|
{
|
||||||
|
|
||||||
BlockParamBase::BlockParamBase(Block *parent, const char *name) :
|
BlockParamBase::BlockParamBase(Block *parent, const char *name, bool parent_prefix) :
|
||||||
_handle(PARAM_INVALID)
|
_handle(PARAM_INVALID)
|
||||||
{
|
{
|
||||||
char fullname[blockNameLengthMax];
|
char fullname[blockNameLengthMax];
|
||||||
|
@ -61,8 +61,10 @@ BlockParamBase::BlockParamBase(Block *parent, const char *name) :
|
||||||
if (!strcmp(name, "")) {
|
if (!strcmp(name, "")) {
|
||||||
strncpy(fullname, parentName, blockNameLengthMax);
|
strncpy(fullname, parentName, blockNameLengthMax);
|
||||||
|
|
||||||
} else {
|
} else if (parent_prefix) {
|
||||||
snprintf(fullname, blockNameLengthMax, "%s_%s", parentName, name);
|
snprintf(fullname, blockNameLengthMax, "%s_%s", parentName, name);
|
||||||
|
} else {
|
||||||
|
strncpy(fullname, name, blockNameLengthMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent->getParams().add(this);
|
parent->getParams().add(this);
|
||||||
|
|
|
@ -53,7 +53,12 @@ namespace control
|
||||||
class __EXPORT BlockParamBase : public ListNode<BlockParamBase *>
|
class __EXPORT BlockParamBase : public ListNode<BlockParamBase *>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlockParamBase(Block *parent, const char *name);
|
/**
|
||||||
|
* Instantiate a block param base.
|
||||||
|
*
|
||||||
|
* @param parent_prefix Set to true to include the parent name in the parameter name
|
||||||
|
*/
|
||||||
|
BlockParamBase(Block *parent, const char *name, bool parent_prefix=true);
|
||||||
virtual ~BlockParamBase() {};
|
virtual ~BlockParamBase() {};
|
||||||
virtual void update() = 0;
|
virtual void update() = 0;
|
||||||
const char *getName() { return param_name(_handle); }
|
const char *getName() { return param_name(_handle); }
|
||||||
|
@ -68,8 +73,8 @@ template<class T>
|
||||||
class __EXPORT BlockParam : public BlockParamBase
|
class __EXPORT BlockParam : public BlockParamBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlockParam(Block *block, const char *name) :
|
BlockParam(Block *block, const char *name, bool parent_prefix=true) :
|
||||||
BlockParamBase(block, name),
|
BlockParamBase(block, name, parent_prefix),
|
||||||
_val() {
|
_val() {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,10 +171,10 @@ BlockBacksideAutopilot::BlockBacksideAutopilot(SuperBlock *parent,
|
||||||
_headingHold(this, ""),
|
_headingHold(this, ""),
|
||||||
_velocityHold(this, ""),
|
_velocityHold(this, ""),
|
||||||
_altitudeHold(this, ""),
|
_altitudeHold(this, ""),
|
||||||
_trimAil(this, "TRIM_AIL"),
|
_trimAil(this, "TRIM_ROLL", false), /* general roll trim (full name: TRIM_ROLL) */
|
||||||
_trimElv(this, "TRIM_ELV"),
|
_trimElv(this, "TRIM_PITCH", false), /* general pitch trim */
|
||||||
_trimRdr(this, "TRIM_RDR"),
|
_trimRdr(this, "TRIM_YAW", false), /* general yaw trim */
|
||||||
_trimThr(this, "TRIM_THR")
|
_trimThr(this, "TRIM_THR", true) /* FWB_ specific throttle trim (full name: FWB_TRIM_THR) */
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,4 @@ PARAM_DEFINE_FLOAT(FWB_V_MIN, 10.0f); // minimum commanded velocity
|
||||||
PARAM_DEFINE_FLOAT(FWB_V_CMD, 12.0f); // commanded velocity
|
PARAM_DEFINE_FLOAT(FWB_V_CMD, 12.0f); // commanded velocity
|
||||||
PARAM_DEFINE_FLOAT(FWB_V_MAX, 16.0f); // maximum commanded velocity
|
PARAM_DEFINE_FLOAT(FWB_V_MAX, 16.0f); // maximum commanded velocity
|
||||||
|
|
||||||
// trim
|
|
||||||
PARAM_DEFINE_FLOAT(FWB_TRIM_AIL, 0.0f); // trim aileron, normalized (-1,1)
|
|
||||||
PARAM_DEFINE_FLOAT(FWB_TRIM_ELV, 0.005f); // trim elevator (-1,1)
|
|
||||||
PARAM_DEFINE_FLOAT(FWB_TRIM_RDR, 0.0f); // trim rudder (-1,1)
|
|
||||||
PARAM_DEFINE_FLOAT(FWB_TRIM_THR, 0.8f); // trim throttle (0,1)
|
PARAM_DEFINE_FLOAT(FWB_TRIM_THR, 0.8f); // trim throttle (0,1)
|
||||||
|
|
Loading…
Reference in New Issue