Skip to content

Instantly share code, notes, and snippets.

@knmcguire
Created November 20, 2020 11:48
Show Gist options
  • Save knmcguire/040df041b9b9e1c90662e20f165d85a5 to your computer and use it in GitHub Desktop.
Save knmcguire/040df041b9b9e1c90662e20f165d85a5 to your computer and use it in GitHub Desktop.
lighthouse_app
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include "app.h"
#include "FreeRTOS.h"
#include "task.h"
#include "debug.h"
#include "lighthouse_core.h"
#include "lighthouse_position_est.h"
baseStationGeometry_t sampleGeoData[1] = {
{.valid = true, .origin = {-1.958483, 0.542299, 3.152727, }, .mat = {{0.79721498, -0.004274, 0.60368103, }, {0.0, 0.99997503, 0.00708, }, {-0.60369599, -0.005645, 0.79719502, }, }},
{.valid = true, .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, }, }},
};
lighthouseCalibration_t sampleCalibrationData[1] = {
{ // Base station 0
.valid = true,
.sweep = {
{.tilt = -0.047058, .phase = 0.0, .curve = 0.052215, .gibphase = 2.087890, .gibmag = -0.003913, .ogeephase = 0.433105, .ogeemag = -0.049285},
{.tilt = 0.048065, .phase = -0.005336, .curve = 0.122375, .gibphase = 2.097656, .gibmag = -0.003883, .ogeephase = 0.631835, .ogeemag = -0.034851},
},
},
{ // Base station 1
.valid = true,
.sweep = {
{.tilt = -0.051208, .phase = 0.0, .curve = 0.011756, .gibphase = 2.136718, .gibmag = -0.006057, .ogeephase = 2.705078,},
{.tilt = 0.045623, .phase = -0.004142, .curve = 0.104736, .gibphase = 2.349609, .gibmag = -0.003332, .ogeephase = 0.380859, .ogeemag = -0.240112,},
},
},
};
void appMain() {
lighthousePositionSetGeometryData(0, &sampleGeoData[0]);
lighthousePositionSetGeometryData(1, &sampleGeoData[1]);
lighthouseCoreSetCalibrationData(0, &sampleCalibrationData[0]);
lighthouseCoreSetCalibrationData(1, &sampleCalibrationData[1]);
while(1) {
vTaskDelay(M2T(2000));
}
}
APP=1
APP_STACKSIZE=300
CFLAGS += -DDISABLE_LIGHTHOUSE_DRIVER=0
CFLAGS += -DLIGHTHOUSE_FORCE_TYPE=2
PROJ_OBJ += app_lighthouse.o
CRAZYFLIE_BASE=../.. #fill in with your crazyflie base code
include $(CRAZYFLIE_BASE)/Makefile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment