Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
autopilot.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2012 The Paparazzi Team
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 
30 
31 #include "mcu_periph/uart.h"
33 #include "subsystems/gps.h"
34 #include "subsystems/commands.h"
35 #include "subsystems/actuators.h"
36 #include "subsystems/electrical.h"
37 #include "subsystems/settings.h"
42 
43 #ifdef POWER_SWITCH_GPIO
44 #include "mcu_periph/gpio.h"
45 #endif
46 
49 
53 
56 
57 bool_t autopilot_rc;
59 
62 
64 #ifndef AUTOPILOT_IN_FLIGHT_TIME
65 #define AUTOPILOT_IN_FLIGHT_TIME 20
66 #endif
67 
69 #ifndef AUTOPILOT_IN_FLIGHT_MIN_SPEED
70 #define AUTOPILOT_IN_FLIGHT_MIN_SPEED 0.2
71 #endif
72 
74 #ifndef AUTOPILOT_IN_FLIGHT_MIN_ACCEL
75 #define AUTOPILOT_IN_FLIGHT_MIN_ACCEL 2.0
76 #endif
77 
79 #ifndef AUTOPILOT_IN_FLIGHT_MIN_THRUST
80 #define AUTOPILOT_IN_FLIGHT_MIN_THRUST 500
81 #endif
82 
83 #ifndef AUTOPILOT_DISABLE_AHRS_KILL
84 #include "subsystems/ahrs.h"
85 static inline int ahrs_is_aligned(void) {
86  return (ahrs.status == AHRS_RUNNING);
87 }
88 #else
89 PRINT_CONFIG_MSG("Using AUTOPILOT_DISABLE_AHRS_KILL")
90 static inline int ahrs_is_aligned(void) {
91  return TRUE;
92 }
93 #endif
94 
96 #ifndef FAILSAFE_DESCENT_SPEED
97 #define FAILSAFE_DESCENT_SPEED 1.5
99 #endif
100 
102 #ifndef FAILSAFE_MODE_TOO_FAR_FROM_HOME
103 #define FAILSAFE_MODE_TOO_FAR_FROM_HOME AP_MODE_FAILSAFE
104 #endif
105 
106 
107 #if USE_KILL_SWITCH_FOR_MOTOR_ARMING
108 #include "autopilot_arming_switch.h"
109 PRINT_CONFIG_MSG("Using kill switch for motor arming")
110 #elif USE_THROTTLE_FOR_MOTOR_ARMING
112 PRINT_CONFIG_MSG("Using throttle for motor arming")
113 #else
114 #include "autopilot_arming_yaw.h"
115 PRINT_CONFIG_MSG("Using 2 sec yaw for motor arming")
116 #endif
117 
118 #ifndef MODE_STARTUP
119 #define MODE_STARTUP AP_MODE_KILL
120 PRINT_CONFIG_MSG("Using default AP_MODE_KILL as MODE_STARTUP")
121 #endif
122 
123 #ifndef UNLOCKED_HOME_MODE
124 #if MODE_AUTO1 == AP_MODE_HOME
125 #define UNLOCKED_HOME_MODE TRUE
126 PRINT_CONFIG_MSG("Enabled UNLOCKED_HOME_MODE since MODE_AUTO1 is AP_MODE_HOME")
127 #elif MODE_AUTO2 == AP_MODE_HOME
128 #define UNLOCKED_HOME_MODE TRUE
129 PRINT_CONFIG_MSG("Enabled UNLOCKED_HOME_MODE since MODE_AUTO2 is AP_MODE_HOME")
130 #else
131 #define UNLOCKED_HOME_MODE FALSE
132 #endif
133 #endif
134 
135 static void send_alive(void) {
136  DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
137 }
138 
139 #if USE_MOTOR_MIXING
141 #endif
142 
143 static void send_status(void) {
144  uint32_t imu_nb_err = 0;
145 #if USE_MOTOR_MIXING
147 #else
148  uint8_t _motor_nb_err = 0;
149 #endif
150 #if USE_GPS
151  uint8_t fix = gps.fix;
152 #else
153  uint8_t fix = GPS_FIX_NONE;
154 #endif
155  uint16_t time_sec = sys_time.nb_sec;
156  DOWNLINK_SEND_ROTORCRAFT_STATUS(DefaultChannel, DefaultDevice,
157  &imu_nb_err, &_motor_nb_err,
159  &fix, &autopilot_mode,
162  &electrical.vsupply, &time_sec);
163 }
164 
165 static void send_energy(void) {
166  const int16_t e = electrical.energy;
167  const float vsup = ((float)electrical.vsupply) / 10.0f;
168  const float curs = ((float)electrical.current) / 1000.0f;
169  const float power = vsup * curs;
170  DOWNLINK_SEND_ENERGY(DefaultChannel, DefaultDevice, &vsup, &curs, &e, &power);
171 }
172 
173 static void send_fp(void) {
174  int32_t carrot_up = -guidance_v_z_sp;
175  DOWNLINK_SEND_ROTORCRAFT_FP(DefaultChannel, DefaultDevice,
176  &(stateGetPositionEnu_i()->x),
177  &(stateGetPositionEnu_i()->y),
178  &(stateGetPositionEnu_i()->z),
179  &(stateGetSpeedEnu_i()->x),
180  &(stateGetSpeedEnu_i()->y),
181  &(stateGetSpeedEnu_i()->z),
187  &carrot_up,
189  &stabilization_cmd[COMMAND_THRUST],
191 }
192 
193 #ifdef RADIO_CONTROL
194 static void send_rc(void) {
196 }
197 
198 static void send_rotorcraft_rc(void) {
199 #ifdef RADIO_KILL_SWITCH
201 #else
202  int16_t _kill_switch = 42;
203 #endif
204  DOWNLINK_SEND_ROTORCRAFT_RADIO_CONTROL(DefaultChannel, DefaultDevice,
210  &_kill_switch,
212 }
213 #endif
214 
215 #ifdef ACTUATORS
216 static void send_actuators(void) {
217  DOWNLINK_SEND_ACTUATORS(DefaultChannel, DefaultDevice , ACTUATORS_NB, actuators);
218 }
219 #endif
220 
221 static void send_dl_value(void) {
222  PeriodicSendDlValue(DefaultChannel, DefaultDevice);
223 }
224 
225 static void send_rotorcraft_cmd(void) {
226  DOWNLINK_SEND_ROTORCRAFT_CMD(DefaultChannel, DefaultDevice,
227  &stabilization_cmd[COMMAND_ROLL],
228  &stabilization_cmd[COMMAND_PITCH],
229  &stabilization_cmd[COMMAND_YAW],
230  &stabilization_cmd[COMMAND_THRUST]);
231 }
232 
233 
234 void autopilot_init(void) {
235  /* mode is finally set at end of init if MODE_STARTUP is not KILL */
245  autopilot_rc = TRUE;
247 #ifdef POWER_SWITCH_GPIO
249  gpio_clear(POWER_SWITCH_GPIO); // POWER OFF
250 #endif
251 
253 
254  nav_init();
255  guidance_h_init();
256  guidance_v_init();
258 
259  /* set startup mode, propagates through to guidance h/v */
261 
262  register_periodic_telemetry(DefaultPeriodic, "ALIVE", send_alive);
263  register_periodic_telemetry(DefaultPeriodic, "ROTORCRAFT_STATUS", send_status);
264  register_periodic_telemetry(DefaultPeriodic, "ENERGY", send_energy);
265  register_periodic_telemetry(DefaultPeriodic, "ROTORCRAFT_FP", send_fp);
266  register_periodic_telemetry(DefaultPeriodic, "ROTORCRAFT_CMD", send_rotorcraft_cmd);
267  register_periodic_telemetry(DefaultPeriodic, "DL_VALUE", send_dl_value);
268 #ifdef ACTUATORS
269  register_periodic_telemetry(DefaultPeriodic, "ACTUATORS", send_actuators);
270 #endif
271 #ifdef RADIO_CONTROL
272  register_periodic_telemetry(DefaultPeriodic, "RC", send_rc);
273  register_periodic_telemetry(DefaultPeriodic, "ROTORCRAFT_RADIO_CONTROL", send_rotorcraft_rc);
274 #endif
275 }
276 
277 
278 #define NAV_PRESCALER (PERIODIC_FREQUENCY / NAV_FREQ)
279 void autopilot_periodic(void) {
280 
281  RunOnceEvery(NAV_PRESCALER, compute_dist2_to_home());
282 
284  if (too_far_from_home) {
287  else
289  }
290  }
291 
292  if (autopilot_mode == AP_MODE_HOME) {
293  RunOnceEvery(NAV_PRESCALER, nav_home());
294  }
295  else {
296  // otherwise always call nav_periodic_task so that carrot is always updated in GCS for other modes
297  RunOnceEvery(NAV_PRESCALER, nav_periodic_task());
298  }
299 
300 
301  /* If in FAILSAFE mode and either already not in_flight anymore
302  * or just "detected" ground, go to KILL mode.
303  */
305  if (!autopilot_in_flight)
307 
308 #if FAILSAFE_GROUND_DETECT
309 INFO("Using FAILSAFE_GROUND_DETECT: KILL")
312 #endif
313  }
314 
315  /* Reset ground detection _after_ running flight plan
316  */
317  if (!autopilot_in_flight) {
320  }
321 
322  /* Set fixed "failsafe" commands from airframe file if in KILL mode.
323  * If in FAILSAFE mode, run normal loops with failsafe attitude and
324  * downwards velocity setpoints.
325  */
326  if (autopilot_mode == AP_MODE_KILL) {
328  }
329  else {
333  }
334 
335 }
336 
337 
338 void autopilot_set_mode(uint8_t new_autopilot_mode) {
339 
340  /* force kill mode as long as AHRS is not aligned */
341  if (!ahrs_is_aligned())
342  new_autopilot_mode = AP_MODE_KILL;
343 
344  if (new_autopilot_mode != autopilot_mode) {
345  /* horizontal mode */
346  switch (new_autopilot_mode) {
347  case AP_MODE_FAILSAFE:
348 #ifndef KILL_AS_FAILSAFE
351  break;
352 #endif
353  case AP_MODE_KILL:
357  break;
358  case AP_MODE_RC_DIRECT:
360  break;
361  case AP_MODE_RATE_DIRECT:
362  case AP_MODE_RATE_Z_HOLD:
364  break;
370  break;
371  case AP_MODE_FORWARD:
373  break;
376  break;
378  case AP_MODE_HOVER_CLIMB:
381  break;
382  case AP_MODE_HOME:
383  case AP_MODE_NAV:
385  break;
386  default:
387  break;
388  }
389  /* vertical mode */
390  switch (new_autopilot_mode) {
391  case AP_MODE_FAILSAFE:
392 #ifndef KILL_AS_FAILSAFE
395  break;
396 #endif
397  case AP_MODE_KILL:
399  stabilization_cmd[COMMAND_THRUST] = 0;
401  break;
402  case AP_MODE_RC_DIRECT:
403  case AP_MODE_RATE_DIRECT:
407  case AP_MODE_FORWARD:
409  break;
413  break;
415  case AP_MODE_HOVER_CLIMB:
417  break;
418  case AP_MODE_RATE_Z_HOLD:
422  break;
423  case AP_MODE_HOME:
424  case AP_MODE_NAV:
426  break;
427  default:
428  break;
429  }
430  autopilot_mode = new_autopilot_mode;
431  }
432 
433 }
434 
435 
436 void autopilot_check_in_flight(bool_t motors_on) {
437  if (autopilot_in_flight) {
438  if (autopilot_in_flight_counter > 0) {
439  /* probably in_flight if thrust, speed and accel above IN_FLIGHT_MIN thresholds */
440  if ((stabilization_cmd[COMMAND_THRUST] <= AUTOPILOT_IN_FLIGHT_MIN_THRUST) &&
443  {
445  if (autopilot_in_flight_counter == 0) {
447  }
448  }
449  else { /* thrust, speed or accel not above min threshold, reset counter */
451  }
452  }
453  }
454  else { /* currently not in flight */
456  motors_on)
457  {
458  /* if thrust above min threshold, assume in_flight.
459  * Don't check for velocity and acceleration above threshold here...
460  */
461  if (stabilization_cmd[COMMAND_THRUST] > AUTOPILOT_IN_FLIGHT_MIN_THRUST) {
465  }
466  else { /* currently not in_flight and thrust below threshold, reset counter */
468  }
469  }
470  }
471 }
472 
473 
474 void autopilot_set_motors_on(bool_t motors_on) {
475  if (autopilot_mode != AP_MODE_KILL && ahrs_is_aligned() && motors_on)
477  else
481 }
482 
483 
485 
486  if (kill_switch_is_on()) {
488  }
489  else if ((autopilot_mode != AP_MODE_HOME)
492 #endif
493  )
494  {
495  uint8_t new_autopilot_mode = 0;
496  AP_MODE_OF_PPRZ(radio_control.values[RADIO_MODE], new_autopilot_mode);
497 
498 #if USE_GPS
499  /* don't enter NAV mode if GPS is lost (this also prevents mode oscillations) */
500  if (!(new_autopilot_mode == AP_MODE_NAV && GpsIsLost()))
501 #endif
502  autopilot_set_mode(new_autopilot_mode);
503  }
504 
505  /* if not in FAILSAFE or HOME mode check motor and in_flight status, read RC */
507 
508  /* if there are some commands that should always be set from RC, do it */
509 #ifdef SetAutoCommandsFromRC
510  SetAutoCommandsFromRC(commands, radio_control.values);
511 #endif
512 
513  /* if not in NAV_MODE set commands from the rc */
514 #ifdef SetCommandsFromRC
515  if (autopilot_mode != AP_MODE_NAV) {
516  SetCommandsFromRC(commands, radio_control.values);
517  }
518 #endif
519 
520  /* an arming sequence is used to start/stop motors */
523 
526  }
527 
528 }
int32_t guidance_v_z_sp
altitude setpoint in meters (input).
Definition: guidance_v.c:117
unsigned short uint16_t
Definition: types.h:16
#define AP_MODE_KILL
Definition: autopilot.h:39
static void send_fp(void)
Definition: autopilot.c:173
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define AP_MODE_ATTITUDE_DIRECT
Definition: autopilot.h:43
static void autopilot_arming_check_motors_on(void)
State machine to check if motors should be turned ON or OFF using the kill switch.
Attitude and Heading Reference System interface.
#define GUIDANCE_V_MODE_NAV
Definition: guidance_v.h:40
#define GUIDANCE_H_MODE_RC_DIRECT
Definition: guidance_h.h:57
#define GUIDANCE_H_MODE_CARE_FREE
Definition: guidance_h.h:58
#define POWER_SWITCH_GPIO
Definition: apogee_1.0.h:95
void autopilot_init(void)
Autopilot inititalization.
Definition: autopilot.c:142
bool_t autopilot_ground_detected
Definition: autopilot.c:60
uint8_t autopilot_mode
Definition: autopilot.c:47
Periodic telemetry system header (includes downlink utility and generated code).
bool_t autopilot_motors_on
Definition: autopilot.c:54
#define AP_MODE_HOVER_DIRECT
Definition: autopilot.h:49
uint16_t autopilot_flight_time
flight time in seconds.
Definition: autopilot.c:47
void guidance_v_run(bool_t in_flight)
Definition: guidance_v.c:249
static bool_t kill_switch_is_on(void)
float psi
in radians
#define FAILSAFE_MODE_TOO_FAR_FROM_HOME
Mode that is set when the plane is really too far from home.
Definition: autopilot.c:103
void guidance_v_init(void)
Definition: guidance_v.c:171
Some architecture independent helper functions for GPIOs.
#define AP_MODE_RATE_RC_CLIMB
Definition: autopilot.h:44
static void send_energy(void)
Definition: autopilot.c:165
#define RADIO_KILL_SWITCH
#define AUTOPILOT_IN_FLIGHT_MIN_ACCEL
minimum vertical acceleration for in_flight condition in m/s^2
Definition: autopilot.c:75
#define AP_MODE_FORWARD
Definition: autopilot.h:55
#define AP_MODE_RATE_Z_HOLD
Definition: autopilot.h:47
static void autopilot_arming_set(bool_t motors_on)
struct Ahrs ahrs
global AHRS state
Definition: ahrs.c:30
void guidance_v_mode_changed(uint8_t new_mode)
Definition: guidance_v.c:213
#define GUIDANCE_H_MODE_ATTITUDE
Definition: guidance_h.h:54
float energy
consumed energy in mAh
Definition: electrical.h:51
#define AP_MODE_ATTITUDE_Z_HOLD
Definition: autopilot.h:48
uint16_t vsupply
supply voltage in decivolts
Definition: electrical.h:48
bool_t autopilot_detect_ground_once
Definition: autopilot.c:61
static void send_rc(void)
Definition: autopilot.c:194
Autopilot modes.
void stabilization_init(void)
Definition: stabilization.c:30
#define AP_MODE_HOVER_CLIMB
Definition: autopilot.h:50
uint8_t autopilot_mode_auto2
Definition: autopilot.c:48
float theta
in radians
uint8_t fix
status of fix
Definition: gps.h:78
bool_t register_periodic_telemetry(struct pprz_telemetry *_pt, const char *_msg, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:38
#define GUIDANCE_V_MODE_KILL
Definition: guidance_v.h:35
#define FALSE
Definition: imu_chimu.h:141
const pprz_t commands_failsafe[COMMANDS_NB]
Definition: commands.c:31
#define RADIO_PITCH
Definition: spektrum_arch.h:45
#define AP_MODE_RATE_DIRECT
Definition: autopilot.h:42
uint32_t nb_saturation
Definition: motor_mixing.h:40
Automatically arm the motors when applying throttle.
#define SetRotorcraftCommands(_cmd, _in_flight,_motor_on)
Set Rotorcraft commands.
Definition: autopilot.h:128
#define MODE_AUTO2
Definition: autopilot.h:87
void autopilot_check_in_flight(bool_t motors_on)
Definition: autopilot.c:436
uint32_t autopilot_in_flight_counter
Definition: autopilot.c:51
#define AP_MODE_RC_DIRECT
Definition: autopilot.h:53
#define GUIDANCE_H_MODE_HOVER
Definition: guidance_h.h:55
int32_t guidance_h_heading_sp
with INT32_ANGLE_FRAC
Definition: guidance_h.c:86
void autopilot_set_motors_on(bool_t motors_on)
Definition: autopilot.c:474
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:55
void guidance_h_read_rc(bool_t in_flight)
Definition: guidance_h.c:261
#define AP_MODE_CARE_FREE_DIRECT
Definition: autopilot.h:54
Arm the motors using a switch.
#define AUTOPILOT_IN_FLIGHT_MIN_THRUST
minimum thrust for in_flight condition in pprz_t units (max = 9600)
Definition: autopilot.c:80
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Definition: state.h:833
float phi
in radians
Interface for electrical status: supply voltage, current, battery status, etc.
static void send_rotorcraft_cmd(void)
Definition: autopilot.c:225
bool_t autopilot_power_switch
Definition: autopilot.c:58
#define GPS_FIX_NONE
Definition: gps.h:41
Device independent GPS code (interface)
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
Definition: state.h:938
bool_t autopilot_in_flight
Definition: autopilot.c:50
uint8_t status
status of the AHRS, AHRS_UNINIT or AHRS_RUNNING
Definition: ahrs.h:45
#define GUIDANCE_V_MODE_CLIMB
Definition: guidance_v.h:38
unsigned long uint32_t
Definition: types.h:18
struct Int32Vect2 guidance_h_pos_sp
horizontal position setpoint in NED.
Definition: guidance_h.c:73
signed short int16_t
Definition: types.h:17
void stabilization_attitude_set_failsafe_setpoint(void)
static void autopilot_arming_init(void)
bool_t autopilot_rc
Definition: autopilot.c:57
bool_t kill_throttle
Definition: autopilot.c:41
void guidance_h_run(bool_t in_flight)
Definition: guidance_h.c:307
#define FAILSAFE_DESCENT_SPEED
Set descent speed in failsafe mode.
Definition: autopilot.c:97
void autopilot_on_rc_frame(void)
Definition: autopilot.c:484
#define GUIDANCE_V_MODE_HOVER
Definition: guidance_v.h:39
Hardware independent code for commands handling.
struct RadioControl radio_control
Definition: radio_control.c:25
static void send_alive(void)
Definition: autopilot.c:135
#define GUIDANCE_H_MODE_NAV
Definition: guidance_h.h:56
Hardware independent API for actuators (servos, motor controllers).
uint8_t frame_rate
Definition: radio_control.h:53
#define AP_MODE_NAV
Definition: autopilot.h:52
uint8_t guidance_h_mode
Definition: guidance_h.c:69
#define RADIO_YAW
Definition: spektrum_arch.h:48
#define GUIDANCE_H_MODE_KILL
Definition: guidance_h.h:52
Arm the motors by with max yaw stick.
void autopilot_periodic(void)
Definition: autopilot.c:279
signed long int32_t
Definition: types.h:19
void gpio_clear(uint32_t port, uint16_t pin)
Clear a gpio output to low level.
#define TRUE
Definition: imu_chimu.h:144
uint8_t status
Definition: radio_control.h:50
#define AP_MODE_OF_PPRZ(_rc, _mode)
Definition: autopilot.h:94
uint8_t guidance_v_mode
Definition: guidance_v.c:97
#define RADIO_MODE
Definition: spektrum_arch.h:69
int32_t current
current in milliamps
Definition: electrical.h:49
#define RADIO_THROTTLE
Definition: spektrum_arch.h:39
uint32_t nb_failure
Definition: motor_mixing.h:41
#define SetCommands(t)
Definition: commands.h:41
#define RADIO_CONTROL_NB_CHANNEL
Definition: spektrum_arch.h:34
unsigned char uint8_t
Definition: types.h:14
pprz_t commands[COMMANDS_NB]
Storage of intermediate command values.
Definition: commands.c:30
Persistent settings interface.
static void gpio_setup_output(uint32_t port, uint32_t gpios)
Setup one or more pins of the given GPIO port as outputs.
Definition: gpio_arch.h:76
static struct EnuCoor_i * stateGetSpeedEnu_i(void)
Get ground speed in local ENU coordinates (int).
Definition: state.h:805
static void send_dl_value(void)
Definition: autopilot.c:221
void guidance_h_mode_changed(uint8_t new_mode)
Definition: guidance_h.c:199
General stabilization interface for rotorcrafts.
#define AUTOPILOT_IN_FLIGHT_MIN_SPEED
minimum vertical speed for in_flight condition in m/s
Definition: autopilot.c:70
void guidance_v_read_rc(void)
Definition: guidance_v.c:193
volatile uint32_t nb_sec
full seconds since startup
Definition: sys_time.h:69
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
Definition: stabilization.c:28
#define AP_MODE_HOVER_Z_HOLD
Definition: autopilot.h:51
static bool_t GpsIsLost(void)
Definition: gps.h:114
static int ahrs_is_aligned(void)
Definition: autopilot.c:85
static void send_status(void)
Definition: autopilot.c:143
#define AP_MODE_ATTITUDE_RC_CLIMB
Definition: autopilot.h:45
int32_t guidance_v_zd_sp
vertical speed setpoint in meter/s (input).
Definition: guidance_v.c:118
struct MotorMixing motor_mixing
Definition: motor_mixing.c:94
#define AP_MODE_FAILSAFE
Definition: autopilot.h:40
#define AP_MODE_HOME
Definition: autopilot.h:41
struct Electrical electrical
#define MODE_STARTUP
Definition: autopilot.c:119
#define AUTOPILOT_IN_FLIGHT_TIME
time steps for in_flight detection (at 20Hz, so 20=1second)
Definition: autopilot.c:65
#define GUIDANCE_V_MODE_RC_CLIMB
Definition: guidance_v.h:37
#define RADIO_ROLL
Definition: spektrum_arch.h:42
#define UNLOCKED_HOME_MODE
Definition: autopilot.c:125
static struct EnuCoor_i * stateGetPositionEnu_i(void)
Get position in local ENU coordinates (int).
Definition: state.h:637
#define NAV_PRESCALER
Definition: autopilot.c:278
#define GUIDANCE_H_MODE_FORWARD
Definition: guidance_h.h:59
Motor Mixing.
#define GUIDANCE_V_MODE_RC_DIRECT
Definition: guidance_v.h:36
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
Definition: state.h:1012
#define GUIDANCE_H_MODE_RATE
Definition: guidance_h.h:53
void autopilot_set_mode(uint8_t new_autopilot_mode)
Definition: autopilot.c:338
#define AP_MODE_ATTITUDE_CLIMB
Definition: autopilot.h:46
#define SPEED_BFP_OF_REAL(_af)
struct GpsState gps
global GPS state
Definition: gps.c:41
void guidance_h_init(void)
Definition: guidance_h.c:163
#define AHRS_RUNNING
Definition: ahrs.h:36
static void send_rotorcraft_rc(void)
Definition: autopilot.c:198