forked from Archive/PX4-Autopilot
FWRateController: use param find for VT_DIFTHR_EN as pure FW build doesn't have VTOL module built
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
parent
2374937388
commit
d9585bf3d3
|
@ -48,6 +48,8 @@ FixedwingRateControl::FixedwingRateControl(bool vtol) :
|
||||||
_vehicle_thrust_setpoint_pub(vtol ? ORB_ID(vehicle_thrust_setpoint_virtual_fw) : ORB_ID(vehicle_thrust_setpoint)),
|
_vehicle_thrust_setpoint_pub(vtol ? ORB_ID(vehicle_thrust_setpoint_virtual_fw) : ORB_ID(vehicle_thrust_setpoint)),
|
||||||
_loop_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": cycle"))
|
_loop_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": cycle"))
|
||||||
{
|
{
|
||||||
|
_handle_param_vt_fw_difthr_en = param_find("VT_FW_DIFTHR_EN");
|
||||||
|
|
||||||
/* fetch initial parameter values */
|
/* fetch initial parameter values */
|
||||||
parameters_update();
|
parameters_update();
|
||||||
|
|
||||||
|
@ -86,6 +88,10 @@ FixedwingRateControl::parameters_update()
|
||||||
// set FF gains to 0 as we add the FF control outside of the rate controller
|
// set FF gains to 0 as we add the FF control outside of the rate controller
|
||||||
Vector3f(0.f, 0.f, 0.f));
|
Vector3f(0.f, 0.f, 0.f));
|
||||||
|
|
||||||
|
if (_handle_param_vt_fw_difthr_en != PARAM_INVALID) {
|
||||||
|
param_get(_handle_param_vt_fw_difthr_en, &_param_vt_fw_difthr_en);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return PX4_OK;
|
return PX4_OK;
|
||||||
}
|
}
|
||||||
|
@ -281,9 +287,9 @@ void FixedwingRateControl::Run()
|
||||||
// Update saturation status from control allocation feedback
|
// Update saturation status from control allocation feedback
|
||||||
// TODO: send the unallocated value directly for better anti-windup
|
// TODO: send the unallocated value directly for better anti-windup
|
||||||
Vector3<bool> diffthr_enabled(
|
Vector3<bool> diffthr_enabled(
|
||||||
_param_vt_fw_difthr_en.get() & static_cast<int32_t>(VTOLFixedWingDifferentialThrustEnabledBit::ROLL_BIT),
|
_param_vt_fw_difthr_en & static_cast<int32_t>(VTOLFixedWingDifferentialThrustEnabledBit::ROLL_BIT),
|
||||||
_param_vt_fw_difthr_en.get() & static_cast<int32_t>(VTOLFixedWingDifferentialThrustEnabledBit::PITCH_BIT),
|
_param_vt_fw_difthr_en & static_cast<int32_t>(VTOLFixedWingDifferentialThrustEnabledBit::PITCH_BIT),
|
||||||
_param_vt_fw_difthr_en.get() & static_cast<int32_t>(VTOLFixedWingDifferentialThrustEnabledBit::YAW_BIT)
|
_param_vt_fw_difthr_en & static_cast<int32_t>(VTOLFixedWingDifferentialThrustEnabledBit::YAW_BIT)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (_vehicle_status.is_vtol_tailsitter) {
|
if (_vehicle_status.is_vtol_tailsitter) {
|
||||||
|
|
|
@ -151,6 +151,9 @@ private:
|
||||||
PITCH_BIT = (1 << 2),
|
PITCH_BIT = (1 << 2),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
param_t _handle_param_vt_fw_difthr_en{PARAM_INVALID};
|
||||||
|
int32_t _param_vt_fw_difthr_en{0};
|
||||||
|
|
||||||
DEFINE_PARAMETERS(
|
DEFINE_PARAMETERS(
|
||||||
(ParamFloat<px4::params::FW_ACRO_X_MAX>) _param_fw_acro_x_max,
|
(ParamFloat<px4::params::FW_ACRO_X_MAX>) _param_fw_acro_x_max,
|
||||||
(ParamFloat<px4::params::FW_ACRO_Y_MAX>) _param_fw_acro_y_max,
|
(ParamFloat<px4::params::FW_ACRO_Y_MAX>) _param_fw_acro_y_max,
|
||||||
|
@ -200,8 +203,7 @@ private:
|
||||||
(ParamFloat<px4::params::TRIM_ROLL>) _param_trim_roll,
|
(ParamFloat<px4::params::TRIM_ROLL>) _param_trim_roll,
|
||||||
(ParamFloat<px4::params::TRIM_YAW>) _param_trim_yaw,
|
(ParamFloat<px4::params::TRIM_YAW>) _param_trim_yaw,
|
||||||
|
|
||||||
(ParamInt<px4::params::FW_SPOILERS_MAN>) _param_fw_spoilers_man,
|
(ParamInt<px4::params::FW_SPOILERS_MAN>) _param_fw_spoilers_man
|
||||||
(ParamInt<px4::params::VT_FW_DIFTHR_EN>) _param_vt_fw_difthr_en
|
|
||||||
)
|
)
|
||||||
|
|
||||||
RateControl _rate_control; ///< class for rate control calculations
|
RateControl _rate_control; ///< class for rate control calculations
|
||||||
|
|
Loading…
Reference in New Issue