34#define THROTTLE_CURVE_SWITCH_VAL (MAX_PPRZ*2/THROTTLE_CURVES_NB)
37#ifndef THROTTLE_CURVE_RPM_FB_P
38#define THROTTLE_CURVE_RPM_FB_P 0.0
42#ifndef THROTTLE_CURVE_RPM_FB_I
43#define THROTTLE_CURVE_RPM_FB_I 0.0
47#ifndef THROTTLE_CURVE_RPM_INC_LIMIT
48#define THROTTLE_CURVE_RPM_INC_LIMIT 512
53#ifndef THROTTLE_CURVE_ACT_FEEDBACK_ID
54#define THROTTLE_CURVE_ACT_FEEDBACK_ID ABI_BROADCAST
59#ifndef THROTTLE_CURVE_RPM_ACT
60#error "There needs to be an actuator to listen for RPM feedback, please set THROTTLE_CURVE_RPM_ACT"
69 .nb_curves = THROTTLE_CURVES_NB,
70 .curves = THROTTLE_CURVES
102#if PERIODIC_TELEMETRY
113 for(
uint8_t i = 0; i < num_act; i++) {
114 if(feedback[i].
idx == THROTTLE_CURVE_RPM_ACT && feedback[i].set.
rpm) {
130 Bound(
mode, 0, THROTTLE_CURVES_NB - 1);
150 int8_t curve_p = ((float)
cmds[COMMAND_THRUST] / curve_range);
154 uint16_t x =
cmds[COMMAND_THRUST] - curve_p * curve_range;
156 + ((curve.
throttle[curve_p + 1] - curve.
throttle[curve_p]) * x / curve_range);
159 if (curve.
rpm[0] != 0xFFFF) {
164 + ((curve.
rpm[curve_p + 1] - curve.
rpm[curve_p]) * x / curve_range);
175 Bound(trimmed_throttle, 0,
MAX_PPRZ);
200 }
else if (curve.
rpm[0] == 0xFFFF) {
210 cmds[COMMAND_THRUST] = 0;
221 Bound(new_mode, 0, THROTTLE_CURVES_NB - 1);
Main include for ABI (AirBorneInterface).
struct abi_struct abi_event
bool autopilot_get_motors_on(void)
get motors status
Core autopilot interface common to all firmwares.
Hardware independent code for commands handling.
static struct uart_periph * dev
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
static abi_event act_feedback_ev
struct RadioControl radio_control
Generic interface for radio control modules.
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
int16_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint16_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
#define THROTTLE_CURVE_SWITCH_VAL
struct throttle_curve_t throttle_curve
#define THROTTLE_CURVE_RPM_FB_P
void throttle_curve_init(void)
Initialize the default throttle curve values.
static void throttle_curve_send_telem(struct transport_tx *trans, struct link_device *dev)
static void act_feedback_cb(uint8_t sender_id, struct act_feedback_t *feedback, uint8_t num_act)
RPM callback for RPM based control throttle curves.
#define THROTTLE_CURVE_ACT_FEEDBACK_ID
void throttle_curve_run(pprz_t cmds[], uint8_t ap_mode)
Run the throttle curve and generate the output throttle and pitch This depends on the FMODE(flight mo...
#define THROTTLE_CURVE_RPM_INC_LIMIT
void nav_throttle_curve_set(uint8_t mode)
Set a specific throttle curve based on the mode given with this function.
#define THROTTLE_CURVE_RPM_FB_I
uint16_t throttle[THROTTLE_POINTS_NB]
Throttle points in the curve.
int16_t collective[THROTTLE_POINTS_NB]
The collective points in the curve.
uint16_t rpm[THROTTLE_POINTS_NB]
RPM points in the curve.
uint8_t nb_points
The number of points in the curve.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
signed char int8_t
Typedef defining 8 bit char type.