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"
35 #include "autopilot.h"
36 
37 // Own Variables
38 
40 // RC Inputs
41  struct AttitudeRCInput rc_sp;
42 
43 // Output command
44  struct Int32Eulers cmd;
45 
46 } ctrl;
47 
48 
49 // Settings
50 float comode_time = 0;
51 
52 
54 // Call our controller
55 void ctrl_module_init(void)
56 {
58 }
59 
61 {
62  // Store current heading
64 
65  // Convert RC to setpoint
67 
68  // vertical mode in hover
70 }
71 
72 void guidance_module_run(bool in_flight)
73 {
75 
76  // YOUR NEW HORIZONTAL OUTERLOOP CONTROLLER GOES HERE
77  // ctrl.cmd = CallMyNewHorizontalOuterloopControl(ctrl);
78  float roll = 0.0;
79  float pitch = 0.0;
80 
81  ctrl.cmd.phi = ANGLE_BFP_OF_REAL(roll);
83 
85  struct ThrustSetpoint th = guidance_v_run(in_flight);
86  // execute attitude stabilization:
88 }
89 
bool autopilot_in_flight(void)
get in_flight flag
Definition: autopilot.c:340
Core autopilot interface common to all firmwares.
void ctrl_module_init(void)
struct ctrl_module_demo_struct ctrl
void guidance_module_enter(void)
void guidance_module_run(bool in_flight)
float comode_time
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
struct RadioControl radio_control
Definition: radio_control.c:33
Generic interface for radio control modules.
void guidance_v_mode_changed(uint8_t new_mode)
Definition: guidance_v.c:132
struct ThrustSetpoint guidance_v_run(bool in_flight)
Guidance vertical run functions.
Definition: guidance_v.c:221
Vertical guidance for rotorcrafts.
#define GUIDANCE_V_MODE_HOVER
Definition: guidance_v.h:39
General attitude stabilization interface for rotorcrafts.
void stabilization_attitude_run(bool in_flight, struct StabilizationSetpoint *sp, struct ThrustSetpoint *thrust, int32_t *cmd)
Attitude control run function.
struct Stabilization stabilization
Definition: stabilization.c:41
struct StabilizationSetpoint stab_sp_from_eulers_i(struct Int32Eulers *eulers)
General stabilization interface for rotorcrafts.
int32_t cmd[COMMANDS_NB]
output command vector, range from [-MAX_PPRZ:MAX_PPRZ] (store for messages)
void stabilization_attitude_rc_setpoint_init(struct AttitudeRCInput *rc_sp)
Init rc input.
struct Int32Eulers stabilization_attitude_read_rc_setpoint_eulers(struct AttitudeRCInput *rc_sp, bool in_flight, bool in_carefree, bool coordinated_turn, struct RadioControl *rc)
Read attitude setpoint from RC as euler angles Only the euler format is updated and returned.
Read an attitude setpoint from the RC.
Attitude (and Rate) Remote Control input.
API to get/set the generic vehicle states.
Stabilization setpoint.
Definition: stabilization.h:53
union StabilizationSetpoint::@278 sp
Thrust setpoint // TODO to a setpoint header Structure to store the desired thrust vector with differ...
Definition: stabilization.h:82
union ThrustSetpoint::@284 sp