Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
guidance_h.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"
28 
37 
41 
42 /* for guidance_v.thrust_coeff */
44 
45 #include "state.h"
46 
47 PRINT_CONFIG_VAR(GUIDANCE_H_USE_REF)
48 PRINT_CONFIG_VAR(GUIDANCE_H_USE_SPEED_REF)
49 
51 
53 
58 
59 static void guidance_h_update_reference(void);
60 static inline void transition_run(bool to_forward);
61 static void read_rc_setpoint_speed_i(struct Int32Vect2 *speed_sp, bool in_flight);
62 
63 #if PERIODIC_TELEMETRY
65 
66 static void send_gh(struct transport_tx *trans, struct link_device *dev)
67 {
68  struct NedCoor_i *pos = stateGetPositionNed_i();
69  pprz_msg_send_GUIDANCE_H_INT(trans, dev, AC_ID,
72  &(pos->x), &(pos->y));
73 }
74 
75 static void send_href(struct transport_tx *trans, struct link_device *dev)
76 {
77  pprz_msg_send_GUIDANCE_H_REF_INT(trans, dev, AC_ID,
84 }
85 
86 #if defined(COMMAND_ROLL) && defined(COMMAND_PITCH) && defined(COMMAND_YAW)
87 static void send_tune_hover(struct transport_tx *trans, struct link_device *dev)
88 {
89  pprz_msg_send_ROTORCRAFT_TUNE_HOVER(trans, dev, AC_ID,
93  &stabilization_cmd[COMMAND_ROLL],
94  &stabilization_cmd[COMMAND_PITCH],
95  &stabilization_cmd[COMMAND_YAW],
96  &stabilization_cmd[COMMAND_THRUST],
97  &(stateGetNedToBodyEulers_i()->phi),
98  &(stateGetNedToBodyEulers_i()->theta),
99  &(stateGetNedToBodyEulers_i()->psi));
100 }
101 #else
102 static void send_tune_hover(struct transport_tx *trans UNUSED, struct link_device *dev UNUSED) {}
103 #endif
104 
105 #endif
106 
107 void guidance_h_init(void)
108 {
109 
112 
115  guidance_h.sp.heading = 0.0;
116  guidance_h.sp.heading_rate = 0.0;
117  guidance_h.sp.h_mask = GUIDANCE_H_SP_POS;
118  guidance_h.sp.yaw_mask = GUIDANCE_H_SP_YAW;
121 
122  gh_ref_init();
123 
124 #if GUIDANCE_H_MODE_MODULE_SETTING == GUIDANCE_H_MODE_MODULE
126 #endif
127 
128 #if PERIODIC_TELEMETRY
129  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_GUIDANCE_H_INT, send_gh);
130  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_GUIDANCE_H_REF_INT, send_href);
131  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_ROTORCRAFT_TUNE_HOVER, send_tune_hover);
132 #endif
133 
134 }
135 
136 
138 {
141  struct FloatVect2 ref_speed;
142  ref_speed.x = SPEED_FLOAT_OF_BFP(guidance_h.ref.speed.x);
143  ref_speed.y = SPEED_FLOAT_OF_BFP(guidance_h.ref.speed.y);
144 
146  struct FloatVect2 ref_accel;
147  FLOAT_VECT2_ZERO(ref_accel);
148  gh_set_ref(guidance_h.ref.pos, ref_speed, ref_accel);
149 }
150 
152 {
153  if (new_mode == guidance_h.mode) {
154  return;
155  }
156 
157  switch (new_mode) {
160  break;
161 
162 #if USE_STABILIZATION_RATE
165  break;
166 #endif
167 
170  /* Falls through. */
173 #if NO_ATTITUDE_RESET_ON_MODE_CHANGE
174  /* reset attitude stabilization if previous mode was not using it */
178 #endif
180  break;
181 
185 #if NO_ATTITUDE_RESET_ON_MODE_CHANGE
186  /* reset attitude stabilization if previous mode was not using it */
190 #endif
192  break;
193 
194 #if GUIDANCE_H_MODE_MODULE_SETTING == GUIDANCE_H_MODE_MODULE
197  break;
198 #endif
199 
200  case GUIDANCE_H_MODE_NAV:
202 #if NO_ATTITUDE_RESET_ON_MODE_CHANGE
203  /* reset attitude stabilization if previous mode was not using it */
207 #endif
209  break;
210 
213  break;
214 
215  default:
216  break;
217  }
218 
219  guidance_h.mode = new_mode;
220 
221 }
222 
223 
224 void guidance_h_read_rc(bool in_flight)
225 {
226 
227  switch (guidance_h.mode) {
228 
231  break;
232 
233 #if USE_STABILIZATION_RATE
235 #if SWITCH_STICKS_FOR_RATE_CONTROL
237 #else
239 #endif
240  break;
241 #endif
242 
245  break;
248  break;
251  break;
254 #if GUIDANCE_H_USE_SPEED_REF
256  /* enable x,y velocity setpoints */
257  guidance_h.sp.h_mask = GUIDANCE_H_SP_SPEED;
258 #endif
259  break;
260 
261 #if GUIDANCE_H_MODE_MODULE_SETTING == GUIDANCE_H_MODE_MODULE
264  break;
265 #endif
266 
267  case GUIDANCE_H_MODE_NAV:
268  if (radio_control.status == RC_OK) {
270  } else {
272  }
273  break;
276  break;
277  default:
278  break;
279  }
280 
281 }
282 
283 void guidance_h_run(bool in_flight)
284 {
285  switch (guidance_h.mode) {
286 
288  stabilization_none_run(in_flight);
289  break;
290 
291 #if USE_STABILIZATION_RATE
293  stabilization_rate_run(in_flight);
294  break;
295 #endif
296 
299  transition_run(true);
300  }
301  /* Falls through. */
305  transition_run(false);
306  }
307  stabilization_attitude_run(in_flight);
308 #if (STABILIZATION_FILTER_CMD_ROLL_PITCH || STABILIZATION_FILTER_CMD_YAW)
309  if (in_flight) {
311  }
312 #endif
313 
314  break;
315 
317  /* set psi command from RC */
319  /* fall trough to GUIDED to update ref, run traj and set final attitude setpoint */
320 
321  /* Falls through. */
323  guidance_h_guided_run(in_flight);
324  break;
325 
326  case GUIDANCE_H_MODE_NAV:
327  guidance_h_from_nav(in_flight);
328  break;
329 
330 #if GUIDANCE_H_MODE_MODULE_SETTING == GUIDANCE_H_MODE_MODULE
332  guidance_h_module_run(in_flight);
333  break;
334 #endif
335 
338  break;
339 
340  default:
341  break;
342  }
343 }
344 
345 
347 {
348  /* compute reference even if usage temporarily disabled via guidance_h_use_ref */
349 #if GUIDANCE_H_USE_REF
350  if (guidance_h.sp.h_mask == GUIDANCE_H_SP_ACCEL) {
351  struct FloatVect2 sp_accel_local;
352  sp_accel_local.x = ACCEL_FLOAT_OF_BFP(guidance_h.sp.accel.x);
353  sp_accel_local.y = ACCEL_FLOAT_OF_BFP(guidance_h.sp.accel.y);
354  gh_update_ref_from_accel_sp(sp_accel_local);
355  }
356  else if (guidance_h.sp.h_mask == GUIDANCE_H_SP_SPEED) {
357  struct FloatVect2 sp_speed;
358  sp_speed.x = SPEED_FLOAT_OF_BFP(guidance_h.sp.speed.x);
359  sp_speed.y = SPEED_FLOAT_OF_BFP(guidance_h.sp.speed.y);
360  gh_update_ref_from_speed_sp(sp_speed);
361  } else {
363  }
364 #endif
365 
366  /* either use the reference or simply copy the pos setpoint */
367  if (guidance_h.use_ref) {
368  /* convert our reference to generic representation */
374  } else {
375  switch (nav.setpoint_mode) {
381  guidance_h.ref.accel.x = 0;
382  guidance_h.ref.accel.y = 0;
383  break;
384 
392  break;
393 
395  default: // Fallback is guidance by pos
399  break;
400  }
401  }
402 
403 #if GUIDANCE_H_USE_SPEED_REF
405  VECT2_COPY(guidance_h.sp.pos, guidance_h.ref.pos); // for display only
406  }
407 #endif
408 
409  /* update heading setpoint from rate */
410  if (guidance_h.sp.yaw_mask == GUIDANCE_H_SP_YAW_RATE) {
411  guidance_h.sp.heading += guidance_h.sp.heading_rate / PERIODIC_FREQUENCY;
413  }
414 }
415 
417 {
418  /* reset speed setting */
419  guidance_h.sp.speed.x = 0;
420  guidance_h.sp.speed.y = 0;
421 
422  /* set horizontal setpoint to current position */
426  /* reset guidance reference */
428 
429  /* set guidance to current heading and position */
432 
433  /* call specific implementation */
435 }
436 
438 {
439  /* horizontal position setpoint from navigation/flightplan */
442 
443  /* call specific implementation */
446 }
447 
448 void guidance_h_from_nav(bool in_flight)
449 {
450  if (!in_flight) {
452  }
453 
455  return; // don't call guidance nor stabilization
458  // directly apply quat setpoint
459  struct Int32Quat quat_i;
460  QUAT_BFP_OF_REAL(quat_i, nav.quat);
462  stabilization_attitude_run(in_flight);
463  }
464  else {
465  // it should be nav.setpoint_mode == NAV_SETPOINT_MODE_ATTITUDE
466  // TODO error handling ?
467  struct Int32Eulers sp_cmd_i;
468  sp_cmd_i.phi = ANGLE_BFP_OF_REAL(nav.roll);
469  sp_cmd_i.theta = ANGLE_BFP_OF_REAL(nav.pitch);
470  sp_cmd_i.psi = ANGLE_BFP_OF_REAL(nav.heading);
472  stabilization_attitude_run(in_flight);
473  }
475  guidance_h_guided_run(in_flight);
476  } else {
477  // update carrot for GCS display and convert ENU float -> NED int
478  // even if sp is changed later
481 
482  switch (nav.setpoint_mode) {
484  guidance_h_set_pos(nav.carrot.y, nav.carrot.x); // nav pos is in ENU frame, convert to NED
488  break;
489 
491  guidance_h_set_vel(nav.speed.y, nav.speed.x); // nav speed is in ENU frame, convert to NED
495  break;
496 
498  guidance_h_set_acc(nav.accel.y, nav.accel.x); // nav acc is in ENU frame, convert to NED
502  break;
503 
504  default:
505  // nothing to do for other cases at the moment
506  break;
507  }
508  /* set final attitude setpoint */
510  stabilization_attitude_run(in_flight);
511 
512  }
513 }
514 
515 static inline void transition_run(bool to_forward)
516 {
517  if (to_forward) {
518  //Add 0.00625%
520  } else {
521  //Subtract 0.00625%
523  }
524 
525 #ifdef TRANSITION_MAX_OFFSET
526  const int32_t max_offset = ANGLE_BFP_OF_REAL(TRANSITION_MAX_OFFSET);
528  max_offset, INT32_ANGLE_FRAC);
529 #endif
530 }
531 
533 static void read_rc_setpoint_speed_i(struct Int32Vect2 *speed_sp, bool in_flight)
534 {
535  if (in_flight) {
536  // negative pitch is forward
537  int64_t rc_x = -radio_control.values[RADIO_PITCH];
538  int64_t rc_y = radio_control.values[RADIO_ROLL];
539  DeadBand(rc_x, MAX_PPRZ / 20);
540  DeadBand(rc_y, MAX_PPRZ / 20);
541 
542  // convert input from MAX_PPRZ range to SPEED_BFP
545  //int32_t rc_norm = sqrtf(rc_x * rc_x + rc_y * rc_y);
546  //int32_t max_pprz = rc_norm * MAX_PPRZ / Max(abs(rc_x), abs(rc_y);
547  rc_x = rc_x * max_speed / MAX_PPRZ;
548  rc_y = rc_y * max_speed / MAX_PPRZ;
549 
550  /* Rotate from body to NED frame by negative psi angle */
552  int32_t s_psi, c_psi;
553  PPRZ_ITRIG_SIN(s_psi, psi);
554  PPRZ_ITRIG_COS(c_psi, psi);
555  speed_sp->x = (int32_t)(((int64_t)c_psi * rc_x + (int64_t)s_psi * rc_y) >> INT32_TRIG_FRAC);
556  speed_sp->y = (int32_t)((-(int64_t)s_psi * rc_x + (int64_t)c_psi * rc_y) >> INT32_TRIG_FRAC);
557  } else {
558  speed_sp->x = 0;
559  speed_sp->y = 0;
560  }
561 }
562 
563 void guidance_h_guided_run(bool in_flight)
564 {
565  /* guidance_h.sp.pos and guidance_h.sp.heading need to be set from external source */
566  if (!in_flight) {
568  }
569 
571 
573  /* set final attitude setpoint */
575  stabilization_attitude_run(in_flight);
576 }
577 
578 void guidance_h_set_pos(float x, float y)
579 {
580  if (guidance_h.sp.h_mask != GUIDANCE_H_SP_POS) {
582  }
583  guidance_h.sp.h_mask = GUIDANCE_H_SP_POS;
586 }
587 
589 {
590  guidance_h.sp.yaw_mask = GUIDANCE_H_SP_YAW;
593 }
594 
595 void guidance_h_set_body_vel(float vx, float vy)
596 {
597  float psi = stateGetNedToBodyEulers_f()->psi;
598  float newvx = cosf(-psi) * vx + sinf(-psi) * vy;
599  float newvy = -sinf(-psi) * vx + cosf(-psi) * vy;
600  guidance_h_set_vel(newvx, newvy);
601 }
602 
603 void guidance_h_set_vel(float vx, float vy)
604 {
605  if (guidance_h.sp.h_mask != GUIDANCE_H_SP_SPEED) {
607  }
608  guidance_h.sp.h_mask = GUIDANCE_H_SP_SPEED;
611 }
612 
613 void guidance_h_set_body_acc(float ax, float ay)
614 {
615  float psi = stateGetNedToBodyEulers_f()->psi;
616  float newax = cosf(-psi) * ax + sinf(-psi) * ay;
617  float neway = -sinf(-psi) * ax + cosf(-psi) * ay;
618  guidance_h_set_acc(newax, neway);
619 }
620 
621 void guidance_h_set_acc(float ax, float ay)
622 {
623  if (guidance_h.sp.h_mask != GUIDANCE_H_SP_ACCEL) {
625  }
626  guidance_h.sp.h_mask = GUIDANCE_H_SP_ACCEL;
629 }
630 
632 {
633  guidance_h.sp.yaw_mask = GUIDANCE_H_SP_YAW_RATE;
634  guidance_h.sp.heading_rate = rate;
635 }
636 
uint8_t last_wp UNUSED
void guidance_h_module_read_rc(void)
void guidance_h_module_run(bool in_flight)
void guidance_h_module_init(void)
void guidance_h_module_enter(void)
float psi
in radians
#define FLOAT_ANGLE_NORMALIZE(_a)
#define FLOAT_EULERS_ZERO(_e)
#define FLOAT_VECT2_ZERO(_v)
#define VECT2_COPY(_a, _b)
Definition: pprz_algebra.h:68
#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
#define INT_MULT_RSHIFT(_a, _b, _r)
#define INT32_POS_FRAC
#define ANGLE_BFP_OF_REAL(_af)
#define INT32_PERCENTAGE_FRAC
#define ACCEL_BFP_OF_REAL(_af)
#define INT32_TRIG_FRAC
#define SPEED_FLOAT_OF_BFP(_ai)
#define INT32_ANGLE_FRAC
#define INT_VECT2_ZERO(_v)
#define INT32_VECT2_RSHIFT(_o, _i, _r)
#define POS_BFP_OF_REAL(_af)
#define ACCEL_FLOAT_OF_BFP(_ai)
#define SPEED_BFP_OF_REAL(_af)
euler angles
Rotation quaternion.
int32_t y
East.
int32_t x
North.
vector in North East Down coordinates
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
Definition: state.h:1125
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Definition: state.h:1143
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
Definition: state.h:710
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
void guidance_flip_run(void)
Definition: guidance_flip.c:65
void guidance_flip_enter(void)
Definition: guidance_flip.c:56
Open Loop guidance for making a flip.
void gh_set_ref(struct Int32Vect2 pos, struct FloatVect2 speed, struct FloatVect2 accel)
void gh_update_ref_from_accel_sp(struct FloatVect2 accel_sp)
void gh_ref_init(void)
void gh_update_ref_from_pos_sp(struct Int32Vect2 pos_sp)
void gh_update_ref_from_speed_sp(struct FloatVect2 speed_sp)
struct GuidanceHRef gh_ref
#define GH_POS_REF_FRAC
fixedpoint representation: Q26.37 will give a range of 67e3 km and a resolution of 1....
struct FloatVect2 accel
Reference model acceleration.
#define GUIDANCE_H_REF_MAX_SPEED
Default speed saturation.
struct Int64Vect2 pos
Reference model position.
struct FloatVect2 speed
Reference model speed.
Guidance controllers (horizontal and vertical) for Hybrid UAV configurations.
struct FloatVect3 speed_sp
Definition: guidance_indi.c:77
Guidance in a module file.
#define MAX_PPRZ
Definition: paparazzi.h:8
float y
in meters
float x
in meters
#define PPRZ_ITRIG_SIN(_s, _a)
#define PPRZ_ITRIG_COS(_c, _a)
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
uint8_t status
Definition: radio_control.h:61
#define RC_OK
Definition: radio_control.h:49
int32_t transition_percentage
Definition: guidance_h.c:52
void guidance_h_set_acc(float ax, float ay)
Set horizontal velocity setpoint.
Definition: guidance_h.c:621
struct StabilizationSetpoint guidance_h_cmd
horizontal guidance command.
Definition: guidance_h.c:57
void guidance_h_read_rc(bool in_flight)
Definition: guidance_h.c:224
void guidance_h_set_pos(float x, float y)
Set horizontal position setpoint.
Definition: guidance_h.c:578
void guidance_h_mode_changed(uint8_t new_mode)
Definition: guidance_h.c:151
static void send_href(struct transport_tx *trans, struct link_device *dev)
Definition: guidance_h.c:75
static void send_gh(struct transport_tx *trans, struct link_device *dev)
Definition: guidance_h.c:66
void guidance_h_hover_enter(void)
Definition: guidance_h.c:416
static void send_tune_hover(struct transport_tx *trans UNUSED, struct link_device *dev UNUSED)
Definition: guidance_h.c:102
void guidance_h_set_body_acc(float ax, float ay)
Set body relative horizontal acceleration setpoint.
Definition: guidance_h.c:613
void guidance_h_guided_run(bool in_flight)
Run GUIDED mode control.
Definition: guidance_h.c:563
void guidance_h_from_nav(bool in_flight)
Set horizontal guidance from NAV and run control loop.
Definition: guidance_h.c:448
void guidance_h_set_heading(float heading)
Set heading setpoint.
Definition: guidance_h.c:588
void guidance_h_init(void)
Definition: guidance_h.c:107
struct HorizontalGuidance guidance_h
Definition: guidance_h.c:50
static void read_rc_setpoint_speed_i(struct Int32Vect2 *speed_sp, bool in_flight)
read speed setpoint from RC
Definition: guidance_h.c:533
void guidance_h_nav_enter(void)
Definition: guidance_h.c:437
static void guidance_h_update_reference(void)
Definition: guidance_h.c:346
void guidance_h_set_vel(float vx, float vy)
Set horizontal acceleration setpoint.
Definition: guidance_h.c:603
void guidance_h_set_body_vel(float vx, float vy)
Set body relative horizontal velocity setpoint.
Definition: guidance_h.c:595
static void reset_guidance_reference_from_current_position(void)
Definition: guidance_h.c:137
static void transition_run(bool to_forward)
Definition: guidance_h.c:515
void guidance_h_set_heading_rate(float rate)
Set heading rate setpoint.
Definition: guidance_h.c:631
void guidance_h_run(bool in_flight)
Definition: guidance_h.c:283
Horizontal guidance for rotorcrafts.
#define GUIDANCE_H_MODE_FORWARD
Definition: guidance_h.h:63
#define GUIDANCE_H_MODE_NAV
Definition: guidance_h.h:60
#define GUIDANCE_H_USE_REF
Use horizontal guidance reference trajectory.
Definition: guidance_h.h:45
struct Int32Vect2 accel
with INT32_ACCEL_FRAC
Definition: guidance_h.h:101
void guidance_h_run_enter(void)
#define GUIDANCE_H_MODE_HOVER
Definition: guidance_h.h:59
struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
struct Int32Vect2 speed
with INT32_SPEED_FRAC
Definition: guidance_h.h:100
struct FloatEulers rc_sp
remote control setpoint
Definition: guidance_h.h:112
#define GUIDANCE_H_MODE_ATTITUDE
Definition: guidance_h.h:58
struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
#define GUIDANCE_H_MODE_GUIDED
Definition: guidance_h.h:66
#define GUIDANCE_H_MODE_RC_DIRECT
Definition: guidance_h.h:61
struct Int32Vect2 pos
with INT32_POS_FRAC
Definition: guidance_h.h:99
struct HorizontalGuidanceReference ref
reference calculated from setpoints
Definition: guidance_h.h:110
#define GUIDANCE_H_USE_SPEED_REF
Use horizontal guidance speed reference.
Definition: guidance_h.h:53
#define GUIDANCE_H_MODE_CARE_FREE
Definition: guidance_h.h:62
struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
#define GUIDANCE_H_MODE_KILL
Definition: guidance_h.h:56
#define GUIDANCE_H_MODE_RATE
Definition: guidance_h.h:57
struct HorizontalGuidanceSetpoint sp
setpoints
Definition: guidance_h.h:109
#define GUIDANCE_H_MODE_FLIP
Definition: guidance_h.h:65
#define GUIDANCE_H_MODE_MODULE
Definition: guidance_h.h:64
Vertical guidance for rotorcrafts.
struct RotorcraftNavigation nav
Definition: navigation.c:51
Rotorcraft navigation functions.
#define NAV_SETPOINT_MODE_QUAT
Definition: navigation.h:104
struct EnuCoor_f speed
speed setpoint (in m/s)
Definition: navigation.h:128
#define NAV_SETPOINT_MODE_SPEED
Definition: navigation.h:101
struct FloatQuat quat
quaternion setpoint
Definition: navigation.h:134
struct EnuCoor_f accel
accel setpoint (in m/s)
Definition: navigation.h:129
#define NAV_SETPOINT_MODE_ACCEL
Definition: navigation.h:102
#define NAV_HORIZONTAL_MODE_GUIDED
Definition: navigation.h:90
#define NAV_HORIZONTAL_MODE_ATTITUDE
Definition: navigation.h:88
float pitch
pitch angle (in radians)
Definition: navigation.h:132
#define NAV_HORIZONTAL_MODE_NONE
Definition: navigation.h:89
float heading
heading setpoint (in radians)
Definition: navigation.h:133
struct EnuCoor_f carrot
carrot position (also used for GCS display)
Definition: navigation.h:127
#define NAV_SETPOINT_MODE_POS
Nav setpoint modes these modes correspond to submodes defined by navigation routines to tell which se...
Definition: navigation.h:100
float roll
roll angle (in radians)
Definition: navigation.h:131
General attitude stabilization interface for rotorcrafts.
void stabilization_attitude_enter(void)
void stabilization_attitude_set_quat_setpoint_i(struct Int32Quat *quat)
void stabilization_attitude_set_stab_sp(struct StabilizationSetpoint *sp)
void stabilization_attitude_set_rpy_setpoint_i(struct Int32Eulers *rpy)
void stabilization_attitude_read_rc(bool in_flight, bool in_carefree, bool coordinated_turn)
void stabilization_attitude_run(bool in_flight)
void stabilization_filter_commands(void)
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
Definition: stabilization.c:34
General stabilization interface for rotorcrafts.
void stabilization_attitude_reset_care_free_heading(void)
reset the heading for care-free mode to current heading
int32_t transition_theta_offset
void stabilization_attitude_read_rc_setpoint_eulers_f(struct FloatEulers *sp, bool in_flight, bool in_carefree, bool coordinated_turn)
Read an attitude setpoint from the RC.
void stabilization_none_read_rc(void)
void stabilization_none_enter(void)
void stabilization_none_run(bool in_flight)
Dummy stabilization for rotorcrafts.
void stabilization_rate_read_rc(void)
void stabilization_rate_enter(void)
void stabilization_rate_read_rc_switched_sticks(void)
void stabilization_rate_run(bool in_flight)
Rate stabilization for rotorcrafts.
API to get/set the generic vehicle states.
#define TRUE
Definition: std.h:4
#define FALSE
Definition: std.h:5
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
enum HorizontalGuidanceSetpoint::@269 h_mask
enum HorizontalGuidanceSetpoint::@270 yaw_mask
struct Int32Vect2 pos
horizontal position setpoint in NED.
Definition: guidance_h.h:80
struct Int32Vect2 accel
For direct control of acceleration, if the guidance scheme is able to provide it.
Definition: guidance_h.h:82
struct Int32Vect2 speed
only used in HOVER mode if GUIDANCE_H_USE_SPEED_REF or in GUIDED mode
Definition: guidance_h.h:81
Stabilization setpoint.
Definition: stabilization.h:42
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
float heading
Definition: wedgebug.c:258