mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 06:54:49 +08:00
[conf][test] cleanup: remove old booz stuff
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
|
||||
|
||||
|
||||
SRC_BOOZ=booz
|
||||
SRC_BOOZ_ARCH=$(SRC_BOOZ)/arch/$(ARCH)
|
||||
SRC_BOOZ_TEST=$(SRC_BOOZ)/test
|
||||
|
||||
SRC_BOOZ_PRIV=booz_priv
|
||||
|
||||
CFG_BOOZ=$(PAPARAZZI_SRC)/conf/firmwares/
|
||||
|
||||
BOOZ_INC = -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH)
|
||||
@@ -1,485 +0,0 @@
|
||||
#
|
||||
# $id$
|
||||
#
|
||||
# Copyright (C) 2008 Antoine Drouin (poinix@gmail.com)
|
||||
#
|
||||
# This file is part of paparazzi.
|
||||
#
|
||||
# paparazzi is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# paparazzi is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with paparazzi; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
|
||||
include $(PAPARAZZI_SRC)/conf/firmwares/booz2_common.makefile
|
||||
|
||||
#
|
||||
# test_led : blinks all leds
|
||||
#
|
||||
test_led.ARCHDIR = $(ARCH)
|
||||
|
||||
test_led.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
|
||||
test_led.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
test_led.srcs += $(SRC_BOOZ_TEST)/booz2_test_led.c
|
||||
test_led.CFLAGS += -DUSE_LED
|
||||
test_led.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_led.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
#
|
||||
# test_downlink : sends a TIME message
|
||||
#
|
||||
test_downlink.ARCHDIR = $(ARCH)
|
||||
|
||||
test_downlink.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
|
||||
test_downlink.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
test_downlink.srcs += $(SRC_BOOZ_TEST)/booz2_test_subsystems/datalink/downlink.c
|
||||
test_downlink.CFLAGS += -DUSE_LED
|
||||
test_downlink.CFLAGS += -DPERIODIC_FREQUENCY='10.' -DSYS_TIME_LED=1
|
||||
test_downlink.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_downlink.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_downlink.srcs += mcu_periph/uart.c
|
||||
test_downlink.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_downlink.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_downlink.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
|
||||
#
|
||||
# test_max1168 : samples gyros and mags, sends values
|
||||
#
|
||||
test_max1168.ARCHDIR = $(ARCH)
|
||||
|
||||
test_max1168.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH)
|
||||
test_max1168.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
test_max1168.srcs += $(SRC_BOOZ_TEST)/booz2_test_max1168.c
|
||||
test_max1168.CFLAGS += -DUSE_LED
|
||||
test_max1168.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_max1168.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_max1168.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_max1168.srcs += mcu_periph/uart.c
|
||||
test_max1168.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_max1168.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_max1168.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_max1168.CFLAGS += -DMAX1168_EOC_VIC_SLOT=11
|
||||
test_max1168.srcs += peripherals/max1168.c \
|
||||
$(SRC_ARCH)/peripherals/max1168_arch.c
|
||||
|
||||
|
||||
|
||||
#
|
||||
# tunnel hw
|
||||
#
|
||||
tunnel.ARCHDIR = $(ARCH)
|
||||
|
||||
tunnel.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
|
||||
tunnel.srcs += $(SRC_BOOZ_TEST)/booz2_tunnel.c
|
||||
tunnel.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
tunnel.CFLAGS += -DUSE_LED
|
||||
tunnel.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
tunnel.srcs += mcu.c $(SRC_ARCH)/mcu_arch.c
|
||||
|
||||
tunnel.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400
|
||||
tunnel.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
tunnel.srcs += mcu_periph/uart.c
|
||||
tunnel.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
|
||||
#
|
||||
# tunnel bit banging
|
||||
#
|
||||
tunnel_bb.ARCHDIR = $(ARCH)
|
||||
|
||||
tunnel_bb.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
|
||||
tunnel_bb.srcs += $(SRC_BOOZ_TEST)/booz2_tunnel_bb.c
|
||||
tunnel_bb.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
tunnel_bb.CFLAGS += -DUSE_LED
|
||||
tunnel_bb.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
|
||||
#
|
||||
# usb tunnels
|
||||
#
|
||||
usb_tunnel_0.ARCHDIR = $(ARCH)
|
||||
usb_tunnel_0.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
|
||||
usb_tunnel_0.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 -DPERIPHERALS_AUTO_INIT
|
||||
usb_tunnel_0.CFLAGS += -DUSE_USB_LINE_CODING -DUSE_USB_SERIAL -DUSE_LED
|
||||
usb_tunnel_0.srcs += $(SRC_ARCH)/usb_tunnel.c $(SRC_ARCH)/usb_ser_hw.c mcu_periph/uart.c $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
usb_tunnel_0.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbinit.c
|
||||
usb_tunnel_0.srcs += $(SRC_ARCH)/lpcusb/usbcontrol.c $(SRC_ARCH)/lpcusb/usbstdreq.c
|
||||
usb_tunnel_0.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
usb_tunnel_0.srcs += mcu.c $(SRC_ARCH)/mcu_arch.c
|
||||
|
||||
usb_tunnel_1.ARCHDIR = $(ARCH)
|
||||
usb_tunnel_1.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
|
||||
usb_tunnel_1.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B38400 -DPERIPHERALS_AUTO_INIT
|
||||
usb_tunnel_1.CFLAGS += -DUSE_USB_LINE_CODING -DUSE_USB_SERIAL -DUSE_LED
|
||||
usb_tunnel_1.srcs += $(SRC_ARCH)/usb_tunnel.c $(SRC_ARCH)/usb_ser_hw.c mcu_periph/uart.c $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
usb_tunnel_1.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbinit.c
|
||||
usb_tunnel_1.srcs += $(SRC_ARCH)/lpcusb/usbcontrol.c $(SRC_ARCH)/lpcusb/usbstdreq.c
|
||||
usb_tunnel_1.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
usb_tunnel_1.srcs += mcu.c $(SRC_ARCH)/mcu_arch.c
|
||||
|
||||
|
||||
#
|
||||
# test GPS
|
||||
#
|
||||
test_gps.ARCHDIR = $(ARCH)
|
||||
|
||||
test_gps.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH)
|
||||
test_gps.srcs += $(SRC_BOOZ_TEST)/booz2_test_gps.c
|
||||
test_gps.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_gps.CFLAGS += -DUSE_LED
|
||||
test_gps.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_gps.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_gps.srcs += mcu_periph/uart.c
|
||||
test_gps.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_gps.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_gps.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_gps.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400
|
||||
test_gps.CFLAGS += -DGPS_LINK=UART0 -DGPS_LED=2
|
||||
test_gps.srcs += $(SRC_BOOZ)/booz2_gps.c
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# test modem
|
||||
#
|
||||
test_modem.ARCHDIR = $(ARCH)
|
||||
|
||||
test_modem.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
|
||||
test_modem.srcs += $(SRC_BOOZ_TEST)/booz2_test_modem.c
|
||||
test_modem.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_modem.CFLAGS += -DUSE_LED
|
||||
test_modem.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_modem.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_modem.srcs += mcu_periph/uart.c
|
||||
test_modem.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_modem.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_modem.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
#test_modem.CFLAGS += -DBOOZ_ANALOG_BARO_LED=2 -DBOOZ_ANALOG_BARO_PERIOD='CPU_TICKS_OF_SEC((1./100.))'
|
||||
#test_modem.srcs += $(BOOZ_PRIV)/booz_analog_baro.c
|
||||
|
||||
|
||||
#
|
||||
# test USB telemetry
|
||||
#
|
||||
test_usb.ARCHDIR = $(ARCH)
|
||||
|
||||
test_usb.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
|
||||
test_usb.srcs += $(SRC_BOOZ_TEST)/booz2_test_usb.c
|
||||
test_usb.CFLAGS += -DPERIODIC_FREQUENCY='512.'
|
||||
# -DSYS_TIME_LED=1
|
||||
test_usb.CFLAGS += -DUSE_LED
|
||||
test_usb.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
test_usb.srcs += mcu.c $(SRC_ARCH)/mcu_arch.c
|
||||
|
||||
#test_usb.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
#test_usb.srcs += mcu_periph/uart.c
|
||||
#test_usb.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
#test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
#test_usb.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DUSE_USB_SERIAL
|
||||
test_usb.CFLAGS += -DDOWNLINK_DEVICE=UsbS -DPPRZ_UART=UsbS -DDATALINK=PPRZ
|
||||
test_usb.srcs += subsystems/datalink/downlink.c mcu_periph/uart.c $(SRC_ARCH)/mcu_periph/uart_arch.c $(SRC_ARCH)/usb_ser_hw.c subsystems/datalink/pprz_transport.c
|
||||
# $(SRC_FIRMWARE)/datalink.c
|
||||
test_usb.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c
|
||||
test_usb.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# test AMI
|
||||
#
|
||||
test_ami.ARCHDIR = $(ARCH)
|
||||
|
||||
test_ami.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
|
||||
test_ami.srcs += $(SRC_BOOZ_TEST)/booz2_test_ami.c
|
||||
test_ami.CFLAGS += -DPERIODIC_FREQUENCY='50.' -DSYS_TIME_LED=1
|
||||
test_ami.CFLAGS += -DUSE_LED
|
||||
test_ami.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_ami.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_ami.srcs += mcu_periph/uart.c
|
||||
test_ami.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_ami.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_ami.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_ami.CFLAGS += -DUSE_I2C1 -DI2C1_SCLL=150 -DI2C1_SCLH=150 -DI2C1_BUF_LEN=16
|
||||
test_ami.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
||||
test_ami.CFLAGS += -DUSE_AMI601
|
||||
test_ami.srcs += AMI601.c
|
||||
|
||||
|
||||
#
|
||||
# test crista
|
||||
#
|
||||
test_crista.ARCHDIR = $(ARCH)
|
||||
|
||||
test_crista.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH)
|
||||
test_crista.srcs += $(SRC_BOOZ_TEST)/booz2_test_crista.c
|
||||
test_crista.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_crista.CFLAGS += -DUSE_LED
|
||||
test_crista.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_crista.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B57600
|
||||
test_crista.srcs += mcu_periph/uart.c
|
||||
test_crista.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_crista.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART0
|
||||
test_crista.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_crista.CFLAGS += -DFLOAT_T=float -DBOOZ2_IMU_TYPE=\"booz2_imu_crista.h\"
|
||||
test_crista.srcs += $(SRC_BOOZ)/booz2_imu.c
|
||||
test_crista.srcs += $(SRC_BOOZ)/booz2_imu_crista.c $(SRC_BOOZ_ARCH)/booz2_imu_crista_hw.c
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# test IMU b2
|
||||
#
|
||||
test_imu_b2.ARCHDIR = $(ARCH)
|
||||
|
||||
test_imu_b2.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH)
|
||||
test_imu_b2.srcs += $(SRC_BOOZ_TEST)/booz2_test_imu_b2.c
|
||||
test_imu_b2.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_imu_b2.CFLAGS += -DUSE_LED
|
||||
test_imu_b2.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_imu_b2.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_imu_b2.srcs += mcu_periph/uart.c
|
||||
test_imu_b2.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_imu_b2.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_imu_b2.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_imu_b2.srcs += $(SRC_BOOZ)/booz_trig_int.c
|
||||
|
||||
test_imu_b2.CFLAGS += -DBOOZ2_IMU_TYPE=\"booz2_imu_b2.h\"
|
||||
test_imu_b2.srcs += $(SRC_BOOZ)/booz2_imu_b2.c $(SRC_BOOZ_ARCH)/booz2_imu_b2_hw.c
|
||||
test_imu_b2.CFLAGS += -DMAX1168_EOC_VIC_SLOT=11
|
||||
test_imu_b2.srcs += $(SRC_BOOZ)/booz2_max1168.c $(SRC_BOOZ_ARCH)/booz2_max1168_hw.c
|
||||
test_imu_b2.CFLAGS += -DFLOAT_T=float
|
||||
test_imu_b2.srcs += $(SRC_BOOZ)/booz2_imu.c
|
||||
|
||||
|
||||
#
|
||||
# test rc spektrum
|
||||
#
|
||||
|
||||
test_rc_spektrum.ARCHDIR = $(ARCH)
|
||||
|
||||
test_rc_spektrum.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) $(BOOZ_CFLAGS)
|
||||
test_rc_spektrum.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
test_rc_spektrum.srcs += $(SRC_BOOZ_TEST)/booz2_test_radio_control.c
|
||||
test_rc_spektrum.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_rc_spektrum.CFLAGS += -DUSE_LED
|
||||
test_rc_spektrum.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
#test_rc_spektrum.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
#test_rc_spektrum.srcs += mcu_periph/uart.c
|
||||
#test_rc_spektrum.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
#test_rc_spektrum.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
#test_rc_spektrum.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
test_rc_spektrum.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DUSE_USB_SERIAL
|
||||
test_rc_spektrum.CFLAGS += -DDOWNLINK_DEVICE=UsbS -DPPRZ_UART=UsbS -DDATALINK=PPRZ
|
||||
test_rc_spektrum.srcs += subsystems/datalink/downlink.c $(SRC_ARCH)/usb_ser_hw.c subsystems/datalink/pprz_transport.c
|
||||
test_rc_spektrum.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c
|
||||
test_rc_spektrum.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c
|
||||
|
||||
test_rc_spektrum.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_LED=1
|
||||
test_rc_spektrum.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"booz_radio_control_spektrum.h\"
|
||||
test_rc_spektrum.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=\"booz_radio_control_spektrum_dx7se.h\"
|
||||
test_rc_spektrum.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B115200
|
||||
test_rc_spektrum.CFLAGS += -DRADIO_CONTROL_LINK=UART0
|
||||
test_rc_spektrum.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control_spektrum.c \
|
||||
mcu_periph/uart.c \
|
||||
$(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
#
|
||||
# test rc ppm
|
||||
#
|
||||
|
||||
test_rc_ppm.ARCHDIR = $(ARCH)
|
||||
|
||||
test_rc_ppm.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) $(BOOZ_CFLAGS)
|
||||
test_rc_ppm.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
test_rc_ppm.srcs += $(SRC_BOOZ_TEST)/booz2_test_radio_control.c
|
||||
test_rc_ppm.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_rc_ppm.CFLAGS += -DUSE_LED
|
||||
test_rc_ppm.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
#test_rc_ppm.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
#test_rc_ppm.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
#test_rc_ppm.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
#test_rc_ppm.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
test_rc_ppm.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DUSE_USB_SERIAL
|
||||
test_rc_ppm.CFLAGS += -DDOWNLINK_DEVICE=UsbS -DPPRZ_UART=UsbS -DDATALINK=PPRZ
|
||||
test_rc_ppm.srcs += subsystems/datalink/downlink.c $(SRC_ARCH)/usb_ser_hw.c subsystems/datalink/pprz_transport.c
|
||||
test_rc_ppm.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c
|
||||
test_rc_ppm.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c
|
||||
|
||||
test_rc_ppm.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_LED=1
|
||||
test_rc_ppm.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"booz_radio_control_ppm.h\"
|
||||
test_rc_ppm.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
test_rc_ppm.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_BOOZ)/$(IMPL)/booz_radio_control_ppm.c \
|
||||
$(SRC_BOOZ)/$(IMPL)/$(ARCH)/booz_radio_control_ppm_arch.c \
|
||||
|
||||
|
||||
#
|
||||
# test MC
|
||||
#
|
||||
test_mc.ARCHDIR = $(ARCH)
|
||||
|
||||
test_mc.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH)
|
||||
test_mc.srcs += $(SRC_BOOZ_TEST)/booz2_test_mc.c
|
||||
test_mc.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_mc.CFLAGS += -DUSE_LED
|
||||
test_mc.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_mc.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_mc.srcs += mcu_periph/uart.c
|
||||
test_mc.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_mc.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_mc.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_mc.CFLAGS += -DACTUATORS=\"actuators_buss_twi_blmc_hw.h\" -DUSE_BUSS_TWI_BLMC
|
||||
test_mc.srcs += $(SRC_BOOZ_ARCH)/actuators_buss_twi_blmc_hw.c actuators.c
|
||||
test_mc.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=150 -DI2C0_SCLH=150
|
||||
test_mc.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
||||
|
||||
|
||||
|
||||
#
|
||||
# test BUSS BLDC
|
||||
#
|
||||
test_buss_bldc.ARCHDIR = $(ARCH)
|
||||
|
||||
test_buss_bldc.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
test_buss_bldc.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH)
|
||||
test_buss_bldc.srcs += $(SRC_BOOZ_TEST)/booz2_test_buss_bldc.c
|
||||
test_buss_bldc.CFLAGS += -DUSE_LED
|
||||
test_buss_bldc.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_buss_bldc.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_buss_bldc.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_buss_bldc.srcs += mcu_periph/uart.c
|
||||
test_buss_bldc.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_buss_bldc.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_buss_bldc.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_buss_bldc.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=150 -DI2C0_SCLH=150
|
||||
test_buss_bldc.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
||||
|
||||
|
||||
|
||||
#
|
||||
# test asctec BLMC
|
||||
#
|
||||
test_amc.ARCHDIR = $(ARCH)
|
||||
|
||||
test_amc.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH)
|
||||
test_amc.srcs += $(SRC_BOOZ_TEST)/booz2_test_amc.c
|
||||
test_amc.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_amc.CFLAGS += -DUSE_LED
|
||||
test_amc.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
test_amc.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_amc.srcs += mcu_periph/uart.c
|
||||
test_amc.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_amc.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_amc.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
test_amc.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=UART1
|
||||
test_amc.srcs += $(SRC_FIRMWARE)/datalink.c
|
||||
|
||||
test_amc.CFLAGS += -DACTUATORS=\"actuators_asctec_twi_blmc_hw.h\"
|
||||
test_amc.srcs += $(SRC_BOOZ_ARCH)/actuators_asctec_twi_blmc_hw.c actuators.c
|
||||
test_amc.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=150 -DI2C0_SCLH=150
|
||||
test_amc.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
||||
test_amc.CFLAGS += -DFLOAT_T=float
|
||||
#-DBOOZ2_IMU_TYPE=\"booz2_imu_crista.h\"
|
||||
|
||||
|
||||
|
||||
#
|
||||
# test_mkk_bldc :
|
||||
#
|
||||
test_mkk_bldc.ARCHDIR = $(ARCH)
|
||||
|
||||
test_mkk_bldc.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) $(BOOZ_CFLAGS)
|
||||
test_mkk_bldc.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
test_mkk_bldc.srcs += $(SRC_BOOZ_TEST)/booz2_test_buss_bldc_hexa.c
|
||||
test_mkk_bldc.CFLAGS += -DUSE_LED
|
||||
test_mkk_bldc.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_mkk_bldc.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
test_mkk_bldc.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=150 -DI2C0_SCLH=150
|
||||
test_mkk_bldc.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
||||
|
||||
|
||||
#
|
||||
# test 24 bits baro
|
||||
#
|
||||
test_baro_24.ARCHDIR = $(ARCH)
|
||||
|
||||
test_baro_24.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) $(BOOZ_CFLAGS)
|
||||
test_baro_24.srcs += $(SRC_BOOZ_TEST)/booz2_test_baro_24.c
|
||||
test_baro_24.CFLAGS += -DPERIODIC_FREQUENCY='5.' -DSYS_TIME_LED=1
|
||||
test_baro_24.CFLAGS += -DUSE_LED
|
||||
test_baro_24.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
|
||||
test_baro_24.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600
|
||||
test_baro_24.srcs += mcu_periph/uart.c
|
||||
test_baro_24.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
|
||||
|
||||
test_baro_24.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UART1
|
||||
test_baro_24.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
|
||||
|
||||
test_baro_24.CFLAGS += -DUSE_I2C1 -DI2C1_SCLL=150 -DI2C1_SCLH=150 -DI2C1_BUF_LEN=16
|
||||
test_baro_24.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
||||
test_baro_24.srcs += $(SRC_BOOZ)/booz2_baro_24.c
|
||||
|
||||
#
|
||||
# test_coders : blinks all leds
|
||||
#
|
||||
test_coder.ARCHDIR = $(ARCH)
|
||||
|
||||
test_coder.CFLAGS += -DBOARD_CONFIG=\"boards/olimex_lpc_h2148.h\" $(BOOZ_CFLAGS)
|
||||
test_coder.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
test_coder.srcs += $(SRC_BOOZ_TEST)/booz2_test_coder.c
|
||||
test_coder.CFLAGS += -DUSE_LED
|
||||
test_coder.CFLAGS += -DPERIODIC_FREQUENCY='512.' -DSYS_TIME_LED=1
|
||||
test_coder.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
|
||||
@@ -5,8 +5,6 @@
|
||||
#
|
||||
|
||||
SRC_ARCH=arch/$(ARCH)
|
||||
SRC_BOOZ=booz
|
||||
SRC_BOOZ_ARCH=$(SRC_BOOZ)/arch/$(ARCH)
|
||||
SRC_LISA=lisa
|
||||
SRC_LISA_ARCH=$(SRC_LISA)/arch/$(ARCH)
|
||||
SRC_CSC=csc
|
||||
@@ -20,7 +18,7 @@ CFG_LISA_PASSTHROUGH = $(PAPARAZZI_SRC)/conf/firmwares/subsystems/lisa_passthrou
|
||||
|
||||
|
||||
stm_passthrough.ARCHDIR = stm32
|
||||
stm_passthrough.CFLAGS += -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(SRC_LISA_ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -I$(SRC_BOARD) -I$(SRC_ROTOR_ARCH) -I$(SRC_IMU_ARCH)
|
||||
stm_passthrough.CFLAGS += -I$(SRC_FIRMWARE) -I$(SRC_LISA) -I$(SRC_LISA_ARCH) -I$(SRC_BOARD) -I$(SRC_ROTOR_ARCH) -I$(SRC_IMU_ARCH)
|
||||
stm_passthrough.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
|
||||
stm_passthrough.CFLAGS += -DPERIPHERALS_AUTO_INIT
|
||||
stm_passthrough.srcs = $(SRC_LISA)/lisa_stm_passthrough_main.c
|
||||
|
||||
@@ -24,17 +24,12 @@
|
||||
CFG_SHARED=$(PAPARAZZI_SRC)/conf/firmwares/subsystems/shared
|
||||
CFG_ROTORCRAFT=$(PAPARAZZI_SRC)/conf/firmwares/subsystems/rotorcraft
|
||||
|
||||
SRC_BOOZ_TEST=$(SRC_BOOZ)/test
|
||||
SRC_BOOZ_PRIV=booz_priv
|
||||
|
||||
SRC_BOARD=boards/$(BOARD)
|
||||
SRC_FIRMWARE=firmwares/rotorcraft
|
||||
SRC_SUBSYSTEMS=subsystems
|
||||
|
||||
SRC_ARCH=arch/$(ARCH)
|
||||
|
||||
CFG_BOOZ=$(PAPARAZZI_SRC)/conf/firmwares/
|
||||
|
||||
ROTORCRAFT_INC = -I$(SRC_FIRMWARE) -I$(SRC_BOARD)
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
|
||||
# Radio control
|
||||
stm_passthrough.CFLAGS += -DRADIO_CONTROL
|
||||
stm_passthrough.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_joby.h\"
|
||||
stm_passthrough.CFLAGS += -DRADIO_CONTROL_JOBY_MODEL_H=\"radio_control/booz_radio_control_joby_9ch.h\"
|
||||
stm_passthrough.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_BOOZ)/radio_control/booz_radio_control_joby.c
|
||||
stm_passthrough.CFLAGS += -DRADIO_CONTROL_LED=6
|
||||
stm_passthrough.CFLAGS += -DUSE_UART3 -DUART3_BAUD=B115200
|
||||
stm_passthrough.CFLAGS += -DRADIO_CONTROL_LINK=UART3
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
##
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
#
|
||||
# This file is part of paparazzi.
|
||||
#
|
||||
# paparazzi is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# paparazzi is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with paparazzi; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
##
|
||||
|
||||
# Quiet compilation
|
||||
Q=@
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -std=gnu99 -Wall -I.. -I../.. -I../../test/ -I../../../include -I../../booz_priv
|
||||
LDFLAGS = -lm
|
||||
|
||||
CFLAGS += -I../../../../var/BOOZ2_A1P
|
||||
test_mlkf: test_mlkf.c ../booz_ahrs.c ../../booz_priv/ahrs/booz_ahrs_mlkf.c ../../booz_priv/ahrs/booz_ahrs_mlkf_opt.c ../booz_imu.c ../../math/pprz_trig_int.c ./imu_dummy.c ../ahrs/booz_ahrs_aligner.c
|
||||
$(CC) $(CFLAGS) -DBOOZ_IMU_TYPE_H=\"test/imu_dummy.h\" -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_vg_ref: test_vg_ref.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_vg_adpt: test_vg_adpt.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
|
||||
test_deadband: test_deadband.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_scaling: test_scaling.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
TEST_ATT_CFLAGS = -DSTABILISATION_ATTITUDE_TYPE_INT \
|
||||
-DSTABILISATION_ATTITUDE_H=\"stabilization/booz_stabilization_attitude_int.h\" \
|
||||
-DSTABILISATION_ATTITUDE_REF_H=\"stabilization/booz_stabilization_attitude_ref_quat_int.h\"
|
||||
|
||||
test_att_ref: test_att_ref.c ../stabilization/booz_stabilization_attitude_ref_quat_int.c
|
||||
$(CC) $(CFLAGS) $(TEST_ATT_CFLAGS) -I/home/poine/work/savannah/paparazzi3/trunk/var/BOOZ2_A1 -o $@ $^ $(LDFLAGS)
|
||||
|
||||
|
||||
clean:
|
||||
$(Q)rm -f *~ test_att_ref
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "mcu.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "interrupt_hw.h"
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
#include "subsystems/datalink/datalink.h"
|
||||
|
||||
#include "booz2_test_buss_bldc_hexa.h"
|
||||
|
||||
#define NB_MOTORS 6
|
||||
static const uint8_t motor_addr[] = {0x52, 0x54, 0x56, 0x58, 0x5A, 0x5C};
|
||||
uint8_t motor = 0;
|
||||
uint8_t thrust = 10;
|
||||
static bool_t i2c_done;
|
||||
|
||||
//static uint8_t addr = 0x52; /* 1 : back right */
|
||||
//static uint8_t addr = 0x54; /* 2 : back left bad balanced */
|
||||
//static uint8_t addr = 0x56; /* 3 : center right not so well balanced */
|
||||
//static uint8_t addr = 0x58; /* 4 : center left */
|
||||
//static uint8_t addr = 0x5A; /* 5 : front right */
|
||||
//static uint8_t addr = 0x5C; /* 6 : front left */
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic_task( void );
|
||||
static inline void main_event_task( void );
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_check_and_ack_timer(0))
|
||||
main_periodic_task();
|
||||
main_event_task();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
mcu_init();
|
||||
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
|
||||
mcu_int_enable();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
i2c0_buf[0] = thrust;
|
||||
i2c0_transmit(motor_addr[motor], 1, &i2c_done);
|
||||
|
||||
RunOnceEvery(128, { DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||
|
||||
}
|
||||
|
||||
static inline void main_event_task( void ) {
|
||||
DatalinkEvent();
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef BOOZ2_TEST_BUSS_BLDC_HEXA_H
|
||||
#define BOOZ2_TEST_BUSS_BLDC_HEXA_H
|
||||
|
||||
extern uint8_t motor;
|
||||
extern uint8_t thrust;
|
||||
|
||||
#endif /* BOOZ2_TEST_BUSS_BLDC_HEXA_H */
|
||||
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "std.h"
|
||||
#include "mcu.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "led.h"
|
||||
#include "mcu_periph/uart.h"
|
||||
#include "messages.h"
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
|
||||
#include "subsystems/imu.h"
|
||||
|
||||
#include "interrupt_hw.h"
|
||||
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic_task( void );
|
||||
static inline void main_event_task( void );
|
||||
|
||||
static inline void on_imu_event(void);
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_check_and_ack_timer(0))
|
||||
main_periodic_task();
|
||||
main_event_task();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
mcu_init();
|
||||
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
|
||||
led_init();
|
||||
|
||||
/* LED_ON(4); */
|
||||
/* LED_ON(5); */
|
||||
/* LED_ON(6); */
|
||||
/* LED_ON(7); */
|
||||
|
||||
uart0_init();
|
||||
imu_impl_init();
|
||||
imu_init();
|
||||
|
||||
mcu_int_enable();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
//#if 0
|
||||
RunOnceEvery(100, {
|
||||
// LED_TOGGLE(7);
|
||||
DOWNLINK_SEND_ALIVE(16, MD5SUM);
|
||||
});
|
||||
// uint16_t foo = ami601_status;
|
||||
// DOWNLINK_SEND_BOOT(&foo);
|
||||
//#endif
|
||||
// if (sys_time.nb_sec > 2)
|
||||
|
||||
imu_periodic();
|
||||
}
|
||||
|
||||
static inline void main_event_task( void ) {
|
||||
|
||||
ImuEvent(on_imu_event);
|
||||
|
||||
}
|
||||
|
||||
static inline void on_imu_event(void) {
|
||||
ImuScaleGyro();
|
||||
ImuScaleAccel();
|
||||
|
||||
// LED_TOGGLE(6);
|
||||
static uint8_t cnt;
|
||||
cnt++;
|
||||
if (cnt > 15) cnt = 0;
|
||||
|
||||
if (cnt == 0) {
|
||||
DOWNLINK_SEND_IMU_GYRO_RAW(&imu_gyro_unscaled.x,
|
||||
&imu_gyro_unscaled.y,
|
||||
&imu_gyro_unscaled.z);
|
||||
|
||||
DOWNLINK_SEND_IMU_ACCEL_RAW(&imu_accel_unscaled.x,
|
||||
&imu_accel_unscaled.y,
|
||||
&imu_accel_unscaled.z);
|
||||
}
|
||||
else if (cnt == 7) {
|
||||
DOWNLINK_SEND_IMU_GYRO_SCALED(&imu_gyro.x,
|
||||
&imu_gyro.y,
|
||||
&imu_gyro.z);
|
||||
|
||||
DOWNLINK_SEND_IMU_ACCEL_SCALED(&imu_accel.x,
|
||||
&imu_accel.y,
|
||||
&imu_accel.z);
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "std.h"
|
||||
#include "mcu.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
#include "subsystems/gps.h"
|
||||
#include "interrupt_hw.h"
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic_task( void );
|
||||
static inline void main_event_task( void );
|
||||
|
||||
static void on_gps_sol(void);
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_check_and_ack_timer(0))
|
||||
main_periodic_task();
|
||||
main_event_task();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
mcu_init();
|
||||
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
|
||||
led_init();
|
||||
gps_init();
|
||||
mcu_int_enable();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
|
||||
RunOnceEvery(128, { DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||
RunOnceEvery(128, { LED_PERIODIC();});
|
||||
}
|
||||
|
||||
static inline void main_event_task( void ) {
|
||||
GpsEvent(on_gps_sol);
|
||||
|
||||
}
|
||||
|
||||
static void on_gps_sol(void) {
|
||||
|
||||
DOWNLINK_SEND_GPS_INT( DefaultChannel, DefaultDevice,
|
||||
&gps.ecef_pos.x,
|
||||
&gps.ecef_pos.y,
|
||||
&gps.ecef_pos.z,
|
||||
&gps.lla_pos.lat,
|
||||
&gps.lla_pos.lon,
|
||||
&gps.lla_pos.alt,
|
||||
&gps.ecef_vel.x,
|
||||
&gps.ecef_vel.y,
|
||||
&gps.ecef_vel.z,
|
||||
&gps.pacc,
|
||||
&gps.sacc,
|
||||
&gps.tow,
|
||||
&gps.pdop,
|
||||
&gps.num_sv,
|
||||
&gps.fix);
|
||||
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "std.h"
|
||||
#include "mcu.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "interrupt_hw.h"
|
||||
#include "messages.h"
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
|
||||
#include "armVIC.h"
|
||||
#include "LPC21xx.h"
|
||||
#include "peripherals/max1168.h"
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic_task( void );
|
||||
static inline void main_event_task( void );
|
||||
|
||||
|
||||
static void main_init_ssp(void);
|
||||
static void SSP_ISR(void) __attribute__((naked));
|
||||
|
||||
|
||||
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_check_and_ack_timer(0))
|
||||
main_periodic_task();
|
||||
main_event_task();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
mcu_init();
|
||||
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
|
||||
|
||||
main_init_ssp();
|
||||
max1168_init();
|
||||
|
||||
mcu_int_enable();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
LED_TOGGLE(3);
|
||||
max1168_read();
|
||||
}
|
||||
|
||||
static inline void main_event_task( void ) {
|
||||
if (max1168_status == MAX1168_DATA_AVAILABLE) {
|
||||
RunOnceEvery(10, {
|
||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice, &max1168_values[0], &max1168_values[1], &max1168_values[2]);
|
||||
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice, &max1168_values[3], &max1168_values[4], &max1168_values[6]);
|
||||
DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &max1168_values[7]); });
|
||||
max1168_status = MAX1168_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
/* SSPCR0 settings */
|
||||
#define SSP_DDS 0x0F << 0 /* data size : 16 bits */
|
||||
#define SSP_FRF 0x00 << 4 /* frame format : SPI */
|
||||
#define SSP_CPOL 0x00 << 6 /* clock polarity : data captured on first clock transition */
|
||||
#define SSP_CPHA 0x00 << 7 /* clock phase : SCK idles low */
|
||||
#define SSP_SCR 0x0F << 8 /* serial clock rate : divide by 16 */
|
||||
|
||||
/* SSPCR1 settings */
|
||||
#define SSP_LBM 0x00 << 0 /* loopback mode : disabled */
|
||||
#define SSP_SSE 0x00 << 1 /* SSP enable : disabled */
|
||||
#define SSP_MS 0x00 << 2 /* master slave mode : master */
|
||||
#define SSP_SOD 0x00 << 3 /* slave output disable : don't care when master */
|
||||
|
||||
#define SSPCR0_VAL (SSP_DDS | SSP_FRF | SSP_CPOL | SSP_CPHA | SSP_SCR )
|
||||
#define SSPCR1_VAL (SSP_LBM | SSP_SSE | SSP_MS | SSP_SOD )
|
||||
|
||||
#define SSP_PINSEL1_SCK (2<<2)
|
||||
#define SSP_PINSEL1_MISO (2<<4)
|
||||
#define SSP_PINSEL1_MOSI (2<<6)
|
||||
|
||||
#define SSP_Enable() SetBit(SSPCR1, SSE);
|
||||
#define SSP_Disable() ClearBit(SSPCR1, SSE);
|
||||
#define SSP_EnableRxi() SetBit(SSPIMSC, RXIM)
|
||||
#define SSP_DisableRxi() ClearBit(SSPIMSC, RXIM)
|
||||
#define SSP_EnableTxi() SetBit(SSPIMSC, TXIM)
|
||||
#define SSP_DisableTxi() ClearBit(SSPIMSC, TXIM)
|
||||
#define SSP_EnableRti() SetBit(SSPIMSC, RTIM);
|
||||
#define SSP_DisableRti() ClearBit(SSPIMSC, RTIM);
|
||||
#define SSP_ClearRti() SetBit(SSPICR, RTIC);
|
||||
|
||||
#ifndef SSP_VIC_SLOT
|
||||
#define SSP_VIC_SLOT 7
|
||||
#endif
|
||||
|
||||
|
||||
static void main_init_ssp(void) {
|
||||
|
||||
/* setup pins for SSP (SCK, MISO, MOSI, SSEL) */
|
||||
PINSEL1 |= SSP_PINSEL1_SCK | SSP_PINSEL1_MISO | SSP_PINSEL1_MOSI;
|
||||
|
||||
/* setup SSP */
|
||||
SSPCR0 = SSPCR0_VAL;;
|
||||
SSPCR1 = SSPCR1_VAL;
|
||||
SSPCPSR = 0x02;
|
||||
|
||||
/* initialize interrupt vector */
|
||||
VICIntSelect &= ~VIC_BIT( VIC_SPI1 ); /* SPI1 selected as IRQ */
|
||||
VICIntEnable = VIC_BIT( VIC_SPI1 ); /* enable it */
|
||||
_VIC_CNTL(SSP_VIC_SLOT) = VIC_ENABLE | VIC_SPI1;
|
||||
_VIC_ADDR(SSP_VIC_SLOT) = (uint32_t)SSP_ISR; /* address of the ISR */
|
||||
|
||||
}
|
||||
|
||||
static void SSP_ISR(void) {
|
||||
ISR_ENTRY();
|
||||
|
||||
Max1168OnSpiInt();
|
||||
|
||||
VICVectAddr = 0x00000000; /* clear this interrupt from the VIC */
|
||||
ISR_EXIT();
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "std.h"
|
||||
#include "mcu.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "led.h"
|
||||
|
||||
#include "mcu_periph/usb_serial.h"
|
||||
|
||||
#include "messages.h"
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
|
||||
#include "interrupt_hw.h"
|
||||
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic_task( void );
|
||||
static inline void main_event_task( void );
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_check_and_ack_timer(0))
|
||||
main_periodic_task();
|
||||
main_event_task();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
mcu_init();
|
||||
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
|
||||
led_init();
|
||||
|
||||
VCOM_init();
|
||||
|
||||
mcu_int_enable();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
RunOnceEvery(10, {
|
||||
LED_TOGGLE(1);
|
||||
DOWNLINK_SEND_ALIVE(PprzTransport,16, MD5SUM);
|
||||
});
|
||||
}
|
||||
|
||||
static inline void main_event_task( void ) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
///
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
//
|
||||
// This file is part of paparazzi.
|
||||
//
|
||||
// paparazzi is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// paparazzi is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with paparazzi; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
///
|
||||
|
||||
clear();
|
||||
|
||||
M=fscanfMat('traj.out');
|
||||
|
||||
value = M(:,1);
|
||||
raw_sensor_f = M(:,2);
|
||||
raw_sensor_i = M(:,3);
|
||||
scaled_sensor_f = M(:,4);
|
||||
scaled_sensor_i = M(:,5);
|
||||
time=1:length(value);
|
||||
|
||||
|
||||
//k = find(time > 500 & time < 550);
|
||||
k = find(value > -0.009 & value < 0.009);
|
||||
//k = 1:length(time);
|
||||
|
||||
|
||||
scf();
|
||||
//clf();
|
||||
|
||||
drawlater();
|
||||
|
||||
subplot(3,1,1);
|
||||
xtitle('real', 'time (s)','');
|
||||
plot2d(time(k), value(k), 3);
|
||||
plot2d2(time(k), scaled_sensor_i(k)/2^10, 2);
|
||||
|
||||
legends(["float", "int", "fixed"],[5 3 2], with_box=%f, opt="lr");
|
||||
|
||||
subplot(3,1,2);
|
||||
xtitle('raw', 'time (s)','');
|
||||
|
||||
plot2d(time(k), raw_sensor_f(k), 3);
|
||||
plot2d2(time(k), raw_sensor_i(k), 2);
|
||||
|
||||
legends(["float", "int", "fixed"],[5 3 2], with_box=%f, opt="lr");
|
||||
|
||||
subplot(3,1,3);
|
||||
xtitle('scaled', 'time (s)','');
|
||||
plot2d(value(k), scaled_sensor_f(k), 3);
|
||||
plot2d2(value(k), scaled_sensor_i(k), 5);
|
||||
//plot2d(time(k), zeros(1, length(time(k))), 1);
|
||||
xgrid(1);
|
||||
|
||||
|
||||
drawnow();
|
||||
@@ -1,93 +0,0 @@
|
||||
///
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
//
|
||||
// This file is part of paparazzi.
|
||||
//
|
||||
// paparazzi is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// paparazzi is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with paparazzi; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
///
|
||||
|
||||
clear();
|
||||
|
||||
M=fscanfMat('traj.out');
|
||||
|
||||
time = M(:,1);
|
||||
meas = M(:,2);
|
||||
thrust = M(:,3);
|
||||
zdd_ref = M(:,4);
|
||||
ffX = M(:,5);
|
||||
ffP = M(:,6);
|
||||
ffm = M(:,7);
|
||||
ifX = M(:,8);
|
||||
ifP = M(:,9);
|
||||
|
||||
//k = find(time > 500 & time < 550);
|
||||
//k = find(time > 1110 & time < 1168);
|
||||
k = 1:length(time);
|
||||
|
||||
|
||||
clf();
|
||||
|
||||
drawlater();
|
||||
|
||||
subplot(3,2,1);
|
||||
xtitle('X', 'time (s)','');
|
||||
plot2d(time(k), ffm(k), 4);
|
||||
plot2d(time(k), ffX(k), 3);
|
||||
plot2d(time(k), ifX(k)/2^18, 5);
|
||||
legends(["float", "int", "meas"],[3 5 4], with_box=%f, opt="lr");
|
||||
|
||||
subplot(3,2,2);
|
||||
xtitle('P', 'time (s)','');
|
||||
plot2d(time(k), ffP(k), 3);
|
||||
plot2d(time(k), ifP(k)/2^18, 5);
|
||||
legends(["float", "int"],[3 5], with_box=%f, opt="lr");
|
||||
|
||||
subplot(3,2,3);
|
||||
xtitle('X', 'time (s)','');
|
||||
plot2d(time(k), ffX(k)*2^18, 3);
|
||||
plot2d(time(k), ifX(k), 5);
|
||||
legends(["float", "int"],[3 5], with_box=%f, opt="lr");
|
||||
|
||||
subplot(3,2,4);
|
||||
xtitle('P', 'time (s)','');
|
||||
plot2d(time(k), ffP(k)*2^18, 3);
|
||||
plot2d(time(k), ifP(k), 5);
|
||||
legends(["float", "int"],[3 5], with_box=%f, opt="lr");
|
||||
|
||||
subplot(3,2,5);
|
||||
xtitle('Zdd', 'time (s)','');
|
||||
plot2d(time(k), meas(k)/2^10, 1);
|
||||
|
||||
subplot(3,2,6);
|
||||
xtitle('Thrust', 'time (s)','');
|
||||
|
||||
fmg = 9.81./ffX(k);
|
||||
img = 9.81./ifX(k)*2^18;
|
||||
plot2d(time(k), fmg, 3);
|
||||
plot2d(time(k), img, 5);
|
||||
|
||||
fmzdd = zdd_ref(k)./ffX(k)./2^10;
|
||||
imzdd = zdd_ref(k)./ifX(k)./2^10*2^18;
|
||||
//plot2d(time(k), fmg - fmzdd, 3);
|
||||
//plot2d(time(k), img - imzdd, 5);
|
||||
|
||||
//plot2d(time(k), thrust(k), 2);
|
||||
|
||||
legends(["float", "int"],[3 5], with_box=%f, opt="lr");
|
||||
|
||||
drawnow();
|
||||
@@ -1,63 +0,0 @@
|
||||
///
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
//
|
||||
// This file is part of paparazzi.
|
||||
//
|
||||
// paparazzi is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// paparazzi is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with paparazzi; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
///
|
||||
|
||||
clear();
|
||||
|
||||
M=fscanfMat('traj.out');
|
||||
|
||||
time = M(:,1);
|
||||
fzsp = M(:,2);
|
||||
fzdsp = M(:,3);
|
||||
fz = M(:,4);
|
||||
fzd = M(:,5);
|
||||
fzdd = M(:,6);
|
||||
iz = M(:,7);
|
||||
izd = M(:,8);
|
||||
izdd = M(:,9);
|
||||
|
||||
|
||||
clf();
|
||||
|
||||
drawlater();
|
||||
|
||||
subplot(3,1,1);
|
||||
xtitle('z', 'time (s)','');
|
||||
plot2d(time, fzsp, 1);
|
||||
plot2d(time, fz, 2);
|
||||
plot2d(time, iz, 3);
|
||||
legends(["sp", "float", "int"],[1 2 3], with_box=%f, opt="ur");
|
||||
|
||||
subplot(3,1,2);
|
||||
xtitle('zd', 'time (s)','');
|
||||
plot2d(time, fzdsp, 1);
|
||||
plot2d(time, fzd, 2);
|
||||
plot2d(time, izd, 3);
|
||||
legends(["float", "int"],[2 3], with_box=%f, opt="lr");
|
||||
|
||||
subplot(3,1,3);
|
||||
xtitle('zdd', 'time (s)','');
|
||||
plot2d(time, fzdd, 2);
|
||||
plot2d(time, izdd, 3);
|
||||
legends(["float", "int"],[2 3], with_box=%f, opt="lr");
|
||||
|
||||
drawnow();
|
||||
@@ -1,116 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "math/pprz_algebra_double.h"
|
||||
#include "subsystems/imu.h"
|
||||
#include "subsystems/ahrs.h"
|
||||
#include "ahrs/ahrs_mlkf.h"
|
||||
|
||||
static void read_data(const char* filename);
|
||||
static void feed_imu(int i);
|
||||
static void store_filter_output(int i);
|
||||
static void dump_output(const char* filename);
|
||||
|
||||
#define IN_FILE "../../../simulator/scilab/q6d/data/stop_stop_state_sensors.txt"
|
||||
#define OUT_FILE "./out.txt"
|
||||
|
||||
#define MAX_SAMPLE 15000
|
||||
struct test_sample {
|
||||
double time;
|
||||
struct DoubleQuat quat_true;
|
||||
struct DoubleRates omega_true;
|
||||
struct DoubleRates gyro;
|
||||
struct DoubleVect3 accel;
|
||||
struct DoubleVect3 mag;
|
||||
};
|
||||
static struct test_sample samples[MAX_SAMPLE];
|
||||
static int nb_samples;
|
||||
|
||||
struct test_output {
|
||||
struct FloatQuat quat_est;
|
||||
struct FloatRates bias_est;
|
||||
struct FloatRates rate_est;
|
||||
float P[6][6];
|
||||
};
|
||||
static struct test_output output[MAX_SAMPLE];
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
read_data(IN_FILE);
|
||||
|
||||
imu_init();
|
||||
ahrs_init();
|
||||
|
||||
for (int i=0; i<nb_samples; i++) {
|
||||
feed_imu(i);
|
||||
ahrs_propagate();
|
||||
ahrs_update_accel();
|
||||
ahrs_update_mag();
|
||||
store_filter_output(i);
|
||||
}
|
||||
dump_output(OUT_FILE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void read_data(const char* filename) {
|
||||
FILE* fd = fopen(filename, "r");
|
||||
nb_samples = 0;
|
||||
int ret = 0;
|
||||
do {
|
||||
struct test_sample* s = &samples[nb_samples];
|
||||
ret = fscanf(fd, "%lf [%lf %lf %lf %lf] [%lf %lf %lf] [%lf %lf %lf] [%lf %lf %lf] [%lf %lf %lf]",
|
||||
&s->time,
|
||||
&s->quat_true.qi, &s->quat_true.qx, &s->quat_true.qy, &s->quat_true.qz,
|
||||
&s->omega_true.p, &s->omega_true.q, &s->omega_true.r,
|
||||
&s->gyro.p, &s->gyro.q, &s->gyro.r,
|
||||
&s->accel.x, &s->accel.y, &s->accel.z,
|
||||
&s->mag.x, &s->mag.y, &s->mag.z );
|
||||
nb_samples++;
|
||||
}
|
||||
while (ret == 17 && nb_samples < MAX_SAMPLE);
|
||||
nb_samples--;
|
||||
fclose(fd);
|
||||
printf("read %d points in file %s\n", nb_samples, filename);
|
||||
}
|
||||
|
||||
|
||||
static void feed_imu(int i) {
|
||||
if (i>0) {
|
||||
RATES_COPY(imu.gyro_prev, imu.gyro);
|
||||
}
|
||||
else {
|
||||
RATES_BFP_OF_REAL(imu.gyro_prev, samples[0].gyro);
|
||||
}
|
||||
RATES_BFP_OF_REAL(imu.gyro, samples[i].gyro);
|
||||
ACCELS_BFP_OF_REAL(imu.accel, samples[i].accel);
|
||||
MAGS_BFP_OF_REAL(imu.mag, samples[i].mag);
|
||||
}
|
||||
|
||||
|
||||
static void store_filter_output(int i) {
|
||||
|
||||
QUAT_COPY(output[i].quat_est, ahrs_float.ltp_to_imu_quat);
|
||||
RATES_COPY(output[i].bias_est, ahrs_mlkf.gyro_bias);
|
||||
RATES_COPY(output[i].rate_est, ahrs_float.imu_rate);
|
||||
memcpy(output[i].P, ahrs_mlkf.P, sizeof(ahrs_mlkf.P));
|
||||
|
||||
}
|
||||
|
||||
static void dump_output(const char* filename) {
|
||||
FILE* fd = fopen(filename, "w");
|
||||
int i;
|
||||
for (i=0; i<nb_samples; i++) {
|
||||
fprintf(fd, "%.16f [%.16f %.16f %.16f %.16f] [%.16f %.16f %.16f] [%.16f %.16f %.16f] [%.16f %.16f %.16f %.16f %.16f %.16f]\n",
|
||||
samples[i].time,
|
||||
output[i].quat_est.qi, output[i].quat_est.qx, output[i].quat_est.qy, output[i].quat_est.qz, // quaternion
|
||||
output[i].rate_est.p, output[i].rate_est.q, output[i].rate_est.r, // omega
|
||||
output[i].bias_est.p, output[i].bias_est.q, output[i].bias_est.r, // bias
|
||||
output[i].P[0][0], output[i].P[1][1], output[i].P[2][2], // covariance
|
||||
output[i].P[3][3], output[i].P[4][4], output[i].P[5][5] );
|
||||
}
|
||||
fclose(fd);
|
||||
printf("wrote %d points in file %s\n", nb_samples, filename);
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
clear();
|
||||
clearglobal();
|
||||
|
||||
|
||||
exec('../../../simulator/scilab/q6d/q6d_fdm.sci');
|
||||
exec('../../../simulator/scilab/q6d/q6d_algebra.sci');
|
||||
|
||||
global ahrs_quat;
|
||||
global ahrs_omega;
|
||||
global ahrs_bias;
|
||||
global ahrs_cov;
|
||||
|
||||
function read_ahrs_output(filename)
|
||||
global ahrs_quat;
|
||||
global ahrs_omega;
|
||||
global ahrs_bias;
|
||||
global ahrs_cov;
|
||||
ahrs_quat = zeros(4,length(time));
|
||||
ahrs_omega = zeros(3,length(time));
|
||||
ahrs_bias = zeros(3,length(time));
|
||||
ahrs_cov = zeros(6,length(time));
|
||||
i=1;
|
||||
u=mopen(filename, 'r');
|
||||
while meof(u) == 0 & i <= length(time)
|
||||
line = mgetl(u, 1);
|
||||
if line ~= []
|
||||
[nb_scan, t, qi, qx, qy, qz, p, q, r, bp, bq, br, c11, c22, c33, c44, c55, c66] = ...
|
||||
msscanf(1, line, '%f [%f %f %f %f] [%f %f %f] [%f %f %f] [%f %f %f %f %f %f]');
|
||||
if nb_scan == 17
|
||||
ahrs_quat(:,i) = [qi qx qy qz]';
|
||||
ahrs_omega(:,i) = [p q r]';
|
||||
ahrs_bias(:,i) = [bp bq br]';
|
||||
ahrs_cov(:,i) = [c11 c22 c33 c44 c55 c66]';
|
||||
i = i+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
mclose(u);
|
||||
endfunction
|
||||
|
||||
function display_ahrs_state()
|
||||
clf();
|
||||
f=get("current_figure");
|
||||
f.figure_name="AHRS state";
|
||||
|
||||
eul_fdm = zeros(3,length(time));
|
||||
eul_ahrs = zeros(3,length(time));
|
||||
|
||||
for i=1:length(time)
|
||||
eul_fdm(:,i) = euler_of_quat(fdm_state(FDM_SQI:FDM_SQZ,i));
|
||||
eul_ahrs(:,i) = euler_of_quat(ahrs_quat(:,i));
|
||||
end
|
||||
|
||||
subplot(4,3,1);
|
||||
plot2d(time, deg_of_rad(eul_ahrs(1,:)), 3);
|
||||
plot2d(time, deg_of_rad(eul_fdm(1,:)), 2);
|
||||
legends(["fdm", "ahrs_c"],[2 3], with_box=%f, opt="ul");
|
||||
xtitle('Phi');
|
||||
|
||||
subplot(4,3,2);
|
||||
plot2d(time, deg_of_rad(eul_ahrs(2,:)), 3);
|
||||
plot2d(time, deg_of_rad(eul_fdm(2,:)), 2);
|
||||
legends(["fdm", "ahrs_c"],[2 3], with_box=%f, opt="ul");
|
||||
xtitle('Theta');
|
||||
|
||||
subplot(4,3,3);
|
||||
plot2d(time, deg_of_rad(eul_ahrs(3,:)), 3);
|
||||
plot2d(time, deg_of_rad(eul_fdm(3,:)), 2);
|
||||
legends(["fdm", "ahrs_c"],[2 3], with_box=%f, opt="ul");
|
||||
xtitle('Psi');
|
||||
|
||||
subplot(4,3,4);
|
||||
plot2d(time, deg_of_rad(ahrs_omega(1,:)), 3);
|
||||
plot2d(time, deg_of_rad(fdm_state(FDM_SP,:)), 2);
|
||||
xtitle('p');
|
||||
|
||||
subplot(4,3,5);
|
||||
plot2d(time, deg_of_rad(ahrs_omega(2,:)), 3);
|
||||
plot2d(time, deg_of_rad(fdm_state(FDM_SQ,:)), 2);
|
||||
xtitle('q');
|
||||
|
||||
subplot(4,3,6);
|
||||
plot2d(time, deg_of_rad(ahrs_omega(3,:)), 3);
|
||||
plot2d(time, deg_of_rad(fdm_state(FDM_SR,:)), 2);
|
||||
xtitle('r');
|
||||
|
||||
subplot(4,3,7);
|
||||
plot2d(time, deg_of_rad(ahrs_bias(1,:)), 3);
|
||||
xtitle('bp');
|
||||
|
||||
subplot(4,3,8);
|
||||
plot2d(time, deg_of_rad(ahrs_bias(2,:)), 3);
|
||||
xtitle('bq');
|
||||
|
||||
subplot(4,3,9);
|
||||
plot2d(time, deg_of_rad(ahrs_bias(3,:)), 3);
|
||||
xtitle('br');
|
||||
|
||||
subplot(4,3,10);
|
||||
|
||||
subplot(4,3,11);
|
||||
plot2d(time, ahrs_cov(1,:),3);
|
||||
plot2d(time, ahrs_cov(2,:),3);
|
||||
plot2d(time, ahrs_cov(3,:),3);
|
||||
|
||||
legends(["ahrs_c", "ahrs_s"],[3 4], with_box=%f, opt="ul");
|
||||
xtitle('cov angles');
|
||||
|
||||
subplot(4,3,12);
|
||||
plot2d(time, ahrs_cov(4,:),3);
|
||||
plot2d(time, ahrs_cov(5,:),3);
|
||||
plot2d(time, ahrs_cov(6,:),3);
|
||||
|
||||
xtitle('cov bias');
|
||||
|
||||
endfunction
|
||||
|
||||
load('../../../simulator/scilab/q6d/data/stop_stop_state_sensors.dat', 'time', 'fdm_state', 'sensor_gyro', 'sensor_accel', 'sensor_mag');
|
||||
read_ahrs_output('out.txt');
|
||||
|
||||
display_ahrs_state();
|
||||
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "math/pprz_algebra_int.h"
|
||||
|
||||
#define IMU_ACCEL_X_NEUTRAL 32081
|
||||
#define IMU_ACCEL_X_SENS -2.50411474
|
||||
#define IMU_ACCEL_X_SENS_NUM -10650
|
||||
#define IMU_ACCEL_X_SENS_DEN 4253
|
||||
|
||||
void test_1(void);
|
||||
void test_2(void);
|
||||
void test_3(void);
|
||||
|
||||
int main(int argc, char** argv){
|
||||
|
||||
// test_2();
|
||||
test_3();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void test_1(void) {
|
||||
|
||||
double value_f;
|
||||
for (value_f=-9.81; value_f<9.81; value_f += 0.001) {
|
||||
|
||||
double neutral_f = (double)IMU_ACCEL_X_NEUTRAL;
|
||||
double sensitivity_f = 1./IMU_ACCEL_X_SENS;
|
||||
|
||||
double sensor_raw_f = ACCEL_BFP_OF_REAL(value_f) * sensitivity_f + neutral_f;
|
||||
int32_t sensor_raw_i = rint(sensor_raw_f);
|
||||
|
||||
double scaled_sensor_f = ACCEL_BFP_OF_REAL(value_f);
|
||||
#if 1
|
||||
int32_t scaled_sensor_i = ((sensor_raw_i - IMU_ACCEL_X_NEUTRAL) * IMU_ACCEL_X_SENS_NUM) / IMU_ACCEL_X_SENS_DEN;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
int32_t scaled_sensor_i = (sensor_raw_i * IMU_ACCEL_X_SENS_NUM / IMU_ACCEL_X_SENS_DEN) -
|
||||
(IMU_ACCEL_X_NEUTRAL * IMU_ACCEL_X_SENS_NUM / IMU_ACCEL_X_SENS_DEN);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
const int32_t delta = (sensor_raw_i - IMU_ACCEL_X_NEUTRAL);
|
||||
int32_t scaled_sensor_i;
|
||||
if (delta > 0)
|
||||
scaled_sensor_i = ( delta * IMU_ACCEL_X_SENS_NUM ) / IMU_ACCEL_X_SENS_DEN;
|
||||
else
|
||||
scaled_sensor_i = ( delta * IMU_ACCEL_X_SENS_NUM + (IMU_ACCEL_X_SENS_DEN>>1)) / IMU_ACCEL_X_SENS_DEN;
|
||||
#endif
|
||||
|
||||
printf("%f %f %d %f %d\n", value_f, sensor_raw_f, sensor_raw_i, scaled_sensor_f, scaled_sensor_i);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void test_2(void) {
|
||||
|
||||
int a;
|
||||
for (a=-7; a<7; a++) {
|
||||
int b = a/-2;
|
||||
int c = (a>0 ? a+1 : a-1)/-2;
|
||||
double d = rint((double)a/-2.);
|
||||
printf("%- d %- d %- d %- .1f\n", a, b, c, d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#define OFFSET_AND_ROUND(_a, _b) (((_a)+(1<<((_b)-1)))>>(_b))
|
||||
#define OFFSET_AND_ROUND2(_a, _b) (((_a)+(1<<((_b)-1))-((_a)<0?1:0))>>(_b))
|
||||
#define N_OFFSET 2
|
||||
void test_3(void) {
|
||||
|
||||
int a;
|
||||
for (a=-(1<<N_OFFSET); a<=(1<<N_OFFSET); a++) {
|
||||
int32_t b = (a>>N_OFFSET);
|
||||
int32_t c;
|
||||
// if ( a>=0 )
|
||||
// c = (a+(1<<(N_OFFSET-1)))>>N_OFFSET;
|
||||
// else
|
||||
// c = (a+(1<<(N_OFFSET-1))-1)>>N_OFFSET;
|
||||
c = OFFSET_AND_ROUND(a, N_OFFSET);
|
||||
|
||||
int32_t d;
|
||||
d = OFFSET_AND_ROUND2(a, N_OFFSET);
|
||||
|
||||
double e;
|
||||
e = (double)a/(double)(1<<N_OFFSET);
|
||||
|
||||
printf("%- d %- d %- d %- d %.1f\n", a, b, c, d, e);
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "std.h"
|
||||
#include "booz_geometry_mixed.h"
|
||||
#define GUIDANCE_V_C
|
||||
#include "firmwares/rotorcraft/guidance/guidance_v_adpt.h"
|
||||
|
||||
|
||||
|
||||
#define NB_STEP 20000
|
||||
int n_dat;
|
||||
|
||||
double time[NB_STEP];
|
||||
|
||||
int32_t z_sp[NB_STEP];
|
||||
int32_t zd_sp[NB_STEP];
|
||||
int32_t est_z[NB_STEP];
|
||||
int32_t est_zd[NB_STEP];
|
||||
int32_t est_zdd[NB_STEP];
|
||||
int32_t ref_z[NB_STEP];
|
||||
int32_t ref_zd[NB_STEP];
|
||||
int32_t ref_zdd[NB_STEP];
|
||||
int32_t adp_inv_m[NB_STEP];
|
||||
int32_t adp_cov[NB_STEP];
|
||||
int32_t sum_err[NB_STEP];
|
||||
int32_t ff_cmd[NB_STEP];
|
||||
int32_t fb_cmd[NB_STEP];
|
||||
int32_t delta_t[NB_STEP];
|
||||
|
||||
|
||||
|
||||
int32_t ifX[NB_STEP];
|
||||
int32_t ifP[NB_STEP];
|
||||
|
||||
|
||||
double ffX[NB_STEP];
|
||||
double ffm[NB_STEP];
|
||||
double ffP[NB_STEP];
|
||||
|
||||
static void float_filter_init(void) {
|
||||
ffX[0] = GV_ADAPT_X0_F;
|
||||
ffP[0] = GV_ADAPT_P0_F;
|
||||
}
|
||||
|
||||
static void float_filter_run( int i) {
|
||||
|
||||
int prev = i>0 ? i-1 : i;
|
||||
ffX[i] = ffX[prev];
|
||||
ffP[i] = ffP[prev];
|
||||
if (delta_t[prev] == 0) return;
|
||||
ffP[i] = ffP[i] + GV_ADAPT_SYS_NOISE_F;
|
||||
ffm[i] = (9.81 - (double)est_zdd[i]/(double)(1<<10)) / (double)delta_t[prev];
|
||||
double residual = ffm[i] - ffX[i];
|
||||
double E = ffP[i] + GV_ADAPT_MEAS_NOISE_F;
|
||||
double K = ffP[i] / E;
|
||||
ffP[i] = ffP[i] - K * ffP[i];
|
||||
ffX[i] = ffX[i] + K * residual;
|
||||
}
|
||||
|
||||
static int read_data(const char* filename) {
|
||||
|
||||
FILE *fp = NULL;
|
||||
fp = fopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
return -1;
|
||||
|
||||
char * line = NULL;
|
||||
size_t len = 0;
|
||||
size_t read;
|
||||
n_dat = 0;
|
||||
while ((read = getline(&line, &len, fp)) != -1 && n_dat< NB_STEP) {
|
||||
if (sscanf(line, "%lf %*d VERT_LOOP %d %d %d %d %d %d %d %d %d %d %d %d %d %d",
|
||||
&time[n_dat],
|
||||
&z_sp[n_dat], &zd_sp[n_dat],
|
||||
&est_z[n_dat], &est_zd[n_dat], &est_zdd[n_dat],
|
||||
&ref_z[n_dat], &ref_zd[n_dat], &ref_zdd[n_dat],
|
||||
&adp_inv_m[n_dat], &adp_cov[n_dat], &sum_err[n_dat],
|
||||
&ff_cmd[n_dat], &fb_cmd[n_dat], &delta_t[n_dat]) == 15) n_dat++;
|
||||
}
|
||||
if (line)
|
||||
free(line);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void gen_data(void) {
|
||||
int i = 0;
|
||||
n_dat = NB_STEP;
|
||||
while (i<n_dat) {
|
||||
long int r = random();
|
||||
double noise = 2. * 2. * ((double)r / (double)RAND_MAX - 0.5);
|
||||
// printf("%ld %f\n", r, noise);
|
||||
est_zdd[i] = 0 + noise;
|
||||
delta_t[i] = 85;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void dump_res(void) {
|
||||
int i = 0;
|
||||
while (i<n_dat) {
|
||||
printf("%f %d %d %d %f %f %f %d %d\n", time[i], est_zdd[i], delta_t[i], ref_zdd[i], ffX[i], ffP[i], ffm[i], ifX[i], ifP[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#define FF_CMD_FRAC 18
|
||||
void test_command(int i) {
|
||||
|
||||
const int32_t inv_m_i = gv_adapt_X>>(GV_ADAPT_X_FRAC - FF_CMD_FRAC);
|
||||
int32_t cmd_i = (BOOZ_INT_OF_FLOAT(9.81, FF_CMD_FRAC) - (ref_zdd[i]<<(FF_CMD_FRAC - IACCEL_RES))) / inv_m_i;
|
||||
|
||||
double inv_m_f = (double)BOOZ_FLOAT_OF_INT(gv_adapt_X, GV_ADAPT_X_FRAC);
|
||||
double cmd_f = (9.81 - (double)BOOZ_FLOAT_OF_INT(ref_zdd[i], IACCEL_RES)) / inv_m_f;
|
||||
|
||||
int32_t cmd_i_fixed;
|
||||
|
||||
// = ((int32_t)BOOZ_INT_OF_FLOAT(9.81, IACCEL_RES) - ref_zdd[i] + (inv_m_i_fixed>>1)) / inv_m_i_fixed;
|
||||
|
||||
if (ref_zdd[i] < BOOZ_INT_OF_FLOAT(9.81, IACCEL_RES))
|
||||
cmd_i_fixed = (BOOZ_INT_OF_FLOAT(9.81, FF_CMD_FRAC) - (ref_zdd[i]<<(FF_CMD_FRAC - IACCEL_RES)) + (inv_m_i>>1) ) / inv_m_i;
|
||||
else
|
||||
cmd_i_fixed = (BOOZ_INT_OF_FLOAT(9.81, FF_CMD_FRAC) - (ref_zdd[i]<<(FF_CMD_FRAC - IACCEL_RES)) - (inv_m_i>>1) ) / inv_m_i;
|
||||
|
||||
printf("%d %f %d\n",cmd_i, cmd_f, cmd_i_fixed);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// gen_data();
|
||||
read_data("09_02_15__20_45_58.data");
|
||||
printf("read %d\n", n_dat);
|
||||
gv_adapt_init();
|
||||
float_filter_init();
|
||||
int i = 0;
|
||||
while (i<n_dat) {
|
||||
Bound(delta_t[i], 1, 200);
|
||||
gv_adapt_run(est_zdd[i], delta_t[i]);
|
||||
ifX[i] = gv_adapt_X;
|
||||
ifP[i] = gv_adapt_P;
|
||||
float_filter_run(i);
|
||||
// test_command(i);
|
||||
i++;
|
||||
}
|
||||
|
||||
dump_res();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "booz_geometry_mixed.h"
|
||||
#define GUIDANCE_V_C
|
||||
#include "firmwares/rotorcraft/guidance/guidance_v_ref.h"
|
||||
|
||||
#define NB_STEP 10000
|
||||
#define DT (1./GV_FREQ)
|
||||
|
||||
double z_sp, zd_sp, z_ref, zd_ref, zdd_ref;
|
||||
|
||||
void set_ref(double z, double zd, double zdd) {
|
||||
z_ref = z;
|
||||
zd_ref = zd;
|
||||
zdd_ref = zdd;
|
||||
}
|
||||
|
||||
void update_ref_from_z(void) {
|
||||
|
||||
z_ref += (zd_ref * DT);
|
||||
zd_ref += (zdd_ref * DT);
|
||||
zdd_ref = -2.*GV_ZETA*GV_OMEGA*zd_ref - GV_OMEGA*GV_OMEGA*(z_ref - z_sp);
|
||||
|
||||
Bound(zdd_ref, GV_MIN_ZDD_F, GV_MAX_ZDD_F);
|
||||
|
||||
if (zd_ref <= GV_MIN_ZD_F) {
|
||||
zd_ref = GV_MIN_ZD_F;
|
||||
if (zdd_ref < 0)
|
||||
zdd_ref = 0;
|
||||
}
|
||||
else if (zd_ref >= GV_MAX_ZD_F) {
|
||||
zd_ref = GV_MAX_ZD_F;
|
||||
if (zdd_ref > 0)
|
||||
zdd_ref = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void update_ref_from_zd(void) {
|
||||
|
||||
z_ref += (zd_ref * DT);
|
||||
zd_ref += (zdd_ref * DT);
|
||||
zdd_ref = -1/GV_REF_THAU_F*(zd_ref - zd_sp);
|
||||
|
||||
Bound(zdd_ref, GV_MIN_ZDD_F, GV_MAX_ZDD_F);
|
||||
|
||||
if (zd_ref <= GV_MIN_ZD_F) {
|
||||
zd_ref = GV_MIN_ZD_F;
|
||||
if (zdd_ref < 0)
|
||||
zdd_ref = 0;
|
||||
}
|
||||
else if (zd_ref >= GV_MAX_ZD_F) {
|
||||
zd_ref = GV_MAX_ZD_F;
|
||||
if (zdd_ref > 0)
|
||||
zdd_ref = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void print_ref(int i) {
|
||||
double i2f_z = BOOZ_FLOAT_OF_INT( gv_z_ref, GV_Z_REF_FRAC);
|
||||
double i2f_zd = BOOZ_FLOAT_OF_INT( gv_zd_ref, GV_ZD_REF_FRAC);
|
||||
double i2f_zdd = BOOZ_FLOAT_OF_INT( gv_zdd_ref, GV_ZDD_REF_FRAC);
|
||||
printf("%f %f %f %f %f %f %f %f %f\n",
|
||||
(double)i*DT, z_sp, zd_sp,
|
||||
z_ref, zd_ref, zdd_ref,
|
||||
i2f_z, i2f_zd, i2f_zdd );
|
||||
}
|
||||
|
||||
int32_t get_sp (int i) {
|
||||
// return BOOZ_INT_OF_FLOAT(i>512 ? -50.0 : 0, IPOS_FRAC);
|
||||
return BOOZ_INT_OF_FLOAT((i>512&&i<3072) ? -1.0 : 0, ISPEED_RES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
gv_set_ref(0, 0, 0);
|
||||
set_ref(0., 0., 0.);
|
||||
int i = 0;
|
||||
while (i<NB_STEP) {
|
||||
int32_t sp_i = get_sp(i);
|
||||
// gv_update_ref_from_z_sp(sp_i);
|
||||
gv_update_ref_from_zd_sp(sp_i);
|
||||
// z_sp = BOOZ_FLOAT_OF_INT(sp_i, IPOS_FRAC);
|
||||
// update_ref_from_z();
|
||||
zd_sp = BOOZ_FLOAT_OF_INT(sp_i, ISPEED_RES);
|
||||
update_ref_from_zd();
|
||||
print_ref(i);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
@@ -18,23 +18,11 @@ test_geodetic: test_geodetic.c ../math/pprz_geodetic_float.c ../math/pprz_geodet
|
||||
test_algebra: test_algebra.c ../math/pprz_trig_int.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_martin: test_martin.c ../math/pprz_trig_int.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_bla: test_bla.c ../math/pprz_trig_int.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_att: test_att.c ../math/pprz_trig_int.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_sqrt: test_sqrt.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test_fmul: test_fmul.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
%.exe : %.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
$(Q)rm -f *~ test_geodetic test_algebra *.exe
|
||||
$(Q)rm -f *~ test_matrix test_geodetic test_algebra test_bla *.exe
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
#include "std.h"
|
||||
#include "mcu.h"
|
||||
#include "interrupt_hw.h"
|
||||
#include "mcu_periph/sys_time.h"
|
||||
#include "led.h"
|
||||
|
||||
#include "mcu_periph/uart.h"
|
||||
#include "messages.h"
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
|
||||
#include "ADS8344.h"
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic( void );
|
||||
static inline void main_event( void );
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_check_and_ack_timer(0))
|
||||
main_periodic();
|
||||
main_event();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
mcu_init();
|
||||
|
||||
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
|
||||
|
||||
led_init();
|
||||
|
||||
uart1_init_tx();
|
||||
|
||||
ADS8344_init();
|
||||
|
||||
mcu_int_enable();
|
||||
|
||||
ADS8344_start();
|
||||
}
|
||||
|
||||
|
||||
static inline void main_periodic( void ) {
|
||||
DOWNLINK_SEND_BOOT(&sys_time.nb_sec);
|
||||
|
||||
}
|
||||
|
||||
static inline void main_event( void ) {
|
||||
if ( ADS8344_available ) {
|
||||
float foo = ADS8344_values[0];
|
||||
float foo1 = ADS8344_values[1];
|
||||
float foo2 = ADS8344_values[2];
|
||||
DOWNLINK_SEND_IMU_GYRO(&foo, &foo1, &foo2);
|
||||
// LED_TOGGLE(2);
|
||||
ADS8344_available = FALSE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user