Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "firmwares/rotorcraft/autopilot_firmware.h"
#include "generated/modules.h"
#include <stdint.h>
#include "modules/energy/electrical.h"
#include "modules/datalink/telemetry.h"
#include "modules/radio_control/radio_control.h"
#include "modules/gps/gps.h"
#include "modules/nav/nav_geofence.h"
Go to the source code of this file.
Macros | |
#define | AUTOPILOT_IN_FLIGHT_TIME 20 |
time steps for in_flight detection (at 20Hz, so 20=1second) More... | |
#define | AUTOPILOT_IN_FLIGHT_MIN_SPEED 0.2 |
minimum vertical speed for in_flight condition in m/s More... | |
#define | AUTOPILOT_IN_FLIGHT_MIN_ACCEL 2.0 |
minimum vertical acceleration for in_flight condition in m/s^2 More... | |
#define | AUTOPILOT_IN_FLIGHT_MIN_THRUST 500 |
minimum thrust for in_flight condition in pprz_t units (max = 9600) More... | |
#define | THRESHOLD_GROUND_DETECT 25.0 |
Z-acceleration threshold to detect ground in m/s^2. More... | |
Functions | |
bool WEAK | autopilot_ground_detection (void) |
Default ground-detection estimation based on accelerometer shock. More... | |
bool WEAK | autopilot_in_flight_end_detection (bool motors_on UNUSED) |
Default end-of-in-flight detection estimation based on thrust and speed. More... | |
static void | send_status (struct transport_tx *trans, struct link_device *dev) |
static void | send_energy (struct transport_tx *trans, struct link_device *dev) |
static void | send_fp (struct transport_tx *trans, struct link_device *dev) |
static void | send_body_rates_accel (struct transport_tx *trans, struct link_device *dev) |
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) |
static void | send_rotorcraft_cmd (struct transport_tx *trans UNUSED, struct link_device *dev UNUSED) |
void | autopilot_firmware_init (void) |
Init function. More... | |
void | autopilot_send_mode (void) |
Report autopilot mode on default downlink channel. More... | |
void | autopilot_event (void) |
autopilot event function More... | |
void | autopilot_reset_in_flight_counter (void) |
reset in_flight counter More... | |
void | autopilot_check_in_flight (bool motors_on) |
in flight check utility function More... | |
Variables | |
uint8_t | autopilot_mode_auto2 |
static uint32_t | autopilot_in_flight_counter |
#define AUTOPILOT_IN_FLIGHT_MIN_ACCEL 2.0 |
minimum vertical acceleration for in_flight condition in m/s^2
Definition at line 67 of file autopilot_firmware.c.
#define AUTOPILOT_IN_FLIGHT_MIN_SPEED 0.2 |
minimum vertical speed for in_flight condition in m/s
Definition at line 62 of file autopilot_firmware.c.
#define AUTOPILOT_IN_FLIGHT_MIN_THRUST 500 |
minimum thrust for in_flight condition in pprz_t units (max = 9600)
Definition at line 72 of file autopilot_firmware.c.
#define AUTOPILOT_IN_FLIGHT_TIME 20 |
time steps for in_flight detection (at 20Hz, so 20=1second)
Definition at line 57 of file autopilot_firmware.c.
#define THRESHOLD_GROUND_DETECT 25.0 |
Z-acceleration threshold to detect ground in m/s^2.
Definition at line 77 of file autopilot_firmware.c.
void autopilot_check_in_flight | ( | bool | motors_on | ) |
in flight check utility function
Check if airframe is in flight.
Definition at line 295 of file autopilot_firmware.c.
References autopilot, autopilot_in_flight_counter, autopilot_in_flight_end_detection(), AUTOPILOT_IN_FLIGHT_MIN_THRUST, AUTOPILOT_IN_FLIGHT_TIME, Stabilization::cmd, pprz_autopilot::in_flight, and stabilization.
void autopilot_event | ( | void | ) |
autopilot event function
Autopilot event check function.
used for automatic ground detection
Definition at line 272 of file autopilot_firmware.c.
References AP_MODE_FAILSAFE, autopilot, autopilot_ground_detection(), pprz_autopilot::detect_ground_once, pprz_autopilot::ground_detected, and pprz_autopilot::mode.
void autopilot_firmware_init | ( | void | ) |
Init function.
Definition at line 242 of file autopilot_firmware.c.
References autopilot_in_flight_counter, autopilot_mode_auto2, DefaultPeriodic, MODE_AUTO2, register_periodic_telemetry(), send_body_rates_accel(), send_energy(), send_fp(), send_fp_min(), send_rotorcraft_cmd(), send_rotorcraft_rc(), and send_status().
bool WEAK autopilot_ground_detection | ( | void | ) |
Default ground-detection estimation based on accelerometer shock.
Definition at line 81 of file autopilot_firmware.c.
References stateGetAccelNed_f(), THRESHOLD_GROUND_DETECT, and NedCoor_f::z.
Referenced by autopilot_event().
bool WEAK autopilot_in_flight_end_detection | ( | bool motors_on | UNUSED | ) |
Default end-of-in-flight detection estimation based on thrust and speed.
Definition at line 92 of file autopilot_firmware.c.
References autopilot_in_flight_counter, AUTOPILOT_IN_FLIGHT_MIN_ACCEL, AUTOPILOT_IN_FLIGHT_MIN_SPEED, AUTOPILOT_IN_FLIGHT_MIN_THRUST, AUTOPILOT_IN_FLIGHT_TIME, Stabilization::cmd, stabilization, stateGetAccelNed_f(), stateGetSpeedNed_f(), and NedCoor_f::z.
Referenced by autopilot_check_in_flight().
void autopilot_reset_in_flight_counter | ( | void | ) |
reset in_flight counter
reset in_flight counter actual implementation is firmware dependent
Definition at line 288 of file autopilot_firmware.c.
References autopilot_in_flight_counter.
void autopilot_send_mode | ( | void | ) |
Report autopilot mode on default downlink channel.
Report autopilot mode on default downlink channel.
Definition at line 261 of file autopilot_firmware.c.
References DefaultChannel, DefaultDevice, and send_status().
|
static |
Definition at line 183 of file autopilot_firmware.c.
References dev, p, stateGetAccelBody_i(), and stateGetBodyRates_f().
Referenced by autopilot_firmware_init().
|
static |
Definition at line 138 of file autopilot_firmware.c.
References autopilot, Electrical::avg_cnt, Electrical::avg_power, Electrical::charge, Electrical::current, dev, electrical, Electrical::energy, MAX_PPRZ, pprz_autopilot::throttle, and Electrical::vsupply.
Referenced by autopilot_firmware_init().
|
static |
Definition at line 151 of file autopilot_firmware.c.
References ANGLE_BFP_OF_REAL, autopilot, dev, EULERS_BFP_OF_REAL, eulers_zxy, pprz_autopilot::flight_time, float_eulers_of_quat_zxy(), guidance_h, guidance_v, HorizontalGuidanceSetpoint::heading, Int32Eulers::phi, HorizontalGuidanceSetpoint::pos, Int32Eulers::psi, HorizontalGuidance::sp, stateGetNedToBodyEulers_i(), stateGetNedToBodyQuat_f(), stateGetPositionEnu_i(), stateGetSpeedEnu_i(), Int32Eulers::theta, pprz_autopilot::throttle, Int32Vect2::x, Int32Vect2::y, and VerticalGuidance::z_sp.
Referenced by autopilot_firmware_init().
|
static |
Definition at line 194 of file autopilot_firmware.c.
References dev, gps, GpsState::gspeed, stateGetHorizontalSpeedNorm_f(), and stateGetPositionEnu_i().
Referenced by autopilot_firmware_init().
|
static |
Definition at line 238 of file autopilot_firmware.c.
Referenced by autopilot_firmware_init().
|
static |
Definition at line 210 of file autopilot_firmware.c.
References dev, radio_control, RADIO_KILL_SWITCH, RADIO_MODE, RADIO_PITCH, RADIO_ROLL, RADIO_THROTTLE, RADIO_YAW, RadioControl::status, and RadioControl::values.
Referenced by autopilot_firmware_init().
|
static |
Definition at line 114 of file autopilot_firmware.c.
References pprz_autopilot::arming_status, autopilot, dev, electrical, GpsState::fix, RadioControl::frame_rate, gps, guidance_h, guidance_v, pprz_autopilot::in_flight, pprz_autopilot::mode, HorizontalGuidance::mode, VerticalGuidance::mode, motor_mixing, pprz_autopilot::motors_on, MotorMixing::nb_failure, MotorMixing::nb_saturation, sys_time::nb_sec, radio_control, RadioControl::status, Electrical::vboard, and Electrical::vsupply.
Referenced by autopilot_firmware_init(), and autopilot_send_mode().
|
static |
Definition at line 50 of file autopilot_firmware.c.
Referenced by autopilot_check_in_flight(), autopilot_firmware_init(), autopilot_in_flight_end_detection(), and autopilot_reset_in_flight_counter().
uint8_t autopilot_mode_auto2 |
Definition at line 49 of file autopilot_firmware.c.
Referenced by autopilot_firmware_init(), and guidance_flip_run().