18 #if defined(USE_AIRBORNE_ANT_TRACKING) && USE_AIRBORNE_ANT_TRACKING == 1
24 #include "autopilot.h"
25 #include "generated/flight_plan.h"
38 float fx1;
float fx2;
float fx3;
39 float fy1;
float fy2;
float fy3;
40 float fz1;
float fz2;
float fz3;
43 float airborne_ant_pan;
44 static bool_t ant_pan_positive = 0;
74 void airborne_ant_point_init(
void)
80 void airborne_ant_point_periodic(
void)
82 float airborne_ant_pan_servo = 0;
84 static VECTOR svPlanePosition,
86 Home_PositionForPlane,
87 Home_PositionForPlane2;
106 smRotation.
fy1 = -smRotation.
fx2;
107 smRotation.
fy2 = smRotation.
fx1;
148 airborne_ant_pan = (float)(atan2(Home_PositionForPlane2.
fx, (Home_PositionForPlane2.
fy)));
151 if (airborne_ant_pan > 0 && airborne_ant_pan <= RadOfDeg(175)) { ant_pan_positive = 1; }
152 if (airborne_ant_pan < 0 && airborne_ant_pan >= RadOfDeg(-175)) { ant_pan_positive = 0; }
154 if (airborne_ant_pan > RadOfDeg(175) && ant_pan_positive == 0) {
155 airborne_ant_pan = RadOfDeg(-180);
157 }
else if (airborne_ant_pan < RadOfDeg(-175) && ant_pan_positive) {
158 airborne_ant_pan = RadOfDeg(180);
159 ant_pan_positive = 0;
162 #ifdef ANT_PAN_NEUTRAL
163 airborne_ant_pan = airborne_ant_pan - RadOfDeg(ANT_PAN_NEUTRAL);
164 if (airborne_ant_pan > 0) {
165 airborne_ant_pan_servo =
MAX_PPRZ * (airborne_ant_pan / (RadOfDeg(ANT_PAN_MAX - ANT_PAN_NEUTRAL)));
167 airborne_ant_pan_servo =
MIN_PPRZ * (airborne_ant_pan / (RadOfDeg(ANT_PAN_MIN - ANT_PAN_NEUTRAL)));
171 airborne_ant_pan_servo =
TRIM_PPRZ(airborne_ant_pan_servo);
173 #ifdef COMMAND_ANT_PAN
174 ap_state->commands[COMMAND_ANT_PAN] = airborne_ant_pan_servo;
Communication between fbw and ap processes.
float alt
in meters above WGS84 reference ellipsoid
void vSubtractVectors(VECTOR *svA, VECTOR svB, VECTOR svC)
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
struct ap_state * ap_state
void vMultiplyMatrixByVector(VECTOR *svA, MATRIX smB, VECTOR svC)
static float stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
API to get/set the generic vehicle states.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
Information relative to the other aircrafts.