Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ctrl_module_outerloop_demo.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015
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, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
28 #include "state.h"
33 #include "autopilot.h"
34 
35 // Own Variables
36 
38 // RC Inputs
39  struct Int32Eulers rc_sp;
40 
41 // Output command
42  struct Int32Eulers cmd;
43 
44 } ctrl;
45 
46 
47 // Settings
48 float comode_time = 0;
49 
50 
52 // Call our controller
53 // Implement own Horizontal loops
55 {
56 }
57 
59 {
60  // Store current heading
62 
63  // Convert RC to setpoint
65 }
66 
68 {
70 }
71 
72 
73 void guidance_h_module_run(bool in_flight)
74 {
75  // YOUR NEW HORIZONTAL OUTERLOOP CONTROLLER GOES HERE
76  // ctrl.cmd = CallMyNewHorizontalOuterloopControl(ctrl);
77  float roll = 0.0;
78  float pitch = 0.0;
79 
80  ctrl.cmd.phi = ANGLE_BFP_OF_REAL(roll);
82 
84  stabilization_attitude_run(in_flight);
85 
86  // Alternatively, use the indi_guidance and send AbiMsgACCEL_SP to it instead of setting pitch and roll
87 }
88 
struct pprz_autopilot autopilot
Global autopilot structure.
Definition: autopilot.c:49
Core autopilot interface common to all firmwares.
bool in_flight
in flight status
Definition: autopilot.h:70
void guidance_h_module_read_rc(void)
struct ctrl_module_demo_struct ctrl
void guidance_h_module_run(bool in_flight)
float comode_time
void guidance_h_module_init(void)
void guidance_h_module_enter(void)
example empty controller
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 ANGLE_BFP_OF_REAL(_af)
euler angles
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
Definition: state.h:1125
Generic interface for radio control modules.
General attitude stabilization interface for rotorcrafts.
void stabilization_attitude_set_rpy_setpoint_i(struct Int32Eulers *rpy)
void stabilization_attitude_run(bool in_flight)
General stabilization interface for rotorcrafts.
void stabilization_attitude_read_rc_setpoint_eulers(struct Int32Eulers *sp, bool in_flight, bool in_carefree, bool coordinated_turn)
Read attitude setpoint from RC as euler angles.
Read an attitude setpoint from the RC.
API to get/set the generic vehicle states.