diff --git a/conf/airframes/Poine/booz2_a7.xml b/conf/airframes/Poine/booz2_a7.xml index 91f6b2e122..ae0984c6d1 100644 --- a/conf/airframes/Poine/booz2_a7.xml +++ b/conf/airframes/Poine/booz2_a7.xml @@ -175,11 +175,11 @@ - - --> + diff --git a/conf/airframes/Poine/swift_1.xml b/conf/airframes/Poine/swift_1.xml index c62db5bafe..d8d589284a 100644 --- a/conf/airframes/Poine/swift_1.xml +++ b/conf/airframes/Poine/swift_1.xml @@ -2,18 +2,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - - + + + \ No newline at end of file diff --git a/conf/airframes/Poine/test_libeknav.xml b/conf/airframes/Poine/test_libeknav.xml index c52e1b513e..01fb15df5a 100644 --- a/conf/airframes/Poine/test_libeknav.xml +++ b/conf/airframes/Poine/test_libeknav.xml @@ -43,7 +43,7 @@ test3.LDFLAGS += -levent -lm test3.CFLAGS += -DFMS_PERIODIC_FREQ=512 test3.srcs += fms/fms_periodic.c - test3.CXXFLAGS += -DOVERO_LINK_MSG_UP=AutopilotMessagePTUp -DOVERO_LINK_MSG_DOWN=AutopilotMessagePTDown + test3.CXXFLAGS += -DOVERO_LINK_MSG_UP=AutopilotMessageVIUp -DOVERO_LINK_MSG_DOWN=AutopilotMessageVIDown test3.srcs += fms/fms_spi_link.c # test 4: Flags like test3 @@ -56,7 +56,7 @@ test4.LDFLAGS += -levent -lm test4.CFLAGS += -DFMS_PERIODIC_FREQ=512 test4.srcs += fms/fms_periodic.c - test4.CXXFLAGS += -DOVERO_LINK_MSG_UP=AutopilotMessagePTUp -DOVERO_LINK_MSG_DOWN=AutopilotMessagePTDown + test4.CXXFLAGS += -DOVERO_LINK_MSG_UP=AutopilotMessageVIUp -DOVERO_LINK_MSG_DOWN=AutopilotMessageVIDown test4.srcs += fms/fms_spi_link.c # test network based telemetry on overo (using udp_transport2/messages2) diff --git a/conf/autopilot/lisa_l_test_progs.makefile b/conf/autopilot/lisa_l_test_progs.makefile index 848d091b63..857abaf82b 100644 --- a/conf/autopilot/lisa_l_test_progs.makefile +++ b/conf/autopilot/lisa_l_test_progs.makefile @@ -572,3 +572,47 @@ test_bmp085.CFLAGS += -DUSE_I2C2 test_bmp085.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c #test_bmp085.CFLAGS += -DIMU_OVERRIDE_CHANNELS #test_bmp085.CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5 + + + +# +# Test manual : a simple test with rc and servos - I want to fly lisa/M +# +test_manual.ARCHDIR = $(ARCH) +test_manual.CFLAGS = -I$(SRC_FIRMWARE) -I$(ARCH) -DPERIPHERALS_AUTO_INIT +test_manual.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) +test_manual.srcs = test/test_manual.c \ + $(SRC_ARCH)/stm32_exceptions.c \ + $(SRC_ARCH)/stm32_vector_table.c +test_manual.CFLAGS += -DUSE_LED +test_manual.srcs += $(SRC_ARCH)/led_hw.c +test_manual.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=$(SYS_TIME_LED) +test_manual.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)' +test_manual.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c + +test_manual.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) +test_manual.srcs += $(SRC_ARCH)/uart_hw.c + +test_manual.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=$(MODEM_PORT) +test_manual.srcs += downlink.c pprz_transport.c + +test_manual.srcs += $(SRC_BOOZ)/booz2_commands.c + +test_manual.CFLAGS += -I$(SRC_FIRMWARE)/actuators/arch/$(ARCH) +#test_manual.srcs += $(SRC_FIRMWARE)/actuators/actuators_pwm.c +test_manual.srcs += $(SRC_FIRMWARE)/actuators/arch/$(ARCH)/actuators_pwm_arch.c +test_manual.srcs += $(SRC_FIRMWARE)/actuators/actuators_heli.c + + +test_manual.CFLAGS += -I$(SRC_BOOZ) -I$(SRC_BOOZ)/arch/$(ARCH) +test_manual.CFLAGS += -DUSE_RADIO_CONTROL +ifdef RADIO_CONTROL_LED +test_manual.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED) +endif +test_manual.CFLAGS += -DRADIO_CONTROL_BIND_IMPL_FUNC=radio_control_spektrum_try_bind +test_manual.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_spektrum.h\" +test_manual.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT) +test_manual.CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER -DUSE_TIM6_IRQ +test_manual.srcs += $(SRC_BOOZ)/booz_radio_control.c \ + $(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c \ + $(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c diff --git a/conf/autopilot/rotorcraft.makefile b/conf/autopilot/rotorcraft.makefile index 689918991b..1646d1d7bb 100644 --- a/conf/autopilot/rotorcraft.makefile +++ b/conf/autopilot/rotorcraft.makefile @@ -92,8 +92,8 @@ ap.srcs += $(SRC_ARCH)/uart_hw.c ap.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport ap.CFLAGS += -DDOWNLINK_DEVICE=$(MODEM_PORT) ap.srcs += $(SRC_FIRMWARE)/telemetry.c \ - downlink.c \ - pprz_transport.c + downlink.c \ + pprz_transport.c ap.CFLAGS += -DDATALINK=PPRZ ap.CFLAGS += -DPPRZ_UART=$(MODEM_PORT) ap.srcs += $(SRC_BOOZ)/booz2_datalink.c diff --git a/conf/modules/vehicle_interface_overo_link.xml b/conf/modules/vehicle_interface_overo_link.xml index 0040414cb8..3d6d40915d 100644 --- a/conf/modules/vehicle_interface_overo_link.xml +++ b/conf/modules/vehicle_interface_overo_link.xml @@ -13,10 +13,11 @@ ap.srcs += lisa/lisa_overo_link.c lisa/arch/stm32/lisa_overo_link_arch.c - + + - - + + diff --git a/sw/airborne/fms/fms_autopilot_msg.h b/sw/airborne/fms/fms_autopilot_msg.h index de1874fa35..43e774705e 100644 --- a/sw/airborne/fms/fms_autopilot_msg.h +++ b/sw/airborne/fms/fms_autopilot_msg.h @@ -3,6 +3,7 @@ #include #include "math/pprz_algebra_int.h" +#include "math/pprz_geodetic_int.h" #include "airframe.h" //#include "adc.h" #define NB_ADC 8 @@ -115,6 +116,30 @@ struct __attribute__ ((packed)) AutopilotMessagePTDown uint16_t pwm_outputs_usecs[LISA_PWM_OUTPUT_NB]; }; + + +#define IMU_DATA_VALID 0 +#define MAG_DATA_VALID 1 +#define GPS_DATA_VALID 2 +#define BARO_ABS_DATA_VALID 3 + +struct __attribute__ ((packed)) AutopilotMessageVIUp +{ + struct Int16Rates gyro; + struct Int16Vect3 accel; + struct Int16Vect3 mag; + struct EcefCoor_i ecef_pos; /* pos ECEF in cm */ + struct EcefCoor_i ecef_vel; /* speed ECEF in cm/s */ + int16_t pressure_absolute; + uint8_t valid_sensors; +}; + +struct __attribute__ ((packed)) AutopilotMessageVIDown +{ + +}; + + /* Union for computing size of SPI transfer (largest of either up or down message) */ union AutopilotMessage { struct OVERO_LINK_MSG_UP msg_up; diff --git a/sw/airborne/fms/libeknav/test_libeknav_4.cpp b/sw/airborne/fms/libeknav/test_libeknav_4.cpp index c35ae304d2..0ccd06f8a0 100644 --- a/sw/airborne/fms/libeknav/test_libeknav_4.cpp +++ b/sw/airborne/fms/libeknav/test_libeknav_4.cpp @@ -17,7 +17,7 @@ extern "C" { #include "fms/fms_periodic.h" #include "fms/fms_spi_link.h" #include "fms/fms_autopilot_msg.h" -#include "booz/booz_imu.h" +#include "firmwares/rotorcraft/imu.h" #include "fms/libeknav/raw_log.h" /* our sensors */ struct BoozImuFloat imu; @@ -146,7 +146,7 @@ static void main_dialog_with_io_proc() { spi_link_send(&msg_out, sizeof(struct AutopilotMessageCRCFrame), &msg_in, &crc_valid); - struct AutopilotMessagePTUp *in = &msg_in.payload.msg_up; + struct AutopilotMessageVIUp *in = &msg_in.payload.msg_up; RATES_FLOAT_OF_BFP(imu.gyro, in->gyro); ACCELS_FLOAT_OF_BFP(imu.accel, in->accel); MAGS_FLOAT_OF_BFP(imu.mag, in->mag); diff --git a/sw/airborne/modules/vehicle_interface/vi.h b/sw/airborne/modules/vehicle_interface/vi.h index 9a0b47e925..bcb4f65a12 100644 --- a/sw/airborne/modules/vehicle_interface/vi.h +++ b/sw/airborne/modules/vehicle_interface/vi.h @@ -82,6 +82,7 @@ struct VehicleInterface { uint8_t last_msg; struct Vi_info info; struct Vi_command input; + uint8_t available_sensors; }; extern struct VehicleInterface vi; @@ -91,6 +92,10 @@ extern void vi_set_enabled(bool_t enabled); extern void vi_periodic(void); extern void vi_update_info(void); +extern void vi_notify_gps(void); +extern void vi_notify_mag(void); +extern void vi_notify_baro_abs(void); + /* must be implemented by specific module */ extern void vi_impl_init(void); extern void vi_impl_periodic(void); diff --git a/sw/airborne/modules/vehicle_interface/vi_overo_link.c b/sw/airborne/modules/vehicle_interface/vi_overo_link.c index 8764793b1d..be4b9b21f4 100644 --- a/sw/airborne/modules/vehicle_interface/vi_overo_link.c +++ b/sw/airborne/modules/vehicle_interface/vi_overo_link.c @@ -25,6 +25,8 @@ #include "lisa/lisa_overo_link.h" #include +#include +#include #include @@ -33,6 +35,7 @@ static inline void on_overo_link_lost(void); void vi_impl_init(void) { overo_link_init(); + vi.available_sensors = 0; } void vi_impl_periodic(void) { @@ -49,15 +52,24 @@ static inline void on_overo_link_lost(void) { void vi_overo_link_on_msg_received(void) { -#if 0 - memcpy(&overo_link.up.msg, &overo_link.down.msg, - sizeof(union AutopilotMessage)); -#endif - overo_link.up.msg.valid.imu = 1; + overo_link.up.msg.valid_sensors = vi.available_sensors; + RATES_COPY(overo_link.up.msg.gyro, imu.gyro); VECT3_COPY(overo_link.up.msg.accel, imu.accel); - VECT3_COPY(overo_link.up.msg.mag, imu.mag); + if (vi.available_sensors && (1<