Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
stabilization_attitude_euler_float.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
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
28#include "generated/airframe.h"
29
32
33#include "std.h"
34#include "paparazzi.h"
36#include "state.h"
37
38#ifndef USE_ATT_REF
39#define USE_ATT_REF 1
40#endif
41
44
47
50
51#if PERIODIC_TELEMETRY
53
79
96#endif
97
130
138
139#define MAX_SUM_ERR 200
140
141void stabilization_attitude_run(bool in_flight, struct StabilizationSetpoint *sp, struct ThrustSetpoint *thrust, int32_t *cmd)
142{
144#if USE_ATT_REF
145 static const float dt = (1./PERIODIC_FREQUENCY);
147#else
151#endif
152
153 /* Compute feedforward */
160
161 /* Compute feedback */
162 /* attitude error */
164 struct FloatEulers att_err;
167
168 if (in_flight) {
169 /* update integrator */
172 } else {
174 }
175
176 /* rate error */
178 struct FloatRates rate_err;
180
181 /* PID */
182
187
192
197
198
203
204 /* bound the result */
209}
float q
in rad/s
float phi
in radians
float p
in rad/s
float r
in rad/s
float theta
in radians
float psi
in radians
#define FLOAT_ANGLE_NORMALIZE(_a)
#define FLOAT_EULERS_ZERO(_e)
#define FLOAT_RATES_ZERO(_r)
euler angles
angular rates
#define EULERS_BOUND_CUBE(_v, _min, _max)
#define EULERS_COPY(_a, _b)
#define EULERS_DIFF(_c, _a, _b)
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define EULERS_ADD(_a, _b)
#define RATES_DIFF(_c, _a, _b)
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Definition state.h:1306
static struct FloatRates * stateGetBodyRates_f(void)
Get vehicle body angular rate (float).
Definition state.h:1367
uint16_t foo
Definition main_demo5.c:58
#define MAX_PPRZ
Definition paparazzi.h:8
Paparazzi floating point algebra.
struct Stabilization stabilization
struct FloatEulers stab_sp_to_eulers_f(struct StabilizationSetpoint *sp)
int32_t th_sp_to_thrust_i(struct ThrustSetpoint *th, int32_t thrust, uint8_t axis)
#define THRUST_AXIS_Z
int32_t cmd[COMMANDS_NB]
output command vector, range from [-MAX_PPRZ:MAX_PPRZ] (store for messages)
static struct FloatEulers stab_att_sp_euler
void stabilization_attitude_run(bool in_flight, struct StabilizationSetpoint *sp, struct ThrustSetpoint *thrust, int32_t *cmd)
Attitude control run function.
void stabilization_attitude_euler_float_init(void)
void stabilization_attitude_enter(void)
Attitude control enter function.
static void send_att_ref(struct transport_tx *trans, struct link_device *dev)
static struct AttRefEulerFloat att_ref_euler_f
struct FloatAttitudeGains stabilization_gains
float stabilization_att_ff_cmd[COMMANDS_NB]
float stabilization_att_fb_cmd[COMMANDS_NB]
struct FloatEulers stabilization_att_sum_err
static void send_att(struct transport_tx *trans, struct link_device *dev)
Rotorcraft attitude stabilization in euler float version.
float stabilization_attitude_get_heading_f(void)
Get attitude heading as float (avoiding jumps)
void attitude_ref_euler_float_enter(struct AttRefEulerFloat *ref, float psi)
void attitude_ref_euler_float_update(struct AttRefEulerFloat *ref, struct FloatEulers *sp_eulers, float dt)
void attitude_ref_euler_float_init(struct AttRefEulerFloat *ref)
Attitude reference state/output (euler float)
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
Definition usb_ser_hw.c:74
Stabilization setpoint.
Thrust setpoint // TODO to a setpoint header Structure to store the desired thrust vector with differ...
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition telemetry.h:66
int int32_t
Typedef defining 32 bit int type.