45 for (
int i = 0; i < 3; i++) {
46 P[i][0] = anchors[i].
pos.
x;
47 P[i][1] = anchors[i].
pos.
y;
48 P[i][2] = anchors[i].
pos.
z;
95 const float d2 =
D *
D;
96 const float i2 =
I *
I;
97 const float j2 =
J *
J;
99 tmp[0] = (r02 - r12 +
d2) / (2.f *
D);
100 tmp[1] = (r02 - r22 + i2 + j2) / (2.f *
J) - ((
I * tmp[0]) /
J);
101 const float d0 = r02 - (tmp[0] * tmp[0]) - (tmp[1] * tmp[1]);
110 pos->
x =
P[0][0] + tmp[0] *
Ex[0] + tmp[1] *
Ey[0] + tmp[2] *
Ez[0];
111 pos->
y =
P[0][1] + tmp[0] *
Ex[1] + tmp[1] *
Ey[1] + tmp[2] *
Ez[1];
112 pos->
z =
P[0][2] + tmp[0] *
Ex[2] + tmp[1] *
Ey[2] + tmp[2] *
Ez[2];
113 pos->
z = fabsf(pos->
z);
static void float_vect_add(float *a, const float *b, const int n)
a += b
static void float_vect_smul(float *o, const float *a, const float s, const int n)
o = a * s
static void float_vect_sdiv(float *o, const float *a, const float s, const int n)
o = a / s
static float float_vect_dot_product(const float *a, const float *b, const int n)
a.b
static void float_vect_diff(float *o, const float *a, const float *b, const int n)
o = a - b
static float float_vect_norm(const float *a, const int n)
||a||
Paparazzi floating point algebra.
vector in East North Up coordinates Units: meters
int trilateration_init(struct Anchor *anchors)
Init internal trilateration structures.
int trilateration_compute(struct Anchor *anchors, struct EnuCoor_f *pos)
Compute trilateration based on the latest measurments.
float distance
last measured distance
struct EnuCoor_f pos
position of the anchor