Helicopter: add yaw compensation from throttle CA_HELI_YAW_TH_S

This commit is contained in:
Matthias Grob
2022-09-07 08:00:26 +02:00
committed by Beat Küng
parent 554d965a2d
commit 9ba6f4efb7
3 changed files with 20 additions and 2 deletions
@@ -58,6 +58,7 @@ ActuatorEffectivenessHelicopter::ActuatorEffectivenessHelicopter(ModuleParams *p
} }
_param_handles.yaw_collective_pitch_scale = param_find("CA_HELI_YAW_CP_S"); _param_handles.yaw_collective_pitch_scale = param_find("CA_HELI_YAW_CP_S");
_param_handles.yaw_throttle_scale = param_find("CA_HELI_YAW_TH_S");
updateParams(); updateParams();
} }
@@ -88,6 +89,7 @@ void ActuatorEffectivenessHelicopter::updateParams()
} }
param_get(_param_handles.yaw_collective_pitch_scale, &_geometry.yaw_collective_pitch_scale); param_get(_param_handles.yaw_collective_pitch_scale, &_geometry.yaw_collective_pitch_scale);
param_get(_param_handles.yaw_throttle_scale, &_geometry.yaw_throttle_scale);
} }
bool bool
@@ -138,7 +140,8 @@ void ActuatorEffectivenessHelicopter::updateSetpoint(const matrix::Vector<float,
actuator_sp(0) = throttle; actuator_sp(0) = throttle;
actuator_sp(1) = control_sp(ControlAxis::YAW) actuator_sp(1) = control_sp(ControlAxis::YAW)
+ fabsf(collective_pitch) * _geometry.yaw_collective_pitch_scale; + fabsf(collective_pitch) * _geometry.yaw_collective_pitch_scale
+ throttle * _geometry.yaw_throttle_scale;
for (int i = 0; i < _geometry.num_swash_plate_servos; i++) { for (int i = 0; i < _geometry.num_swash_plate_servos; i++) {
actuator_sp(_first_swash_plate_servo_index + i) = collective_pitch actuator_sp(_first_swash_plate_servo_index + i) = collective_pitch
@@ -55,6 +55,7 @@ public:
float throttle_curve[NUM_CURVE_POINTS]; float throttle_curve[NUM_CURVE_POINTS];
float pitch_curve[NUM_CURVE_POINTS]; float pitch_curve[NUM_CURVE_POINTS];
float yaw_collective_pitch_scale; float yaw_collective_pitch_scale;
float yaw_throttle_scale;
}; };
ActuatorEffectivenessHelicopter(ModuleParams *parent); ActuatorEffectivenessHelicopter(ModuleParams *parent);
@@ -82,6 +83,7 @@ private:
param_t throttle_curve[NUM_CURVE_POINTS]; param_t throttle_curve[NUM_CURVE_POINTS];
param_t pitch_curve[NUM_CURVE_POINTS]; param_t pitch_curve[NUM_CURVE_POINTS];
param_t yaw_collective_pitch_scale; param_t yaw_collective_pitch_scale;
param_t yaw_throttle_scale;
}; };
ParamHandles _param_handles{}; ParamHandles _param_handles{};
+14 -1
View File
@@ -444,7 +444,7 @@ parameters:
default: [0.05, 0.15, 0.25, 0.35, 0.45] default: [0.05, 0.15, 0.25, 0.35, 0.45]
CA_HELI_YAW_CP_S: CA_HELI_YAW_CP_S:
description: description:
short: Yaw scaling by collective pitch short: Scale for yaw compensation based on collective pitch
long: | long: |
This allows to add a proportional factor of the collective pitch command to the yaw command. This allows to add a proportional factor of the collective pitch command to the yaw command.
@@ -455,6 +455,19 @@ parameters:
min: -2 min: -2
max: 2 max: 2
default: 0.0 default: 0.0
CA_HELI_YAW_TH_S:
description:
short: Scale for yaw compensation based on throttle
long: |
This allows to add a proportional factor of the throttle command to the yaw command.
tail_output += CA_HELI_YAW_TH_S * throttle
type: float
decimal: 3
increment: 0.1
min: -2
max: 2
default: 0.0
# Others # Others
CA_FAILURE_MODE: CA_FAILURE_MODE: