px4-firmware/Tools/tests-host/autodeclination_test.cpp

29 lines
603 B
C++
Raw Normal View History

#include <stdio.h>
2014-04-28 15:42:46 -03:00
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <systemlib/mixer/mixer.h>
#include <systemlib/err.h>
#include <drivers/drv_hrt.h>
#include <px4iofirmware/px4io.h>
#include "../../src/systemcmds/tests/tests.h"
2014-04-28 15:42:46 -03:00
#include <geo/geo.h>
int main(int argc, char *argv[]) {
warnx("autodeclination test started");
if (argc < 3)
errx(1, "Need lat/lon!");
2014-04-28 15:42:46 -03:00
char* p_end;
float lat = strtod(argv[1], &p_end);
float lon = strtod(argv[2], &p_end);
float declination = get_mag_declination(lat, lon);
printf("lat: %f lon: %f, dec: %f\n", lat, lon, declination);
2014-05-03 07:40:11 -03:00
}