Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
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 
int32_t psi
in rad with INT32_ANGLE_FRAC
float comode_time
struct ctrl_module_demo_struct ctrl
General attitude stabilization interface for rotorcrafts.
int32_t theta
in rad with INT32_ANGLE_FRAC
void guidance_h_module_read_rc(void)
bool in_flight
in flight status
Definition: autopilot.h:65
Read an attitude setpoint from the RC.
void stabilization_attitude_run(bool in_flight)
struct pprz_autopilot autopilot
Global autopilot structure.
Definition: autopilot.c:50
euler angles
void stabilization_attitude_set_rpy_setpoint_i(struct Int32Eulers *rpy)
example empty controller
void guidance_h_module_enter(void)
void guidance_h_module_run(bool in_flight)
#define ANGLE_BFP_OF_REAL(_af)
Core autopilot interface common to all firmwares.
int32_t phi
in rad with INT32_ANGLE_FRAC
API to get/set the generic vehicle states.
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.
void guidance_h_module_init(void)
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
Definition: state.h:1125