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
101 pprz_msg_send_ROTORCRAFT_STATUS(trans, dev, AC_ID,
102 &imu_nb_err, &_motor_nb_err,
113 pprz_msg_send_ENERGY(trans, dev, AC_ID,
117 static void send_fp(
struct transport_tx *trans,
struct link_device *
dev)
122 pprz_msg_send_ROTORCRAFT_FP(trans, dev, AC_ID,
148 pprz_msg_send_ROTORCRAFT_FP_MIN(trans, dev, AC_ID,
158 #ifdef RADIO_KILL_SWITCH
163 pprz_msg_send_ROTORCRAFT_RADIO_CONTROL(trans, dev, AC_ID,
176 pprz_msg_send_ROTORCRAFT_CMD(trans, dev, AC_ID,
int32_t psi
in rad with INT32_ANGLE_FRAC
int32_t guidance_v_z_sp
altitude setpoint in meters (input).
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
void autopilot_firmware_init(void)
Init function.
struct Int32Vect2 pos
horizontal position setpoint in NED.
#define THRESHOLD_GROUND_DETECT
Z-acceleration threshold to detect ground in m/s^2.
static void send_fp_min(struct transport_tx *trans, struct link_device *dev)
static void send_rotorcraft_rc(struct transport_tx *trans, struct link_device *dev)
Periodic telemetry system header (includes downlink utility and generated code).
int32_t theta
in rad with INT32_ANGLE_FRAC
bool in_flight
in flight status
static void send_status(struct transport_tx *trans, struct link_device *dev)
uint16_t flight_time
flight time in seconds
float vsupply
supply voltage in V
void autopilot_reset_in_flight_counter(void)
reset in_flight counter
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
struct pprz_autopilot autopilot
Global autopilot structure.
static void send_energy(struct transport_tx *trans, struct link_device *dev)
#define AUTOPILOT_IN_FLIGHT_TIME
time steps for in_flight detection (at 20Hz, so 20=1second)
bool detect_ground_once
enable automatic detection of ground (one shot)
vector in North East Down coordinates Units: meters
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Interface for electrical status: supply voltage, current, battery status, etc.
static void send_fp(struct transport_tx *trans, struct link_device *dev)
uint8_t autopilot_mode_auto2
float charge
consumed electric charge in Ah
Device independent GPS code (interface)
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
#define DefaultPeriodic
Set default periodic telemetry.
#define AUTOPILOT_IN_FLIGHT_MIN_SPEED
minimum vertical speed for in_flight condition in m/s
struct RadioControl radio_control
struct HorizontalGuidance guidance_h
Optional exceptions triggeringg HOME_MODE 1) GEOFENCE_DATALINK_LOST_TIME: go to HOME mode if datalink...
uint8_t arming_status
arming status
static void send_rotorcraft_cmd(struct transport_tx *trans, struct link_device *dev)
#define ANGLE_BFP_OF_REAL(_af)
static const struct usb_device_descriptor dev
void autopilot_event(void)
autopilot event function
int32_t phi
in rad with INT32_ANGLE_FRAC
bool motors_on
motor status
static uint32_t autopilot_in_flight_counter
volatile uint32_t nb_sec
full seconds since startup
static struct EnuCoor_i * stateGetSpeedEnu_i(void)
Get ground speed in local ENU coordinates (int).
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
void autopilot_check_in_flight(bool motors_on)
in flight check utility function
struct MotorMixing motor_mixing
#define AUTOPILOT_IN_FLIGHT_MIN_THRUST
minimum thrust for in_flight condition in pprz_t units (max = 9600)
uint16_t gspeed
norm of 2d ground speed in cm/s
float energy
consumed energy in Wh
struct Electrical electrical
#define AUTOPILOT_IN_FLIGHT_MIN_ACCEL
minimum vertical acceleration for in_flight condition in m/s^2
static struct EnuCoor_i * stateGetPositionEnu_i(void)
Get position in local ENU coordinates (int).
#define RADIO_KILL_SWITCH
float current
current in A
bool ground_detected
automatic detection of landing
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
Rotorcraft specific autopilot interface and initialization.
struct GpsState gps
global GPS state
struct HorizontalGuidanceSetpoint sp
setpoints
uint8_t mode
current autopilot mode
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
pprz_t throttle
throttle level as will be displayed in GCS