diff --git a/conf/airframes/Poine/beth.xml b/conf/airframes/Poine/beth.xml index c1972c4128..f48be5ed45 100644 --- a/conf/airframes/Poine/beth.xml +++ b/conf/airframes/Poine/beth.xml @@ -246,7 +246,7 @@ main_overo.srcs += $(SRC_BETH)/overo_controller.c # USER = -HOST = 192.168.0.16 +HOST = auto3 TARGET_DIR = ~ SRC_FMS=fms @@ -254,18 +254,18 @@ overo_test_uart.ARCHDIR = omap overo_test_uart.CFLAGS = -I. -I$(SRC_FMS) 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_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.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=UdpTransport overo_test_uart.srcs += $(SRC_FMS)/udp_transport2.c downlink.c overo_test_uart.srcs += $(SRC_FMS)/fms_network.c overo_test_uart.LDFLAGS += -levent -lm 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 diff --git a/sw/airborne/beth/overo_gcs_com.c b/sw/airborne/beth/overo_gcs_com.c index 02a354300e..069e3da9be 100644 --- a/sw/airborne/beth/overo_gcs_com.c +++ b/sw/airborne/beth/overo_gcs_com.c @@ -9,7 +9,10 @@ #include "dl_protocol.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 DATALINK_PORT 4243 diff --git a/sw/airborne/beth/overo_test_uart.c b/sw/airborne/beth/overo_test_uart.c index 0ca9bdc6fe..c3a0d9503a 100644 --- a/sw/airborne/beth/overo_test_uart.c +++ b/sw/airborne/beth/overo_test_uart.c @@ -31,6 +31,8 @@ #include +#include "gps.h" + #include "messages2.h" #include "airframe.h" @@ -39,6 +41,7 @@ #include "fms_serial_port.h" #include "overo_gcs_com.h" +#include "uart_hw.h" struct OveroController { int armed; @@ -47,16 +50,23 @@ struct OveroController { static void main_periodic(int); static void main_exit(int sig); static void main_talk_with_tiny(void); +void check_gps(void); -static uint32_t foo = 0; -struct FmsSerialPort* fmssp; -int spfd; +//make gps.c happy without incluing navigation code +uint8_t nav_utm_zone0 = 5; + +static uint16_t foo = 0; +//struct FmsSerialPort* fmssp; +//int spfd; int main(int argc, char *argv[]) { (void) signal(SIGINT, main_exit); - fmssp = serial_port_new(); + uart_init(); + gps_init(); + +/* fmssp = serial_port_new(); //speed_t speed; if (serial_port_open_raw(fmssp,"/dev/ttyUSB0",B9600)){ @@ -65,7 +75,7 @@ int main(int argc, char *argv[]) { } spfd = (int)fmssp->fd; - +*/ /* Initalize the event library */ event_init(); @@ -83,14 +93,54 @@ int main(int argc, char *argv[]) { return 0; } +static uint16_t tempstatus = 0; + 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(); + 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) { @@ -101,18 +151,11 @@ static void main_exit(int sig) { } static void main_talk_with_tiny() { - unsigned char c='D'; - write(spfd,&c,1); - if (read(spfd,&c,1)>0) write(STDOUT_FILENO,&c,1); + //unsigned char c='D'; + //write(spfd,&c,1); + //if (read(spfd,&c,1)>0) write(STDOUT_FILENO,&c,1); //fprintf(spfd,"testing\n"); - printf("."); + //printf("."); foo++; } -int ttyUSB0Transmit(){ - -} -int ttyUSB0SendMessage(){ - -} -