control_allocator: implement trim + slew rate limits configuration

This commit is contained in:
Beat Küng
2021-12-24 20:06:13 -05:00
committed by Daniel Agar
parent 301100ce0e
commit 4c80adfaf1
17 changed files with 224 additions and 24 deletions
+11
View File
@@ -81,6 +81,17 @@ void ActuatorTest::update(int num_outputs, float thrust_curve)
FunctionMotors::updateValues(motors.reversible_flags >> motor_idx, thrust_curve, &value, 1);
}
// handle servos: add trim
if (actuator_test.function >= (int)OutputFunction::Servo1 && actuator_test.function <= (int)OutputFunction::ServoMax) {
actuator_servos_trim_s trim{};
_actuator_servos_trim_sub.copy(&trim);
int idx = actuator_test.function - (int)OutputFunction::Servo1;
if (idx < actuator_servos_trim_s::NUM_CONTROLS) {
value += trim.trim[idx];
}
}
_current_outputs[i] = value;
} else {
+2
View File
@@ -38,6 +38,7 @@
#include <drivers/drv_pwm_output.h>
#include <uORB/topics/actuator_test.h>
#include <uORB/topics/actuator_motors.h>
#include <uORB/topics/actuator_servos_trim.h>
#include <uORB/Subscription.hpp>
static_assert(actuator_test_s::FUNCTION_MOTOR1 == (int)OutputFunction::Motor1, "define mismatch");
@@ -66,6 +67,7 @@ private:
uORB::Subscription _actuator_test_sub{ORB_ID(actuator_test)};
uORB::Subscription _actuator_motors_sub{ORB_ID(actuator_motors)};
uORB::Subscription _actuator_servos_trim_sub{ORB_ID(actuator_servos_trim)};
bool _in_test_mode{false};
hrt_abstime _next_timeout{0};
+1 -1
View File
@@ -44,7 +44,7 @@
*
* Minimum time allowed for the motor input signal to pass through
* a range of 1000 PWM units. A value x means that the motor signal
* can only go from 1000 to 2000 PWM in maximum x seconds.
* can only go from 1000 to 2000 PWM in minimum x seconds.
*
* Zero means that slew rate limiting is disabled.
*