34#include "generated/airframe.h" 
   51#ifdef GUIDANCE_INDI_POS_GAIN 
   57#ifdef GUIDANCE_INDI_SPEED_GAIN 
   63#ifndef GUIDANCE_INDI_ACCEL_SP_ID 
   64#define GUIDANCE_INDI_ACCEL_SP_ID ABI_BROADCAST 
   75#ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN 
   79#ifdef GUIDANCE_INDI_THRUST_DYNAMICS 
   80#warning GUIDANCE_INDI_THRUST_DYNAMICS is deprecated, use GUIDANCE_INDI_THRUST_DYNAMICS_FREQ instead. 
   81#warning "The thrust dynamics are now specified in continuous time with the corner frequency of the first order model!" 
   82#warning "define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ in rad/s" 
   83#warning "Use -ln(1 - old_number) * PERIODIC_FREQUENCY to compute it from the old value." 
   86#ifndef GUIDANCE_INDI_THRUST_DYNAMICS_FREQ 
   87#ifndef STABILIZATION_INDI_ACT_FREQ_P 
   88#error "You need to define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ to be able to use indi vertical control" 
   90#define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ STABILIZATION_INDI_ACT_FREQ_P 
   97#ifndef GUIDANCE_INDI_FILTER_CUTOFF 
   98#ifdef STABILIZATION_INDI_FILT_CUTOFF 
   99#define GUIDANCE_INDI_FILTER_CUTOFF STABILIZATION_INDI_FILT_CUTOFF 
  101#define GUIDANCE_INDI_FILTER_CUTOFF 3.0 
  130#if PERIODIC_TELEMETRY 
  159#if PERIODIC_TELEMETRY 
 
  176#ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN 
  177#ifdef GUIDANCE_INDI_THRUST_DYNAMICS 
  186  for (
int8_t i = 0; i < 3; i++) {
 
 
  238#if GUIDANCE_INDI_RC_DEBUG 
  239#warning "GUIDANCE_INDI_RC_DEBUG lets you control the accelerations via RC, but disables autonomous flight!" 
  266#ifndef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN 
  267#ifndef STABILIZATION_ATTITUDE_INDI_FULL 
  280#ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN 
  285#if GUIDANCE_INDI_RC_DEBUG 
 
  366#ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN 
  445  RMAT_ELMT(*
Gmat, 0, 0) = (cphi * spsi - sphi * cpsi * stheta) * T;
 
  446  RMAT_ELMT(*
Gmat, 1, 0) = (-sphi * spsi * stheta - cpsi * cphi) * T;
 
 
  467  } 
