mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-04 03:40:35 +08:00
Control Allocation: Tiltrotor: pass only thrust magnitude instead of 3D thrust to allocator
Special case tiltrotor: instead of passing a 3D thrust vector (that would mostly have a x-component in FW, and z in MC), pass the vector magnitude as z-component, plus the collective tilt. Passing 3D thrust plus tilt is not feasible as they can't be allocated independently, and with the current controller it's not possible to have collective tilt calculated by the allocator directly. Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
@@ -212,6 +212,17 @@ ActuatorEffectivenessRotors::computeEffectivenessMatrix(const Geometry &geometry
|
||||
effectiveness(j, i + actuator_start_index) = moment(j);
|
||||
effectiveness(j + 3, i + actuator_start_index) = thrust(j);
|
||||
}
|
||||
|
||||
if (geometry.three_dimensional_thrust_disabled) {
|
||||
// Special case tiltrotor: instead of passing a 3D thrust vector (that would mostly have a x-component in FW, and z in MC),
|
||||
// pass the vector magnitude as z-component, plus the collective tilt. Passing 3D thrust plus tilt is not feasible as they
|
||||
// can't be allocated independently, and with the current controller it's not possible to have collective tilt calculated
|
||||
// by the allocator directly.
|
||||
|
||||
effectiveness(0 + 3, i + actuator_start_index) = 0.f;
|
||||
effectiveness(1 + 3, i + actuator_start_index) = 0.f;
|
||||
effectiveness(2 + 3, i + actuator_start_index) = ct;
|
||||
}
|
||||
}
|
||||
|
||||
return num_actuators;
|
||||
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
int num_rotors{0};
|
||||
bool propeller_torque_disabled{false};
|
||||
bool propeller_torque_disabled_non_upwards{false}; ///< keeps propeller torque enabled for upward facing motors
|
||||
bool three_dimensional_thrust_disabled{false}; ///< for handling of tiltrotor VTOL, as they pass in 1D thrust and collective tilt
|
||||
};
|
||||
|
||||
ActuatorEffectivenessRotors(ModuleParams *parent, AxisConfiguration axis_config = AxisConfiguration::Configurable,
|
||||
@@ -120,6 +121,8 @@ public:
|
||||
|
||||
void enablePropellerTorqueNonUpwards(bool enable) { _geometry.propeller_torque_disabled_non_upwards = !enable; }
|
||||
|
||||
void enableThreeDimensionalThrust(bool enable) { _geometry.three_dimensional_thrust_disabled = !enable; }
|
||||
|
||||
uint32_t getUpwardsMotors() const;
|
||||
|
||||
private:
|
||||
|
||||
+13
@@ -61,6 +61,7 @@ ActuatorEffectivenessTiltrotorVTOL::getEffectivenessMatrix(Configuration &config
|
||||
// MC motors
|
||||
configuration.selected_matrix = 0;
|
||||
_mc_rotors.enablePropellerTorque(!_tilts.hasYawControl());
|
||||
_mc_rotors.enableThreeDimensionalThrust(false);
|
||||
|
||||
// Update matrix with tilts in vertical position when update is triggered by a manual
|
||||
// configuration (parameter) change. This is to make sure the normalization
|
||||
@@ -130,6 +131,18 @@ void ActuatorEffectivenessTiltrotorVTOL::updateSetpoint(const matrix::Vector<flo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// in FW directly use throttle sp
|
||||
if (_flight_phase == FlightPhase::FORWARD_FLIGHT) {
|
||||
|
||||
actuator_controls_s actuator_controls_0;
|
||||
|
||||
if (_actuator_controls_0_sub.copy(&actuator_controls_0)) {
|
||||
for (int i = 0; i < _first_tilt_idx; ++i) {
|
||||
actuator_sp(i) = actuator_controls_0.control[actuator_controls_s::INDEX_THROTTLE];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -95,4 +95,5 @@ protected:
|
||||
float _last_tilt_control{NAN};
|
||||
|
||||
uORB::Subscription _actuator_controls_1_sub{ORB_ID(actuator_controls_1)};
|
||||
uORB::Subscription _actuator_controls_0_sub{ORB_ID(actuator_controls_0)};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user