mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 14:37:34 +08:00
Remove INDEX_COLLECTIVE_TILT from actuator_controls and instead use new topic tiltrotor_extra_controls
Tiltrotor_extra_controls also contains collective thrust beside collective tilt, as passing a 3D thrust setpoint vector beside the tilt is not feasible. Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
-3
@@ -43,7 +43,6 @@
|
||||
#include "ActuatorEffectivenessRotors.hpp"
|
||||
#include "ActuatorEffectivenessControlSurfaces.hpp"
|
||||
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/Subscription.hpp>
|
||||
|
||||
class ActuatorEffectivenessTailsitterVTOL : public ModuleParams, public ActuatorEffectiveness
|
||||
@@ -81,6 +80,4 @@ protected:
|
||||
uint32_t _stopped_motors{}; ///< currently stopped motors
|
||||
|
||||
int _first_control_surface_idx{0}; ///< applies to matrix 1
|
||||
|
||||
uORB::Subscription _actuator_controls_1_sub{ORB_ID(actuator_controls_1)};
|
||||
};
|
||||
|
||||
+7
-10
@@ -110,10 +110,11 @@ void ActuatorEffectivenessTiltrotorVTOL::updateSetpoint(const matrix::Vector<flo
|
||||
|
||||
// apply tilt
|
||||
if (matrix_index == 0) {
|
||||
actuator_controls_s actuator_controls_1;
|
||||
|
||||
if (_actuator_controls_1_sub.copy(&actuator_controls_1)) {
|
||||
float control_collective_tilt = actuator_controls_1.control[actuator_controls_s::INDEX_COLLECTIVE_TILT] * 2.f - 1.f;
|
||||
tiltrotor_extra_controls_s tiltrotor_extra_controls;
|
||||
|
||||
if (_tiltrotor_extra_controls_sub.copy(&tiltrotor_extra_controls)) {
|
||||
float control_collective_tilt = tiltrotor_extra_controls.collective_tilt_normalized_setpoint * 2.f - 1.f;
|
||||
|
||||
// set control_collective_tilt to exactly -1 or 1 if close to these end points
|
||||
control_collective_tilt = control_collective_tilt < -0.99f ? -1.f : control_collective_tilt;
|
||||
@@ -133,16 +134,12 @@ void ActuatorEffectivenessTiltrotorVTOL::updateSetpoint(const matrix::Vector<flo
|
||||
actuator_sp(i + _first_tilt_idx) += control_collective_tilt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// in FW directly use throttle sp
|
||||
if (_flight_phase == FlightPhase::FORWARD_FLIGHT) {
|
||||
// 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];
|
||||
actuator_sp(i) = tiltrotor_extra_controls.collective_thrust_normalized_setpoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -46,6 +46,7 @@
|
||||
#include "ActuatorEffectivenessControlSurfaces.hpp"
|
||||
#include "ActuatorEffectivenessTilts.hpp"
|
||||
|
||||
#include <uORB/topics/tiltrotor_extra_controls.h>
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/Subscription.hpp>
|
||||
|
||||
@@ -107,4 +108,6 @@ protected:
|
||||
};
|
||||
|
||||
YawTiltSaturationFlags _yaw_tilt_saturation_flags{};
|
||||
|
||||
uORB::Subscription _tiltrotor_extra_controls_sub{ORB_ID(tiltrotor_extra_controls)};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user