aboutsummaryrefslogtreecommitdiff
path: root/Tools/tests-host/autodeclination_test.cpp
blob: 93bc340bb3769cf1256c8b6bb09c05b56bbd77c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#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"
#include <geo/geo.h>

int main(int argc, char *argv[]) {
	warnx("autodeclination test started");

	if (argc < 3)
		errx(1, "Need lat/lon!");

	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);

}