helicopter: add tail servo support

as a separate CA_AIRFRAME, as the UI cannot switch between servo/motor.
This commit is contained in:
Beat Küng
2023-03-09 07:56:51 +01:00
parent bae413a332
commit 77d6c722a7
5 changed files with 46 additions and 10 deletions
@@ -37,8 +37,8 @@
using namespace matrix;
using namespace time_literals;
ActuatorEffectivenessHelicopter::ActuatorEffectivenessHelicopter(ModuleParams *parent)
: ModuleParams(parent)
ActuatorEffectivenessHelicopter::ActuatorEffectivenessHelicopter(ModuleParams *parent, ActuatorType tail_actuator_type)
: ModuleParams(parent), _tail_actuator_type(tail_actuator_type)
{
for (int i = 0; i < NUM_SWASH_PLATE_SERVOS_MAX; ++i) {
char buffer[17];
@@ -115,8 +115,8 @@ ActuatorEffectivenessHelicopter::getEffectivenessMatrix(Configuration &configura
// As the allocation is non-linear, we use updateSetpoint() instead of the matrix
configuration.addActuator(ActuatorType::MOTORS, Vector3f{}, Vector3f{});
// Tail (yaw) motor
configuration.addActuator(ActuatorType::MOTORS, Vector3f{}, Vector3f{});
// Tail (yaw) (either ESC or Servo)
configuration.addActuator(_tail_actuator_type, Vector3f{}, Vector3f{});
// N swash plate servos
_first_swash_plate_servo_index = configuration.num_actuators_matrix[0];
@@ -66,7 +66,7 @@ public:
float spoolup_time;
};
ActuatorEffectivenessHelicopter(ModuleParams *parent);
ActuatorEffectivenessHelicopter(ModuleParams *parent, ActuatorType tail_actuator_type);
virtual ~ActuatorEffectivenessHelicopter() = default;
bool getEffectivenessMatrix(Configuration &configuration, EffectivenessUpdateReason external_update) override;
@@ -129,4 +129,6 @@ private:
uORB::Subscription _manual_control_switches_sub{ORB_ID(manual_control_switches)};
bool _main_motor_engaged{true};
const ActuatorType _tail_actuator_type;
};
@@ -258,8 +258,12 @@ ControlAllocator::update_effectiveness_source()
tmp = new ActuatorEffectivenessCustom(this);
break;
case EffectivenessSource::HELICOPTER:
tmp = new ActuatorEffectivenessHelicopter(this);
case EffectivenessSource::HELICOPTER_TAIL_ESC:
tmp = new ActuatorEffectivenessHelicopter(this, ActuatorType::MOTORS);
break;
case EffectivenessSource::HELICOPTER_TAIL_SERVO:
tmp = new ActuatorEffectivenessHelicopter(this, ActuatorType::SERVOS);
break;
default:
@@ -153,7 +153,8 @@ private:
MOTORS_6DOF = 7,
MULTIROTOR_WITH_TILT = 8,
CUSTOM = 9,
HELICOPTER = 10,
HELICOPTER_TAIL_ESC = 10,
HELICOPTER_TAIL_SERVO = 11,
};
enum class FailureMode {
+31 -2
View File
@@ -27,7 +27,8 @@ parameters:
7: Motors (6DOF)
8: Multirotor with Tilt
9: Custom
10: Helicopter
10: Helicopter (tail ESC)
11: Helicopter (tail Servo)
default: 0
CA_METHOD:
@@ -1058,7 +1059,7 @@ mixer:
advanced: true
identifier: 'servo-scale-spoiler'
10: # Helicopter
10: # Helicopter (tail ESC)
actuators:
- actuator_type: 'motor'
count: 1
@@ -1087,3 +1088,31 @@ mixer:
- label: 'Throttle spoolup time'
name: COM_SPOOLUP_TIME
11: # Helicopter (tail Servo)
actuators:
- actuator_type: 'motor'
count: 1
item_label_prefix: ['Rotor']
- actuator_type: 'servo'
item_label_prefix: ['Yaw tail Servo']
count: 1
- actuator_type: 'servo'
group_label: 'Swash plate servos'
count: 'CA_SP0_COUNT'
per_item_parameters:
extra:
- name: 'CA_SP0_ANG${i}'
label: 'Angle'
- name: 'CA_SP0_ARM_L${i}'
label: 'Arm Length (relative)'
- name: 'CA_SV_CS${i}_TRIM'
label: 'Trim'
parameters:
- label: 'Yaw compensation scale based on collective pitch'
name: CA_HELI_YAW_CP_S
- label: 'Yaw compensation scale based on throttle'
name: CA_HELI_YAW_TH_S
- label: 'Main rotor turns counter-clockwise'
name: CA_HELI_YAW_CCW
- label: 'Throttle spoolup time'
name: COM_SPOOLUP_TIME