mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 07:53:43 +08:00
gps received by overo.
This commit is contained in:
@@ -246,7 +246,7 @@ main_overo.srcs += $(SRC_BETH)/overo_controller.c
|
|||||||
#
|
#
|
||||||
|
|
||||||
USER =
|
USER =
|
||||||
HOST = 192.168.0.16
|
HOST = auto3
|
||||||
TARGET_DIR = ~
|
TARGET_DIR = ~
|
||||||
SRC_FMS=fms
|
SRC_FMS=fms
|
||||||
|
|
||||||
@@ -254,18 +254,18 @@ overo_test_uart.ARCHDIR = omap
|
|||||||
overo_test_uart.CFLAGS = -I. -I$(SRC_FMS)
|
overo_test_uart.CFLAGS = -I. -I$(SRC_FMS)
|
||||||
overo_test_uart.srcs = $(SRC_BETH)/overo_test_uart.c
|
overo_test_uart.srcs = $(SRC_BETH)/overo_test_uart.c
|
||||||
|
|
||||||
overo_test_uart.CFLAGS += -DFMS_PERIODIC_FREQ=2
|
overo_test_uart.CFLAGS += -DFMS_PERIODIC_FREQ=500
|
||||||
overo_test_uart.srcs += $(SRC_FMS)/fms_periodic.c
|
overo_test_uart.srcs += $(SRC_FMS)/fms_periodic.c
|
||||||
overo_test_uart.srcs += $(SRC_FMS)/fms_serial_port.c
|
overo_test_uart.srcs += $(SRC_FMS)/fms_serial_port.c
|
||||||
overo_test_uart.CFLAGS += -DUBX -DGPS -DGPS_LINK=ttyUSB0
|
|
||||||
overo_test_uart.srcs += $(SRC_BETH)/gps_ubx.c
|
|
||||||
overo_test_uart.LDFLAGS += -lrt
|
overo_test_uart.LDFLAGS += -lrt
|
||||||
overo_test_uart.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=UdpTransport
|
overo_test_uart.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=UdpTransport
|
||||||
overo_test_uart.srcs += $(SRC_FMS)/udp_transport2.c downlink.c
|
overo_test_uart.srcs += $(SRC_FMS)/udp_transport2.c downlink.c
|
||||||
overo_test_uart.srcs += $(SRC_FMS)/fms_network.c
|
overo_test_uart.srcs += $(SRC_FMS)/fms_network.c
|
||||||
overo_test_uart.LDFLAGS += -levent -lm
|
overo_test_uart.LDFLAGS += -levent -lm
|
||||||
overo_test_uart.srcs += $(SRC_BETH)/overo_gcs_com.c
|
overo_test_uart.srcs += $(SRC_BETH)/overo_gcs_com.c
|
||||||
|
overo_test_uart.CFLAGS += -DUBX -DGPS -DUSE_UART0 -DUART0_BAUD=B38400 -DGPS_LINK=Uart0 -DGPS_USE_LATLONG
|
||||||
|
#overo_test_uart.CFLAGS += -DUBX -DGPS -DUSE_UART1 -DUART1_BAUD=B9600 -DGPS_LINK=Uart1 -DGPS_USE_LATLONG
|
||||||
|
overo_test_uart.srcs += gps_ubx.c gps.c latlong.c $(SRC_FMS)/uart_hw.c
|
||||||
|
|
||||||
#
|
#
|
||||||
# Overo twisting
|
# Overo twisting
|
||||||
|
|||||||
@@ -9,7 +9,10 @@
|
|||||||
#include "dl_protocol.h"
|
#include "dl_protocol.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#define GCS_HOST "10.31.4.5"
|
//bill laptop
|
||||||
|
//#define GCS_HOST "10.31.4.5"
|
||||||
|
//auto4
|
||||||
|
#define GCS_HOST "10.31.4.104"
|
||||||
#define GCS_PORT 4242
|
#define GCS_PORT 4242
|
||||||
#define DATALINK_PORT 4243
|
#define DATALINK_PORT 4243
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
|
|
||||||
|
#include "gps.h"
|
||||||
|
|
||||||
#include "messages2.h"
|
#include "messages2.h"
|
||||||
#include "airframe.h"
|
#include "airframe.h"
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@
|
|||||||
#include "fms_serial_port.h"
|
#include "fms_serial_port.h"
|
||||||
|
|
||||||
#include "overo_gcs_com.h"
|
#include "overo_gcs_com.h"
|
||||||
|
#include "uart_hw.h"
|
||||||
|
|
||||||
struct OveroController {
|
struct OveroController {
|
||||||
int armed;
|
int armed;
|
||||||
@@ -47,16 +50,23 @@ struct OveroController {
|
|||||||
static void main_periodic(int);
|
static void main_periodic(int);
|
||||||
static void main_exit(int sig);
|
static void main_exit(int sig);
|
||||||
static void main_talk_with_tiny(void);
|
static void main_talk_with_tiny(void);
|
||||||
|
void check_gps(void);
|
||||||
|
|
||||||
static uint32_t foo = 0;
|
//make gps.c happy without incluing navigation code
|
||||||
struct FmsSerialPort* fmssp;
|
uint8_t nav_utm_zone0 = 5;
|
||||||
int spfd;
|
|
||||||
|
static uint16_t foo = 0;
|
||||||
|
//struct FmsSerialPort* fmssp;
|
||||||
|
//int spfd;
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
(void) signal(SIGINT, main_exit);
|
(void) signal(SIGINT, main_exit);
|
||||||
|
|
||||||
fmssp = serial_port_new();
|
uart_init();
|
||||||
|
gps_init();
|
||||||
|
|
||||||
|
/* fmssp = serial_port_new();
|
||||||
//speed_t speed;
|
//speed_t speed;
|
||||||
|
|
||||||
if (serial_port_open_raw(fmssp,"/dev/ttyUSB0",B9600)){
|
if (serial_port_open_raw(fmssp,"/dev/ttyUSB0",B9600)){
|
||||||
@@ -65,7 +75,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
spfd = (int)fmssp->fd;
|
spfd = (int)fmssp->fd;
|
||||||
|
*/
|
||||||
/* Initalize the event library */
|
/* Initalize the event library */
|
||||||
event_init();
|
event_init();
|
||||||
|
|
||||||
@@ -83,14 +93,54 @@ int main(int argc, char *argv[]) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint16_t tempstatus = 0;
|
||||||
|
|
||||||
static void main_periodic(int my_sig_num) {
|
static void main_periodic(int my_sig_num) {
|
||||||
|
|
||||||
RunOnceEvery(20, {DOWNLINK_SEND_ALIVE(gcs_com.udp_transport, 16, MD5SUM); printf("\n");});
|
|
||||||
|
|
||||||
|
RunOnceEvery(10, {DOWNLINK_SEND_MOTOR(gcs_com.udp_transport, &tempstatus, &foo );});
|
||||||
|
|
||||||
|
RunOnceEvery(50, {DOWNLINK_SEND_ALIVE(gcs_com.udp_transport, 16, MD5SUM);});
|
||||||
|
|
||||||
|
#ifdef USE_UART0
|
||||||
|
uart0_handler();
|
||||||
|
#elif USE_UART1
|
||||||
|
uart1_handler();
|
||||||
|
#endif
|
||||||
main_talk_with_tiny();
|
main_talk_with_tiny();
|
||||||
|
check_gps();
|
||||||
|
|
||||||
RunOnceEvery(2, gcs_com_periodic());
|
|
||||||
|
|
||||||
|
RunOnceEvery(20, gcs_com_periodic());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void check_gps(void){
|
||||||
|
if (ubx_status > tempstatus) tempstatus = ubx_status;
|
||||||
|
|
||||||
|
/* if (GpsTimeoutError) {
|
||||||
|
printf("gps timeout\n");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (GpsBuffer()) {
|
||||||
|
ReadGpsBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gps_msg_received) {
|
||||||
|
printf("gps msg rx\n");
|
||||||
|
/* parse and use GPS messages */
|
||||||
|
parse_gps_msg();
|
||||||
|
gps_msg_received = FALSE;
|
||||||
|
if (gps_pos_available) {
|
||||||
|
printf("gps pos avail\n");
|
||||||
|
gps_verbose_downlink = 0;
|
||||||
|
// UseGpsPosNoSend(estimator_update_state_gps);
|
||||||
|
gps_downlink();
|
||||||
|
gps_pos_available = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void main_exit(int sig) {
|
static void main_exit(int sig) {
|
||||||
@@ -101,18 +151,11 @@ static void main_exit(int sig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void main_talk_with_tiny() {
|
static void main_talk_with_tiny() {
|
||||||
unsigned char c='D';
|
//unsigned char c='D';
|
||||||
write(spfd,&c,1);
|
//write(spfd,&c,1);
|
||||||
if (read(spfd,&c,1)>0) write(STDOUT_FILENO,&c,1);
|
//if (read(spfd,&c,1)>0) write(STDOUT_FILENO,&c,1);
|
||||||
//fprintf(spfd,"testing\n");
|
//fprintf(spfd,"testing\n");
|
||||||
printf(".");
|
//printf(".");
|
||||||
foo++;
|
foo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ttyUSB0Transmit(){
|
|
||||||
|
|
||||||
}
|
|
||||||
int ttyUSB0SendMessage(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user