mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-04 20:41:36 +08:00
Merge branch 'master' into new_state_machine
Conflicts: apps/controllib/fixedwing.cpp
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
namespace control
|
||||
{
|
||||
|
||||
BlockParamBase::BlockParamBase(Block *parent, const char *name) :
|
||||
BlockParamBase::BlockParamBase(Block *parent, const char *name, bool parent_prefix) :
|
||||
_handle(PARAM_INVALID)
|
||||
{
|
||||
char fullname[blockNameLengthMax];
|
||||
@@ -61,8 +61,10 @@ BlockParamBase::BlockParamBase(Block *parent, const char *name) :
|
||||
if (!strcmp(name, "")) {
|
||||
strncpy(fullname, parentName, blockNameLengthMax);
|
||||
|
||||
} else {
|
||||
} else if (parent_prefix) {
|
||||
snprintf(fullname, blockNameLengthMax, "%s_%s", parentName, name);
|
||||
} else {
|
||||
strncpy(fullname, name, blockNameLengthMax);
|
||||
}
|
||||
|
||||
parent->getParams().add(this);
|
||||
|
||||
@@ -53,7 +53,12 @@ namespace control
|
||||
class __EXPORT BlockParamBase : public ListNode<BlockParamBase *>
|
||||
{
|
||||
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 void update() = 0;
|
||||
const char *getName() { return param_name(_handle); }
|
||||
@@ -68,8 +73,8 @@ template<class T>
|
||||
class __EXPORT BlockParam : public BlockParamBase
|
||||
{
|
||||
public:
|
||||
BlockParam(Block *block, const char *name) :
|
||||
BlockParamBase(block, name),
|
||||
BlockParam(Block *block, const char *name, bool parent_prefix=true) :
|
||||
BlockParamBase(block, name, parent_prefix),
|
||||
_val() {
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -172,10 +172,10 @@ BlockBacksideAutopilot::BlockBacksideAutopilot(SuperBlock *parent,
|
||||
_headingHold(this, ""),
|
||||
_velocityHold(this, ""),
|
||||
_altitudeHold(this, ""),
|
||||
_trimAil(this, "TRIM_AIL"),
|
||||
_trimElv(this, "TRIM_ELV"),
|
||||
_trimRdr(this, "TRIM_RDR"),
|
||||
_trimThr(this, "TRIM_THR")
|
||||
_trimAil(this, "TRIM_ROLL", false), /* general roll trim (full name: TRIM_ROLL) */
|
||||
_trimElv(this, "TRIM_PITCH", false), /* general pitch trim */
|
||||
_trimRdr(this, "TRIM_YAW", false), /* general yaw trim */
|
||||
_trimThr(this, "TRIM_THR", true) /* FWB_ specific throttle trim (full name: FWB_TRIM_THR) */
|
||||
{
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ void BlockMultiModeBacksideAutopilot::update()
|
||||
_att.rollspeed, _att.pitchspeed, _att.yawspeed
|
||||
);
|
||||
_actuators.control[CH_AIL] = _backsideAutopilot.getAileron();
|
||||
_actuators.control[CH_ELV] = - _backsideAutopilot.getElevator();
|
||||
_actuators.control[CH_ELV] = _backsideAutopilot.getElevator();
|
||||
_actuators.control[CH_RDR] = _backsideAutopilot.getRudder();
|
||||
_actuators.control[CH_THR] = _backsideAutopilot.getThrottle();
|
||||
|
||||
@@ -351,17 +351,17 @@ void BlockMultiModeBacksideAutopilot::update()
|
||||
_actuators.control[CH_ELV] = _manual.pitch;
|
||||
_actuators.control[CH_RDR] = _manual.yaw;
|
||||
_actuators.control[CH_THR] = _manual.throttle;
|
||||
#warning please check whether this flag makes sense
|
||||
} else if (_status.flag_control_attitude_enabled) {
|
||||
|
||||
// } else if (_status.manual_control_mode == VEHICLE_MANUAL_CONTROL_MODE_SAS) {
|
||||
//
|
||||
// _stabilization.update(_manual.roll, _manual.pitch, _manual.yaw,
|
||||
// _att.rollspeed, _att.pitchspeed, _att.yawspeed);
|
||||
//
|
||||
// _actuators.control[CH_AIL] = _stabilization.getAileron();
|
||||
// _actuators.control[CH_ELV] = - _stabilization.getElevator();
|
||||
// _actuators.control[CH_RDR] = _stabilization.getRudder();
|
||||
// _actuators.control[CH_THR] = _manual.throttle;
|
||||
// }
|
||||
_stabilization.update(_manual.roll, _manual.pitch, _manual.yaw,
|
||||
_att.rollspeed, _att.pitchspeed, _att.yawspeed);
|
||||
|
||||
_actuators.control[CH_AIL] = _stabilization.getAileron();
|
||||
_actuators.control[CH_ELV] = _stabilization.getElevator();
|
||||
_actuators.control[CH_RDR] = _stabilization.getRudder();
|
||||
_actuators.control[CH_THR] = _manual.throttle;
|
||||
}
|
||||
}
|
||||
|
||||
// update all publications
|
||||
|
||||
Reference in New Issue
Block a user