34 #include "generated/flight_plan.h"
49 #define PRTDEB(TYPE,EXP) \
50 printf("%5d: " #EXP ": %"#TYPE"\n",CPTDEBUG,EXP);fflush(stdout);CPTDEBUG++;
51 #define PRTDEBSTR(EXP) \
52 printf("%5d: STR: "#EXP"\n",CPTDEBUG);fflush(stdout);CPTDEBUG++;
54 #define PRTDEB(TYPE,EXP) \
57 #define PRTDEBSTR(EXP) \
71 #define DISTXY(P1X,P1Y,P2X,P2Y)\
72 (sqrt( ( (P2X-P1X) * (P2X-P1X) ) + ( (P2Y-P1Y) * (P2Y-P1Y) ) ) )
74 #define NORMXY(P1X,P1Y)\
75 (sqrt( ( (P1X) * (P1X) ) + ( (P1Y) * (P1Y) ) ) )
89 #define USE_ONBOARD_CAMERA 1
91 #if USE_ONBOARD_CAMERA
139 #include "generated/modules.h"
155 static uint8_t dummy_state = 0;
156 static uint8_t snapshot_valid = 1;
157 static float dummy_temp = NAN;
187 cartography_periodic_downlink_carto_status = MODULES_START;
196 cartography_periodic_downlink_carto_status = MODULES_START;
205 cartography_periodic_downlink_carto_status = MODULES_START;
224 float *normAMf,
float *normBMf,
float *distancefromrailf);
228 float *normAMf,
float *normBMf,
float *distancefromrailf)
231 float a,
b,
c, xa, xb, xc, ya, yb, yc;
238 float AMx, AMy, BMx, BMy;
255 c = (yb - yc) * xb + (xc - xb) * yb ;
260 if (fabs(
a) > 1e-10) {
261 *distancefromrailf = fabs((
a * xa +
b * ya +
c) / sqrt(
a *
a +
b *
276 if (fabs(AA1) > 1e-10) {
277 f = (
b - (
a * BB1 / AA1));
278 if (fabs(
f) > 1e-10) {
279 YP = (-(
a * xa) - (
a * BB1 * ya / AA1) -
c) /
f;
290 XP = (-
c -
b * YP) /
a ;
300 AMx = XP - pointAf.
x;
301 AMy = YP - pointAf.
y;
302 BMx = XP - pointBf.
x;
303 BMy = YP - pointBf.
y;
305 *normAMf =
NORMXY(AMx, AMy);
306 *normBMf =
NORMXY(BMx, BMy);
311 if (((*normAMf) + (*normBMf)) > 1.05 *
DISTXY(pointBf.
x, pointBf.
y, pointAf.
x, pointAf.
y)) {
349 vec12.x = point2.x - point1.x;
350 vec12.y = point2.y - point1.y;
372 if (fabs(distrailinit) <= 1) {
486 || (
normBM < (
DISTXY(pointB.x, pointB.y, pointA.x, pointA.y)))) {
717 cartography_periodic_downlink_carto_status = MODULES_START;