Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
guidance_indi.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Ewoud Smeur <ewoud.smeur@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 
34 #include "generated/airframe.h"
36 #include "modules/ins/ins_int.h"
38 #include "state.h"
39 #include "modules/imu/imu.h"
44 #include "mcu_periph/sys_time.h"
45 #include "autopilot.h"
49 #include "modules/core/abi.h"
50 
51 // The acceleration reference is calculated with these gains. If you use GPS,
52 // they are probably limited by the update rate of your GPS. The default
53 // values are tuned for 4 Hz GPS updates. If you have high speed position updates, the
54 // gains can be higher, depending on the speed of the inner loop.
55 #ifdef GUIDANCE_INDI_POS_GAIN
57 #else
59 #endif
60 
61 #ifdef GUIDANCE_INDI_SPEED_GAIN
63 #else
65 #endif
66 
67 #ifndef GUIDANCE_INDI_ACCEL_SP_ID
68 #define GUIDANCE_INDI_ACCEL_SP_ID ABI_BROADCAST
69 #endif
71 static void accel_sp_cb(uint8_t sender_id, uint8_t flag, struct FloatVect3 *accel_sp);
72 struct FloatVect3 indi_accel_sp = {0.0f, 0.0f, 0.0f};
73 bool indi_accel_sp_set_2d = false;
74 bool indi_accel_sp_set_3d = false;
75 
76 // FIXME make a proper structure for these variables
77 struct FloatVect3 speed_sp = {0.0f, 0.0f, 0.0f};
78 struct FloatVect3 sp_accel = {0.0f, 0.0f, 0.0f};
79 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
80 float guidance_indi_specific_force_gain = GUIDANCE_INDI_SPECIFIC_FORCE_GAIN;
81 static void guidance_indi_filter_thrust(void);
82 
83 #ifdef GUIDANCE_INDI_THRUST_DYNAMICS
84 #warning GUIDANCE_INDI_THRUST_DYNAMICS is deprecated, use GUIDANCE_INDI_THRUST_DYNAMICS_FREQ instead.
85 #warning "The thrust dynamics are now specified in continuous time with the corner frequency of the first order model!"
86 #warning "define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ in rad/s"
87 #warning "Use -ln(1 - old_number) * PERIODIC_FREQUENCY to compute it from the old value."
88 #endif
89 
90 #ifndef GUIDANCE_INDI_THRUST_DYNAMICS_FREQ
91 #ifndef STABILIZATION_INDI_ACT_FREQ_P
92 #error "You need to define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ to be able to use indi vertical control"
93 #else // assume that the same actuators are used for thrust as for roll (e.g. quadrotor)
94 #define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ STABILIZATION_INDI_ACT_FREQ_P
95 #endif
96 #endif //GUIDANCE_INDI_THRUST_DYNAMICS_FREQ
97 
98 
99 #endif //GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
100 
101 #ifndef GUIDANCE_INDI_FILTER_CUTOFF
102 #ifdef STABILIZATION_INDI_FILT_CUTOFF
103 #define GUIDANCE_INDI_FILTER_CUTOFF STABILIZATION_INDI_FILT_CUTOFF
104 #else
105 #define GUIDANCE_INDI_FILTER_CUTOFF 3.0
106 #endif
107 #endif
108 
109 float thrust_dyn = 0.f;
110 float thrust_act = 0.f;
115 
116 struct FloatMat33 Ga;
117 struct FloatMat33 Ga_inv;
118 struct FloatVect3 control_increment; // [dtheta, dphi, dthrust]
119 
122 
125 
127 float thrust_in;
128 
129 static void guidance_indi_propagate_filters(struct FloatEulers *eulers);
130 static void guidance_indi_calcG(struct FloatMat33 *Gmat);
131 static void guidance_indi_calcG_yxz(struct FloatMat33 *Gmat, struct FloatEulers *euler_yxz);
132 
133 #if PERIODIC_TELEMETRY
135 static void send_indi_guidance(struct transport_tx *trans, struct link_device *dev)
136 {
137  pprz_msg_send_GUIDANCE_INDI_HYBRID(trans, dev, AC_ID,
138  &sp_accel.x,
139  &sp_accel.y,
140  &sp_accel.z,
144  &filt_accel_ned[0].o[0],
145  &filt_accel_ned[1].o[0],
146  &filt_accel_ned[2].o[0],
147  &speed_sp.x,
148  &speed_sp.y,
149  &speed_sp.z);
150 }
151 #endif
152 
157 {
158  AbiBindMsgACCEL_SP(GUIDANCE_INDI_ACCEL_SP_ID, &accel_sp_ev, accel_sp_cb);
159 
160 #if PERIODIC_TELEMETRY
161  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_GUIDANCE_INDI_HYBRID, send_indi_guidance);
162 #endif
163 }
164 
170 {
171  /* set nav_heading to current heading */
173 
174  thrust_in = stabilization_cmd[COMMAND_THRUST];
176 
177 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
178 #ifdef GUIDANCE_INDI_THRUST_DYNAMICS
179  thrust_dyn = GUIDANCE_INDI_THRUST_DYNAMICS;
180 #else
181  thrust_dyn = 1-exp(-GUIDANCE_INDI_THRUST_DYNAMICS_FREQ/PERIODIC_FREQUENCY);
182 #endif //GUIDANCE_INDI_THRUST_DYNAMICS
183 #endif //GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
184 
185  float tau = 1.0 / (2.0 * M_PI * filter_cutoff);
186  float sample_time = 1.0 / PERIODIC_FREQUENCY;
187  for (int8_t i = 0; i < 3; i++) {
188  init_butterworth_2_low_pass(&filt_accel_ned[i], tau, sample_time, 0.0);
189  }
193 }
194 
202 struct StabilizationSetpoint guidance_indi_run(struct FloatVect3 *accel_sp, float heading_sp)
203 {
204  struct FloatEulers eulers_yxz;
205  struct FloatQuat * statequat = stateGetNedToBodyQuat_f();
206  float_eulers_of_quat_yxz(&eulers_yxz, statequat);
207 
208  // set global accel sp variable FIXME clean this
209  sp_accel = *accel_sp;
210 
211  //filter accel to get rid of noise and filter attitude to synchronize with accel
212  guidance_indi_propagate_filters(&eulers_yxz);
213 
214  // FIXME the ABI message overwrite the accel setpoint
215  // it update should be replaced by a call to the run function
216  // If the acceleration setpoint is set over ABI message
217  if (indi_accel_sp_set_2d) {
220  // In 2D the vertical motion is derived from the flight plan
223  // If the input command is not updated after a timeout, switch back to flight plan control
224  if (dt > 0.5) {
225  indi_accel_sp_set_2d = false;
226  }
227  } else if (indi_accel_sp_set_3d) {
232  // If the input command is not updated after a timeout, switch back to flight plan control
233  if (dt > 0.5) {
234  indi_accel_sp_set_3d = false;
235  }
236  }
237  // else, don't change sp_accel
238 
239 #if GUIDANCE_INDI_RC_DEBUG
240 #warning "GUIDANCE_INDI_RC_DEBUG lets you control the accelerations via RC, but disables autonomous flight!"
241  //for rc control horizontal, rotate from body axes to NED
242  float psi = stateGetNedToBodyEulers_f()->psi;
243  float rc_x = -(radio_control.values[RADIO_PITCH] / 9600.0) * 8.0;
244  float rc_y = (radio_control.values[RADIO_ROLL] / 9600.0) * 8.0;
245  sp_accel.x = cosf(psi) * rc_x - sinf(psi) * rc_y;
246  sp_accel.y = sinf(psi) * rc_x + cosf(psi) * rc_y;
247 
248  //for rc vertical control
249  sp_accel.z = -(radio_control.values[RADIO_THROTTLE] - 4500) * 8.0 / 9600.0;
250 #endif
251 
252  //Calculate matrix of partial derivatives
253  guidance_indi_calcG_yxz(&Ga, &eulers_yxz);
254 
255  //Invert this matrix
256  MAT33_INV(Ga_inv, Ga);
257 
258  struct FloatVect3 a_diff = { sp_accel.x - filt_accel_ned[0].o[0], sp_accel.y - filt_accel_ned[1].o[0], sp_accel.z - filt_accel_ned[2].o[0]};
259 
260  //Bound the acceleration error so that the linearization still holds
261  Bound(a_diff.x, -6.0, 6.0);
262  Bound(a_diff.y, -6.0, 6.0);
263  Bound(a_diff.z, -9.0, 9.0);
264 
265  //If the thrust to specific force ratio has been defined, include vertical control
266  //else ignore the vertical acceleration error
267 #ifndef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
268 #ifndef STABILIZATION_ATTITUDE_INDI_FULL
269  a_diff.z = 0.0;
270 #endif
271 #endif
272 
273  //Calculate roll,pitch and thrust command
275 
276  struct FloatVect3 thrust_vect;
277  thrust_vect.x = 0.0; // Fill for quadplanes
278  thrust_vect.y = 0.0;
279  thrust_vect.z = control_increment.z;
280  AbiSendMsgTHRUST(THRUST_INCREMENT_ID, thrust_vect);
281 
284  guidance_euler_cmd.psi = heading_sp;
285 
286 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
287  guidance_indi_filter_thrust();
288 
289  //Add the increment in specific force * specific_force_to_thrust_gain to the filtered thrust
291  Bound(thrust_in, 0, 9600);
292 
293 #if GUIDANCE_INDI_RC_DEBUG
294  if (radio_control.values[RADIO_THROTTLE] < 300) {
295  thrust_in = 0;
296  }
297 #endif
298 
299  //Overwrite the thrust command from guidance_v
300  stabilization_cmd[COMMAND_THRUST] = thrust_in;
301 #endif
302 
303  //Bound euler angles to prevent flipping
306 
307  //set the quat setpoint with the calculated roll and pitch
308  struct FloatQuat q_sp;
310 
311  return stab_sp_from_quat_f(&q_sp);
312 }
313 
314 struct StabilizationSetpoint guidance_indi_run_mode(bool in_flight UNUSED, struct HorizontalGuidance *gh, struct VerticalGuidance *gv, enum GuidanceIndi_HMode h_mode, enum GuidanceIndi_VMode v_mode)
315 {
316  struct FloatVect3 pos_err = { 0 };
317  struct FloatVect3 accel_sp = { 0 };
318 
319  struct FloatVect3 speed_fb;
320 
321 
322  if (h_mode == GUIDANCE_INDI_H_ACCEL) {
323  // Speed feedback is included in the guidance when running in ACCEL mode
324  speed_fb.x = 0.;
325  speed_fb.y = 0.;
326  }
327  else {
328  // Generate speed feedback for acceleration, as it is estimated
329  if (h_mode == GUIDANCE_INDI_H_SPEED) {
330  speed_sp.x = SPEED_FLOAT_OF_BFP(gh->ref.speed.x);
331  speed_sp.y = SPEED_FLOAT_OF_BFP(gh->ref.speed.y);
332  }
333  else { // H_POS
334  pos_err.x = POS_FLOAT_OF_BFP(gh->ref.pos.x) - stateGetPositionNed_f()->x;
335  pos_err.y = POS_FLOAT_OF_BFP(gh->ref.pos.y) - stateGetPositionNed_f()->y;
336  speed_sp.x = pos_err.x * guidance_indi_pos_gain + SPEED_FLOAT_OF_BFP(gh->ref.speed.x);
337  speed_sp.y = pos_err.y * guidance_indi_pos_gain + SPEED_FLOAT_OF_BFP(gh->ref.speed.y);
338  }
341  }
342 
343  if (v_mode == GUIDANCE_INDI_V_ACCEL) {
344  // Speed feedback is included in the guidance when running in ACCEL mode
345  speed_fb.z = 0;
346  }
347  else {
348  // Generate speed feedback for acceleration, as it is estimated
349  if (v_mode == GUIDANCE_INDI_V_SPEED) {
351  }
352  else { // V_POS
353  pos_err.z = POS_FLOAT_OF_BFP(gv->z_ref) - stateGetPositionNed_f()->z;
355  }
357  }
358 
359  accel_sp.x = speed_fb.x + ACCEL_FLOAT_OF_BFP(gh->ref.accel.x);
360  accel_sp.y = speed_fb.y + ACCEL_FLOAT_OF_BFP(gh->ref.accel.y);
361  accel_sp.z = speed_fb.z + ACCEL_FLOAT_OF_BFP(gv->zdd_ref);
362 
363  return guidance_indi_run(&accel_sp, gh->sp.heading);
364 }
365 
366 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
370 void guidance_indi_filter_thrust(void)
371 {
372  // Actuator dynamics
374 
375  // same filter as for the acceleration
377 }
378 #endif
379 
386 {
387  struct NedCoor_f *accel = stateGetAccelNed_f();
391 
394 }
395 
403 void guidance_indi_calcG_yxz(struct FloatMat33 *Gmat, struct FloatEulers *euler_yxz)
404 {
405 
406  float sphi = sinf(euler_yxz->phi);
407  float cphi = cosf(euler_yxz->phi);
408  float stheta = sinf(euler_yxz->theta);
409  float ctheta = cosf(euler_yxz->theta);
410  //minus gravity is a guesstimate of the thrust force, thrust measurement would be better
411  float T = -9.81;
412 
413  RMAT_ELMT(*Gmat, 0, 0) = ctheta * cphi * T;
414  RMAT_ELMT(*Gmat, 1, 0) = 0;
415  RMAT_ELMT(*Gmat, 2, 0) = -stheta * cphi * T;
416  RMAT_ELMT(*Gmat, 0, 1) = -stheta * sphi * T;
417  RMAT_ELMT(*Gmat, 1, 1) = -cphi * T;
418  RMAT_ELMT(*Gmat, 2, 1) = -ctheta * sphi * T;
419  RMAT_ELMT(*Gmat, 0, 2) = stheta * cphi;
420  RMAT_ELMT(*Gmat, 1, 2) = -sphi;
421  RMAT_ELMT(*Gmat, 2, 2) = ctheta * cphi;
422 }
423 
432 {
433 
434  struct FloatEulers *euler = stateGetNedToBodyEulers_f();
435 
436  float sphi = sinf(euler->phi);
437  float cphi = cosf(euler->phi);
438  float stheta = sinf(euler->theta);
439  float ctheta = cosf(euler->theta);
440  float spsi = sinf(euler->psi);
441  float cpsi = cosf(euler->psi);
442  //minus gravity is a guesstimate of the thrust force, thrust measurement would be better
443  float T = -9.81;
444 
445  RMAT_ELMT(*Gmat, 0, 0) = (cphi * spsi - sphi * cpsi * stheta) * T;
446  RMAT_ELMT(*Gmat, 1, 0) = (-sphi * spsi * stheta - cpsi * cphi) * T;
447  RMAT_ELMT(*Gmat, 2, 0) = -ctheta * sphi * T;
448  RMAT_ELMT(*Gmat, 0, 1) = (cphi * cpsi * ctheta) * T;
449  RMAT_ELMT(*Gmat, 1, 1) = (cphi * spsi * ctheta) * T;
450  RMAT_ELMT(*Gmat, 2, 1) = -stheta * cphi * T;
451  RMAT_ELMT(*Gmat, 0, 2) = sphi * spsi + cphi * cpsi * stheta;
452  RMAT_ELMT(*Gmat, 1, 2) = cphi * spsi * stheta - cpsi * sphi;
453  RMAT_ELMT(*Gmat, 2, 2) = cphi * ctheta;
454 }
455 
460 static void accel_sp_cb(uint8_t sender_id __attribute__((unused)), uint8_t flag, struct FloatVect3 *accel_sp)
461 {
462  if (flag == 0) {
463  indi_accel_sp.x = accel_sp->x;
464  indi_accel_sp.y = accel_sp->y;
465  indi_accel_sp_set_2d = true;
467  } else if (flag == 1) {
468  indi_accel_sp.x = accel_sp->x;
469  indi_accel_sp.y = accel_sp->y;
470  indi_accel_sp.z = accel_sp->z;
471  indi_accel_sp_set_3d = true;
473  }
474 }
475 
476 #if GUIDANCE_INDI_USE_AS_DEFAULT
477 // guidance indi control function is implementing the default functions of guidance
478 
479 void guidance_h_run_enter(void)
480 {
482 }
483 
484 void guidance_v_run_enter(void)
485 {
486  // nothing to do
487 }
488 
489 static struct VerticalGuidance *_gv = &guidance_v;
491 
492 struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
493 {
494  return guidance_indi_run_mode(in_flight, gh, _gv, GUIDANCE_INDI_H_POS, _v_mode);
495 }
496 
497 struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
498 {
499  return guidance_indi_run_mode(in_flight, gh, _gv, GUIDANCE_INDI_H_SPEED, _v_mode);
500 }
501 
502 struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
503 {
504  return guidance_indi_run_mode(in_flight, gh, _gv, GUIDANCE_INDI_H_ACCEL, _v_mode);
505 }
506 
507 int32_t guidance_v_run_pos(bool in_flight UNUSED, struct VerticalGuidance *gv)
508 {
509  _gv = gv;
511  return 0; // nothing to do
512 }
513 
514 int32_t guidance_v_run_speed(bool in_flight UNUSED, struct VerticalGuidance *gv)
515 {
516  _gv = gv;
518  return 0; // nothing to do
519 }
520 
521 int32_t guidance_v_run_accel(bool in_flight UNUSED, struct VerticalGuidance *gv)
522 {
523  _gv = gv;
525  return 0; // nothing to do
526 }
527 
528 #endif
529 
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
Definition: abi_common.h:67
#define THRUST_INCREMENT_ID
Core autopilot interface common to all firmwares.
uint8_t last_wp UNUSED
float phi
in radians
float theta
in radians
float psi
in radians
void float_eulers_of_quat_yxz(struct FloatEulers *e, struct FloatQuat *q)
euler rotation 'YXZ' This function calculates from a quaternion the Euler angles with the order YXZ,...
void float_quat_of_eulers_yxz(struct FloatQuat *q, struct FloatEulers *e)
quat from euler rotation 'YXZ' This function calculates a quaternion from Euler angles with the order...
euler angles
Roation quaternion.
#define MAT33_VECT3_MUL(_vout, _mat, _vin)
Definition: pprz_algebra.h:463
#define MAT33_INV(_minv, _m)
Definition: pprz_algebra.h:489
#define RMAT_ELMT(_rm, _row, _col)
Definition: pprz_algebra.h:660
#define POS_FLOAT_OF_BFP(_ai)
#define SPEED_FLOAT_OF_BFP(_ai)
#define ACCEL_FLOAT_OF_BFP(_ai)
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
Definition: state.h:1038
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Definition: state.h:1143
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
Definition: state.h:1131
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
Definition: state.h:710
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Definition: state.h:908
#define GUIDANCE_INDI_ACCEL_SP_ID
Definition: guidance_indi.c:68
Butterworth2LowPass roll_filt
float thrust_in
float guidance_indi_max_bank
bool indi_accel_sp_set_3d
Definition: guidance_indi.c:74
float guidance_indi_pos_gain
Definition: guidance_indi.c:58
struct FloatVect3 sp_accel
Definition: guidance_indi.c:78
struct FloatEulers guidance_euler_cmd
static void guidance_indi_calcG(struct FloatMat33 *Gmat)
struct FloatVect3 speed_sp
Definition: guidance_indi.c:77
static void guidance_indi_calcG_yxz(struct FloatMat33 *Gmat, struct FloatEulers *euler_yxz)
float thrust_act
struct FloatMat33 Ga_inv
void guidance_indi_enter(void)
Call upon entering indi guidance.
static void accel_sp_cb(uint8_t sender_id, uint8_t flag, struct FloatVect3 *accel_sp)
ABI callback that obtains the acceleration setpoint from telemetry flag: 0 -> 2D, 1 -> 3D.
Butterworth2LowPass pitch_filt
static void guidance_indi_propagate_filters(struct FloatEulers *eulers)
Low pass the accelerometer measurements to remove noise from vibrations.
abi_event accel_sp_ev
Definition: guidance_indi.c:70
void guidance_indi_init(void)
Init function.
float time_of_accel_sp_3d
float filter_cutoff
#define GUIDANCE_INDI_FILTER_CUTOFF
struct StabilizationSetpoint guidance_indi_run_mode(bool in_flight UNUSED, struct HorizontalGuidance *gh, struct VerticalGuidance *gv, enum GuidanceIndi_HMode h_mode, enum GuidanceIndi_VMode v_mode)
bool indi_accel_sp_set_2d
Definition: guidance_indi.c:73
struct FloatVect3 indi_accel_sp
Definition: guidance_indi.c:72
struct FloatVect3 control_increment
struct FloatMat33 Ga
Butterworth2LowPass filt_accel_ned[3]
float guidance_indi_speed_gain
Definition: guidance_indi.c:64
float time_of_accel_sp_2d
float thrust_dyn
struct StabilizationSetpoint guidance_indi_run(struct FloatVect3 *accel_sp, float heading_sp)
Butterworth2LowPass thrust_filt
static void send_indi_guidance(struct transport_tx *trans, struct link_device *dev)
A guidance mode based on Incremental Nonlinear Dynamic Inversion.
float guidance_indi_specific_force_gain
GuidanceIndi_VMode
Definition: guidance_indi.h:46
@ GUIDANCE_INDI_V_ACCEL
Definition: guidance_indi.h:49
@ GUIDANCE_INDI_V_SPEED
Definition: guidance_indi.h:48
@ GUIDANCE_INDI_V_POS
Definition: guidance_indi.h:47
GuidanceIndi_HMode
Definition: guidance_indi.h:40
@ GUIDANCE_INDI_H_SPEED
Definition: guidance_indi.h:42
@ GUIDANCE_INDI_H_ACCEL
Definition: guidance_indi.h:43
@ GUIDANCE_INDI_H_POS
Definition: guidance_indi.h:41
#define GUIDANCE_INDI_POS_GAIN
#define GUIDANCE_INDI_SPEED_GAIN
static enum GuidanceOneloop_VMode _v_mode
void guidance_v_run_enter(void)
static struct VerticalGuidance * _gv
int32_t guidance_v_run_speed(bool in_flight UNUSED, struct VerticalGuidance *gv)
int32_t guidance_v_run_pos(bool in_flight UNUSED, struct VerticalGuidance *gv)
int32_t guidance_v_run_accel(bool in_flight UNUSED, struct VerticalGuidance *gv)
Inertial Measurement Unit interface.
INS for rotorcrafts combining vertical and horizontal filters.
Simple first order low pass filter with bilinear transform.
float o[2]
output history
static void init_butterworth_2_low_pass(Butterworth2LowPass *filter, float tau, float sample_time, float value)
Init a second order Butterworth filter.
static float update_butterworth_2_low_pass(Butterworth2LowPass *filter, float value)
Update second order Butterworth low pass filter state with a new value.
Second order low pass filter structure.
float z
in meters
float x
in meters
float y
in meters
vector in North East Down coordinates Units: meters
struct RadioControl radio_control
Definition: radio_control.c:33
Generic interface for radio control modules.
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:67
Some helper functions to check RC sticks.
Horizontal guidance for rotorcrafts.
void guidance_h_run_enter(void)
struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
#define GUIDANCE_H_MAX_BANK
Max bank controlled by guidance.
Definition: guidance_h.h:71
struct VerticalGuidance guidance_v
Definition: guidance_v.c:59
Vertical guidance for rotorcrafts.
int32_t z_ref
altitude reference in meters.
Definition: guidance_v.h:63
int32_t zd_ref
vertical speed reference in meter/s.
Definition: guidance_v.h:69
int32_t zdd_ref
vertical acceleration reference in meter/s^2.
Definition: guidance_v.h:75
struct RotorcraftNavigation nav
Definition: navigation.c:51
float heading
heading setpoint (in radians)
Definition: navigation.h:133
General attitude stabilization interface for rotorcrafts.
struct StabilizationSetpoint stab_sp_from_quat_f(struct FloatQuat *quat)
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
Definition: stabilization.c:34
General stabilization interface for rotorcrafts.
Rotorcraft attitude reference generation.
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
Stabilization setpoint.
Definition: stabilization.h:42
union StabilizationSetpoint::@278 sp
Architecture independent timing functions.
static float get_sys_time_float(void)
Get the time in seconds since startup.
Definition: sys_time.h:138
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
signed char int8_t
Typedef defining 8 bit char type.
Definition: vl53l1_types.h:103