34 #include "generated/modules.h"
45 #include "generated/settings.h"
47 #include "pprz_version.h"
51 #ifndef AUTOPILOT_RC_ID
52 #define AUTOPILOT_RC_ID ABI_BROADCAST
66 static uint32_t ap_version = PPRZ_VERSION_INT;
67 static char *ver_desc = PPRZ_VERSION_DESC;
68 pprz_msg_send_AUTOPILOT_VERSION(trans,
dev, AC_ID, &ap_version, strlen(ver_desc), ver_desc);
71 static void send_alive(
struct transport_tx *trans,
struct link_device *
dev)
73 pprz_msg_send_ALIVE(trans,
dev, AC_ID, 16, MD5SUM);
79 pprz_msg_send_ATTITUDE(trans,
dev, AC_ID, &(att->
phi), &(att->
psi), &(att->
theta));
84 PeriodicSendDlValue(trans,
dev);
101 pprz_msg_send_MINIMAL_COM(trans,
dev, AC_ID,
102 &lat, &lon, &hmsl, &gspeed, &
course, &climb,
127 #if USE_GENERATED_AUTOPILOT
154 #if FIXEDWING_FIRMWARE
165 #if USE_GENERATED_AUTOPILOT
180 #if USE_GENERATED_AUTOPILOT
196 #if USE_GENERATED_AUTOPILOT
213 #if USE_GENERATED_AUTOPILOT
239 #if USE_GENERATED_AUTOPILOT
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
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 FIXME is i...
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
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.
bool motors_on
motor status
bool ground_detected
automatic detection of landing
uint8_t mode_auto2
FIXME hide this in a private part ?
bool launch
request launch
pprz_t throttle
throttle level as will be displayed in GCS
bool use_rc
enable/disable RC input
bool detect_ground_once
enable automatic detection of ground (one shot)
bool kill_throttle
allow autopilot to use throttle
uint8_t mode
current autopilot mode
bool in_flight
in flight status
uint16_t flight_time
flight time in seconds
PPRZ Autopilot structure definition.
Hardware independent code for commands handling.
struct Electrical electrical
float vsupply
supply voltage in V
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
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
static struct LlaCoor_f * stateGetPositionLla_f(void)
Get position in LLA 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).
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...
static const struct usb_device_descriptor dev
Architecture independent timing functions.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_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.