Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
throttle_curve.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 C. De Wagter
3  * 2015 Freek van Tienen <freek.v.tienen@gmail.com>
4  *
5  * This file is part of paparazzi
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
27 #ifndef THROTTLE_CURVE_H
28 #define THROTTLE_CURVE_H
29 
30 #include "std.h"
31 #include "paparazzi.h"
32 #include "generated/airframe.h"
33 
34 /* Throttle and collective curve */
35 struct curve_t {
37  uint16_t throttle[THROTTLE_POINTS_NB];
38  uint16_t rpm[THROTTLE_POINTS_NB];
39  int16_t collective[THROTTLE_POINTS_NB];
40 };
41 
42 /* Main throttle curve structure */
47  struct curve_t curves[THROTTLE_CURVES_NB];
48 
52 
54  bool rpm_measured;
55  float rpm_err_sum;
56  float rpm_fb_p;
57  float rpm_fb_i;
58 
61 };
62 extern struct throttle_curve_t throttle_curve;
63 
64 /* External functions */
65 extern void throttle_curve_init(void);
66 void throttle_curve_run(pprz_t in_cmd[], uint8_t autopilot_mode);
68 
69 #endif
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
curve_t::throttle
uint16_t throttle[THROTTLE_POINTS_NB]
Throttle points in the curve.
Definition: throttle_curve.h:37
throttle_curve_t::throttle_trim
int32_t throttle_trim
RPM feedback i gain.
Definition: throttle_curve.h:59
throttle_curve_t::rpm_fb_p
float rpm_fb_p
RPM feedback p gain.
Definition: throttle_curve.h:56
throttle_curve_t::mode
uint8_t mode
Flight mode.
Definition: throttle_curve.h:44
curve_t
Definition: throttle_curve.h:35
throttle_curve_t::rpm_err_sum
float rpm_err_sum
Summed RPM error.
Definition: throttle_curve.h:55
throttle_curve_t::collective
int16_t collective
Output collective of the throttle curve.
Definition: throttle_curve.h:50
throttle_curve_t::nb_curves
uint8_t nb_curves
The number of throttle/pitch curves.
Definition: throttle_curve.h:46
paparazzi.h
int16_t
short int16_t
Typedef defining 16 bit short type.
Definition: vl53l1_types.h:93
throttle_curve_t::rpm
uint16_t rpm
Output RPM of the throttle curve.
Definition: throttle_curve.h:51
std.h
throttle_curve_t::coll_trim
int32_t coll_trim
Collective trim.
Definition: throttle_curve.h:60
pprz_t
int16_t pprz_t
Definition: paparazzi.h:6
throttle_curve_t::curves
struct curve_t curves[THROTTLE_CURVES_NB]
Throttle/pitch curves.
Definition: throttle_curve.h:47
curve_t::nb_points
uint8_t nb_points
The number of points in the curve.
Definition: throttle_curve.h:36
throttle_curve_t::nav_mode
uint8_t nav_mode
Nav Flight mode.
Definition: throttle_curve.h:45
curve_t::rpm
uint16_t rpm[THROTTLE_POINTS_NB]
RPM points in the curve.
Definition: throttle_curve.h:38
throttle_curve_t
Definition: throttle_curve.h:43
nav_throttle_curve_set
void nav_throttle_curve_set(uint8_t mode)
Set a specific throttle curve based on the mode given with this function.
Definition: throttle_curve.c:208
throttle_curve_run
void throttle_curve_run(pprz_t in_cmd[], uint8_t autopilot_mode)
Run the throttle curve and generate the output throttle and pitch This depends on the FMODE(flight mo...
Definition: throttle_curve.c:115
throttle_curve_t::throttle
uint16_t throttle
Output thrust(throttle) of the throttle curve.
Definition: throttle_curve.h:49
int32_t
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83
throttle_curve_init
void throttle_curve_init(void)
Initialize the default throttle curve values.
Definition: throttle_curve.c:79
throttle_curve_t::rpm_measured
bool rpm_measured
Whenever the RPM is measured.
Definition: throttle_curve.h:54
curve_t::collective
int16_t collective[THROTTLE_POINTS_NB]
The collective points in the curve.
Definition: throttle_curve.h:39
throttle_curve_t::rpm_fb_i
float rpm_fb_i
Definition: throttle_curve.h:57
mode
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Definition: sonar_bebop.c:69
throttle_curve
struct throttle_curve_t throttle_curve
Definition: throttle_curve.c:60
throttle_curve_t::rpm_meas
uint16_t rpm_meas
RPM measured.
Definition: throttle_curve.h:53
uint16_t
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88