34 #include "generated/modules.h"
46 #include "generated/settings.h"
48 #include "pprz_version.h"
55 static uint32_t ap_version = PPRZ_VERSION_INT;
56 static char *ver_desc = PPRZ_VERSION_DESC;
57 pprz_msg_send_AUTOPILOT_VERSION(trans, dev, AC_ID, &ap_version, strlen(ver_desc), ver_desc);
60 static void send_alive(
struct transport_tx *trans,
struct link_device *
dev)
62 pprz_msg_send_ALIVE(trans, dev, AC_ID, 16, MD5SUM);
68 pprz_msg_send_ATTITUDE(trans, dev, AC_ID, &(att->
phi), &(att->
psi), &(att->
theta));
73 PeriodicSendDlValue(trans, dev);
77 static void send_rc(
struct transport_tx *trans,
struct link_device *
dev)
86 pprz_msg_send_ACTUATORS(trans, dev, AC_ID , ACTUATORS_NB, actuators);
104 #ifdef POWER_SWITCH_GPIO
106 #ifdef POWER_SWITCH_ENABLE
136 #if USE_GENERATED_AUTOPILOT
151 #if USE_GENERATED_AUTOPILOT
162 #if USE_GENERATED_AUTOPILOT
174 #if USE_GENERATED_AUTOPILOT
201 #if USE_GENERATED_AUTOPILOT
265 #ifdef POWER_SWITCH_GPIO
bool launch
request launch
void autopilot_reset_flight_time(void)
reset flight time and launch
static void send_dl_value(struct transport_tx *trans, struct link_device *dev)
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void autopilot_firmware_init(void)
Init function.
bool use_rc
enable/disable RC input
void WEAK autopilot_reset_in_flight_counter(void)
reset in_flight counter actual implementation is firmware dependent
void autopilot_generated_SetModeHandler(float mode)
AP mode setting handler.
#define POWER_SWITCH_GPIO
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static void gpio_clear(ioportid_t port, uint16_t pin)
Clear a gpio output to low level.
void autopilot_clear_settings(void)
clear settings
Periodic telemetry system header (includes downlink utility and generated code).
void autopilot_SetModeHandler(float mode)
AP mode setting handler.
bool autopilot_throttle_killed(void)
get kill status
bool autopilot_get_motors_on(void)
get motors status
bool in_flight
in flight status
Some architecture independent helper functions for GPIOs.
uint16_t flight_time
flight time in seconds
void autopilot_static_SetModeHandler(float new_autopilot_mode)
bool autopilot_set_mode(uint8_t new_autopilot_mode)
set autopilot mode
void autopilot_init(void)
Autopilot initialization function.
void autopilot_generated_on_rc_frame(void)
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
void WEAK autopilot_check_in_flight(bool motors_on)
in flight check utility function actual implementation is firmware dependent
void gpio_setup_output(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
int32_t settings_store(void)
store settings marked as persistent to flash
static void send_actuators(struct transport_tx *trans, struct link_device *dev)
struct pprz_autopilot autopilot
Global autopilot structure.
void autopilot_static_set_mode(uint8_t new_autopilot_mode)
#define RADIO_CONTROL_NB_CHANNEL
void autopilot_store_settings(void)
store settings
Hardware independent API for actuators (servos, motor controllers).
void WEAK autopilot_send_mode(void)
send autopilot mode actual implementation is firmware dependent
bool detect_ground_once
enable automatic detection of ground (one shot)
void autopilot_generated_set_mode(uint8_t new_autopilot_mode)
int32_t settings_clear(void)
clear all persistent settings from flash
void autopilot_static_on_rc_frame(void)
Function to be called when a message from FBW is available.
void autopilot_static_periodic(void)
bool power_switch
enable/disable power from power switch (if any)
Architecture independent timing functions.
bool autopilot_in_flight(void)
get in_flight flag
void autopilot_set_kill_throttle(bool kill)
set kill throttle
uint8_t mode_auto2
FIXME hide this in a private part ?
static void send_attitude(struct transport_tx *trans, struct link_device *dev)
#define DefaultPeriodic
Set default periodic telemetry.
void autopilot_generated_set_motors_on(bool motors_on)
Hardware independent code for commands handling.
struct RadioControl radio_control
bool settings_store_flag
flag for setting feedback.
void WEAK autopilot_event(void)
AP event call.
static void send_alive(struct transport_tx *trans, struct link_device *dev)
PPRZ Autopilot structure definition.
static const struct usb_device_descriptor dev
Core autopilot interface common to all firmwares.
bool motors_on
arming status
void autopilot_static_set_motors_on(bool motors_on)
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...
void autopilot_set_motors_on(bool motors_on)
turn motors on/off, eventually depending of the current mode set kill_throttle accordingly FIXME is i...
static void send_rc(struct transport_tx *trans, struct link_device *dev)
void autopilot_periodic(void)
AP periodic call.
static void send_autopilot_version(struct transport_tx *trans, struct link_device *dev)
void autopilot_on_rc_frame(void)
RC frame handler.
void autopilot_set_in_flight(bool in_flight)
set in_flight flag
bool kill_throttle
allow autopilot to use throttle
bool ground_detected
automatic detection of landing
void autopilot_set_power_switch(bool power_switch)
set power switch
void autopilot_send_version(void)
send autopilot version
static void gpio_set(ioportid_t port, uint16_t pin)
Set a gpio output to high level.
uint8_t mode
current autopilot mode
void autopilot_generated_periodic(void)
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
uint8_t autopilot_get_mode(void)
get autopilot mode