Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
nav.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin
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 
28 #define NAV_C
29 
30 #include <math.h>
31 
32 #include "subsystems/nav.h"
33 #include "subsystems/gps.h"
36 #include "inter_mcu.h"
38 
39 #define RCLost() bit_is_set(fbw_state->status, STATUS_RADIO_REALLY_LOST)
40 
42 
43 float last_x, last_y;
44 
46 static uint8_t last_wp __attribute__ ((unused));
47 
48 float rc_pitch;
50 
52 float nav_circle_radians; /* Cumulated */
53 float nav_circle_radians_no_rewind; /* Cumulated */
54 float nav_circle_trigo_qdr; /* Angle from center to mobile */
56 
57 
59 static float nav_leg_progress;
60 
62 static float nav_leg_length;
63 
69 float circle_bank = 0;
70 
73 
75 #ifndef NAV_GLIDE_PITCH_TRIM
76 #define NAV_GLIDE_PITCH_TRIM 0.
77 #endif
78 
79 
80 
82 
83 /* Used in nav_survey_rectangle. Defined here for downlink and uplink */
87 
89 
90 void nav_init_stage( void ) {
93  stage_time = 0;
94  nav_circle_radians = 0;
95  nav_circle_radians_no_rewind = 0;
96  nav_in_circle = FALSE;
97  nav_in_segment = FALSE;
98  nav_shift = 0;
99  nav_pitch = 0.;
100 }
101 
102 #define PowerVoltage() (vsupply/10.)
103 #define RcRoll(travel) (fbw_state->channels[RADIO_ROLL]* (float)travel /(float)MAX_PPRZ)
104 
105 #define MIN_DX ((int16_t)(MAX_PPRZ * 0.05))
106 
107 
109 void nav_circle_XY(float x, float y, float radius) {
110  struct EnuCoor_f* pos = stateGetPositionEnu_f();
111  float last_trigo_qdr = nav_circle_trigo_qdr;
112  nav_circle_trigo_qdr = atan2(pos->y - y, pos->x - x);
113  float sign_radius = radius > 0 ? 1 : -1;
114 
115  if (nav_in_circle) {
116  float trigo_diff = nav_circle_trigo_qdr - last_trigo_qdr;
117  NormRadAngle(trigo_diff);
118  nav_circle_radians += trigo_diff;
119  trigo_diff *= - sign_radius;
120  if (trigo_diff > 0) // do not rewind if the change in angle is in the opposite sense than nav_radius
121  nav_circle_radians_no_rewind += trigo_diff;
122  }
123 
124  float dist2_center = DistanceSquare(pos->x, pos->y, x, y);
125  float dist_carrot = CARROT*NOMINAL_AIRSPEED;
126 
127  radius += -nav_shift;
128 
129  float abs_radius = fabs(radius);
130 
132  circle_bank =
133  (dist2_center > Square(abs_radius + dist_carrot)
134  || dist2_center < Square(abs_radius - dist_carrot)) ?
135  0 :
137 
138  float carrot_angle = dist_carrot / abs_radius;
139  carrot_angle = Min(carrot_angle, M_PI/4);
140  carrot_angle = Max(carrot_angle, M_PI/16);
141  float alpha_carrot = nav_circle_trigo_qdr - sign_radius * carrot_angle;
142  horizontal_mode = HORIZONTAL_MODE_CIRCLE;
143  float radius_carrot = abs_radius;
144  if (nav_mode == NAV_MODE_COURSE) {
145  radius_carrot += (abs_radius / cos(carrot_angle) - abs_radius);
146  }
147  fly_to_xy(x+cos(alpha_carrot)*radius_carrot,
148  y+sin(alpha_carrot)*radius_carrot);
149  nav_in_circle = TRUE;
150  nav_circle_x = x;
151  nav_circle_y = y;
152  nav_circle_radius = radius;
153 }
154 
155 
156 #define NavGlide(_last_wp, _wp) { \
157  float start_alt = waypoints[_last_wp].a; \
158  float diff_alt = waypoints[_wp].a - start_alt; \
159  float alt = start_alt + nav_leg_progress * diff_alt; \
160  float pre_climb = (*stateGetHorizontalSpeedNorm_f()) * diff_alt / nav_leg_length; \
161  NavVerticalAltitudeMode(alt, pre_climb); \
162  }
163 
164 
165 
166 
167 #define MAX_DIST_CARROT 250.
168 #define MIN_HEIGHT_CARROT 50.
169 #define MAX_HEIGHT_CARROT 150.
170 
171 #define Goto3D(radius) { \
172  if (pprz_mode == PPRZ_MODE_AUTO2) { \
173  int16_t yaw = fbw_state->channels[RADIO_YAW]; \
174  if (yaw > MIN_DX || yaw < -MIN_DX) { \
175  carrot_x += FLOAT_OF_PPRZ(yaw, 0, -20.); \
176  carrot_x = Min(carrot_x, MAX_DIST_CARROT); \
177  carrot_x = Max(carrot_x, -MAX_DIST_CARROT); \
178  } \
179  int16_t pitch = fbw_state->channels[RADIO_PITCH]; \
180  if (pitch > MIN_DX || pitch < -MIN_DX) { \
181  carrot_y += FLOAT_OF_PPRZ(pitch, 0, -20.); \
182  carrot_y = Min(carrot_y, MAX_DIST_CARROT); \
183  carrot_y = Max(carrot_y, -MAX_DIST_CARROT); \
184  } \
185  v_ctl_mode = V_CTL_MODE_AUTO_ALT; \
186  int16_t roll = fbw_state->channels[RADIO_ROLL]; \
187  if (roll > MIN_DX || roll < -MIN_DX) { \
188  nav_altitude += FLOAT_OF_PPRZ(roll, 0, -1.0); \
189  nav_altitude = Max(nav_altitude, MIN_HEIGHT_CARROT+ground_alt); \
190  nav_altitude = Min(nav_altitude, MAX_HEIGHT_CARROT+ground_alt); \
191  } \
192  } \
193  nav_circle_XY(carrot_x, carrot_y, radius); \
194  }
195 
196 
197 #define NavFollow(_ac_id, _distance, _height) \
198  nav_follow(_ac_id, _distance, _height);
199 
200 
201 static unit_t unit __attribute__ ((unused));
202 
203 static inline void nav_follow(uint8_t _ac_id, float _distance, float _height);
204 
205 #ifdef NAV_GROUND_SPEED_PGAIN
206 
208 static void nav_ground_speed_loop( void ) {
209  if (MINIMUM_AIRSPEED < nav_ground_speed_setpoint
210  && nav_ground_speed_setpoint < MAXIMUM_AIRSPEED) {
211  float err = nav_ground_speed_setpoint - (*stateGetHorizontalSpeedNorm_f());
212  v_ctl_auto_throttle_cruise_throttle += nav_ground_speed_pgain*err;
213  Bound(v_ctl_auto_throttle_cruise_throttle, V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE, V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE);
214  } else {
215  /* Reset cruise throttle to nominal value */
216  v_ctl_auto_throttle_cruise_throttle = V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE;
217  }
218 }
219 #endif
220 
221 static float baseleg_out_qdr;
222 static inline bool_t nav_compute_baseleg(uint8_t wp_af, uint8_t wp_td, uint8_t wp_baseleg, float radius ) {
223  nav_radius = radius;
224 
225  float x_0 = waypoints[wp_td].x - waypoints[wp_af].x;
226  float y_0 = waypoints[wp_td].y - waypoints[wp_af].y;
227 
228  /* Unit vector from AF to TD */
229  float d = sqrt(x_0*x_0+y_0*y_0);
230  float x_1 = x_0 / d;
231  float y_1 = y_0 / d;
232 
233  waypoints[wp_baseleg].x = waypoints[wp_af].x + y_1 * nav_radius;
234  waypoints[wp_baseleg].y = waypoints[wp_af].y - x_1 * nav_radius;
235  waypoints[wp_baseleg].a = waypoints[wp_af].a;
236  baseleg_out_qdr = M_PI - atan2(-y_1, -x_1);
237  if (nav_radius < 0)
238  baseleg_out_qdr += M_PI;
239 
240  return FALSE;
241 }
242 
243 static inline bool_t nav_compute_final_from_glide(uint8_t wp_af, uint8_t wp_td, float glide ) {
244 
245  float x_0 = waypoints[wp_td].x - waypoints[wp_af].x;
246  float y_0 = waypoints[wp_td].y - waypoints[wp_af].y;
247  float h_0 = waypoints[wp_td].a - waypoints[wp_af].a;
248 
249  /* Unit vector from AF to TD */
250  float d = sqrt(x_0*x_0+y_0*y_0);
251  float x_1 = x_0 / d;
252  float y_1 = y_0 / d;
253 
254  waypoints[wp_af].x = waypoints[wp_td].x + x_1 * h_0 * glide;
255  waypoints[wp_af].y = waypoints[wp_td].y + y_1 * h_0 * glide;
256  waypoints[wp_af].a = waypoints[wp_af].a;
257 
258  return FALSE;
259 }
260 
261 
262 /* For a landing UPWIND.
263  Computes Top Of Descent waypoint from Touch Down and Approach Fix
264  waypoints, using glide airspeed, glide vertical speed and wind */
265 static inline bool_t compute_TOD(uint8_t _af, uint8_t _td, uint8_t _tod, float glide_airspeed, float glide_vspeed) {
266  struct FloatVect2* wind = stateGetHorizontalWindspeed_f();
267  float td_af_x = WaypointX(_af) - WaypointX(_td);
268  float td_af_y = WaypointY(_af) - WaypointY(_td);
269  float td_af = sqrt( td_af_x*td_af_x + td_af_y*td_af_y);
270  float td_tod = (WaypointAlt(_af) - WaypointAlt(_td)) / glide_vspeed * (glide_airspeed - sqrt(wind->x*wind->x + wind->y*wind->y));
271  WaypointX(_tod) = WaypointX(_td) + td_af_x / td_af * td_tod;
272  WaypointY(_tod) = WaypointY(_td) + td_af_y / td_af * td_tod;
273  WaypointAlt(_tod) = WaypointAlt(_af);
274  return FALSE;
275 }
276 
277 
278 #include "generated/flight_plan.h"
279 
280 
281 #ifndef LINE_START_FUNCTION
282 #define LINE_START_FUNCTION {}
283 #endif
284 #ifndef LINE_STOP_FUNCTION
285 #define LINE_STOP_FUNCTION {}
286 #endif
287 
288 
289 
290 static inline void nav_follow(uint8_t _ac_id, float _distance, float _height) {
291  struct ac_info_ * ac = get_ac_info(_ac_id);
293  NavVerticalAltitudeMode(Max(ac->alt + _height, ground_alt+SECURITY_HEIGHT), 0.);
294  float alpha = M_PI/2 - ac->course;
295  float ca = cos(alpha), sa = sin(alpha);
296  float x = ac->east - _distance*ca;
297  float y = ac->north - _distance*sa;
298  fly_to_xy(x, y);
299 #ifdef NAV_FOLLOW_PGAIN
300  float s = (stateGetPositionEnu_f()->x - x)*ca + (stateGetPositionEnu_f()->y - y)*sa;
301  nav_ground_speed_setpoint = ac->gspeed + NAV_FOLLOW_PGAIN*s;
302  nav_ground_speed_loop();
303 #endif
304 }
305 
306 float nav_altitude = GROUND_ALT + MIN_HEIGHT_CARROT;
309 float nav_pitch; /* Rad */
310 float fp_pitch; /* deg */
311 
312 
319 bool_t nav_approaching_xy(float x, float y, float from_x, float from_y, float approaching_time) {
321  float pw_x = x - stateGetPositionEnu_f()->x;
323  float pw_y = y - stateGetPositionEnu_f()->y;
324 
325  dist2_to_wp = pw_x*pw_x + pw_y *pw_y;
326  float min_dist = approaching_time * (*stateGetHorizontalSpeedNorm_f());
327  if (dist2_to_wp < min_dist*min_dist)
328  return TRUE;
329 
330  float scal_prod = (x - from_x) * pw_x + (y - from_y) * pw_y;
331 
332  return (scal_prod < 0.);
333 }
334 
335 
339 //static inline void fly_to_xy(float x, float y) {
340 void fly_to_xy(float x, float y) {
341  struct EnuCoor_f* pos = stateGetPositionEnu_f();
342  desired_x = x;
343  desired_y = y;
344  if (nav_mode == NAV_MODE_COURSE) {
345  h_ctl_course_setpoint = atan2(x - pos->x, y - pos->y);
346  if (h_ctl_course_setpoint < 0.)
347  h_ctl_course_setpoint += 2 * M_PI;
349  } else {
350  float diff = atan2(x - pos->x, y - pos->y) - (*stateGetHorizontalSpeedDir_f());
351  NormRadAngle(diff);
352  BoundAbs(diff,M_PI/2.);
353  float s = sin(diff);
354  float speed = *stateGetHorizontalSpeedNorm_f();
355  h_ctl_roll_setpoint = atan(2 * speed * speed * s * h_ctl_course_pgain / (CARROT * NOMINAL_AIRSPEED * 9.81) );
358  }
359 }
360 
364 void nav_route_xy(float last_wp_x, float last_wp_y, float wp_x, float wp_y) {
365  float leg_x = wp_x - last_wp_x;
366  float leg_y = wp_y - last_wp_y;
367  float leg2 = Max(leg_x * leg_x + leg_y * leg_y, 1.);
368  nav_leg_progress = ((stateGetPositionEnu_f()->x - last_wp_x) * leg_x + (stateGetPositionEnu_f()->y - last_wp_y) * leg_y) / leg2;
369  nav_leg_length = sqrt(leg2);
370 
372  float carrot = CARROT * NOMINAL_AIRSPEED;
373 
374  nav_leg_progress += Max(carrot / nav_leg_length, 0.);
375  nav_in_segment = TRUE;
376  nav_segment_x_1 = last_wp_x;
377  nav_segment_y_1 = last_wp_y;
378  nav_segment_x_2 = wp_x;
379  nav_segment_y_2 = wp_y;
380  horizontal_mode = HORIZONTAL_MODE_ROUTE;
381 
382  fly_to_xy(last_wp_x + nav_leg_progress*leg_x +nav_shift*leg_y/nav_leg_length, last_wp_y + nav_leg_progress*leg_y-nav_shift*leg_x/nav_leg_length);
383 }
384 
386 
387 #ifndef FAILSAFE_HOME_RADIUS
388 #define FAILSAFE_HOME_RADIUS DEFAULT_CIRCLE_RADIUS
389 #endif
390 
391 static void nav_set_altitude(void) {
392  static float last_nav_altitude;
393  if (fabs(nav_altitude - last_nav_altitude) > 1.) {
394  flight_altitude = nav_altitude;
395  last_nav_altitude = nav_altitude;
396  }
398 }
399 
401 void nav_home(void) {
404  nav_pitch = 0.;
406  nav_altitude = ground_alt+HOME_MODE_HEIGHT;
410 }
411 
416 void nav_periodic_task(void) {
417  nav_survey_active = FALSE;
418 
420  dist2_to_wp = 0.;
421 
422  auto_nav(); /* From flight_plan.h */
423 
424  h_ctl_course_pre_bank = nav_in_circle ? circle_bank : 0;
425 
426 #ifdef AGR_CLIMB
429 #endif
430 
432 }
433 
434 
438 void nav_init(void) {
439  nav_block = 0;
440  nav_stage = 0;
441  ground_alt = GROUND_ALT;
442  nav_glide_pitch_trim = NAV_GLIDE_PITCH_TRIM;
443  nav_radius = DEFAULT_CIRCLE_RADIUS;
444  nav_survey_shift = 2*DEFAULT_CIRCLE_RADIUS;
445  nav_mode = NAV_MODE_COURSE;
446 
447 #ifdef NAV_GROUND_SPEED_PGAIN
448  nav_ground_speed_pgain = ABS(NAV_GROUND_SPEED_PGAIN);
449  nav_ground_speed_setpoint = NOMINAL_AIRSPEED;
450 #endif
451 }
452 
459 void nav_without_gps(void) {
462 
463 #ifdef SECTION_FAILSAFE
464  h_ctl_roll_setpoint = FAILSAFE_DEFAULT_ROLL;
465  nav_pitch = FAILSAFE_DEFAULT_PITCH;
466  nav_throttle_setpoint = TRIM_UPPRZ((FAILSAFE_DEFAULT_THROTTLE)*MAX_PPRZ);
467 #else
469  nav_pitch = 0;
470  nav_throttle_setpoint = TRIM_UPPRZ((V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE)*MAX_PPRZ);
471 #endif
472 }
473 
474 
475 /**************** 8 Navigation **********************************************/
476 
477 
478 enum eight_status { R1T, RT2, C2, R2T, RT1, C1 };
479 
481 void nav_eight_init( void ) {
482  eight_status = C1;
483 }
484 
493 void nav_eight(uint8_t target, uint8_t c1, float radius) {
494  float aradius = fabs(radius);
495  float alt = waypoints[target].a;
496  waypoints[c1].a = alt;
497 
498  float target_c1_x = waypoints[c1].x - waypoints[target].x;
499  float target_c1_y = waypoints[c1].y - waypoints[target].y;
500  float d = sqrt(target_c1_x*target_c1_x+target_c1_y*target_c1_y);
501  d = Max(d, 1.); /* To prevent a division by zero */
502 
503  /* Unit vector from target to c1 */
504  float u_x = target_c1_x / d;
505  float u_y = target_c1_y / d;
506 
507  /* Move [c1] closer if needed */
508  if (d > 2 * aradius) {
509  d = 2*aradius;
510  waypoints[c1].x = waypoints[target].x + d*u_x;
511  waypoints[c1].y = waypoints[target].y + d*u_y;
512  }
513 
514  /* The other center */
515  struct point c2 = {
516  waypoints[target].x - d*u_x,
517  waypoints[target].y - d*u_y,
518  alt };
519 
520  struct point c1_in = {
521  waypoints[c1].x + radius * -u_y,
522  waypoints[c1].y + radius * u_x,
523  alt };
524  struct point c1_out = {
525  waypoints[c1].x - radius * -u_y,
526  waypoints[c1].y - radius * u_x,
527  alt };
528 
529  struct point c2_in = {
530  c2.x + radius * -u_y,
531  c2.y + radius * u_x,
532  alt };
533  struct point c2_out = {
534  c2.x - radius * -u_y,
535  c2.y - radius * u_x,
536  alt };
537 
538  float qdr_out = M_PI - atan2(u_y, u_x);
539  if (radius < 0)
540  qdr_out += M_PI;
541 
542  switch (eight_status) {
543  case C1 :
544  NavCircleWaypoint(c1, radius);
545  if (NavQdrCloseTo(DegOfRad(qdr_out)-10)) {
546  eight_status = R1T;
547  InitStage();
548  }
549  return;
550 
551  case R1T:
552  nav_route_xy(c1_out.x, c1_out.y, c2_in.x, c2_in.y);
553  if (nav_approaching_xy(waypoints[target].x, waypoints[target].y, c1_out.x, c1_out.y, 0)) {
554  eight_status = RT2;
555  InitStage();
556  }
557  return;
558 
559  case RT2:
560  nav_route_xy(c1_out.x, c1_out.y, c2_in.x, c2_in.y);
561  if (nav_approaching_xy(c2_in.x, c2_in.y, c1_out.x, c1_out.y, CARROT)) {
562  eight_status = C2;
563  InitStage();
564  }
565  return;
566 
567  case C2 :
568  nav_circle_XY(c2.x, c2.y, -radius);
569  if (NavQdrCloseTo(DegOfRad(qdr_out)+10)) {
570  eight_status = R2T;
571  InitStage();
572  }
573  return;
574 
575  case R2T:
576  nav_route_xy(c2_out.x, c2_out.y, c1_in.x, c1_in.y);
577  if (nav_approaching_xy(waypoints[target].x, waypoints[target].y, c2_out.x, c2_out.y, 0)) {
578  eight_status = RT1;
579  InitStage();
580  }
581  return;
582 
583  case RT1:
584  nav_route_xy(c2_out.x, c2_out.y, c1_in.x, c1_in.y);
585  if (nav_approaching_xy(c1_in.x, c1_in.y, c2_out.x, c2_out.y, CARROT)) {
586  eight_status = C1;
587  InitStage();
588  }
589  return;
590 
591  default:/* Should not occur !!! Doing nothing */
592  return;
593  } /* switch */
594 }
595 
596 /************** Oval Navigation **********************************************/
597 
608 
609 void nav_oval_init( void ) {
610  oval_status = OC2;
611  nav_oval_count = 0;
612 }
613 
614 void nav_oval(uint8_t p1, uint8_t p2, float radius) {
615  radius = - radius; /* Historical error ? */
616 
617  float alt = waypoints[p1].a;
618  waypoints[p2].a = alt;
619 
620  float p2_p1_x = waypoints[p1].x - waypoints[p2].x;
621  float p2_p1_y = waypoints[p1].y - waypoints[p2].y;
622  float d = sqrt(p2_p1_x*p2_p1_x+p2_p1_y*p2_p1_y);
623 
624  /* Unit vector from p1 to p2 */
625  float u_x = p2_p1_x / d;
626  float u_y = p2_p1_y / d;
627 
628  /* The half circle centers and the other leg */
629  struct point p1_center = { waypoints[p1].x + radius * -u_y,
630  waypoints[p1].y + radius * u_x,
631  alt };
632  struct point p1_out = { waypoints[p1].x + 2*radius * -u_y,
633  waypoints[p1].y + 2*radius * u_x,
634  alt };
635 
636  struct point p2_in = { waypoints[p2].x + 2*radius * -u_y,
637  waypoints[p2].y + 2*radius * u_x,
638  alt };
639  struct point p2_center = { waypoints[p2].x + radius * -u_y,
640  waypoints[p2].y + radius * u_x,
641  alt };
642 
643  float qdr_out_2 = M_PI - atan2(u_y, u_x);
644  float qdr_out_1 = qdr_out_2 + M_PI;
645  if (radius < 0) {
646  qdr_out_2 += M_PI;
647  qdr_out_1 += M_PI;
648  }
649  float qdr_anticipation = (radius > 0 ? -15 : 15);
650 
651  switch (oval_status) {
652  case OC1 :
653  nav_circle_XY(p1_center.x,p1_center.y, -radius);
654  if (NavQdrCloseTo(DegOfRad(qdr_out_1)-qdr_anticipation)) {
655  oval_status = OR12;
656  InitStage();
658  }
659  return;
660 
661  case OR12:
662  nav_route_xy(p1_out.x, p1_out.y, p2_in.x, p2_in.y);
663  if (nav_approaching_xy(p2_in.x, p2_in.y, p1_out.x, p1_out.y, CARROT)) {
664  oval_status = OC2;
665  nav_oval_count++;
666  InitStage();
668  }
669  return;
670 
671  case OC2 :
672  nav_circle_XY(p2_center.x, p2_center.y, -radius);
673  if (NavQdrCloseTo(DegOfRad(qdr_out_2)-qdr_anticipation)) {
674  oval_status = OR21;
675  InitStage();
677  }
678  return;
679 
680  case OR21:
681  nav_route_xy(waypoints[p2].x, waypoints[p2].y, waypoints[p1].x, waypoints[p1].y);
682  if (nav_approaching_xy(waypoints[p1].x, waypoints[p1].y, waypoints[p2].x, waypoints[p2].y, CARROT)) {
683  oval_status = OC1;
684  InitStage();
686  }
687  return;
688 
689  default: /* Should not occur !!! Doing nothing */
690  return;
691  }
692 }
static float * stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
Definition: state.h:861
#define Min(x, y)
float v_ctl_altitude_setpoint
in meters above MSL
Definition: energy_ctrl.c:91
float h_ctl_course_setpoint
uint8_t lateral_mode
Definition: autopilot.c:39
int16_t pprz_t
Definition: paparazzi.h:6
float north
Definition: traffic_info.h:38
static float * stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
Definition: state.h:854
static float radius
Definition: chemotaxis.c:15
#define InitStage()
uint8_t nav_block
#define V_CTL_MODE_AUTO_THROTTLE
float dist2_to_home
Definition: common_nav.c:32
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
Definition: state.h:672
struct ac_info_ * get_ac_info(uint8_t id)
Definition: traffic_info.c:44
float y
in meters
float east
Definition: traffic_info.h:37
#define FALSE
Definition: imu_chimu.h:141
float alt
Definition: traffic_info.h:40
Fixed wing horizontal control.
#define V_CTL_AUTO_THROTTLE_STANDARD
#define TRIM_UPPRZ(pprz)
Definition: paparazzi.h:14
#define Max(x, y)
#define V_CTL_MODE_AUTO_ALT
Device independent GPS code (interface)
float x
in meters
static uint16_t c1
Definition: baro_MS5534A.c:196
float course
Definition: traffic_info.h:39
uint8_t v_ctl_auto_throttle_submode
Definition: energy_ctrl.c:79
uint8_t v_ctl_mode
Definition: energy_ctrl.c:77
#define V_CTL_MODE_AUTO_CLIMB
uint16_t stage_time
In s.
float h_ctl_roll_max_setpoint
#define TRUE
Definition: imu_chimu.h:144
uint8_t nav_stage
float h_ctl_course_pre_bank
float v_ctl_auto_throttle_cruise_throttle
Definition: energy_ctrl.c:106
unsigned char uint8_t
Definition: types.h:14
float h_ctl_roll_setpoint
float h_ctl_course_pgain
static struct FloatVect2 * stateGetHorizontalWindspeed_f(void)
Get horizontal windspeed (float).
Definition: state.h:1192
float y
Definition: common_nav.h:41
float dist2_to_wp
Definition: common_nav.c:33
#define LATERAL_MODE_ROLL
Definition: autopilot.h:76
vector in East North Up coordinates Units: meters
int32_t y
North.
#define MAX_PPRZ
Definition: paparazzi.h:8
#define LATERAL_MODE_COURSE
Definition: autopilot.h:77
float gspeed
Definition: traffic_info.h:41
float x
Definition: common_nav.h:40
int32_t x
East.
Information relative to the other aircrafts.
Fixedwing autopilot modes.