[ARDrone] Reorganise .h, clean includes

This commit is contained in:
Matteo Cypriani 2011-08-18 10:00:45 +02:00
parent 2c91f5b976
commit fe8846cca9
2 changed files with 64 additions and 54 deletions

View File

@ -2,15 +2,20 @@
* This file is part of the rtap localisation project.
*/
#include "../libowlps-client/owlps-client.h"
#include "owlps-drone.h"
#include <owlps-client.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <time.h>
@ -20,13 +25,11 @@
#include <sys/time.h>
#include <fcntl.h>
#include <assert.h>
#include <signal.h>
#include <semaphore.h>
#define SEPARATOR ','
#define EOL '$'
#define TYPE "GPS"
#include <assert.h>
/* Options */

View File

@ -1,13 +1,11 @@
#include <stdio.h>
#include <pthread.h>
#include <math.h>
#ifndef _OWLPS_ARDRONE_H_
#define _OWLPS_ARDRONE_H_
#include "oc.h"
/* Lenght of string algo */
#define ALGO_STRLEN 15
/* Error codes */
#define ERR_BAD_USAGE 1 // Bad program call (bad number of arguments)
/* Program arguments (getopt string) */
#define OPTIONS "d:hi:l::n:p:t:V"
/* Number of packets to send */
#define DEFAULT_NBPKT_CALIB 20 // 20 packets when calibrating
@ -17,48 +15,31 @@
#define DEFAULT_DELAY_CALIB 50000 // Calibration request
#define DEFAULT_DELAY_NORMAL 25000 // Localisation request
/* Program arguments (getopt string) */
#define OPTIONS "d:hi:l::n:p:t:V"
/* Maximum length of the algorithm name */
#define ALGO_STRLEN 15
/* GPS inputs */
#define SEPARATOR ','
#define EOL '$'
#define TYPE "GPS"
//Define send command
/* Drone commands */
#define LENSTR 1000
#define ATREF "AT*REF="
#define LANDING ",290717696"
#define TAKEOFF ",290718208"
//Define socket
//#define IP "172.20.105.4"
/* Socket parameters */
#define IP "192.168.1.1"
#define PORT 5556
/* Function headers */
void parse_command_line(int argc, char **argv) ;
void parse_main_options(int argc, char **argv) ;
void check_destination_ip(void) ;
void parse_calibration_data(int argc, char **argv) ;
void check_configuration(void) ;
#ifdef DEBUG
void print_configuration(void) ;
#endif // DEBUG
void create_socket(void) ;
void make_packet(void) ;
void send_request(void) ;
void* receive_position(void*) ;
void print_usage(void) ;
void string2data(char*) ;
void traficGPS(int);
void* thread_gps(void*) ;
void* thread_send(void*) ;
void* thread_control(void*) ;
void print_error(char*) ;
void print_version(void) ;
void drone_handler_sigint(const int);
typedef struct result result;
typedef struct gps gps;
/* Struct */
/* Error codes */
#define ERR_BAD_USAGE 1 // Bad program call (bad number of arguments)
struct result
/* Received result */
typedef struct _result
{
char algo[ALGO_STRLEN];
float x;
@ -66,9 +47,9 @@ struct result
float z;
char *check;
float err;
};
} result ;
struct gps
typedef struct _gps
{
float time;
char state;
@ -80,7 +61,7 @@ struct gps
float cap;
int date;
float decmag;
};
} gps ;
typedef struct _consigne
{
@ -91,33 +72,59 @@ typedef struct _consigne
struct _consigne *next;
} consigne ;
typedef struct _point
typedef struct _point_consigne
{
double lat;
double lon;
double alt;
} point_consigne ;
/* Prototype drone */
/* Function headers */
void parse_command_line(int argc, char **argv) ;
void parse_main_options(int argc, char **argv) ;
void check_destination_ip(void) ;
void parse_calibration_data(int argc, char **argv) ;
void check_configuration(void) ;
#ifdef DEBUG
void print_configuration(void) ;
#endif // DEBUG
void print_usage(void) ;
void print_version(void) ;
void drone_handler_sigint(const int) ;
void create_socket(void) ;
void make_packet(void) ;
void send_request(void) ;
void* receive_position(void*) ;
void string2data(char*) ;
void traficGPS(int);
void* thread_gps(void*) ;
void* thread_send(void*) ;
void* thread_control(void*) ;
void print_error(char*) ;
void drone_err(int);
//Position
int read_position(char*);
//Socket
int drone_socket_create(void);
void* drone_socket_watchdog(void*);
int drone_socket_close(void);
//Commands drone
int cmd_drone_take_off(void); //Add socket
int cmd_drone_landing(void); //Add socket
int cmd_drone_move(float, int);
int cmd_drone_init_direction(void); //Add socket
//Algo
void calcul_trajectory(float*, float*);
float calcul_speed(float);
int check_destination(struct point, struct point);
float calcul_angle(void);
//Liste chaine
consigne* list_add_front(consigne*, double, double, double);
consigne* list_add_back(consigne*, double, double, double);
void list_print(consigne*);
#endif //_OWLPS_ARDRONE_H_