11 #include "pprzlink/messages.h"
14 #include "generated/airframe.h"
46 float Err_airspeed = 0;
47 float Err_altitude = 0;
48 float Err_position = 0;
56 #if USE_AIRSPEED && defined(BENCHMARK_AIRSPEED)
64 #ifdef BENCHMARK_ALTITUDE
72 #ifdef BENCHMARK_POSITION
77 float deltaPlaneX = 0;
78 float deltaPlaneY = 0;
79 float Err_position_segment = 0;
80 float Err_position_circle = 0;
85 float anglePath = atan2(deltaX, deltaY);
88 float anglePlane = atan2(deltaPlaneX, deltaPlaneY);
89 float angleDiff = fabs(anglePlane - anglePath);
90 Err_position_segment = fabs(sin(angleDiff) * sqrt(deltaPlaneX * deltaPlaneX + deltaPlaneY * deltaPlaneY));
96 Err_position_circle = fabs(sqrt(deltaPlaneX * deltaPlaneX + deltaPlaneY * deltaPlaneY) -
nav_circle_radius);
98 if (Err_position_circle < Err_position_segment) {
99 Err_position = Err_position_circle;
101 Err_position = Err_position_segment;