34#include "generated/modules.h"
46#include "generated/settings.h"
48#include "pprz_version.h"
52#ifndef AUTOPILOT_RC_ID
53#define AUTOPILOT_RC_ID ABI_BROADCAST
67 static uint32_t ap_version = PPRZ_VERSION_INT;
68 static char *ver_desc = PPRZ_VERSION_DESC;
69 static uint32_t build_time = PPRZ_BUILD_TIME;
72 get_pprz_git_sha1(sha1,
sizeof(sha1));
74 pprz_msg_send_AUTOPILOT_VERSION(trans,
dev, AC_ID, &ap_version, strlen(ver_desc), ver_desc,
75 sha1, &build_time, uid_len, uid);
78static void send_alive(
struct transport_tx *trans,
struct link_device *
dev)
80 pprz_msg_send_ALIVE(trans,
dev, AC_ID, 16, MD5SUM);
86 pprz_msg_send_ATTITUDE(trans,
dev, AC_ID, &(att->
phi), &(att->
psi), &(att->
theta));
91 PeriodicSendDlValue(trans,
dev);
108 pprz_msg_send_MINIMAL_COM(trans,
dev, AC_ID,
109 &lat, &lon, &hmsl, &gspeed, &
course, &climb,
134#if USE_GENERATED_AUTOPILOT
161#if FIXEDWING_FIRMWARE
169 RunOnceEvery(PERIODIC_FREQUENCY,
autopilot.flight_time++);
172#if USE_GENERATED_AUTOPILOT
187#if USE_GENERATED_AUTOPILOT
203#if USE_GENERATED_AUTOPILOT
220#if USE_GENERATED_AUTOPILOT
246#if USE_GENERATED_AUTOPILOT
Main include for ABI (AirBorneInterface).
struct abi_struct abi_event
void WEAK autopilot_event(void)
AP event call.
static void send_dl_value(struct transport_tx *trans, struct link_device *dev)
void autopilot_periodic(void)
AP periodic call.
bool autopilot_set_mode(uint8_t new_autopilot_mode)
set autopilot mode
void WEAK autopilot_send_mode(void)
send autopilot mode actual implementation is firmware dependent
uint8_t autopilot_get_mode(void)
get autopilot mode
void autopilot_set_in_flight(bool in_flight)
set in_flight flag
static void rc_cb(uint8_t sender_id, struct RadioControl *rc)
static void send_attitude(struct transport_tx *trans, struct link_device *dev)
static void send_autopilot_version(struct transport_tx *trans, struct link_device *dev)
bool autopilot_set_motors_on(bool motors_on)
turn motors on/off, eventually depending of the current mode set kill_throttle accordingly: kill_thro...
struct pprz_autopilot autopilot
Global autopilot structure.
static void send_alive(struct transport_tx *trans, struct link_device *dev)
bool autopilot_get_motors_on(void)
get motors status
void autopilot_on_rc_frame(void)
RC frame handler.
bool autopilot_arming_motors_on(bool motors_on)
turn motors on/off during arming, not done automatically prevents takeoff with preflight checks
void autopilot_SetModeHandler(float mode)
AP mode setting handler.
void autopilot_init(void)
Autopilot initialization function.
bool autopilot_in_flight(void)
get in_flight flag
void autopilot_force_motors_on(bool motors_on)
Force the motors on/off skipping preflight checks.
static void send_minimal_com(struct transport_tx *trans, struct link_device *dev)
void autopilot_set_kill_throttle(bool kill)
set kill throttle Kill always kills, also when motors_on is already false (fixedwing in flight).
void WEAK autopilot_failsafe_checks(void)
Failsafe checks.
void autopilot_send_version(void)
send autopilot version
void WEAK autopilot_reset_in_flight_counter(void)
reset in_flight counter actual implementation is firmware dependent
bool autopilot_throttle_killed(void)
get kill status
void autopilot_store_settings(void)
store settings
void autopilot_clear_settings(void)
clear settings
void autopilot_reset_flight_time(void)
reset flight time and launch
void WEAK autopilot_check_in_flight(bool motors_on)
in flight check utility function actual implementation is firmware dependent
Core autopilot interface common to all firmwares.
PPRZ Autopilot structure definition.
Hardware independent code for commands handling.
static struct uart_periph * dev
struct Electrical electrical
void autopilot_firmware_init(void)
Init function.
void autopilot_generated_SetModeHandler(float mode)
AP mode setting handler.
void autopilot_generated_periodic(void)
void autopilot_generated_set_mode(uint8_t new_autopilot_mode)
void autopilot_generated_init(void)
void autopilot_generated_on_rc_frame(void)
void autopilot_generated_set_motors_on(bool motors_on)
void autopilot_static_init(void)
Static autopilot API.
void autopilot_static_periodic(void)
void autopilot_static_SetModeHandler(float new_autopilot_mode)
void autopilot_static_set_motors_on(bool motors_on)
void autopilot_static_on_rc_frame(void)
Function to be called when a message from FBW is available.
void autopilot_static_set_mode(uint8_t new_autopilot_mode)
Some architecture independent helper functions for GPIOs.
struct GpsState gps
global GPS state
uint8_t mcu_get_uid(uint8_t *uid, uint8_t max_len)
Get the 96-bit unique device ID of the STM32.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct LlaCoor_f * stateGetPositionLla_f(void)
Get position in LLA coordinates (float).
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
static float stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
Arch independent mcu ( Micro Controller Unit ) utilities.
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
bool preflight_check(void)
Perform all the preflight checks.
int32_t settings_clear(void)
clear all persistent settings from flash
bool settings_store_flag
flag for setting feedback.
int32_t settings_store(void)
store settings marked as persistent to flash
Persistent settings interface.
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Architecture independent timing functions.
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.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.