Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ctrl_module_innerloop_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"
30 #include "generated/radio.h"
32 
34  int rc_x;
35  int rc_y;
36  int rc_z;
37  int rc_t;
38 
40 
41 float ctrl_module_demo_pr_ff_gain = 0.2f; // Pitch/Roll
43 float ctrl_module_demo_y_ff_gain = 0.4f; // Yaw
45 
46 void ctrl_module_init(void)
47 {
52 }
53 
54 // simple rate control without reference model nor attitude
55 static void ctrl_module_run(bool in_flight)
56 {
57  if (!in_flight) {
58  // Reset integrators
59  stabilization.cmd[COMMAND_ROLL] = 0;
60  stabilization.cmd[COMMAND_PITCH] = 0;
61  stabilization.cmd[COMMAND_YAW] = 0;
62  stabilization.cmd[COMMAND_THRUST] = 0;
63  } else {
70  stabilization.cmd[COMMAND_THRUST] = ctrl_module_demo.rc_t;
71  }
72 }
73 
74 
76 // Call our controller
78 {
80 }
81 
82 void guidance_module_run(bool in_flight)
83 {
84  // -MAX_PPRZ to MAX_PPRZ
89  // Call full inner-/outerloop / horizontal-/vertical controller:
90  ctrl_module_run(in_flight);
91 }
92 
void ctrl_module_init(void)
float ctrl_module_demo_y_d_gain
static void ctrl_module_run(bool in_flight)
struct ctrl_module_demo_struct ctrl_module_demo
void guidance_module_enter(void)
void guidance_module_run(bool in_flight)
float ctrl_module_demo_y_ff_gain
float ctrl_module_demo_pr_d_gain
float ctrl_module_demo_pr_ff_gain
example empty controller
int32_t p
in rad/s with INT32_RATE_FRAC
int32_t r
in rad/s with INT32_RATE_FRAC
int32_t q
in rad/s with INT32_RATE_FRAC
static struct Int32Rates * stateGetBodyRates_i(void)
Get vehicle body angular rate (int).
Definition: state.h:1191
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
struct Stabilization stabilization
Definition: stabilization.c:41
General stabilization interface for rotorcrafts.
int32_t cmd[COMMANDS_NB]
output command vector, range from [-MAX_PPRZ:MAX_PPRZ] (store for messages)
API to get/set the generic vehicle states.