9 #include "pprzlink/dl_protocol.h"
17 #include "generated/airframe.h"
27 #ifndef FORCE_POS_GAIN
28 #define FORCE_POS_GAIN 1.
31 #ifndef FORCE_SPEED_GAIN
32 #define FORCE_SPEED_GAIN 1.
35 #ifndef FORCE_CLIMB_GAIN
36 #define FORCE_CLIMB_GAIN 1.
39 #ifndef FORCE_MAX_DIST
40 #define FORCE_MAX_DIST 100.
71 for (i = 0; i <
NB_ACS; ++i) {
72 if (
ti_acs[i].ac_id == AC_ID) {
continue; }
77 if (delta_t >
CARROT) {
continue; }
85 float dist = sqrtf(de * de +
dn *
dn + da * da);
86 if (dist == 0.) {
continue; }
90 float scal = dve * de + dvn *
dn + dva * da;
91 if (scal < 0.) {
continue; }
92 float d3 = dist * dist * dist;
99 if (nb == 0) {
return true; }
116 float cruise = V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE;
118 Bound(cruise, V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE, V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE);
Core autopilot interface common to all firmwares.
Common code for AP and FBW telemetry.
#define V_CTL_ALTITUDE_MAX_CLIMB
float v_ctl_auto_throttle_cruise_throttle
Vertical control for fixed wing vehicles.
Fixed wing horizontal control.
struct GpsState gps
global GPS state
Device independent GPS code (interface)
uint32_t tow
GPS time of week in ms.
static struct EnuCoor_f * acInfoGetPositionEnu_f(uint8_t ac_id)
Get position in local ENU coordinates (float).
static uint32_t acInfoGetItow(uint8_t ac_id)
Get time of week from latest message (ms).
struct acInfo ti_acs[NB_ACS]
static struct EnuCoor_f * acInfoGetVelocityEnu_f(uint8_t ac_id)
Get position from ENU coordinates (float).
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU 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).
void fly_to_xy(float x, float y)
Computes desired_x, desired_y and desired_course.
#define NavVerticalClimbMode(_climb)
Set the vertical mode to climb control with the specified climb setpoint.
#define NavVerticalAutoThrottleMode(_pitch)
Set the climb control to auto-throttle with the specified pitch pre-command.
void potential_init(void)
struct force_ potential_force
flying with potential field to avoid collision
vector in East North Up coordinates Units: meters
#define CARROT
default approaching_time for a wp
API to get/set the generic vehicle states.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
signed char int8_t
Typedef defining 8 bit char type.