remove CA_LIN_SERVO and enable feature if CA_MAX_SERVO_THROW > 0 plus Update param description.

This commit is contained in:
TedObrien
2025-01-07 14:31:55 +00:00
committed by Matthias Grob
parent 6ba8d73ebe
commit 0ee772e5e8
3 changed files with 16 additions and 23 deletions
@@ -65,7 +65,6 @@ ActuatorEffectivenessHelicopter::ActuatorEffectivenessHelicopter(ModuleParams *p
_param_handles.yaw_throttle_scale = param_find("CA_HELI_YAW_TH_S");
_param_handles.yaw_ccw = param_find("CA_HELI_YAW_CCW");
_param_handles.spoolup_time = param_find("COM_SPOOLUP_TIME");
_param_handles.linearize_servos = param_find("CA_LIN_SERVO");
_param_handles.max_servo_throw = param_find("CA_MAX_SVO_THROW");
updateParams();
@@ -103,14 +102,20 @@ void ActuatorEffectivenessHelicopter::updateParams()
int32_t yaw_ccw = 0;
param_get(_param_handles.yaw_ccw, &yaw_ccw);
_geometry.yaw_sign = (yaw_ccw == 1) ? -1.f : 1.f;
int32_t linearize_servos = 0;
param_get(_param_handles.linearize_servos, &linearize_servos);
_geometry.linearize_servos = (linearize_servos != 0);
float max_servo_throw_deg = 0.f;
param_get(_param_handles.max_servo_throw, &max_servo_throw_deg);
const float max_servo_throw = math::radians(max_servo_throw_deg);
_geometry.max_servo_height = sinf(max_servo_throw);
_geometry.inverse_max_servo_throw = 1.f / max_servo_throw;
if (max_servo_throw_deg > 0.f){
const float max_servo_throw = math::radians(max_servo_throw_deg);
_geometry.max_servo_height = sinf(max_servo_throw);
_geometry.inverse_max_servo_throw = 1.f / max_servo_throw;
_geometry.linearize_servos = 1;
} else {
// handle any undefined behaviour
_geometry.max_servo_height = 0.f;
_geometry.inverse_max_servo_throw = 0.f;
_geometry.linearize_servos = 0;
}
}
bool ActuatorEffectivenessHelicopter::getEffectivenessMatrix(Configuration &configuration,
@@ -120,7 +120,6 @@ private:
param_t yaw_throttle_scale;
param_t yaw_ccw;
param_t spoolup_time;
param_t linearize_servos;
param_t max_servo_throw;
};
ParamHandles _param_handles{};
+4 -15
View File
@@ -564,25 +564,18 @@ parameters:
min: 0
max: 10
default: 0.0
CA_LIN_SERVO:
description:
short: linearize servo output
long: |
Linearize the servo's mechanical output attached to a 4-servos swashplate. Requires setting the servo range of motion using CA_MAX_SVO_THROW.
type: boolean
default: 0
CA_MAX_SVO_THROW:
description:
short: Defines max/min throw of servo.
short: Defines max/min throw of servo for linearization. Set to zero to disable.
long: |
Defines min/max throw of servo when linearizing servo output. Only used when CA_LIN_SERVO is enabled.
Defines min/max throw of servo. Used to linearize mechanical output of servo attached to a 4-servo swashplate. Setting to zero to disables feature.
type: float
decimal: 3
unit: deg
increment: 0.1
min: 5
min: 0
max: 75
default: 50.0
default: 0.0
# Others
CA_FAILURE_MODE:
@@ -1147,8 +1140,6 @@ mixer:
name: CA_HELI_YAW_CCW
- label: 'Throttle spoolup time'
name: COM_SPOOLUP_TIME
- label: 'Linearize servos'
name: CA_LIN_SERVO
- label: 'Min/max servo throw in degrees'
name: CA_MAX_SVO_THROW
@@ -1180,8 +1171,6 @@ mixer:
name: CA_HELI_YAW_CCW
- label: 'Throttle spoolup time'
name: COM_SPOOLUP_TIME
- label: 'Linearize servos'
name: CA_LIN_SERVO
- label: 'Min/max servo throw in degrees'
name: CA_MAX_SVO_THROW