Skip to content

Commit

Permalink
#461 Added feature flag for experimental lighthouse code
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed Nov 20, 2019
1 parent 8f0c34a commit dde90d6
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/deck/drivers/src/lighthouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,18 @@ baseStationGeometry_t lighthouseBaseStationsGeometry[2] = {
{.origin = {1.062398, -2.563488, 3.112367, }, .mat = {{0.018067, -0.999336, 0.031647, }, {0.76125097, 0.034269, 0.64755201, }, {-0.648206, 0.012392, 0.76136398, }, }},
};

baseStationEulerAngles_t lighthouseBaseStationAngles[2];

// Uncomment if you want to force the Crazyflie to reflash the deck at each startup
// #define FORCE_FLASH true

// Uncomment for experimental mode
// #define FF_EXPERIMENTAL

static bool isInit = false;

#if DISABLE_LIGHTHOUSE_DRIVER == 0

baseStationEulerAngles_t lighthouseBaseStationAngles[2];

// Sensor positions on the deck
#define SENSOR_POS_W (0.015f / 2.0f)
#define SENSOR_POS_L (0.030f / 2.0f)
Expand All @@ -83,10 +90,6 @@ static vec3d sensorDeckPositions[4] = {
{SENSOR_POS_L, -SENSOR_POS_W, 0.0},
};

static bool isInit = false;

#if DISABLE_LIGHTHOUSE_DRIVER == 0

#ifndef FORCE_FLASH
#define FORCE_FLASH false
#endif
Expand Down Expand Up @@ -156,9 +159,12 @@ static bool getFrame(frame_t *frame)
static vec3d position;
static positionMeasurement_t ext_pos;
static float deltaLog;

#ifdef FF_EXPERIMENTAL
static int8_t maxs = 4;
static int8_t oneBs = 0;
static float std = 0.0004;
#endif

static void estimatePosition(pulseProcessorResult_t angles[]) {
memset(&ext_pos, 0, sizeof(ext_pos));
Expand All @@ -180,7 +186,7 @@ static void estimatePosition(pulseProcessorResult_t angles[]) {
STATS_CNT_RATE_EVENT(&positionRate);

// Experimental code for pushing sweep angles into the kalman filter
#if 0
#ifdef FF_EXPERIMENTAL
if (sensor < maxs) {
sweepAngleMeasurement_t sweepAngles;
sweepAngles.stdDevX = std;
Expand Down Expand Up @@ -217,7 +223,9 @@ static void estimatePosition(pulseProcessorResult_t angles[]) {
return;
}
ext_pos.stdDev = 0.01;
#ifndef FF_EXPERIMENTAL
estimatorEnqueuePosition(&ext_pos);
#endif
}

static bool estimateYawDeltaOneBaseStation(const int bs, const pulseProcessorResult_t angles[], baseStationGeometry_t baseStationGeometries[], const float cfPos[3], const float n[3], const arm_matrix_instance_f32 *RR, float *yawDelta) {
Expand Down Expand Up @@ -501,11 +509,13 @@ LOG_GROUP_STOP(lighthouse)

#endif // DISABLE_LIGHTHOUSE_DRIVER

#ifdef FF_EXPERIMENTAL
PARAM_GROUP_START(lh)
PARAM_ADD(PARAM_INT8, maxs, &maxs)
PARAM_ADD(PARAM_INT8, oneBs, &oneBs)
PARAM_ADD(PARAM_FLOAT, std, &std)
PARAM_GROUP_STOP(lh)
#endif


PARAM_GROUP_START(deck)
Expand Down

0 comments on commit dde90d6

Please sign in to comment.