35 #ifdef POWER_SWITCH_GPIO
39 #include "pprz_version.h"
60 #if PERIODIC_TELEMETRY
62 #include "generated/settings.h"
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);
76 #if defined RADIO_CALIB && defined RADIO_CONTROL_SETTINGS
78 static void send_rc_settings(
struct transport_tx *trans,
struct link_device *
dev)
88 static void send_mode(
struct transport_tx *trans,
struct link_device *dev)
90 pprz_msg_send_PPRZ_MODE(trans, dev, AC_ID,
94 static void send_attitude(
struct transport_tx *trans,
struct link_device *dev)
97 pprz_msg_send_ATTITUDE(trans, dev, AC_ID,
103 pprz_msg_send_ESTIMATOR(trans, dev, AC_ID,
107 static void send_bat(
struct transport_tx *trans,
struct link_device *dev)
112 if (fabs(
energy) >= INT16_MAX) {
115 pprz_msg_send_BAT(trans, dev, AC_ID,
121 static void send_energy(
struct transport_tx *trans,
struct link_device *dev)
124 if (fabs(
energy) >= INT16_MAX) {
127 float vsup = ((float)
vsupply) / 10.0f;
128 float curs = ((float)
current) / 1000.0f;
129 float power = vsup * curs;
130 pprz_msg_send_ENERGY(trans, dev, AC_ID, &vsup, &curs, &e, &power);
133 static void send_dl_value(
struct transport_tx *trans,
struct link_device *dev)
135 PeriodicSendDlValue(trans, dev);
141 static void send_desired(
struct transport_tx *trans,
struct link_device *dev)
146 pprz_msg_send_DESIRED(trans, dev, AC_ID,
149 &v_ctl_auto_airspeed_setpoint);
152 static void send_airspeed(
struct transport_tx *trans __attribute__((unused)),
153 struct link_device *dev __attribute__((unused)))
157 pprz_msg_send_AIRSPEED(trans, dev, AC_ID,
162 pprz_msg_send_AIRSPEED(trans, dev, AC_ID, &airspeed, &zero, &zero, &zero);
187 #ifdef POWER_SWITCH_GPIO
192 #if PERIODIC_TELEMETRY
204 #if defined RADIO_CALIB && defined RADIO_CONTROL_SETTINGS
uint16_t vsupply
Supply voltage in deciVolt.
float v_ctl_altitude_setpoint
in meters above MSL
#define POWER_SWITCH_GPIO
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
void autopilot_init(void)
Autopilot inititalization.
static void gpio_clear(ioportid_t port, uint16_t pin)
Clear a gpio output to low level.
#define LATERAL_MODE_MANUAL
Variable setting though the radio control.
Periodic telemetry system header (includes downlink utility and generated code).
uint16_t autopilot_flight_time
flight time in seconds.
float h_ctl_course_setpoint
float v_ctl_auto_groundspeed_setpoint
in meters per second
Some architecture independent helper functions for GPIOs.
float v_ctl_climb_setpoint
static float stateGetAirspeed_f(void)
Get airspeed (float).
static void send_energy(struct transport_tx *trans, struct link_device *dev)
void gpio_setup_output(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
static void send_dl_value(struct transport_tx *trans, struct link_device *dev)
static void send_estimator(struct transport_tx *trans, struct link_device *dev)
int32_t current
Supply current in milliAmpere.
float v_ctl_auto_airspeed_setpoint
in meters per second
static void send_attitude(struct transport_tx *trans, struct link_device *dev)
Fixed wing horizontal control.
bool power_switch
Power switch control.
float h_ctl_pitch_loop_setpoint
#define DefaultPeriodic
Set default periodic telemetry.
static void send_bat(struct transport_tx *trans, struct link_device *dev)
static void send_airspeed(struct transport_tx *trans, struct link_device *dev)
void send_autopilot_version(struct transport_tx *trans, struct link_device *dev)
static const struct usb_device_descriptor dev
void autopilot_send_mode(void)
Send mode over telemetry.
#define DefaultChannel
SITL.
static void send_mode(struct transport_tx *trans, struct link_device *dev)
float energy
Energy consumption (mAh) This is the ap copy of the measurement from fbw.
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
API to get/set the generic vehicle states.
float h_ctl_roll_setpoint
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
Fixedwing Navigation library.
static void send_desired(struct transport_tx *trans, struct link_device *dev)
pprz_t v_ctl_throttle_slewed
float v_ctl_auto_airspeed_controlled
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
static void send_alive(struct transport_tx *trans, struct link_device *dev)
Fixedwing autopilot modes.