 |
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
46 #if PERIODIC_TELEMETRY
48 static void send_gvf(
struct transport_tx *trans,
struct link_device *
dev)
87 pprz_msg_send_CIRCLE(trans,
dev, AC_ID,
100 pprz_msg_send_SEGMENT(trans,
dev, AC_ID,
111 float px =
p->x - x1;
112 float py =
p->y - y1;
116 float alpha = atan2f(zy, zx);
118 float cosa = cosf(-
alpha);
119 float sina = sinf(-
alpha);
121 float pxr = px * cosa - py * sina;
122 float zxr = zx * cosa - zy * sina;
128 }
else if (pxr > (zxr +
d2)) {
146 #if PERIODIC_TELEMETRY
162 float px_dot = ground_speed * sinf(
course);
163 float py_dot = ground_speed * cosf(
course);
171 float tx =
s * grad->
ny;
172 float ty = -
s * grad->
nx;
175 float H11 = hess->
H11;
176 float H12 = hess->
H12;
177 float H21 = hess->
H21;
178 float H22 = hess->
H22;
181 float pdx_dot = tx - ke * e * nx;
182 float pdy_dot = ty - ke * e * ny;
184 float norm_pd_dot = sqrtf(pdx_dot * pdx_dot + pdy_dot * pdy_dot);
185 float md_x = pdx_dot / norm_pd_dot;
186 float md_y = pdy_dot / norm_pd_dot;
188 float Apd_dot_dot_x = -ke * (nx * px_dot + ny * py_dot) * nx;
189 float Apd_dot_dot_y = -ke * (nx * px_dot + ny * py_dot) * ny;
191 float Bpd_dot_dot_x = ((-ke * e * H11) +
s * H21) * px_dot
192 + ((-ke * e * H12) +
s * H22) * py_dot;
193 float Bpd_dot_dot_y = -(
s * H11 + (ke * e * H21)) * px_dot
194 - (
s * H12 + (ke * e * H22)) * py_dot;
196 float pd_dot_dot_x = Apd_dot_dot_x + Bpd_dot_dot_x;
197 float pd_dot_dot_y = Apd_dot_dot_y + Bpd_dot_dot_y;
199 float md_dot_const = -(md_x * pd_dot_dot_y - md_y * pd_dot_dot_x)
202 float md_dot_x = md_y * md_dot_const;
203 float md_dot_y = -md_x * md_dot_const;
205 float omega_d = -(md_dot_x * md_y - md_dot_y * md_x);
207 float mr_x = sinf(
course);
208 float mr_y = cosf(
course);
210 float omega = omega_d + kn * (mr_x * md_y - mr_y * md_x);
293 float alpha = atanf(zx / zy);
320 float px =
p->x - x1;
321 float py =
p->y - y1;
326 float beta = atan2f(zy, zx);
327 float cosb = cosf(-beta);
328 float sinb = sinf(-beta);
329 float zxr = zx * cosb - zy * sinb;
330 float pxr = px * cosb - py * sinb;
332 if ((zxr > 0 && pxr > zxr) || (zxr < 0 && pxr < zxr)) {
375 if (a < 1 ||
b < 1) {
389 e, &grad_ellipse, &Hess_ellipse);
440 float alpha = atanf(zy / zx);
gvf_ell_par gvf_ellipse_par
static float stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
bool gvf_sin_XY_alpha(float a, float b, float alpha, float w, float off, float A)
bool gvf_sin_wp1_wp2(uint8_t wp1, uint8_t wp2, float w, float off, float A)
bool gvf_segment_XY1_XY2(float x1, float y1, float x2, float y2)
void gvf_sin_info(float *phi, struct gvf_grad *grad, struct gvf_Hess *hess)
#define LATERAL_MODE_ROLL
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
bool gvf_line_wp1_wp2(uint8_t wp1, uint8_t wp2)
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
float h_ctl_roll_max_setpoint
void gvf_control_2D(float ke, float kn, float e, struct gvf_grad *grad, struct gvf_Hess *hess)
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
float h_ctl_roll_setpoint
bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha)
#define HORIZONTAL_MODE_WAYPOINT
bool gvf_line_XY_heading(float a, float b, float heading)
bool gvf_line_XY1_XY2(float x1, float y1, float x2, float y2)
static int out_of_segment_area(float x1, float y1, float x2, float y2, float d1, float d2)
static const struct usb_device_descriptor dev
#define HORIZONTAL_MODE_CIRCLE
uint32_t get_sys_time_msec(void)
Get the time in milliseconds since startup.
void gvf_ellipse_info(float *phi, struct gvf_grad *grad, struct gvf_Hess *hess)
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
vector in East North Up coordinates Units: meters
bool gvf_ellipse_wp(uint8_t wp, float a, float b, float alpha)
bool gvf_segment_loop_XY1_XY2(float x1, float y1, float x2, float y2, float d1, float d2)
bool gvf_sin_wp_alpha(uint8_t wp, float alpha, float w, float off, float A)
bool gvf_segment_wp1_wp2(uint8_t wp1, uint8_t wp2)
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
bool gvf_line_wp_heading(uint8_t wp, float heading)
bool gvf_segment_loop_wp1_wp2(uint8_t wp1, uint8_t wp2, float d1, float d2)
static void send_segment(struct transport_tx *trans, struct link_device *dev)
static void send_gvf(struct transport_tx *trans, struct link_device *dev)
void gvf_line_info(float *phi, struct gvf_grad *grad, struct gvf_Hess *hess)
uint8_t autopilot_get_mode(void)
get autopilot mode
void gvf_set_direction(int8_t s)
#define HORIZONTAL_MODE_ROUTE
static void send_circle(struct transport_tx *trans, struct link_device *dev)
static void gvf_line(float a, float b, float heading)
#define DefaultPeriodic
Set default periodic telemetry.