31#include "generated/modules.h"
42#if NO_GPS_NEEDED_FOR_NAV
43#define GpsIsLost() FALSE
45#define GpsIsLost() TRUE
56#ifndef AUTOPILOT_IN_FLIGHT_TIME
57#define AUTOPILOT_IN_FLIGHT_TIME 20
61#ifndef AUTOPILOT_IN_FLIGHT_MIN_SPEED
62#define AUTOPILOT_IN_FLIGHT_MIN_SPEED 0.2
66#ifndef AUTOPILOT_IN_FLIGHT_MIN_ACCEL
67#define AUTOPILOT_IN_FLIGHT_MIN_ACCEL 2.0
71#ifndef AUTOPILOT_IN_FLIGHT_MIN_THRUST
72#define AUTOPILOT_IN_FLIGHT_MIN_THRUST 500
76#ifndef THRESHOLD_GROUND_DETECT
77#define THRESHOLD_GROUND_DETECT 25.0
130 pprz_msg_send_ROTORCRAFT_STATUS(trans,
dev, AC_ID,
131 &imu_nb_err, &_motor_nb_err,
133 &fix, &
autopilot.mode, &in_flight, &motors_on,
147 pprz_msg_send_ENERGY(trans,
dev, AC_ID,
151static void send_fp(
struct transport_tx *trans,
struct link_device *
dev)
157#if GUIDANCE_INDI_HYBRID
165 pprz_msg_send_ROTORCRAFT_FP(trans,
dev, AC_ID,
185 pprz_msg_send_BODY_RATES_ACCEL(trans,
dev, AC_ID,
202 pprz_msg_send_ROTORCRAFT_FP_MIN(trans,
dev, AC_ID,
212#ifdef RADIO_KILL_SWITCH
217 pprz_msg_send_ROTORCRAFT_RADIO_CONTROL(trans,
dev, AC_ID,
228#if defined(COMMAND_ROLL) && defined(COMMAND_PITCH) && defined(COMMAND_YAW)
231 pprz_msg_send_ROTORCRAFT_CMD(trans,
dev, AC_ID,
struct pprz_autopilot autopilot
Global autopilot structure.
static struct uart_periph * dev
struct Electrical electrical
Interface for electrical status: supply voltage, current, battery status, etc.
void autopilot_firmware_init(void)
Init function.
void autopilot_send_mode(void)
Report autopilot mode on default downlink channel.
static void send_energy(struct transport_tx *trans, struct link_device *dev)
struct GpsState gps
global GPS state
Device independent GPS code (interface).
#define EULERS_BFP_OF_REAL(_ei, _ef)
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)
vector in East North Up coordinates
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
static struct FloatEulers * stateGetNedToBodyEulersZxy_f(void)
Get vehicle body attitude ZXY euler angles (float).
static struct EnuCoor_i * stateGetPositionEnu_i(void)
Get position in local ENU coordinates (int).
static struct FloatRates * stateGetBodyRates_f(void)
Get vehicle body angular rate (float).
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
static struct Int32Vect3 * stateGetAccelBody_i(void)
Get acceleration in Body coordinates (int).
static struct EnuCoor_i * stateGetSpeedEnu_i(void)
Get ground speed in local ENU coordinates (int).
struct FloatEulers eulers_zxy
state eulers in zxy order
struct MotorMixing motor_mixing
Optional exceptions triggeringg HOME_MODE 1) GEOFENCE_DATALINK_LOST_TIME: go to HOME mode if datalink...
vector in North East Down coordinates Units: meters
struct RadioControl radio_control
Generic interface for radio control modules.
#define RADIO_KILL_SWITCH
#define RADIO_ROLL
Redefining RADIO_* Do not use with radio.h (ppm rc).
void autopilot_event(void)
autopilot event function
#define AUTOPILOT_IN_FLIGHT_MIN_SPEED
minimum vertical speed for in_flight condition in m/s
static void send_status(struct transport_tx *trans, struct link_device *dev)
uint8_t autopilot_mode_auto2
#define AUTOPILOT_IN_FLIGHT_TIME
time steps for in_flight detection (at 20Hz, so 20=1second)
static void send_body_rates_accel(struct transport_tx *trans, struct link_device *dev)
#define THRESHOLD_GROUND_DETECT
Z-acceleration threshold to detect ground in m/s^2.
bool WEAK autopilot_in_flight_end_detection(bool motors_on UNUSED)
Default end-of-in-flight detection estimation based on thrust and speed.
static void send_rotorcraft_rc(struct transport_tx *trans, struct link_device *dev)
void autopilot_check_in_flight(bool motors_on)
in flight check utility function
static void send_fp_min(struct transport_tx *trans, struct link_device *dev)
#define AUTOPILOT_IN_FLIGHT_MIN_ACCEL
minimum vertical acceleration for in_flight condition in m/s^2
static void send_rotorcraft_cmd(struct transport_tx *trans UNUSED, struct link_device *dev UNUSED)
static void send_fp(struct transport_tx *trans, struct link_device *dev)
bool WEAK autopilot_ground_detection(void)
Default ground-detection estimation based on accelerometer shock.
static uint32_t autopilot_in_flight_counter
void autopilot_reset_in_flight_counter(void)
reset in_flight counter
#define AUTOPILOT_IN_FLIGHT_MIN_THRUST
minimum thrust for in_flight condition in pprz_t units (max = 9600)
Rotorcraft specific autopilot interface and initialization.
struct HorizontalGuidance guidance_h
struct VerticalGuidance guidance_v
struct Stabilization stabilization
volatile uint32_t nb_sec
full 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 short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.