}
}
+static real_t beacon_xy[3][2] = {
+ { 3.062, -0.05},
+ {-0.062, 1.05},
+ { 3.062, 2.162},
+};
+static real_t ekf_y[5] = {0.0, 0.0, 0.0, 0.0, 0.0};
+static ekf8_t ekf8;
+
+void init_ekf(float x, float y, float ang)
+{
+ /*FIXME:reflect init pos & beacon coords accord.to our color */
+ real_t xy0[] = {x, y}; // 2.63, 0.35
+ ekf_y[3] = ekf_y[4] = 0.0;
+ ekf8_init(&ekf8, (real_t*)beacon_xy, D_MAX, 30.0, xy0, ekf_y);
+ ekf8.ekf.x[6] = ang;
+}
+
static void do_estimation()
{
- static real_t beacon_xy[3][2] = {
- { 3.062, -0.05},
- {-0.062, 1.05},
- { 3.062, 2.162},
- };
- static ekf8_t ekf8;
- static int virgo = 1; /*FIXME:deploy estimator_init() outside*/
static uint32_t odo0[2];
- static real_t y[5] = {0.0, 0.0, 0.0, 0.0, 0.0};
static int missing_odo_count = 0;
+ real_t *y = ekf_y;
uint32_t t[3], odo[2];
real_t x[8], P[8*8];
int i, odo_received, err[5];
DBG("UZV+ODO: %f %f %f %f %f\n", y[0], y[1], y[2], y[3], y[4]);
//DBG("ODO: %f %f %u %u\n", y[3], y[4], odo[0], odo[1]);
- if (virgo) {
- /*FIXME:reflect init pos & beacon coords accord.to our color */
- real_t xy0[] = {2.63, 0.35};
- y[3] = y[4] = 0.0;
- ekf8_init(&ekf8, (real_t*)beacon_xy, D_MAX, 30.0, xy0, y);
- ekf8.ekf.x[6] = -45.0*(M_PI/180.0);
- virgo = 0;
- }
-
ekf8_step(&ekf8, x, P, err, y);
DBG("EKF: x=%f y=%f phi=%8.4f\n", x[0], x[1], x[6]*(180.0/M_PI));