Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
guidance_v.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
27 #include "generated/airframe.h"
30 
35 
36 #include "state.h"
37 
38 #include "math/pprz_algebra_int.h"
39 
40 
41 /* error if some gains are negative */
42 #if (GUIDANCE_V_HOVER_KP < 0) || \
43  (GUIDANCE_V_HOVER_KD < 0) || \
44  (GUIDANCE_V_HOVER_KI < 0)
45 #error "ALL control gains must be positive!!!"
46 #endif
47 
48 
49 /* If only GUIDANCE_V_NOMINAL_HOVER_THROTTLE is defined,
50  * disable the adaptive throttle estimation by default.
51  * Otherwise enable adaptive estimation by default.
52  */
53 #ifdef GUIDANCE_V_NOMINAL_HOVER_THROTTLE
54 # ifndef GUIDANCE_V_ADAPT_THROTTLE_ENABLED
55 # define GUIDANCE_V_ADAPT_THROTTLE_ENABLED FALSE
56 # endif
57 #else
58 # define GUIDANCE_V_NOMINAL_HOVER_THROTTLE 0.4
59 # ifndef GUIDANCE_V_ADAPT_THROTTLE_ENABLED
60 # define GUIDANCE_V_ADAPT_THROTTLE_ENABLED TRUE
61 # endif
62 #endif
63 PRINT_CONFIG_VAR(GUIDANCE_V_NOMINAL_HOVER_THROTTLE)
64 PRINT_CONFIG_VAR(GUIDANCE_V_ADAPT_THROTTLE_ENABLED)
65 
66 
67 #ifndef GUIDANCE_V_CLIMB_RC_DEADBAND
68 #define GUIDANCE_V_CLIMB_RC_DEADBAND MAX_PPRZ/10
69 #endif
70 
71 #ifndef GUIDANCE_V_MAX_RC_CLIMB_SPEED
72 #define GUIDANCE_V_MAX_RC_CLIMB_SPEED GUIDANCE_V_REF_MIN_ZD
73 #endif
74 
75 #ifndef GUIDANCE_V_MAX_RC_DESCENT_SPEED
76 #define GUIDANCE_V_MAX_RC_DESCENT_SPEED GUIDANCE_V_REF_MAX_ZD
77 #endif
78 
79 #ifndef GUIDANCE_V_MIN_ERR_Z
80 #define GUIDANCE_V_MIN_ERR_Z POS_BFP_OF_REAL(-10.)
81 #endif
82 
83 #ifndef GUIDANCE_V_MAX_ERR_Z
84 #define GUIDANCE_V_MAX_ERR_Z POS_BFP_OF_REAL(10.)
85 #endif
86 
87 #ifndef GUIDANCE_V_MIN_ERR_ZD
88 #define GUIDANCE_V_MIN_ERR_ZD SPEED_BFP_OF_REAL(-10.)
89 #endif
90 
91 #ifndef GUIDANCE_V_MAX_ERR_ZD
92 #define GUIDANCE_V_MAX_ERR_ZD SPEED_BFP_OF_REAL(10.)
93 #endif
94 
95 #ifndef GUIDANCE_V_MAX_SUM_ERR
96 #define GUIDANCE_V_MAX_SUM_ERR 2000000
97 #endif
98 
103 
107 
112 
118 
124 
128 
130 
132 
133 
134 #define GuidanceVSetRef(_pos, _speed, _accel) { \
135  gv_set_ref(_pos, _speed, _accel); \
136  guidance_v_z_ref = _pos; \
137  guidance_v_zd_ref = _speed; \
138  guidance_v_zdd_ref = _accel; \
139  }
140 
142 static void run_hover_loop(bool in_flight);
143 
144 #if PERIODIC_TELEMETRY
146 
147 static void send_vert_loop(struct transport_tx *trans, struct link_device *dev)
148 {
149  pprz_msg_send_VERT_LOOP(trans, dev, AC_ID,
150  &guidance_v_z_sp, &guidance_v_zd_sp,
151  &(stateGetPositionNed_i()->z),
152  &(stateGetSpeedNed_i()->z),
153  &(stateGetAccelNed_i()->z),
154  &guidance_v_z_ref, &guidance_v_zd_ref,
155  &guidance_v_zdd_ref,
156  &gv_adapt_X,
157  &gv_adapt_P,
159  &guidance_v_z_sum_err,
160  &guidance_v_ff_cmd,
161  &guidance_v_fb_cmd,
162  &guidance_v_delta_t);
163 }
164 
165 static void send_tune_vert(struct transport_tx *trans, struct link_device *dev)
166 {
167  pprz_msg_send_TUNE_VERT(trans, dev, AC_ID,
168  &guidance_v_z_sp,
169  &(stateGetPositionNed_i()->z),
170  &guidance_v_z_ref,
171  &guidance_v_zd_ref);
172 }
173 #endif
174 
175 void guidance_v_init(void)
176 {
177 
178  guidance_v_mode = GUIDANCE_V_MODE_KILL;
179 
180  guidance_v_kp = GUIDANCE_V_HOVER_KP;
181  guidance_v_kd = GUIDANCE_V_HOVER_KD;
182  guidance_v_ki = GUIDANCE_V_HOVER_KI;
183 
184  guidance_v_z_sum_err = 0;
185 
186  guidance_v_nominal_throttle = GUIDANCE_V_NOMINAL_HOVER_THROTTLE;
187  guidance_v_adapt_throttle_enabled = GUIDANCE_V_ADAPT_THROTTLE_ENABLED;
188  guidance_v_guided_vel_enabled = false;
189 
190  gv_adapt_init();
191 
192 #if GUIDANCE_V_MODE_MODULE_SETTING == GUIDANCE_V_MODE_MODULE
194 #endif
195 
196 #if PERIODIC_TELEMETRY
199 #endif
200 }
201 
202 
204 {
205 
206  /* used in RC_DIRECT directly and as saturation in CLIMB and HOVER */
207  guidance_v_rc_delta_t = (int32_t)radio_control.values[RADIO_THROTTLE];
208 
209  /* used in RC_CLIMB */
210  guidance_v_rc_zd_sp = (MAX_PPRZ / 2) - (int32_t)radio_control.values[RADIO_THROTTLE];
211  DeadBand(guidance_v_rc_zd_sp, GUIDANCE_V_CLIMB_RC_DEADBAND);
212 
213  static const int32_t climb_scale = ABS(SPEED_BFP_OF_REAL(GUIDANCE_V_MAX_RC_CLIMB_SPEED) /
215  static const int32_t descent_scale = ABS(SPEED_BFP_OF_REAL(GUIDANCE_V_MAX_RC_DESCENT_SPEED) /
217 
218  if (guidance_v_rc_zd_sp > 0) {
219  guidance_v_rc_zd_sp *= descent_scale;
220  } else {
221  guidance_v_rc_zd_sp *= climb_scale;
222  }
223 }
224 
226 {
227 
228  if (new_mode == guidance_v_mode) {
229  return;
230  }
231 
232  switch (new_mode) {
235  /* disable vertical velocity setpoints */
236  guidance_v_guided_vel_enabled = false;
237 
238  /* set current altitude as setpoint */
239  guidance_v_z_sp = stateGetPositionNed_i()->z;
240 
241  /* reset guidance reference */
242  guidance_v_z_sum_err = 0;
244 
245  /* reset speed setting */
246  guidance_v_zd_sp = 0;
247  break;
248 
251  guidance_v_zd_sp = 0;
252  case GUIDANCE_V_MODE_NAV:
253  guidance_v_z_sum_err = 0;
255  break;
256 
257 #if GUIDANCE_V_MODE_MODULE_SETTING == GUIDANCE_V_MODE_MODULE
260  break;
261 #endif
262 
264  break;
265 
266  default:
267  break;
268 
269  }
270 
271  guidance_v_mode = new_mode;
272 
273 }
274 
275 void guidance_v_notify_in_flight(bool in_flight)
276 {
277  if (in_flight) {
278  gv_adapt_init();
279  }
280 }
281 
282 
283 void guidance_v_run(bool in_flight)
284 {
285 
286  // FIXME... SATURATIONS NOT TAKEN INTO ACCOUNT
287  // AKA SUPERVISION and co
288  guidance_v_thrust_coeff = get_vertical_thrust_coeff();
289  if (in_flight) {
290  int32_t vertical_thrust = (stabilization_cmd[COMMAND_THRUST] * guidance_v_thrust_coeff) >> INT32_TRIG_FRAC;
291  gv_adapt_run(stateGetAccelNed_i()->z, vertical_thrust, guidance_v_zd_ref);
292  } else {
293  /* reset estimate while not in_flight */
294  gv_adapt_init();
295  }
296 
297  switch (guidance_v_mode) {
298 
300  guidance_v_z_sp = stateGetPositionNed_i()->z; // for display only
301  stabilization_cmd[COMMAND_THRUST] = guidance_v_rc_delta_t;
302  break;
303 
305  guidance_v_zd_sp = guidance_v_rc_zd_sp;
306  gv_update_ref_from_zd_sp(guidance_v_zd_sp, stateGetPositionNed_i()->z);
307  run_hover_loop(in_flight);
308  stabilization_cmd[COMMAND_THRUST] = guidance_v_delta_t;
309  break;
310 
312  gv_update_ref_from_zd_sp(guidance_v_zd_sp, stateGetPositionNed_i()->z);
313  run_hover_loop(in_flight);
314 #if !NO_RC_THRUST_LIMIT
315  /* use rc limitation if available */
316  if (radio_control.status == RC_OK) {
317  stabilization_cmd[COMMAND_THRUST] = Min(guidance_v_rc_delta_t, guidance_v_delta_t);
318  } else
319 #endif
320  stabilization_cmd[COMMAND_THRUST] = guidance_v_delta_t;
321  break;
322 
324  guidance_v_guided_vel_enabled = false;
326  if (guidance_v_guided_vel_enabled) {
327  gv_update_ref_from_zd_sp(guidance_v_zd_sp, stateGetPositionNed_i()->z);
328  run_hover_loop(in_flight);
329  /* update z sp for telemetry/debuging */
330  guidance_v_z_sp = guidance_v_z_ref;
331  } else {
332  guidance_v_zd_sp = 0;
333  gv_update_ref_from_z_sp(guidance_v_z_sp);
334  run_hover_loop(in_flight);
335  }
336 #if !NO_RC_THRUST_LIMIT
337  /* use rc limitation if available */
338  if (radio_control.status == RC_OK) {
339  stabilization_cmd[COMMAND_THRUST] = Min(guidance_v_rc_delta_t, guidance_v_delta_t);
340  } else
341 #endif
342  stabilization_cmd[COMMAND_THRUST] = guidance_v_delta_t;
343  break;
344 
345 #if GUIDANCE_V_MODE_MODULE_SETTING == GUIDANCE_V_MODE_MODULE
347  guidance_v_module_run(in_flight);
348  break;
349 #endif
350 
351  case GUIDANCE_V_MODE_NAV: {
353  guidance_v_z_sp = -nav_flight_altitude;
354  guidance_v_zd_sp = 0;
355  gv_update_ref_from_z_sp(guidance_v_z_sp);
356  run_hover_loop(in_flight);
357  } else if (vertical_mode == VERTICAL_MODE_CLIMB) {
358  guidance_v_z_sp = stateGetPositionNed_i()->z;
359  guidance_v_zd_sp = -nav_climb;
360  gv_update_ref_from_zd_sp(guidance_v_zd_sp, stateGetPositionNed_i()->z);
361  run_hover_loop(in_flight);
362  } else if (vertical_mode == VERTICAL_MODE_MANUAL) {
363  guidance_v_z_sp = stateGetPositionNed_i()->z;
364  guidance_v_zd_sp = stateGetSpeedNed_i()->z;
365  GuidanceVSetRef(guidance_v_z_sp, guidance_v_zd_sp, 0);
366  guidance_v_z_sum_err = 0;
367  guidance_v_delta_t = nav_throttle;
368  }
369 #if HYBRID_NAVIGATION
371 #else
372 #if !NO_RC_THRUST_LIMIT
373  /* use rc limitation if available */
374  if (radio_control.status == RC_OK) {
375  stabilization_cmd[COMMAND_THRUST] = Min(guidance_v_rc_delta_t, guidance_v_delta_t);
376  } else
377 #endif
378  stabilization_cmd[COMMAND_THRUST] = guidance_v_delta_t;
379 #endif
380  break;
381  }
382 
384  break;
385 
386  default:
387  break;
388  }
389 }
390 
393 {
394  // cos(30°) = 0.8660254
395  static const int32_t max_bank_coef = BFP_OF_REAL(0.8660254f, INT32_TRIG_FRAC);
396 
397  struct Int32RMat *att = stateGetNedToBodyRMat_i();
398  /* thrust vector:
399  * int32_rmat_vmult(&thrust_vect, &att, &zaxis)
400  * same as last colum of rmat with INT32_TRIG_FRAC
401  * struct Int32Vect thrust_vect = {att.m[2], att.m[5], att.m[8]};
402  *
403  * Angle between two vectors v1 and v2:
404  * angle = acos(dot(v1, v2) / (norm(v1) * norm(v2)))
405  * since here both are already of unit length:
406  * angle = acos(dot(v1, v2))
407  * since we we want the cosine of the angle we simply need
408  * thrust_coeff = dot(v1, v2)
409  * also can be simplified considering: v1 is zaxis with (0,0,1)
410  * dot(v1, v2) = v1.z * v2.z = v2.z
411  */
412  int32_t coef = att->m[8];
413  if (coef < max_bank_coef) {
414  coef = max_bank_coef;
415  }
416  return coef;
417 }
418 
419 
420 #define FF_CMD_FRAC 18
421 
422 static void run_hover_loop(bool in_flight)
423 {
424 
425  /* convert our reference to generic representation */
427  guidance_v_z_ref = (int32_t)tmp;
428  guidance_v_zd_ref = gv_zd_ref << (INT32_SPEED_FRAC - GV_ZD_REF_FRAC);
429  guidance_v_zdd_ref = gv_zdd_ref << (INT32_ACCEL_FRAC - GV_ZDD_REF_FRAC);
430  /* compute the error to our reference */
431  int32_t err_z = guidance_v_z_ref - stateGetPositionNed_i()->z;
433  int32_t err_zd = guidance_v_zd_ref - stateGetSpeedNed_i()->z;
435 
436  if (in_flight) {
437  guidance_v_z_sum_err += err_z;
438  Bound(guidance_v_z_sum_err, -GUIDANCE_V_MAX_SUM_ERR, GUIDANCE_V_MAX_SUM_ERR);
439  } else {
440  guidance_v_z_sum_err = 0;
441  }
442 
443  /* our nominal command : (g + zdd)*m */
444  int32_t inv_m;
445  if (guidance_v_adapt_throttle_enabled) {
446  inv_m = gv_adapt_X >> (GV_ADAPT_X_FRAC - FF_CMD_FRAC);
447  } else {
448  /* use the fixed nominal throttle */
449  inv_m = BFP_OF_REAL(9.81 / (guidance_v_nominal_throttle * MAX_PPRZ), FF_CMD_FRAC);
450  }
451 
452  const int32_t g_m_zdd = (int32_t)BFP_OF_REAL(9.81, FF_CMD_FRAC) -
453  (guidance_v_zdd_ref << (FF_CMD_FRAC - INT32_ACCEL_FRAC));
454 
455  guidance_v_ff_cmd = g_m_zdd / inv_m;
456  /* feed forward command */
457  guidance_v_ff_cmd = (guidance_v_ff_cmd << INT32_TRIG_FRAC) / guidance_v_thrust_coeff;
458 
459 #if HYBRID_NAVIGATION
460  //FIXME: NOT USING FEEDFORWARD COMMAND BECAUSE OF QUADSHOT NAVIGATION
461  guidance_v_ff_cmd = guidance_v_nominal_throttle * MAX_PPRZ;
462 #endif
463 
464  /* bound the nominal command to 0.9*MAX_PPRZ */
465  Bound(guidance_v_ff_cmd, 0, 8640);
466 
467 
468  /* our error feed back command */
469  /* z-axis pointing down -> positive error means we need less thrust */
470  guidance_v_fb_cmd = ((-guidance_v_kp * err_z) >> 7) +
471  ((-guidance_v_kd * err_zd) >> 16) +
472  ((-guidance_v_ki * guidance_v_z_sum_err) >> 16);
473 
474  guidance_v_delta_t = guidance_v_ff_cmd + guidance_v_fb_cmd;
475 
476  /* bound the result */
477  Bound(guidance_v_delta_t, 0, MAX_PPRZ);
478 
479 }
480 
482 {
483  if (guidance_v_mode == GUIDANCE_V_MODE_GUIDED) {
484  guidance_v_guided_vel_enabled = false;
485  guidance_v_z_sp = POS_BFP_OF_REAL(z);
486  return true;
487  }
488  return false;
489 }
490 
492 {
493  if (guidance_v_mode == GUIDANCE_V_MODE_GUIDED) {
494  guidance_v_guided_vel_enabled = true;
495  guidance_v_zd_sp = SPEED_BFP_OF_REAL(vz);
496  return true;
497  }
498  return false;
499 }
bool guidance_v_set_guided_z(float z)
Set z setpoint in GUIDED mode.
Definition: guidance_v.c:481
int32_t guidance_v_z_sp
altitude setpoint in meters (input).
Definition: guidance_v.c:119
#define GV_ZD_REF_FRAC
number of bits for the fractional part of gv_zd_ref
void guidance_hybrid_vertical(void)
Description.
int32_t guidance_v_kd
vertical control D-gain
Definition: guidance_v.c:126
#define GUIDANCE_V_MODE_NAV
Definition: guidance_v.h:40
static void send_vert_loop(struct transport_tx *trans, struct link_device *dev)
Definition: guidance_v.c:147
bool guidance_v_set_guided_vz(float vz)
Set z velocity setpoint in GUIDED mode.
Definition: guidance_v.c:491
#define GUIDANCE_V_NOMINAL_HOVER_THROTTLE
Definition: guidance_v.c:58
#define GV_Z_REF_FRAC
number of bits for the fractional part of gv_z_ref
#define INT32_ACCEL_FRAC
#define INT32_SPEED_FRAC
static void run_hover_loop(bool in_flight)
Definition: guidance_v.c:422
int32_t guidance_v_fb_cmd
feed-back command
Definition: guidance_v.c:101
Periodic telemetry system header (includes downlink utility and generated code).
static struct Int32RMat * stateGetNedToBodyRMat_i(void)
Get vehicle body attitude rotation matrix (int).
Definition: state.h:1101
bool guidance_v_guided_vel_enabled
Definition: guidance_v.c:106
int32_t guidance_v_delta_t
thrust command.
Definition: guidance_v.c:102
uint8_t status
Definition: radio_control.h:53
int32_t guidance_v_kp
vertical control P-gain
Definition: guidance_v.c:125
#define GV_ADAPT_X_FRAC
void guidance_v_init(void)
Definition: guidance_v.c:175
#define POS_BFP_OF_REAL(_af)
bool guidance_v_adapt_throttle_enabled
Use adaptive throttle command estimation.
Definition: guidance_v.c:105
#define GUIDANCE_V_MIN_ERR_Z
Definition: guidance_v.c:80
int32_t m[3 *3]
void guidance_v_mode_changed(uint8_t new_mode)
Definition: guidance_v.c:225
float guidance_v_nominal_throttle
nominal throttle for hover.
Definition: guidance_v.c:104
Vertical guidance for rotorcrafts.
#define GV_ZDD_REF_FRAC
number of bits for the fractional part of gv_zdd_ref
void guidance_v_run(bool in_flight)
Definition: guidance_v.c:283
signed long long int64_t
Definition: types.h:21
int32_t guidance_v_z_sum_err
accumulator for I-gain
Definition: guidance_v.c:129
void guidance_v_notify_in_flight(bool in_flight)
Definition: guidance_v.c:275
Guidance controllers (horizontal and vertical) for Hybrid UAV configurations.
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:58
int32_t z
Down.
#define GUIDANCE_V_MODE_KILL
Definition: guidance_v.h:35
int32_t guidance_v_rc_zd_sp
Vertical speed setpoint from radio control.
Definition: guidance_v.c:117
#define BFP_OF_REAL(_vr, _frac)
void gv_update_ref_from_z_sp(int32_t z_sp)
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
Definition: state.h:851
int32_t guidance_v_ki
vertical control I-gain
Definition: guidance_v.c:127
#define GUIDANCE_V_MODE_MODULE
Definition: guidance_v.h:41
void guidance_v_module_init(void)
void gv_adapt_init(void)
#define GUIDANCE_V_MAX_RC_DESCENT_SPEED
Definition: guidance_v.c:76
#define GUIDANCE_V_MODE_CLIMB
Definition: guidance_v.h:38
int32_t gv_zd_ref
reference model vertical speed in meters/sec (output) fixed point representation with GV_ZD_REF_FRAC ...
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
int32_t guidance_v_zdd_ref
vertical acceleration reference in meter/s^2.
Definition: guidance_v.c:123
#define GUIDANCE_V_MAX_ERR_Z
Definition: guidance_v.c:84
#define GUIDANCE_V_MODE_HOVER
Definition: guidance_v.h:39
struct RadioControl radio_control
Definition: radio_control.c:30
void gv_adapt_run(int32_t zdd_meas, int32_t thrust_applied, int32_t zd_ref)
Adaptation function.
#define GUIDANCE_V_MAX_RC_CLIMB_SPEED
Definition: guidance_v.c:72
int32_t guidance_v_z_ref
altitude reference in meters.
Definition: guidance_v.c:121
#define RADIO_THROTTLE
Definition: spektrum_arch.h:42
void guidance_v_module_run(UNUSED bool in_flight)
#define INT32_POS_FRAC
void gv_update_ref_from_zd_sp(int32_t zd_sp, int32_t z_pos)
update vertical reference from speed setpoint.
int32_t guidance_v_zd_ref
vertical speed reference in meter/s.
Definition: guidance_v.c:122
#define Min(x, y)
Definition: main_fbw.c:52
int32_t gv_adapt_P
Covariance.
#define GuidanceVSetRef(_pos, _speed, _accel)
Definition: guidance_v.c:134
signed long int32_t
Definition: types.h:19
#define RC_OK
Definition: radio_control.h:48
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:73
#define INT32_TRIG_FRAC
#define GUIDANCE_V_CLIMB_RC_DEADBAND
Definition: guidance_v.c:68
uint8_t guidance_v_mode
Definition: guidance_v.c:99
#define GUIDANCE_V_ADAPT_THROTTLE_ENABLED
Definition: guidance_v.c:60
unsigned char uint8_t
Definition: types.h:14
void guidance_v_module_enter(void)
API to get/set the generic vehicle states.
int32_t gv_adapt_Xmeas
Measurement.
#define FF_CMD_FRAC
Definition: guidance_v.c:420
int32_t guidance_v_thrust_coeff
Definition: guidance_v.c:131
#define GUIDANCE_V_MIN_ERR_ZD
Definition: guidance_v.c:88
int64_t gv_z_ref
reference model altitude in meters (output) fixed point representation with GV_Z_REF_FRAC Q37...
static int32_t get_vertical_thrust_coeff(void)
get the cosine of the angle between thrust vector and gravity vector
Definition: guidance_v.c:392
General stabilization interface for rotorcrafts.
void guidance_v_read_rc(void)
Definition: guidance_v.c:203
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
Definition: stabilization.c:28
#define GUIDANCE_V_MAX_ERR_ZD
Definition: guidance_v.c:92
#define GUIDANCE_V_MODE_FLIP
Definition: guidance_v.h:42
static void send_tune_vert(struct transport_tx *trans, struct link_device *dev)
Definition: guidance_v.c:165
Guidance in a module file.
int32_t guidance_v_zd_sp
vertical speed setpoint in meter/s (input).
Definition: guidance_v.c:120
#define GUIDANCE_V_MAX_SUM_ERR
Definition: guidance_v.c:96
int32_t guidance_v_rc_delta_t
Direct throttle from radio control.
Definition: guidance_v.c:111
rotation matrix
#define SPEED_BFP_OF_REAL(_af)
int32_t guidance_v_ff_cmd
feed-forward command
Definition: guidance_v.c:100
#define GUIDANCE_V_MODE_RC_CLIMB
Definition: guidance_v.h:37
#define MAX_PPRZ
Definition: paparazzi.h:8
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
Definition: state.h:659
#define GUIDANCE_V_MODE_RC_DIRECT
Definition: guidance_v.h:36
uint8_t vertical_mode
Definition: sim_ap.c:35
int32_t gv_adapt_X
State of the estimator.
#define GUIDANCE_V_MODE_GUIDED
Definition: guidance_v.h:43
int32_t gv_zdd_ref
reference model vertical accel in meters/s^2 (output) fixed point representation with GV_ZDD_REF_FRAC...
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:46
static struct NedCoor_i * stateGetAccelNed_i(void)
Get acceleration in NED coordinates (int).
Definition: state.h:1002
Paparazzi fixed point algebra.