[ARDrone] Create oc.h
Create oc.h from oc.c, include it in owlps-drone.h instead of directly oc.c. Compile oc.o separately.
This commit is contained in:
parent
e823014708
commit
dc3ba41222
|
@ -22,7 +22,7 @@ CP=cp -v
|
||||||
|
|
||||||
# Cible
|
# Cible
|
||||||
TARGET=owlps-drone
|
TARGET=owlps-drone
|
||||||
HEADER=
|
DEPS = oc.o
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
LIBOWLPS_DIR = ../libowlps
|
LIBOWLPS_DIR = ../libowlps
|
||||||
|
@ -46,15 +46,14 @@ dynamic : $(TARGET)
|
||||||
static : $(TARGET).static
|
static : $(TARGET).static
|
||||||
all : dynamic static
|
all : dynamic static
|
||||||
|
|
||||||
% : %.o
|
%.o : %.c %.h
|
||||||
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
|
||||||
%.o : %.c $(HEADER)
|
|
||||||
$(CC) $(XCFLAGS) $(OWLPSFLAGS) -c $<
|
$(CC) $(XCFLAGS) $(OWLPSFLAGS) -c $<
|
||||||
|
|
||||||
# Compilation du programme
|
# Compilation du programme
|
||||||
$(TARGET) : $(TARGET).o $(HEADER)
|
$(TARGET) : $(TARGET).o $(DEPS)
|
||||||
|
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
$(TARGET).static : $(TARGET).c $(HEADER)
|
$(TARGET).static : $(TARGET).o $(DEPS)
|
||||||
$(CC) $(LDFLAGS) -static $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
|
$(CC) $(LDFLAGS) -static $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ CP=cp -v
|
||||||
|
|
||||||
# Cible
|
# Cible
|
||||||
TARGET=owlps-drone
|
TARGET=owlps-drone
|
||||||
HEADER=
|
DEPS = oc.o
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
LIBOWLPS_DIR = ../libowlps
|
LIBOWLPS_DIR = ../libowlps
|
||||||
|
@ -58,19 +58,16 @@ all: semistatic static
|
||||||
# Cancel implicit make rule
|
# Cancel implicit make rule
|
||||||
%: %.c
|
%: %.c
|
||||||
|
|
||||||
#%: %.o
|
%.o: %.c %.h
|
||||||
# $(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(DYNAMIC_LIBS)
|
|
||||||
|
|
||||||
%: %.o
|
|
||||||
$(CC) $(STRIPFLAGS) $(XCFLAGS) $(OWLPSFLAGS) -o $@ $^ $(LDFLAGS) $(SEMISTATIC_LIBS)
|
|
||||||
|
|
||||||
%.static: %.o
|
|
||||||
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(STATIC_LIBS) \
|
|
||||||
-static
|
|
||||||
|
|
||||||
%.o: %.c $(HEADER)
|
|
||||||
$(CC) $(XCFLAGS) $(IATHEROS) $(OWLPSFLAGS) -c $<
|
$(CC) $(XCFLAGS) $(IATHEROS) $(OWLPSFLAGS) -c $<
|
||||||
|
|
||||||
|
# Compilation du programme
|
||||||
|
$(TARGET) : $(TARGET).o $(DEPS)
|
||||||
|
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
|
$(TARGET).static : $(TARGET).o $(DEPS)
|
||||||
|
$(CC) $(LDFLAGS) -static $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
|
||||||
|
|
||||||
|
|
||||||
## Installation / désinstallation ##
|
## Installation / désinstallation ##
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
// Bibliotheque OpenCoordinate : fonctions coordonnees geographiques
|
// Bibliotheque OpenCoordinate : fonctions coordonnees geographiques
|
||||||
|
|
||||||
#ifndef M_PI
|
#include "oc.h"
|
||||||
#define M_PI 3.14159265358979323846
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
struct point {
|
|
||||||
int date;
|
|
||||||
float time;
|
|
||||||
double lat, lon, alt, cap;
|
|
||||||
} point;
|
|
||||||
|
|
||||||
struct point_relatif {
|
|
||||||
double x, y, z;
|
|
||||||
} point_relatif;
|
|
||||||
|
|
||||||
double oc_distance_between(struct point a, struct point b) {
|
double oc_distance_between(struct point a, struct point b) {
|
||||||
// retourne la distance entre les 2 points en metres
|
// retourne la distance entre les 2 points en metres
|
||||||
|
@ -29,6 +18,7 @@ double oc_distance_between(struct point a, struct point b) {
|
||||||
return R * c;
|
return R * c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct point_relatif oc_convert(struct point o, struct point a) {
|
struct point_relatif oc_convert(struct point o, struct point a) {
|
||||||
//convert transforme des coordonnes WGS84 en metres par rapport au referentiel r
|
//convert transforme des coordonnes WGS84 en metres par rapport au referentiel r
|
||||||
struct point proj_x, proj_y;
|
struct point proj_x, proj_y;
|
||||||
|
@ -45,6 +35,7 @@ struct point_relatif oc_convert(struct point o, struct point a) {
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
function unconvert(x,y) {
|
function unconvert(x,y) {
|
||||||
if (origine==null) return null;
|
if (origine==null) return null;
|
||||||
|
@ -64,6 +55,7 @@ struct point_relatif oc_convert(struct point o, struct point a) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
double oc_cap(struct point o, struct point a) {
|
double oc_cap(struct point o, struct point a) {
|
||||||
struct point_relatif pr=oc_convert(a, o);
|
struct point_relatif pr=oc_convert(a, o);
|
||||||
double alpha;
|
double alpha;
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef _LIBOPENCOORDINATES_
|
||||||
|
#define _LIBOPENCOORDINATES_
|
||||||
|
|
||||||
|
|
||||||
|
/* Define M_PI if it is not defined */
|
||||||
|
#ifndef M_PI
|
||||||
|
# define M_PI 3.14159265358979323846
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct point
|
||||||
|
{
|
||||||
|
int date;
|
||||||
|
float time;
|
||||||
|
double lat, lon, alt, cap;
|
||||||
|
} point;
|
||||||
|
|
||||||
|
|
||||||
|
struct point_relatif
|
||||||
|
{
|
||||||
|
double x, y, z;
|
||||||
|
} point_relatif;
|
||||||
|
|
||||||
|
|
||||||
|
double oc_distance_between(struct point a, struct point b) ;
|
||||||
|
struct point_relatif oc_convert(struct point o, struct point a) ;
|
||||||
|
double oc_cap(struct point o, struct point a) ;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _LIBOPENCOORDINATES_
|
|
@ -1,8 +1,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
/* include OpenCoordinate */
|
|
||||||
#include "oc.c"
|
#include "oc.h"
|
||||||
|
|
||||||
/* Lenght of string algo */
|
/* Lenght of string algo */
|
||||||
#define ALGO_STRLEN 15
|
#define ALGO_STRLEN 15
|
||||||
|
@ -20,10 +20,6 @@
|
||||||
/* Program arguments (getopt string) */
|
/* Program arguments (getopt string) */
|
||||||
#define OPTIONS "d:hi:l::n:p:t:V"
|
#define OPTIONS "d:hi:l::n:p:t:V"
|
||||||
|
|
||||||
/* Define M_PI if is not define */
|
|
||||||
#ifndef M_PI
|
|
||||||
#define M_PI 3.14159265358979323846
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Define send command
|
//Define send command
|
||||||
#define LENSTR 1000
|
#define LENSTR 1000
|
||||||
|
|
Loading…
Reference in New Issue