else if (
flag == 1) {
 
 
  476#if GUIDANCE_INDI_USE_AS_DEFAULT 
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
Core autopilot interface common to all firmwares.
void float_eulers_of_quat_yxz(struct FloatEulers *e, struct FloatQuat *q)
euler rotation 'YXZ' This function calculates from a quaternion the Euler angles with the order YXZ,...
#define FLOAT_EULERS_ZERO(_e)
void float_quat_of_eulers_yxz(struct FloatQuat *q, struct FloatEulers *e)
quat from euler rotation 'YXZ' This function calculates a quaternion from Euler angles with the order...
#define MAT33_VECT3_MUL(_vout, _mat, _vin)
#define MAT33_INV(_minv, _m)
#define RMAT_ELMT(_rm, _row, _col)
#define POS_FLOAT_OF_BFP(_ai)
#define SPEED_FLOAT_OF_BFP(_ai)
#define ACCEL_FLOAT_OF_BFP(_ai)
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
#define GUIDANCE_INDI_ACCEL_SP_ID
Butterworth2LowPass roll_filt
float guidance_indi_max_bank
bool indi_accel_sp_set_3d
float guidance_indi_pos_gain
struct FloatVect3 sp_accel
struct FloatEulers guidance_euler_cmd
static void guidance_indi_calcG(struct FloatMat33 *Gmat)
struct FloatVect3 speed_sp
static void guidance_indi_calcG_yxz(struct FloatMat33 *Gmat, struct FloatEulers *euler_yxz)
void guidance_indi_enter(void)
Call upon entering indi guidance.
static void accel_sp_cb(uint8_t sender_id, uint8_t flag, struct FloatVect3 *accel_sp)
ABI callback that obtains the acceleration setpoint from telemetry flag: 0 -> 2D, 1 -> 3D.
Butterworth2LowPass pitch_filt
struct ThrustSetpoint thrust_sp
void guidance_indi_init(void)
Init function.
float time_of_accel_sp_3d
#define GUIDANCE_INDI_FILTER_CUTOFF
struct StabilizationSetpoint guidance_indi_run_mode(bool in_flight UNUSED, struct HorizontalGuidance *gh, struct VerticalGuidance *gv, enum GuidanceIndi_HMode h_mode, enum GuidanceIndi_VMode v_mode)
bool indi_accel_sp_set_2d
struct FloatVect3 indi_accel_sp
struct FloatVect3 control_increment
Butterworth2LowPass filt_accel_ned[3]
float guidance_indi_speed_gain
float time_of_accel_sp_2d
struct StabilizationSetpoint guidance_indi_run(struct FloatVect3 *accel_sp, float heading_sp)
Butterworth2LowPass thrust_filt
static void send_indi_guidance(struct transport_tx *trans, struct link_device *dev)
A guidance mode based on Incremental Nonlinear Dynamic Inversion.
float guidance_indi_specific_force_gain
#define GUIDANCE_INDI_POS_GAIN
void guidance_indi_propagate_filters(void)
Low pass the accelerometer measurements to remove noise from vibrations.
#define GUIDANCE_INDI_SPEED_GAIN
static enum GuidanceOneloop_VMode _v_mode
void guidance_v_run_enter(void)
static struct VerticalGuidance * _gv
struct ThrustSetpoint guidance_v_run_pos(bool in_flight UNUSED, struct VerticalGuidance *gv)
struct ThrustSetpoint guidance_v_run_speed(bool in_flight UNUSED, struct VerticalGuidance *gv)
struct ThrustSetpoint guidance_v_run_accel(bool in_flight UNUSED, struct VerticalGuidance *gv)
Simple first order low pass filter with bilinear transform.
static void init_butterworth_2_low_pass(Butterworth2LowPass *filter, float tau, float sample_time, float value)
Init a second order Butterworth filter.
static float update_butterworth_2_low_pass(Butterworth2LowPass *filter, float value)
Update second order Butterworth low pass filter state with a new value.
Second order low pass filter structure.
vector in North East Down coordinates Units: meters
struct RadioControl radio_control
Generic interface for radio control modules.
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
#define RADIO_ROLL
Redefining RADIO_* Do not use with radio.h (ppm rc)
Some helper functions to check RC sticks.
Horizontal guidance for rotorcrafts.
void guidance_h_run_enter(void)
struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
#define GUIDANCE_H_MAX_BANK
Max bank controlled by guidance.
struct VerticalGuidance guidance_v
Vertical guidance for rotorcrafts.
struct RotorcraftNavigation nav
float heading
heading setpoint (in radians)
struct Stabilization stabilization
struct ThrustSetpoint th_sp_from_incr_vect_f(float th_increment[3])
struct StabilizationSetpoint stab_sp_from_quat_f(struct FloatQuat *quat)
struct ThrustSetpoint th_sp_from_thrust_i(int32_t thrust, uint8_t axis)
General stabilization interface for rotorcrafts.
#define THRUST_SP_SET_ZERO(_sp)
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.
static const struct usb_device_descriptor dev
Thrust setpoint // TODO to a setpoint header Structure to store the desired thrust vector with differ...
Architecture independent timing functions.
static float get_sys_time_float(void)
Get the time in seconds since startup.
int16_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint16_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
signed char int8_t
Typedef defining 8 bit char type.