Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
guidance_hybrid.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Ewoud Smeur <e.j.j.smeur@tudelft.nl>
3  * This is code for guidance of hybrid UAVs. It needs a simple velocity
4  * model to control the ground velocity of the UAV while estimating the
5  * wind velocity.
6  *
7  * This file is part of paparazzi.
8  *
9  * paparazzi is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * paparazzi is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with paparazzi; see the file COPYING. If not, write to
21  * the Free Software Foundation, 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  */
24 
39 
40 /* for guidance_v.thrust_coeff */
42 
43 #include "firmwares/rotorcraft/guidance/guidance_pid.h" // FIXME is it really what we want ?
44 
45 // max airspeed for quadshot guidance
46 #ifndef MAX_AIRSPEED
47 #define MAX_AIRSPEED 15
48 #endif
49 
50 // high res frac for integration of angles
51 #define INT32_ANGLE_HIGH_RES_FRAC 18
52 
53 // Variables used for settings
61 
62 #define AIRSPEED_HOVER 4
63 #define AIRSPEED_FORWARD 12
64 #define CRUISE_THROTTLE 4000
65 #define FWD_SPEED_P_GAIN 30
66 #define FWD_ALT_THRUST_GAIN 0.35
67 #define FWD_PID_DIV 2
68 #define FWD_NOMINAL_PITCH 78.0
69 #define FWD_PITCH_GAIN 2.1
70 #define HOVER_P_GAIN 12
71 
79 
80 // Private variables
84 static struct Int32Vect2 guidance_h_pos_err;
86 static struct Int32Vect2 wind_estimate;
89 
95 static bool guidance_hovering;
98 
99 #if PERIODIC_TELEMETRY
101 
102 static void send_hybrid_guidance(struct transport_tx *trans, struct link_device *dev)
103 {
104  struct NedCoor_i *pos = stateGetPositionNed_i();
105  struct NedCoor_i *speed = stateGetSpeedNed_i();
106  pprz_msg_send_HYBRID_GUIDANCE(trans, dev, AC_ID,
107  &(pos->x), &(pos->y),
108  &(speed->x), &(speed->y),
119 }
120 
121 #endif
122 
124 {
125 
130 
131  high_res_psi = 0;
132  guidance_hovering = true;
136  max_turn_bank = 23.0;
137  turn_bank_gain = 0.5;
138  wind_gain = 35;
143 
144 #if PERIODIC_TELEMETRY
146 #endif
147 
148 }
149 
150 #define INT32_ANGLE_HIGH_RES_NORMALIZE(_a) { \
151  while ((_a) > (INT32_ANGLE_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC))) (_a) -= (INT32_ANGLE_2_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC)); \
152  while ((_a) < -(INT32_ANGLE_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC))) (_a) += (INT32_ANGLE_2_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC)); \
153  }
154 
156 {
161 }
162 
164 {
165  // compute position error
167  // Compute ground speed setpoint
169  return guidance_hybrid_run();
170 }
171 
173 {
174  // directly set ground speed setpoint
176  return guidance_hybrid_run();
177 }
178 
180 {
181  struct StabilizationSetpoint sp = { 0 };
182  // TODO
183  return sp;
184 }
185 
187 {
188  int32_t delta_t = guidance_pid_v_run_pos(in_flight, gv);
189  return guidance_hybrid_vertical(delta_t);
190 }
191 
193 {
194  int32_t delta_t = guidance_pid_v_run_speed(in_flight, gv);
195  return guidance_hybrid_vertical(delta_t);
196 }
197 
199 {
200  int32_t delta_t = guidance_pid_v_run_accel(in_flight, gv);
201  return guidance_hybrid_vertical(delta_t);
202 }
203 
204 
206 {
207  guidance_hybrid_ypr_sp.psi = sp_cmd->psi;
210 }
211 
214 {
215 
216  //notes:
217  //in forward flight, it is preferred to first get to min(airspeed_sp, airspeed_ref) and then change heading and then get to airspeed_sp
218  //in hover, just a gradual change is needed, or maybe not even needed
219  //changes between flight regimes should be handled
220 
221  //determine the heading of the airspeed_sp vector
222  int32_t omega = 0;
223  float airspeed_sp_heading = atan2f((float) POS_FLOAT_OF_BFP(guidance_hybrid_airspeed_sp.y),
225  //only for debugging
226  airspeed_sp_heading_disp = (int32_t)(DegOfRad(airspeed_sp_heading));
227 
228  //The difference of the current heading with the required heading.
229  float heading_diff = airspeed_sp_heading - ANGLE_FLOAT_OF_BFP(ypr_sp->psi);
230  FLOAT_ANGLE_NORMALIZE(heading_diff);
231 
232  //only for debugging
233  heading_diff_disp = (int32_t)(heading_diff / 3.14 * 180.0);
234 
235  //calculate the norm of the airspeed setpoint
236  int32_t norm_sp_airspeed;
237  norm_sp_airspeed = int32_vect2_norm(&guidance_hybrid_airspeed_sp);
238 
239  //reference goes with a steady pace towards the setpoint airspeed
240  //hold ref norm below 4 m/s until heading is aligned
241  if (!((norm_sp_airspeed > (AIRSPEED_HOVER << 8)) && (guidance_hybrid_norm_ref_airspeed < (AIRSPEED_HOVER << 8))
242  && (guidance_hybrid_norm_ref_airspeed > ((AIRSPEED_HOVER << 8) - 10)) && (fabs(heading_diff) > (5.0 / 180.0 * 3.14)))) {
244  guidance_hybrid_norm_ref_airspeed) * 2 - 1) * 3 / 2;
246  }
247 
248  norm_sp_airspeed_disp = norm_sp_airspeed;
249 
250  int32_t psi = ypr_sp->psi;
251  int32_t s_psi, c_psi;
252  PPRZ_ITRIG_SIN(s_psi, psi);
253  PPRZ_ITRIG_COS(c_psi, psi);
254 
257 
260  // translate speed_sp into bank angle and heading
261 
262  // change heading to direction of airspeed, faster if the airspeed is higher
263  if (heading_diff > 0.0) {
264  omega = (norm_sp_airspeed << (INT32_ANGLE_FRAC - INT32_POS_FRAC)) / 6;
265  } else if (heading_diff < 0.0) {
266  omega = (norm_sp_airspeed << (INT32_ANGLE_FRAC - INT32_POS_FRAC)) / -6;
267  }
268 
269  if (omega > ANGLE_BFP_OF_REAL(0.8)) { omega = ANGLE_BFP_OF_REAL(0.8); }
270  if (omega < ANGLE_BFP_OF_REAL(-0.8)) { omega = ANGLE_BFP_OF_REAL(-0.8); }
271 
272  // 2) calculate roll/pitch commands
273  struct Int32Vect2 hover_sp;
274  //if the setpoint is beyond 4m/s but the ref is not, the norm of the hover sp will stay at 4m/s
275  if (norm_sp_airspeed > (AIRSPEED_HOVER << 8)) {
276  hover_sp.x = (guidance_hybrid_airspeed_sp.x << 8) / norm_sp_airspeed * AIRSPEED_HOVER;
277  hover_sp.y = (guidance_hybrid_airspeed_sp.y << 8) / norm_sp_airspeed * AIRSPEED_HOVER;
278  } else {
279  hover_sp.x = guidance_hybrid_airspeed_sp.x;
280  hover_sp.y = guidance_hybrid_airspeed_sp.y;
281  }
282 
283  // gain of 10 means that for 4 m/s an angle of 40 degrees is needed
284  ypr_sp->theta = (((- (c_psi * hover_sp.x + s_psi * hover_sp.y)) >> INT32_TRIG_FRAC) * hover_p_gain * INT32_ANGLE_PI / 180) >> 8;
285  ypr_sp->phi = ((((- s_psi * hover_sp.x + c_psi * hover_sp.y)) >> INT32_TRIG_FRAC) * hover_p_gain * INT32_ANGLE_PI / 180) >> 8;
286  } else {
288  // translate speed_sp into theta + thrust
289  // coordinated turns to change heading
290 
291  // calculate required pitch angle from airspeed_sp magnitude
293  ypr_sp->theta = -ANGLE_BFP_OF_REAL(RadOfDeg(fwd_nominal_pitch));
294  } else {
296  float hover_max_deg = hover_p_gain * AIRSPEED_HOVER;
297  float diff_deg = (fwd_nominal_pitch - hover_max_deg) * airspeed_transition;
298  ypr_sp->theta = -ANGLE_BFP_OF_REAL(RadOfDeg(diff_deg + hover_max_deg));
299  }
300 
301  // if the sp_airspeed is within hovering range, don't start a coordinated turn
302  if (norm_sp_airspeed < (AIRSPEED_HOVER << 8)) {
303  omega = 0;
304  ypr_sp->phi = 0;
305  } else { // coordinated turn
306  ypr_sp->phi = ANGLE_BFP_OF_REAL(heading_diff * turn_bank_gain);
307  if (ypr_sp->phi > ANGLE_BFP_OF_REAL(max_turn_bank / 180.0 * M_PI)) { ypr_sp->phi = ANGLE_BFP_OF_REAL(max_turn_bank / 180.0 * M_PI); }
308  if (ypr_sp->phi < ANGLE_BFP_OF_REAL(-max_turn_bank / 180.0 * M_PI)) { ypr_sp->phi = ANGLE_BFP_OF_REAL(-max_turn_bank / 180.0 * M_PI); }
309 
310  //feedforward estimate angular rotation omega = g*tan(phi)/v
312 
313  if (omega > ANGLE_BFP_OF_REAL(0.7)) { omega = ANGLE_BFP_OF_REAL(0.7); }
314  if (omega < ANGLE_BFP_OF_REAL(-0.7)) { omega = ANGLE_BFP_OF_REAL(-0.7); }
315  }
316  }
317 
318  //only for debugging purposes
319  omega_disp = omega;
320 
321  //go to higher resolution because else the increment is too small to be added
323 
325 
326  // go back to angle_frac
328  ypr_sp->theta = ypr_sp->theta + v_control_pitch;
329 }
330 
332 {
333  int32_t norm_groundspeed_sp;
334  norm_groundspeed_sp = int32_vect2_norm(&guidance_hybrid_groundspeed_sp);
335 
336  //create setpoint groundspeed with a norm of 15 m/s
337  if (force_forward_flight) {
338  //scale the groundspeed_sp to 15 m/s if large enough to begin with
339  if (norm_groundspeed_sp > 1 << 8) {
342  } else { //groundspeed_sp is very small, so continue with the current heading
344  int32_t s_psi, c_psi;
345  PPRZ_ITRIG_SIN(s_psi, psi);
346  PPRZ_ITRIG_COS(c_psi, psi);
349  }
350  }
351 
352  struct Int32Vect2 airspeed_sp;
353  INT_VECT2_ZERO(airspeed_sp);
355  VECT2_ADD(airspeed_sp, wind_estimate);
356 
357  int32_t norm_airspeed_sp;
358  norm_airspeed_sp = int32_vect2_norm(&airspeed_sp);
359 
360  //Check if the airspeed_sp is larger than the max airspeed. If so, give the wind cancellatioin priority.
361  if (norm_airspeed_sp > (max_airspeed << 8) && norm_groundspeed_sp > 0) {
367  8) - (max_airspeed << 8) * max_airspeed;
368 
369  float dv = POS_FLOAT_OF_BFP(bv) * POS_FLOAT_OF_BFP(bv) - 4.0 * POS_FLOAT_OF_BFP(av) * POS_FLOAT_OF_BFP(cv);
370  float d_sqrt_f = sqrtf(dv);
371  int32_t d_sqrt = POS_BFP_OF_REAL(d_sqrt_f);
372 
373  int32_t result = ((-bv + d_sqrt) << 8) / (2 * av);
374 
377  } else {
378  // Add the wind to get the airspeed setpoint
381  }
382 
383  // limit the airspeed setpoint to 15 m/s, because else saturation+windup will occur
384  norm_airspeed_sp = int32_vect2_norm(&guidance_hybrid_airspeed_sp);
385  // add check for non-zero airspeed (in case the max_airspeed is ever set to zero
386  if ((norm_airspeed_sp > (max_airspeed << 8)) && (norm_airspeed_sp != 0)) {
389  }
390 }
391 
393 {
394 
395  /* compute speed error */
396  struct Int32Vect2 wind_estimate_measured;
397  struct Int32Vect2 measured_ground_speed;
398  INT32_VECT2_RSHIFT(measured_ground_speed, *stateGetSpeedNed_i(), 11);
399  VECT2_DIFF(wind_estimate_measured, guidance_hybrid_ref_airspeed, measured_ground_speed);
400 
401  //Low pass wind_estimate, because we know the wind usually only changes slowly
402  //But not too slow, because the wind_estimate is also an adaptive element for the airspeed model inaccuracies
403  wind_estimate_high_res.x += (((wind_estimate_measured.x - wind_estimate.x) > 0) * 2 - 1) * wind_gain;
404  wind_estimate_high_res.y += (((wind_estimate_measured.y - wind_estimate.y) > 0) * 2 - 1) * wind_gain;
405 
408 }
409 
411 {
413 
414  /* orientation vector describing simultaneous rotation of roll/pitch */
415  struct FloatVect3 ov;
416  ov.x = ANGLE_FLOAT_OF_BFP(sp_cmd->phi);
417  ov.y = ANGLE_FLOAT_OF_BFP(sp_cmd->theta);
418  ov.z = 0.0;
419  /* quaternion from that orientation vector */
420  struct FloatQuat q_rp;
421  float_quat_of_orientation_vect(&q_rp, &ov);
422  struct Int32Quat q_rp_i;
423  QUAT_BFP_OF_REAL(q_rp_i, q_rp);
424 
425  // get the vertical vector to rotate the roll pitch setpoint around
426  struct Int32Vect3 zaxis = {0, 0, 1};
427 
428  /* get current heading setpoint */
429  struct Int32Quat q_yaw_sp;
430  int32_quat_of_axis_angle(&q_yaw_sp, &zaxis, sp_cmd->psi);
431 
432  // first apply the roll/pitch setpoint and then the yaw
433  struct Int32Quat quat_sp;
434  int32_quat_comp(&quat_sp, &q_yaw_sp, &q_rp_i);
435 
436  return stab_sp_from_quat_i(&quat_sp);
437 }
438 
444 {
445  int32_t hybrid_delta_t = 0;
446 
448  float fwd_thrust = cruise_throttle
449  + (fwd_speed_err * fwd_speed_p_gain)
451  int32_t hover_thrust = delta_t;
452 
453  float alt_control_pitch = (delta_t - MAX_PPRZ * guidance_v.nominal_throttle) * fwd_pitch_gain;
454  int32_t fwd_pitch = ANGLE_BFP_OF_REAL(alt_control_pitch / MAX_PPRZ);
455 
456  /* Hover regime */
458  hybrid_delta_t = hover_thrust;
459 
460  // Do not control pitch and only PID for hover
461  v_control_pitch = 0;
462  guidance_pid.kp = GUIDANCE_V_HOVER_KP;
463  guidance_pid.kd = GUIDANCE_V_HOVER_KD;
464  guidance_pid.ki = GUIDANCE_V_HOVER_KI;
465  }
466  /* Forward regime */
468  hybrid_delta_t = fwd_thrust;
469 
470  //Control altitude with pitch, now only proportional control
471  v_control_pitch = fwd_pitch;
472  guidance_pid.kp = GUIDANCE_V_HOVER_KP / fwd_pid_div;
473  guidance_pid.kd = GUIDANCE_V_HOVER_KD / fwd_pid_div;
474  guidance_pid.ki = GUIDANCE_V_HOVER_KI / fwd_pid_div;
475  }
476  /* Transition regime */
477  else {
478  float airspeed_transition = (guidance_hybrid_norm_ref_airspeed_f - AIRSPEED_HOVER) / (AIRSPEED_FORWARD - AIRSPEED_HOVER); // scaled to 0-1
479  hybrid_delta_t = (fwd_thrust * airspeed_transition
480  + hover_thrust * (1 - airspeed_transition));
481 
482  // Control by both thrust and pitch
483  v_control_pitch = fwd_pitch * airspeed_transition;
484  guidance_pid.kp = GUIDANCE_V_HOVER_KP;
485  guidance_pid.kd = GUIDANCE_V_HOVER_KD;
486  guidance_pid.ki = GUIDANCE_V_HOVER_KI;
487  }
488 
489  return hybrid_delta_t;
490 }
491 
492 
493 #if GUIDANCE_HYBRID_USE_AS_DEFAULT
494 // guidance hybrid is implementing the default functions of guidance
495 
496 void guidance_h_run_enter(void)
497 {
498  /*Obtain eulers with zxy rotation order*/
499  struct FloatEulers eulers_zxy;
502 }
503 
504 void guidance_v_run_enter(void)
505 {
506  // nothing to do
507 }
508 
509 struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
510 {
511  return guidance_hybrid_h_run_pos(in_flight, gh);
512 }
513 
514 struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
515 {
516  return guidance_hybrid_h_run_speed(in_flight, gh);
517 }
518 
519 struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
520 {
521  return guidance_hybrid_h_run_accel(in_flight, gh);
522 }
523 
524 int32_t guidance_v_run_pos(bool in_flight, struct VerticalGuidance *gv)
525 {
526  return guidance_hybrid_v_run_pos(in_flight, gv);
527 }
528 
529 int32_t guidance_v_run_speed(bool in_flight, struct VerticalGuidance *gv)
530 {
531  return guidance_hybrid_v_run_speed(in_flight, gv);
532 }
533 
534 int32_t guidance_v_run_accel(bool in_flight, struct VerticalGuidance *gv)
535 {
536  return guidance_hybrid_v_run_accel(in_flight, gv);
537 }
538 
539 #endif
540 
uint8_t last_wp UNUSED
float psi
in radians
#define FLOAT_ANGLE_NORMALIZE(_a)
void float_eulers_of_quat_zxy(struct FloatEulers *e, struct FloatQuat *q)
euler rotation 'ZXY' This rotation order is useful if you need 90 deg pitch
void float_quat_of_orientation_vect(struct FloatQuat *q, const struct FloatVect3 *ov)
Quaternion from orientation vector.
euler angles
Roation quaternion.
#define VECT2_ADD(_a, _b)
Definition: pprz_algebra.h:74
#define VECT2_DIFF(_c, _a, _b)
Definition: pprz_algebra.h:92
#define VECT2_COPY(_a, _b)
Definition: pprz_algebra.h:68
#define VECT2_SDIV(_vo, _vi, _s)
Definition: pprz_algebra.h:104
#define QUAT_BFP_OF_REAL(_qi, _qf)
Definition: pprz_algebra.h:752
int32_t phi
in rad with INT32_ANGLE_FRAC
int32_t psi
in rad with INT32_ANGLE_FRAC
int32_t theta
in rad with INT32_ANGLE_FRAC
void int32_quat_comp(struct Int32Quat *a2c, struct Int32Quat *a2b, struct Int32Quat *b2c)
Composition (multiplication) of two quaternions.
void int32_quat_of_axis_angle(struct Int32Quat *q, struct Int32Vect3 *uv, int32_t angle)
Quaternion from unit vector and angle.
#define INT_MULT_RSHIFT(_a, _b, _r)
#define INT32_POS_FRAC
#define ANGLE_BFP_OF_REAL(_af)
#define INT32_ANGLE_PI
#define INT32_TRIG_FRAC
static uint32_t int32_vect2_norm(struct Int32Vect2 *v)
return norm of 2D vector
#define POS_FLOAT_OF_BFP(_ai)
#define FLOAT_OF_BFP(_vbfp, _frac)
#define INT32_ANGLE_FRAC
#define INT_VECT2_ZERO(_v)
#define ANGLE_FLOAT_OF_BFP(_ai)
#define INT32_VECT2_RSHIFT(_o, _i, _r)
#define POS_BFP_OF_REAL(_af)
#define INT_EULERS_ZERO(_e)
euler angles
Rotation quaternion.
int32_t y
East.
int32_t x
North.
vector in North East Down coordinates
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
Definition: state.h:1131
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
Definition: state.h:665
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
Definition: state.h:863
struct StabilizationSetpoint guidance_hybrid_h_run_pos(bool in_flight UNUSED, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_hybrid_h_run_speed(bool in_flight UNUSED, struct HorizontalGuidance *gh)
float fwd_pitch_gain
int32_t guidance_hybrid_norm_ref_airspeed
#define FWD_NOMINAL_PITCH
float guidance_hybrid_norm_ref_airspeed_f
float fwd_alt_thrust_gain
static int32_t omega_disp
static int32_t v_control_pitch
#define FWD_PID_DIV
#define MAX_AIRSPEED
int32_t guidance_hybrid_v_run_speed(bool in_flight, struct VerticalGuidance *gv)
static struct Int32Vect2 guidance_h_pos_err
static struct Int32Eulers guidance_hybrid_ypr_sp
float fwd_pid_div
float turn_bank_gain
static int32_t airspeed_sp_heading_disp
struct StabilizationSetpoint guidance_hybrid_run(void)
Runs the Hybrid Guidance main functions.
static struct Int32Vect2 guidance_hybrid_groundspeed_sp
static void send_hybrid_guidance(struct transport_tx *trans, struct link_device *dev)
#define HOVER_P_GAIN
struct StabilizationSetpoint guidance_hybrid_h_run_accel(bool in_flight UNUSED, struct HorizontalGuidance *gh UNUSED)
#define CRUISE_THROTTLE
int32_t guidance_hybrid_v_run_pos(bool in_flight, struct VerticalGuidance *gv)
#define FWD_ALT_THRUST_GAIN
static bool guidance_hovering
void guidance_hybrid_determine_wind_estimate(void)
Description.
static struct Int32Vect2 guidance_hybrid_airspeed_sp
int32_t max_airspeed
#define INT32_ANGLE_HIGH_RES_NORMALIZE(_a)
int32_t hover_p_gain
static int32_t heading_diff_disp
int32_t fwd_speed_p_gain
float fwd_nominal_pitch
#define FWD_PITCH_GAIN
void guidance_hybrid_groundspeed_to_airspeed(void)
Description.
static struct Int32Vect2 wind_estimate_high_res
static struct Int32Vect2 guidance_hybrid_airspeed_ref
void guidance_hybrid_airspeed_to_attitude(struct Int32Eulers *ypr_sp)
Convert a required airspeed to a certain attitude for the Quadshot.
int32_t guidance_hybrid_vertical(int32_t delta_t)
Take a thrust command as input and returns the modified value according to the current flight regime.
int32_t horizontal_speed_gain
int32_t wind_gain
int32_t cruise_throttle
#define FWD_SPEED_P_GAIN
struct StabilizationSetpoint guidance_hybrid_set_cmd_i(struct Int32Eulers *sp_cmd)
Creates the attitude set-points from an orientation vector.
static int32_t high_res_psi
float max_turn_bank
static struct Int32Vect2 guidance_hybrid_ref_airspeed
static struct Int32Vect2 wind_estimate
int32_t guidance_hybrid_v_run_accel(bool in_flight, struct VerticalGuidance *gv)
void guidance_hybrid_reset_heading(struct Int32Eulers *sp_cmd)
Description.
#define AIRSPEED_FORWARD
void guidance_hybrid_init(void)
Hybrid Guidance Initialization function.
#define INT32_ANGLE_HIGH_RES_FRAC
#define AIRSPEED_HOVER
bool force_forward_flight
static int32_t norm_sp_airspeed_disp
Guidance controllers (horizontal and vertical) for Hybrid UAV configurations.
struct FloatEulers eulers_zxy
state eulers in zxy order
void guidance_v_run_enter(void)
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)
struct GuidancePID guidance_pid
Guidance PID structyre.
Definition: guidance_pid.c:124
int32_t guidance_pid_v_run_accel(bool in_flight UNUSED, struct VerticalGuidance *gv UNUSED)
Definition: guidance_pid.c:381
int32_t guidance_pid_v_run_pos(bool in_flight, struct VerticalGuidance *gv)
Definition: guidance_pid.c:371
int32_t guidance_pid_v_run_speed(bool in_flight, struct VerticalGuidance *gv)
Definition: guidance_pid.c:376
Guidance controller with PID for rotorcrafts.
int32_t ki
Definition: guidance_pid.h:42
int32_t kd
Definition: guidance_pid.h:41
int32_t kp
Definition: guidance_pid.h:40
#define MAX_PPRZ
Definition: paparazzi.h:8
#define PPRZ_ITRIG_SIN(_s, _a)
#define PPRZ_ITRIG_COS(_c, _a)
Generic interface for radio control modules.
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)
struct VerticalGuidance guidance_v
Definition: guidance_v.c:59
Vertical guidance for rotorcrafts.
float nominal_throttle
nominal throttle for hover.
Definition: guidance_v.h:103
struct RotorcraftNavigation nav
Definition: navigation.c:51
float heading
heading setpoint (in radians)
Definition: navigation.h:133
General attitude stabilization interface for rotorcrafts.
void stabilization_attitude_set_rpy_setpoint_i(struct Int32Eulers *rpy)
struct StabilizationSetpoint stab_sp_from_quat_i(struct Int32Quat *quat)
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
Stabilization setpoint.
Definition: stabilization.h:42
union StabilizationSetpoint::@278 sp
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