mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-10-02 12:23:17 +08:00
@@ -1,37 +0,0 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||
# Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||
#
|
||||
# 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, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
# This Makefile uses the generic Makefile.arm-linux and adds upload rules for the Parrot Swing
|
||||
#
|
||||
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-linux
|
||||
|
||||
DRONE = $(PAPARAZZI_SRC)/sw/tools/parrot/swing.py
|
||||
|
||||
# Program the device and start it.
|
||||
upload program: $(OBJDIR)/$(TARGET).elf
|
||||
$(Q)$(PREFIX)-strip $(OBJDIR)/$(TARGET).elf
|
||||
$(Q)$(DRONE) --host=$(HOST) upload_file_and_run $(OBJDIR)/$(TARGET).elf $(SUB_DIR)
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : upload program
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,56 +0,0 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# krooz_sd.makefile
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
BOARD=krooz
|
||||
BOARD_VERSION=sd
|
||||
BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\"
|
||||
|
||||
ARCH=stm32
|
||||
ARCH_L=f4
|
||||
HARD_FLOAT=yes
|
||||
ARCH_DIR=stm32
|
||||
SRC_ARCH=arch/$(ARCH_DIR)
|
||||
$(TARGET).ARCHDIR = $(ARCH)
|
||||
# not needed?
|
||||
$(TARGET).OOCD_INTERFACE=ftdi/flossjtag
|
||||
#$(TARGET).OOCD_INTERFACE=ftdi/jtagkey
|
||||
$(TARGET).LDSCRIPT=$(SRC_ARCH)/krooz.ld
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
# default flash mode is via usb dfu bootloader (luftboot)
|
||||
# other possibilities: DFU-UTIL, JTAG, SWD, STLINK, SERIAL
|
||||
FLASH_MODE ?= DFU
|
||||
|
||||
DFU_ADDR = 0x8004000
|
||||
DFU_PRODUCT = any
|
||||
|
||||
#
|
||||
#
|
||||
# some default values shared between different firmwares
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# default LED configuration
|
||||
#
|
||||
RADIO_CONTROL_LED ?= none
|
||||
BARO_LED ?= none
|
||||
AHRS_ALIGNER_LED ?= 2
|
||||
GPS_LED ?= none
|
||||
SYS_TIME_LED ?= 1
|
||||
|
||||
#
|
||||
# default uart configuration
|
||||
#
|
||||
RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT ?= UART1
|
||||
|
||||
MODEM_PORT ?= UART5
|
||||
MODEM_BAUD ?= B57600
|
||||
|
||||
GPS_PORT ?= UART3
|
||||
GPS_BAUD ?= B38400
|
||||
@@ -1,51 +0,0 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# swing.makefile
|
||||
#
|
||||
# http://wiki.paparazziuav.org/wiki/Swing
|
||||
#
|
||||
|
||||
BOARD=swing
|
||||
BOARD_CFG=\"boards/$(BOARD).h\"
|
||||
|
||||
ARCH=linux
|
||||
$(TARGET).ARCHDIR = $(ARCH)
|
||||
# include conf/Makefile.swing (with specific upload rules) instead of only Makefile.linux:
|
||||
ap.MAKEFILE = swing
|
||||
|
||||
FLOAT_ABI =
|
||||
ARCH_CFLAGS = -march=armv5
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
USER=foobar
|
||||
HOST?=192.168.4.1
|
||||
SUB_DIR=paparazzi
|
||||
FTP_DIR=/data/edu
|
||||
TARGET_DIR=$(FTP_DIR)/$(SUB_DIR)
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
# The datalink default uses UDP
|
||||
MODEM_HOST ?= 192.168.4.255
|
||||
|
||||
# The GPS sensor is connected internally
|
||||
GPS_PORT ?= UART1
|
||||
GPS_BAUD ?= B230400
|
||||
|
||||
# handle linux signals by hand
|
||||
$(TARGET).CFLAGS += -DUSE_LINUX_SIGNAL -D_GNU_SOURCE
|
||||
|
||||
# board specific init function
|
||||
$(TARGET).srcs += $(SRC_BOARD)/board.c
|
||||
|
||||
# Link static (Done for GLIBC)
|
||||
$(TARGET).CFLAGS += -DLINUX_LINK_STATIC
|
||||
$(TARGET).LDFLAGS += -static
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
# default LED configuration
|
||||
RADIO_CONTROL_LED ?= none
|
||||
BARO_LED ?= none
|
||||
AHRS_ALIGNER_LED ?= none
|
||||
GPS_LED ?= none
|
||||
SYS_TIME_LED ?= 0
|
||||
@@ -36,10 +36,6 @@ else ifeq ($(BOARD), disco)
|
||||
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
|
||||
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
|
||||
|
||||
# Swing baro
|
||||
else ifeq ($(BOARD), swing)
|
||||
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
|
||||
|
||||
# Lisa/M baro
|
||||
else ifeq ($(BOARD), lisa_m)
|
||||
ifeq ($(BOARD_VERSION), 1.0)
|
||||
@@ -172,14 +168,6 @@ LIA_BARO ?= BARO_MS5611_SPI
|
||||
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
|
||||
endif
|
||||
|
||||
# krooz baro
|
||||
else ifeq ($(BOARD), krooz)
|
||||
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
|
||||
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_ADDR=0xEC
|
||||
BARO_BOARD_SRCS += peripherals/ms5611.c
|
||||
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
|
||||
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
|
||||
|
||||
# PX4FMU
|
||||
else ifeq ($(BOARD),$(filter $(BOARD),px4fmu))
|
||||
include $(CFG_SHARED)/spi_master.makefile
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<mode name="SERIAL (stm32)">
|
||||
<variable name="FLASH_MODE" value="SERIAL"/>
|
||||
<boards>
|
||||
<board name="krooz_sd"/>
|
||||
<board name="lia_.*"/>
|
||||
<board name="lisa_[ms]_.*"/>
|
||||
<board name="elle*"/>
|
||||
@@ -14,7 +13,6 @@
|
||||
<mode name="USB DFU (stm32_mem)">
|
||||
<variable name="FLASH_MODE" value="DFU"/>
|
||||
<boards>
|
||||
<board name="krooz_sd"/>
|
||||
<board name="li[s]?a_[m]?_.*"/>
|
||||
<board name="li[s]?a_mx_.*"/>
|
||||
<board name="px4fmu_.*"/>
|
||||
@@ -109,7 +107,6 @@
|
||||
<mode name="JTAG (OpenOCD)">
|
||||
<variable name="FLASH_MODE" value="JTAG"/>
|
||||
<boards>
|
||||
<board name="krooz_sd"/>
|
||||
<board name="li[s]?a_[lm]?_.*"/>
|
||||
<board name="elle*"/>
|
||||
</boards>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="actuators_swing" dir="actuators" task="actuators">
|
||||
<doc>
|
||||
<description>
|
||||
Actuators Driver for Swing
|
||||
</description>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>actuators</depends>
|
||||
<provides>actuators</provides>
|
||||
</dep>
|
||||
<header>
|
||||
<file name="actuators.h" dir="boards/swing"/>
|
||||
</header>
|
||||
<makefile target="ap">
|
||||
<file name="actuators.c" dir="$(SRC_BOARD)"/>
|
||||
</makefile>
|
||||
</module>
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="ahrs_gx3" dir="ahrs" task="estimation">
|
||||
<doc>
|
||||
<description>
|
||||
AHRS driver for GX3.
|
||||
</description>
|
||||
<configure name="GX3_PORT" value="UART3" description="uart for GX3"/>
|
||||
<configure name="GX3_BAUD" value="B921600" description="GX3 uart baud rate"/>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>uart</depends>
|
||||
<provides>ahrs,imu,mag</provides>
|
||||
</dep>
|
||||
<autoload name="ahrs_sim"/>
|
||||
<header>
|
||||
<file name="ahrs.h"/>
|
||||
</header>
|
||||
<init fun="ahrs_init()"/>
|
||||
<makefile target="ap">
|
||||
<configure name="GX3_PORT" default="UART3" case="upper|lower"/>
|
||||
<configure name="GX3_BAUD" default="B921600"/>
|
||||
<define name="USE_$(GX3_PORT_UPPER)"/>
|
||||
<define name="$(GX3_PORT_UPPER)_BAUD" value="$(GX3_BAUD)"/>
|
||||
|
||||
<define name="USE_AHRS"/>
|
||||
<define name="USE_IMU"/>
|
||||
|
||||
<file name="ahrs.c"/>
|
||||
<file name="imu.c" dir="modules/imu"/>
|
||||
<file name="ahrs_gx3.c"/>
|
||||
<test>
|
||||
<define name="GX3_PORT" value="uart3"/>
|
||||
<define name="USE_UART3"/>
|
||||
<define name="PRIMARY_AHRS" value="ahrs_gx3"/>
|
||||
<define name="AHRS_TYPE_H" value="modules/ahrs/ahrs_gx3.h" type="string"/>
|
||||
</test>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -150,14 +150,6 @@ LIA_BARO ?= BARO_MS5611_SPI
|
||||
endif
|
||||
|
||||
|
||||
# krooz baro
|
||||
else ifeq ($(BOARD), krooz)
|
||||
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
|
||||
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_ADDR=0xEC
|
||||
BARO_BOARD_SRCS += peripherals/ms5611.c
|
||||
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
|
||||
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
|
||||
|
||||
# PX4FMU
|
||||
else ifeq ($(BOARD),$(filter $(BOARD),px4fmu))
|
||||
include $(CFG_SHARED)/spi_master.makefile
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "../module.dtd">
|
||||
|
||||
<module name="krooz_sd" dir="boards">
|
||||
<doc>
|
||||
<description>
|
||||
Specific configuration for Krooz SD
|
||||
</description>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>i2c,baro_board</depends>
|
||||
</dep>
|
||||
<makefile target="!sim|nps|fbw"/>
|
||||
</module>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "../module.dtd">
|
||||
|
||||
<module name="swing" dir="boards">
|
||||
<doc>
|
||||
<description>
|
||||
Specific configuration for Parrot Swing
|
||||
</description>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>baro_board_common</depends>
|
||||
<provides>baro</provides>
|
||||
</dep>
|
||||
<makefile target="!sim|nps|fbw">
|
||||
<file name="baro_board.c" dir="$(SRC_BOARD)"/>
|
||||
</makefile>
|
||||
</module>
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="imu_drotek_10dof_v2" dir="imu" task="sensors">
|
||||
<doc>
|
||||
<description>
|
||||
Drotek 10DOF V2 IMU via I2C.
|
||||
MPU60x0 via I2C.
|
||||
HMC58xx via I2C.
|
||||
</description>
|
||||
<configure name="DROTEK_2_I2C_DEV" value="i2c2" description="I2C device to use"/>
|
||||
<section name="IMU" prefix="IMU_">
|
||||
<define name="MAG_X_NEUTRAL" value="2358"/>
|
||||
<define name="MAG_Y_NEUTRAL" value="2362"/>
|
||||
<define name="MAG_Z_NEUTRAL" value="2119"/>
|
||||
|
||||
<define name="MAG_X_SENS" value="3.4936416" integer="16"/>
|
||||
<define name="MAG_Y_SENS" value="3.607713" integer="16"/>
|
||||
<define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
|
||||
</section>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>i2c,imu_common</depends>
|
||||
<provides>imu,mag</provides>
|
||||
</dep>
|
||||
<autoload name="imu_sim"/>
|
||||
<autoload name="imu_nps"/>
|
||||
<header>
|
||||
<file name="imu_drotek_10dof_v2.h"/>
|
||||
</header>
|
||||
<init fun="imu_drotek2_init()"/>
|
||||
<periodic fun="imu_drotek2_periodic()"/>
|
||||
<event fun="imu_drotek2_event()"/>
|
||||
<makefile target="!sim|nps|fbw">
|
||||
<configure name="DROTEK_2_I2C_DEV" default="i2c2" case="lower|upper"/>
|
||||
<define name="DROTEK_2_I2C_DEV" value="$(DROTEK_2_I2C_DEV_LOWER)"/>
|
||||
<define name="USE_$(DROTEK_2_I2C_DEV_UPPER)"/>
|
||||
|
||||
<define name="IMU_TYPE_H" value="imu/imu_drotek_10dof_v2.h" type="string"/>
|
||||
|
||||
<file name="mpu60x0.c" dir="peripherals"/>
|
||||
<file name="mpu60x0_i2c.c" dir="peripherals"/>
|
||||
<file name="hmc58xx.c" dir="peripherals"/>
|
||||
<file name="imu_drotek_10dof_v2.c"/>
|
||||
<test>
|
||||
<define name="IMU_TYPE_H" value="imu/imu_drotek_10dof_v2.h" type="string"/>
|
||||
<define name="USE_I2C1"/>
|
||||
<define name="DROTEK_2_I2C_DEV" value="i2c1"/>
|
||||
<define name="PERIODIC_FREQUENCY" value="512"/>
|
||||
</test>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -1,46 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="imu_gl1" dir="imu" task="sensors">
|
||||
<doc>
|
||||
<description>
|
||||
IMU from Goodluckbuy.
|
||||
- Accelerometer: ADXL345 via I2C.
|
||||
- Gyroscope: L3G4200 via I2C.
|
||||
- Magnetometer: HMC58xx via I2C.
|
||||
</description>
|
||||
<configure name="GL1_I2C_DEV" value="i2c2" description="I2C device to use"/>
|
||||
<section name="IMU" prefix="IMU_">
|
||||
<define name="MAG_X_NEUTRAL" value="2358"/>
|
||||
<define name="MAG_Y_NEUTRAL" value="2362"/>
|
||||
<define name="MAG_Z_NEUTRAL" value="2119"/>
|
||||
|
||||
<define name="MAG_X_SENS" value="3.4936416" integer="16"/>
|
||||
<define name="MAG_Y_SENS" value="3.607713" integer="16"/>
|
||||
<define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
|
||||
</section>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>i2c,imu_common</depends>
|
||||
<provides>imu,mag</provides>
|
||||
</dep>
|
||||
<autoload name="imu_nps"/>
|
||||
<autoload name="imu_sim"/>
|
||||
<header>
|
||||
<file name="imu_gl1.h"/>
|
||||
</header>
|
||||
<init fun="imu_gl1_init()"/>
|
||||
<periodic fun="imu_gl1_periodic()"/>
|
||||
<event fun="imu_gl1_event()"/>
|
||||
<makefile target="!sim|nps|fbw">
|
||||
<configure name="GL1_I2C_DEV" default="i2c2" case="lower|upper"/>
|
||||
<define name="GL1_I2C_DEV" value="$(GL1_I2C_DEV_LOWER)"/>
|
||||
<define name="USE_$(GL1_I2C_DEV_UPPER)"/>
|
||||
|
||||
<define name="IMU_TYPE_H" value="modules/imu/imu_gl1.h" type="string"/>
|
||||
|
||||
<file name="adxl345_i2c.c" dir="peripherals"/>
|
||||
<file name="l3g4200.c" dir="peripherals"/>
|
||||
<file name="hmc58xx.c" dir="peripherals"/>
|
||||
<file name="imu_gl1.c"/>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -1,44 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="imu_krooz_sd" dir="imu" task="sensors">
|
||||
<doc>
|
||||
<description>
|
||||
IMU on KroozSD board.
|
||||
MPU60x0 and HMC58xx via I2C2.
|
||||
</description>
|
||||
<section name="IMU" prefix="IMU_">
|
||||
<define name="MAG_X_NEUTRAL" value="2358"/>
|
||||
<define name="MAG_Y_NEUTRAL" value="2362"/>
|
||||
<define name="MAG_Z_NEUTRAL" value="2119"/>
|
||||
|
||||
<define name="MAG_X_SENS" value="3.4936416" integer="16"/>
|
||||
<define name="MAG_Y_SENS" value="3.607713" integer="16"/>
|
||||
<define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
|
||||
</section>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>i2c,imu_common</depends>
|
||||
<provides>imu,mag</provides>
|
||||
</dep>
|
||||
<autoload name="imu_nps"/>
|
||||
<autoload name="imu_sim"/>
|
||||
<header>
|
||||
<file name="imu_krooz.h" dir="boards/krooz"/>
|
||||
</header>
|
||||
<init fun="imu_krooz_init()"/>
|
||||
<periodic fun="imu_krooz_periodic()"/>
|
||||
<event fun="imu_krooz_event()"/>
|
||||
<makefile target="!sim|nps|fbw">
|
||||
<define name="IMU_KROOZ_I2C_DEV" value="i2c2"/>
|
||||
<define name="USE_I2C2"/>
|
||||
<define name="I2C2_CLOCK_SPEED" value="400000"/>
|
||||
|
||||
<define name="IMU_TYPE_H" value="boards/krooz/imu_krooz.h" type="string"/>
|
||||
|
||||
<file name="mpu60x0.c" dir="peripherals"/>
|
||||
<file name="mpu60x0_i2c.c" dir="peripherals"/>
|
||||
<file name="hmc58xx.c" dir="peripherals"/>
|
||||
<file name="imu_krooz.c" dir="boards/krooz"/>
|
||||
<file_arch name="imu_krooz_sd_arch.c"/>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -1,50 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="imu_krooz_sd_memsic" dir="imu" task="sensors">
|
||||
<doc>
|
||||
<description>
|
||||
IMU on KroozSD board.
|
||||
MPU60x0 via SPI2.
|
||||
HMC58xx via I2C2.
|
||||
</description>
|
||||
<section name="IMU" prefix="IMU_">
|
||||
<define name="MAG_X_NEUTRAL" value="2358"/>
|
||||
<define name="MAG_Y_NEUTRAL" value="2362"/>
|
||||
<define name="MAG_Z_NEUTRAL" value="2119"/>
|
||||
|
||||
<define name="MAG_X_SENS" value="3.4936416" integer="16"/>
|
||||
<define name="MAG_Y_SENS" value="3.607713" integer="16"/>
|
||||
<define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
|
||||
</section>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>spi_master,i2c,imu_common</depends>
|
||||
<provides>imu,mag</provides>
|
||||
</dep>
|
||||
<autoload name="imu_nps"/>
|
||||
<autoload name="imu_sim"/>
|
||||
<header>
|
||||
<file name="imu_krooz.h" dir="boards/krooz"/>
|
||||
</header>
|
||||
<init fun="imu_krooz_init()"/>
|
||||
<periodic fun="imu_krooz_periodic()"/>
|
||||
<event fun="imu_krooz_event()"/>
|
||||
<makefile target="!sim|nps|fbw">
|
||||
<define name="IMU_KROOZ_I2C_DEV" value="i2c2"/>
|
||||
<define name="USE_I2C2"/>
|
||||
<define name="I2C2_CLOCK_SPEED" value="400000"/>
|
||||
<define name="IMU_KROOZ_SPI_DEV" value="spi2"/>
|
||||
<define name="USE_SPI2"/>
|
||||
<define name="USE_SPI_SLAVE1"/>
|
||||
<define name="USE_SPI_SLAVE2"/>
|
||||
<define name="IMU_KROOZ_SPI_SLAVE_IDX" value="1"/>
|
||||
|
||||
<define name="IMU_TYPE_H" value="boards/krooz/imu_krooz.h" type="string"/>
|
||||
|
||||
<file name="mpu60x0.c" dir="peripherals"/>
|
||||
<file name="mpu60x0_i2c.c" dir="peripherals"/>
|
||||
<file name="hmc58xx.c" dir="peripherals"/>
|
||||
<file name="imu_krooz_memsic.c" dir="boards/krooz"/>
|
||||
<file_arch name="imu_krooz_sd_arch.c"/>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -1,46 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="imu_pprzuav" dir="imu" task="sensors">
|
||||
<doc>
|
||||
<description>
|
||||
PPZUAV IMU.
|
||||
- Accelerometer: ADXL345 via I2C
|
||||
- Gyroscope: ITG3200 via I2C
|
||||
- Magnetometer: HMC58xx via I2C
|
||||
</description>
|
||||
<configure name="IMU_PPZUAV_I2C_DEV" value="i2c2" description="I2C device to use"/>
|
||||
<section name="IMU" prefix="IMU_">
|
||||
<define name="MAG_X_NEUTRAL" value="2358"/>
|
||||
<define name="MAG_Y_NEUTRAL" value="2362"/>
|
||||
<define name="MAG_Z_NEUTRAL" value="2119"/>
|
||||
|
||||
<define name="MAG_X_SENS" value="3.4936416" integer="16"/>
|
||||
<define name="MAG_Y_SENS" value="3.607713" integer="16"/>
|
||||
<define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
|
||||
</section>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>i2c,imu_common</depends>
|
||||
<provides>imu,mag</provides>
|
||||
</dep>
|
||||
<autoload name="imu_nps"/>
|
||||
<autoload name="imu_sim"/>
|
||||
<header>
|
||||
<file name="imu_ppzuav.h"/>
|
||||
</header>
|
||||
<init fun="imu_ppzuav_init()"/>
|
||||
<periodic fun="imu_ppzuav_periodic()"/>
|
||||
<event fun="imu_ppzuav_event()"/>
|
||||
<makefile target="!sim|nps|fbw">
|
||||
<configure name="IMU_PPZUAV_I2C_DEV" default="i2c2" case="lower|upper"/>
|
||||
<define name="IMU_PPZUAV_I2C_DEV" value="$(IMU_PPZUAV_I2C_DEV_LOWER)"/>
|
||||
<define name="USE_$(IMU_PPZUAV_I2C_DEV_UPPER)"/>
|
||||
|
||||
<define name="IMU_TYPE_H" value="imu/imu_ppzuav.h" type="string"/>
|
||||
|
||||
<file name="adxl345_i2c.c" dir="peripherals"/>
|
||||
<file name="itg3200.c" dir="peripherals"/>
|
||||
<file name="hmc58xx.c" dir="peripherals"/>
|
||||
<file name="imu_ppzuav.c"/>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -1,35 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="imu_swing" dir="imu" task="sensors">
|
||||
<doc>
|
||||
<description>
|
||||
Driver for IMU on the Parrot Swing drone.
|
||||
- Accelerometer/Gyroscope: MPU6000 via I2C0
|
||||
</description>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>i2c,imu_common</depends>
|
||||
<provides>imu</provides>
|
||||
</dep>
|
||||
<autoload name="imu_nps"/>
|
||||
<autoload name="imu_sim"/>
|
||||
<!--autoload name="sonar_bebop"/-->
|
||||
<header>
|
||||
<file name="imu_swing.h"/>
|
||||
</header>
|
||||
<init fun="imu_swing_init()"/>
|
||||
<periodic fun="imu_swing_periodic()"/>
|
||||
<event fun="imu_swing_event()"/>
|
||||
<makefile target="!sim|nps|fbw">
|
||||
<define name="USE_I2C0"/>
|
||||
<define name="IMU_TYPE_H" value="modules/imu/imu_swing.h" type="string"/>
|
||||
<file name="mpu60x0.c" dir="peripherals"/>
|
||||
<file name="mpu60x0_i2c.c" dir="peripherals"/>
|
||||
<file name="imu_swing.c"/>
|
||||
<test>
|
||||
<define name="IMU_TYPE_H" value="modules/imu/imu_swing.h" type="string"/>
|
||||
<define name="USE_I2C0"/>
|
||||
<define name="PERIODIC_FREQUENCY" value="512"/>
|
||||
</test>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -1,34 +0,0 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="imu_um6" dir="imu" task="sensors">
|
||||
<doc>
|
||||
<description>
|
||||
CHR-UM6 IMU.
|
||||
</description>
|
||||
<configure name="UM6_PORT" value="uart3" description="UART to use"/>
|
||||
<configure name="UM6_BAUD" value="B115200" description="Baud rate"/>
|
||||
</doc>
|
||||
<dep>
|
||||
<depends>uart,imu_common</depends>
|
||||
<provides>imu,mag</provides>
|
||||
</dep>
|
||||
<autoload name="imu_nps"/>
|
||||
<autoload name="imu_sim"/>
|
||||
<header>
|
||||
<file name="imu_um6.h"/>
|
||||
</header>
|
||||
<init fun="imu_um6_init()"/>
|
||||
<periodic fun="imu_um6_periodic()"/>
|
||||
<event fun="imu_um6_event()"/>
|
||||
<makefile target="!sim|nps|fbw">
|
||||
<configure name="UM6_PORT" default="uart3" case="lower|upper"/>
|
||||
<configure name="UM6_BAUD" default="B115200"/>
|
||||
<define name="USE_$(UM6_PORT_UPPER)"/>
|
||||
<define name="$(UM6_PORT_UPPER)_BAUD" value="$(UM6_BAUD)"/>
|
||||
<define name="UM6_LINK" value="$(UM6_PORT_LOWER)"/>
|
||||
|
||||
<define name="IMU_TYPE_H" value="imu/imu_um6.h" type="string"/>
|
||||
|
||||
<file name="imu_um6.c"/>
|
||||
</makefile>
|
||||
</module>
|
||||
@@ -1,39 +0,0 @@
|
||||
#include "modules/imu/imu.h"
|
||||
|
||||
#include <libopencm3/stm32/rcc.h>
|
||||
#include <libopencm3/stm32/gpio.h>
|
||||
#include <libopencm3/stm32/exti.h>
|
||||
#include <libopencm3/cm3/nvic.h>
|
||||
|
||||
#include "modules/imu/imu_krooz_sd_arch.h"
|
||||
|
||||
void imu_krooz_sd_arch_init(void)
|
||||
{
|
||||
rcc_periph_clock_enable(RCC_SYSCFG);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
gpio_mode_setup(GPIOB, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO5);
|
||||
gpio_mode_setup(GPIOC, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO6);
|
||||
|
||||
nvic_enable_irq(NVIC_EXTI9_5_IRQ);
|
||||
exti_select_source(EXTI5, GPIOB);
|
||||
exti_select_source(EXTI6, GPIOC);
|
||||
exti_set_trigger(EXTI5, EXTI_TRIGGER_RISING);
|
||||
exti_set_trigger(EXTI6, EXTI_TRIGGER_FALLING);
|
||||
exti_enable_request(EXTI5);
|
||||
exti_enable_request(EXTI6);
|
||||
nvic_set_priority(NVIC_EXTI9_5_IRQ, 0x0F);
|
||||
}
|
||||
|
||||
void exti9_5_isr(void)
|
||||
{
|
||||
/* clear EXTI */
|
||||
if (EXTI_PR & EXTI6) {
|
||||
exti_reset_request(EXTI6);
|
||||
imu_krooz.hmc_eoc = true;
|
||||
}
|
||||
if (EXTI_PR & EXTI5) {
|
||||
exti_reset_request(EXTI5);
|
||||
imu_krooz.mpu_eoc = true;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef IMU_KROOZ_SD_ARCH_H
|
||||
#define IMU_KROOZ_SD_ARCH_H
|
||||
|
||||
#include "modules/imu/imu.h"
|
||||
|
||||
void imu_krooz_sd_arch_init(void);
|
||||
|
||||
#endif /* IMU_KROOZ_SD_ARCH_H */
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
/*
|
||||
* board specific interface for the KroozSD board
|
||||
*
|
||||
* It uses the modules/sensors/baro_ms5611_i2c.c driver
|
||||
*/
|
||||
|
||||
#ifndef BOARDS_KROOZ_BARO_H
|
||||
#define BOARDS_KROOZ_BARO_H
|
||||
|
||||
// only for printing the baro type during compilation
|
||||
#define BARO_BOARD BARO_BOARD_MS5611_I2C
|
||||
|
||||
extern void baro_event(void);
|
||||
#define BaroEvent baro_event
|
||||
|
||||
#endif /* BOARDS_KROOZ_SD_BARO_H */
|
||||
@@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Sergey Krukowski <softsr@yahoo.de>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/krooz/imu_krooz.c
|
||||
*
|
||||
* Driver for the IMU on the KroozSD board.
|
||||
*
|
||||
* Invensense MPU-6050
|
||||
* Honeywell HMC-5883
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "boards/krooz/imu_krooz.h"
|
||||
#include "modules/imu/imu_krooz_sd_arch.h"
|
||||
#include "mcu_periph/i2c.h"
|
||||
#include "led.h"
|
||||
#include "filters/median_filter.h"
|
||||
#include "modules/core/abi.h"
|
||||
|
||||
// Downlink
|
||||
#include "mcu_periph/uart.h"
|
||||
#include "pprzlink/messages.h"
|
||||
#include "modules/datalink/downlink.h"
|
||||
|
||||
#if !defined KROOZ_LOWPASS_FILTER && !defined KROOZ_SMPLRT_DIV
|
||||
#define KROOZ_LOWPASS_FILTER MPU60X0_DLPF_256HZ
|
||||
#define KROOZ_SMPLRT_DIV 1
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(KROOZ_SMPLRT_DIV)
|
||||
PRINT_CONFIG_VAR(KROOZ_LOWPASS_FILTER)
|
||||
|
||||
PRINT_CONFIG_VAR(KROOZ_GYRO_RANGE)
|
||||
PRINT_CONFIG_VAR(KROOZ_ACCEL_RANGE)
|
||||
|
||||
struct ImuKrooz imu_krooz;
|
||||
|
||||
#if IMU_KROOZ_USE_ACCEL_MEDIAN_FILTER
|
||||
struct MedianFilter3Int median_accel;
|
||||
#endif
|
||||
struct MedianFilter3Int median_mag;
|
||||
|
||||
void imu_krooz_init(void)
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// MPU-60X0
|
||||
mpu60x0_i2c_init(&imu_krooz.mpu, &(IMU_KROOZ_I2C_DEV), MPU60X0_ADDR);
|
||||
// change the default configuration
|
||||
imu_krooz.mpu.config.smplrt_div = KROOZ_SMPLRT_DIV;
|
||||
imu_krooz.mpu.config.dlpf_cfg = KROOZ_LOWPASS_FILTER;
|
||||
imu_krooz.mpu.config.gyro_range = KROOZ_GYRO_RANGE;
|
||||
imu_krooz.mpu.config.accel_range = KROOZ_ACCEL_RANGE;
|
||||
imu_krooz.mpu.config.drdy_int_enable = true;
|
||||
|
||||
hmc58xx_init(&imu_krooz.hmc, &(IMU_KROOZ_I2C_DEV), HMC58XX_ADDR);
|
||||
|
||||
// Init median filters
|
||||
#if IMU_KROOZ_USE_ACCEL_MEDIAN_FILTER
|
||||
InitMedianFilterVect3Int(median_accel, MEDIAN_DEFAULT_SIZE);
|
||||
#endif
|
||||
InitMedianFilterVect3Int(median_mag, MEDIAN_DEFAULT_SIZE);
|
||||
|
||||
RATES_ASSIGN(imu_krooz.rates_sum, 0, 0, 0);
|
||||
VECT3_ASSIGN(imu_krooz.accel_sum, 0, 0, 0);
|
||||
imu_krooz.meas_nb = 0;
|
||||
|
||||
imu_krooz.hmc_eoc = false;
|
||||
imu_krooz.mpu_eoc = false;
|
||||
|
||||
imu_krooz_sd_arch_init();
|
||||
}
|
||||
|
||||
void imu_krooz_periodic(void)
|
||||
{
|
||||
// Start reading the latest gyroscope data
|
||||
if (!imu_krooz.mpu.config.initialized) {
|
||||
mpu60x0_i2c_start_configure(&imu_krooz.mpu);
|
||||
}
|
||||
|
||||
if (!imu_krooz.hmc.initialized) {
|
||||
hmc58xx_start_configure(&imu_krooz.hmc);
|
||||
}
|
||||
|
||||
if (imu_krooz.meas_nb) {
|
||||
RATES_ASSIGN(imu.gyro_unscaled, -imu_krooz.rates_sum.q / imu_krooz.meas_nb, imu_krooz.rates_sum.p / imu_krooz.meas_nb,
|
||||
imu_krooz.rates_sum.r / imu_krooz.meas_nb);
|
||||
VECT3_ASSIGN(imu.accel_unscaled, -imu_krooz.accel_sum.y / imu_krooz.meas_nb, imu_krooz.accel_sum.x / imu_krooz.meas_nb,
|
||||
imu_krooz.accel_sum.z / imu_krooz.meas_nb);
|
||||
|
||||
#if IMU_KROOZ_USE_ACCEL_MEDIAN_FILTER
|
||||
UpdateMedianFilterVect3Int(median_accel, imu.accel_unscaled);
|
||||
#endif
|
||||
VECT3_SMUL(imu_krooz.accel_filtered, imu_krooz.accel_filtered, IMU_KROOZ_ACCEL_AVG_FILTER);
|
||||
VECT3_ADD(imu_krooz.accel_filtered, imu.accel_unscaled);
|
||||
VECT3_SDIV(imu_krooz.accel_filtered, imu_krooz.accel_filtered, (IMU_KROOZ_ACCEL_AVG_FILTER + 1));
|
||||
VECT3_COPY(imu.accel_unscaled, imu_krooz.accel_filtered);
|
||||
|
||||
RATES_ASSIGN(imu_krooz.rates_sum, 0, 0, 0);
|
||||
VECT3_ASSIGN(imu_krooz.accel_sum, 0, 0, 0);
|
||||
imu_krooz.meas_nb = 0;
|
||||
|
||||
uint32_t now_ts = get_sys_time_usec();
|
||||
imu_scale_gyro(&imu);
|
||||
imu_scale_accel(&imu);
|
||||
AbiSendMsgIMU_GYRO_INT32(IMU_BOARD_ID, now_ts, &imu.gyro);
|
||||
AbiSendMsgIMU_ACCEL_INT32(IMU_BOARD_ID, now_ts, &imu.accel);
|
||||
}
|
||||
|
||||
//RunOnceEvery(10,imu_krooz_downlink_raw());
|
||||
}
|
||||
|
||||
void imu_krooz_downlink_raw(void)
|
||||
{
|
||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice, &imu.gyro_unscaled.p, &imu.gyro_unscaled.q,
|
||||
&imu.gyro_unscaled.r);
|
||||
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice, &imu.accel_unscaled.x, &imu.accel_unscaled.y,
|
||||
&imu.accel_unscaled.z);
|
||||
}
|
||||
|
||||
|
||||
void imu_krooz_event(void)
|
||||
{
|
||||
if (imu_krooz.mpu_eoc) {
|
||||
mpu60x0_i2c_read(&imu_krooz.mpu);
|
||||
imu_krooz.mpu_eoc = false;
|
||||
}
|
||||
|
||||
// If the MPU6050 I2C transaction has succeeded: convert the data
|
||||
mpu60x0_i2c_event(&imu_krooz.mpu);
|
||||
if (imu_krooz.mpu.data_available) {
|
||||
RATES_ADD(imu_krooz.rates_sum, imu_krooz.mpu.data_rates.rates);
|
||||
VECT3_ADD(imu_krooz.accel_sum, imu_krooz.mpu.data_accel.vect);
|
||||
imu_krooz.meas_nb++;
|
||||
imu_krooz.mpu.data_available = false;
|
||||
}
|
||||
|
||||
if (imu_krooz.hmc_eoc) {
|
||||
hmc58xx_read(&imu_krooz.hmc);
|
||||
imu_krooz.hmc_eoc = false;
|
||||
}
|
||||
|
||||
// If the HMC5883 I2C transaction has succeeded: convert the data
|
||||
hmc58xx_event(&imu_krooz.hmc);
|
||||
if (imu_krooz.hmc.data_available) {
|
||||
VECT3_ASSIGN(imu.mag_unscaled, imu_krooz.hmc.data.vect.y, -imu_krooz.hmc.data.vect.x, imu_krooz.hmc.data.vect.z);
|
||||
UpdateMedianFilterVect3Int(median_mag, imu.mag_unscaled);
|
||||
imu_krooz.hmc.data_available = false;
|
||||
imu_scale_mag(&imu);
|
||||
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, get_sys_time_usec(), &imu.mag);
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Sergey Krukowski <softsr@yahoo.de>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/krooz/imu_krooz.h
|
||||
*
|
||||
* Driver for the IMU on the KroozSD board.
|
||||
*
|
||||
* Invensense MPU-6050
|
||||
*/
|
||||
|
||||
#ifndef IMU_KROOZ_H
|
||||
#define IMU_KROOZ_H
|
||||
|
||||
#include "std.h"
|
||||
#include "generated/airframe.h"
|
||||
#include "modules/imu/imu.h"
|
||||
|
||||
#include "peripherals/mpu60x0_i2c.h"
|
||||
#include "peripherals/hmc58xx.h"
|
||||
|
||||
#ifndef KROOZ_GYRO_RANGE
|
||||
#define KROOZ_GYRO_RANGE MPU60X0_GYRO_RANGE_250
|
||||
#endif
|
||||
|
||||
#ifndef KROOZ_ACCEL_RANGE
|
||||
#define KROOZ_ACCEL_RANGE MPU60X0_ACCEL_RANGE_2G
|
||||
#endif
|
||||
|
||||
|
||||
// Set default sensitivity based on range if needed
|
||||
#if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
|
||||
#define IMU_GYRO_P_SENS MPU60X0_GYRO_SENS[KROOZ_GYRO_RANGE]
|
||||
#define IMU_GYRO_P_SENS_NUM MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_P_SENS_DEN MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][1]
|
||||
#define IMU_GYRO_Q_SENS MPU60X0_GYRO_SENS[KROOZ_GYRO_RANGE]
|
||||
#define IMU_GYRO_Q_SENS_NUM MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_Q_SENS_DEN MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][1]
|
||||
#define IMU_GYRO_R_SENS MPU60X0_GYRO_SENS[KROOZ_GYRO_RANGE]
|
||||
#define IMU_GYRO_R_SENS_NUM MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_R_SENS_DEN MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][1]
|
||||
#endif
|
||||
|
||||
// Set default sensitivity based on range if needed
|
||||
#if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
|
||||
#define IMU_ACCEL_X_SENS MPU60X0_ACCEL_SENS[KROOZ_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_X_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[KROOZ_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_X_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[KROOZ_ACCEL_RANGE][1]
|
||||
#define IMU_ACCEL_Y_SENS MPU60X0_ACCEL_SENS[KROOZ_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_Y_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[KROOZ_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_Y_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[KROOZ_ACCEL_RANGE][1]
|
||||
#define IMU_ACCEL_Z_SENS MPU60X0_ACCEL_SENS[KROOZ_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_Z_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[KROOZ_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_Z_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[KROOZ_ACCEL_RANGE][1]
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef IMU_KROOZ_ACCEL_AVG_FILTER
|
||||
#define IMU_KROOZ_ACCEL_AVG_FILTER 15
|
||||
#endif
|
||||
|
||||
struct ImuKrooz {
|
||||
volatile bool mpu_eoc;
|
||||
volatile bool hmc_eoc;
|
||||
struct Mpu60x0_I2c mpu;
|
||||
struct Hmc58xx hmc;
|
||||
struct Int32Rates rates_sum;
|
||||
struct Int32Vect3 accel_sum;
|
||||
volatile uint8_t meas_nb;
|
||||
struct Int32Vect3 accel_filtered;
|
||||
int32_t temperature;
|
||||
};
|
||||
|
||||
extern struct ImuKrooz imu_krooz;
|
||||
|
||||
extern void imu_krooz_init(void);
|
||||
extern void imu_krooz_periodic(void);
|
||||
extern void imu_krooz_event(void);
|
||||
extern void imu_krooz_downlink_raw(void);
|
||||
|
||||
#endif // IMU_KROOZ_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Sergey Krukowski <softsr@yahoo.de>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/krooz/imu_krooz_memsic.h
|
||||
*
|
||||
* Driver for the IMU on the KroozSD Big Rotorcraft Edition board.
|
||||
*
|
||||
* Invensense MPU-6050
|
||||
* Memsic MXR9500 with AD7689
|
||||
* Honeywell HMC-5883
|
||||
*/
|
||||
|
||||
#ifndef IMU_KROOZ_H
|
||||
#define IMU_KROOZ_H
|
||||
|
||||
#include "std.h"
|
||||
#include "generated/airframe.h"
|
||||
#include "modules/imu/imu.h"
|
||||
|
||||
#include "peripherals/mpu60x0_i2c.h"
|
||||
#include "peripherals/hmc58xx.h"
|
||||
#include "mcu_periph/spi.h"
|
||||
|
||||
#ifndef KROOZ_GYRO_RANGE
|
||||
#define KROOZ_GYRO_RANGE MPU60X0_GYRO_RANGE_250
|
||||
#endif
|
||||
|
||||
// Set default sensitivity based on range if needed
|
||||
#if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
|
||||
#define IMU_GYRO_P_SENS MPU60X0_GYRO_SENS[KROOZ_GYRO_RANGE]
|
||||
#define IMU_GYRO_P_SENS_NUM MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_P_SENS_DEN MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][1]
|
||||
#define IMU_GYRO_Q_SENS MPU60X0_GYRO_SENS[KROOZ_GYRO_RANGE]
|
||||
#define IMU_GYRO_Q_SENS_NUM MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_Q_SENS_DEN MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][1]
|
||||
#define IMU_GYRO_R_SENS MPU60X0_GYRO_SENS[KROOZ_GYRO_RANGE]
|
||||
#define IMU_GYRO_R_SENS_NUM MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_R_SENS_DEN MPU60X0_GYRO_SENS_FRAC[KROOZ_GYRO_RANGE][1]
|
||||
#endif
|
||||
|
||||
|
||||
/** default accel sensitivy using 16 bit AD7689 adc
|
||||
* MXR9500 with 1.5g has 21845 LSB/g
|
||||
* sens = 9.81 [m/s^2] / 21845 [LSB/g] * 2^INT32_ACCEL_FRAC = 0.6131
|
||||
*/
|
||||
#if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
|
||||
// FIXME
|
||||
#define IMU_ACCEL_X_SENS 0.9197
|
||||
#define IMU_ACCEL_X_SENS_NUM 9197
|
||||
#define IMU_ACCEL_X_SENS_DEN 10000
|
||||
#define IMU_ACCEL_Y_SENS 0.9197
|
||||
#define IMU_ACCEL_Y_SENS_NUM 9197
|
||||
#define IMU_ACCEL_Y_SENS_DEN 10000
|
||||
#define IMU_ACCEL_Z_SENS 0.9197
|
||||
#define IMU_ACCEL_Z_SENS_NUM 9197
|
||||
#define IMU_ACCEL_Z_SENS_DEN 10000
|
||||
#endif
|
||||
#if !defined IMU_ACCEL_X_NEUTRAL & !defined IMU_ACCEL_Y_NEUTRAL & !defined IMU_ACCEL_Z_NEUTRAL
|
||||
#define IMU_ACCEL_X_NEUTRAL 32768
|
||||
#define IMU_ACCEL_Y_NEUTRAL 32768
|
||||
#define IMU_ACCEL_Z_NEUTRAL 32768
|
||||
#endif
|
||||
|
||||
#ifndef IMU_KROOZ_ACCEL_AVG_FILTER
|
||||
#define IMU_KROOZ_ACCEL_AVG_FILTER 15
|
||||
#endif
|
||||
|
||||
struct ImuKrooz {
|
||||
volatile bool mpu_eoc;
|
||||
volatile bool hmc_eoc;
|
||||
struct Mpu60x0_I2c mpu;
|
||||
struct spi_transaction ad7689_trans;
|
||||
volatile uint8_t ad7689_spi_tx_buffer[2];
|
||||
volatile uint8_t ad7689_spi_rx_buffer[2];
|
||||
struct Hmc58xx hmc;
|
||||
struct Int32Rates rates_sum;
|
||||
struct Int32Vect3 accel_sum;
|
||||
volatile uint8_t meas_nb;
|
||||
struct Uint8Vect3 meas_nb_acc;
|
||||
struct Int32Vect3 accel_filtered;
|
||||
int32_t temperature;
|
||||
};
|
||||
|
||||
extern struct ImuKrooz imu_krooz;
|
||||
|
||||
extern void imu_krooz_init(void);
|
||||
extern void imu_krooz_periodic(void);
|
||||
extern void imu_krooz_event(void);
|
||||
extern void imu_krooz_downlink_raw(void);
|
||||
|
||||
#endif // IMU_KROOZ_H
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||
* Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_SWING
|
||||
#define CONFIG_SWING
|
||||
|
||||
#define BOARD_SWING
|
||||
|
||||
#include "std.h"
|
||||
|
||||
/** uart connected to GPS internally */
|
||||
#define UART1_DEV /dev/ttyPA1
|
||||
#define GPS_UBX_ENABLE_NMEA_DATA_MASK 0xff
|
||||
/** FTDI cable for stereoboard or external GPS */
|
||||
#define UART2_DEV /dev/ttyUSB0
|
||||
|
||||
/* Default actuators driver */
|
||||
#define DEFAULT_ACTUATORS "boards/swing/actuators.h"
|
||||
#define ActuatorDefaultSet(_x,_y) ActuatorsSwingSet(_x,_y)
|
||||
#define ActuatorsDefaultInit() ActuatorsSwingInit()
|
||||
#define ActuatorsDefaultCommit() ActuatorsSwingCommit()
|
||||
|
||||
/* by default activate onboard baro */
|
||||
#ifndef USE_BARO_BOARD
|
||||
#define USE_BARO_BOARD 1
|
||||
#endif
|
||||
|
||||
/* The ADC from the sonar */
|
||||
#if USE_ADC0
|
||||
#define ADC0_ID 0
|
||||
#define ADC0_CHANNELS 2
|
||||
#define ADC0_CHANNELS_CNT 1
|
||||
#define ADC0_BUF_LENGTH 8192
|
||||
#endif
|
||||
|
||||
/* The SPI from the sonar */
|
||||
#if USE_SPI0
|
||||
#define SPI0_MODE 0
|
||||
#define SPI0_BITS_PER_WORD 8
|
||||
#define SPI0_MAX_SPEED_HZ 320000
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SWING */
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||
* Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/swing/actuators.c
|
||||
* Actuator driver for the swing
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* build ioctl unique identifiers for R/W operations */
|
||||
#define PWM_MAGIC 'p'
|
||||
typedef struct { unsigned int val[4]; } __attribute__ ((packed)) pwm_delos_quadruplet;
|
||||
#define PWM_DELOS_SET_RATIOS _IOR(PWM_MAGIC, 9, pwm_delos_quadruplet*)
|
||||
#define PWM_DELOS_SET_SPEEDS _IOR(PWM_MAGIC, 10, pwm_delos_quadruplet*)
|
||||
#define PWM_DELOS_SET_CTRL _IOR(PWM_MAGIC, 11, unsigned int)
|
||||
#define PWM_DELOS_REQUEST _IO(PWM_MAGIC, 12)
|
||||
|
||||
#define PWM_NB_BITS (9)
|
||||
|
||||
/* PWM can take value between 0 and 511 */
|
||||
#ifndef PWM_TOTAL_RANGE
|
||||
#define PWM_TOTAL_RANGE (1<<PWM_NB_BITS)
|
||||
#endif
|
||||
|
||||
#define PWM_REG_RATIO_PRECISION_MASK (PWM_NB_BITS<<16)
|
||||
#define PWM_REG_SATURATION (PWM_REG_RATIO_PRECISION_MASK|PWM_TOTAL_RANGE)
|
||||
|
||||
#include "modules/actuators/actuators.h"
|
||||
#include "modules/actuators/motor_mixing.h"
|
||||
#include "actuators.h"
|
||||
#include "autopilot.h"
|
||||
|
||||
struct ActuatorsSwing actuators_swing;
|
||||
static int actuators_fd;
|
||||
|
||||
// Start/stop PWM
|
||||
enum {
|
||||
SiP6_PWM0_START = (1<<0),
|
||||
SiP6_PWM1_START = (1<<1),
|
||||
SiP6_PWM2_START = (1<<2),
|
||||
SiP6_PWM3_START = (1<<3),
|
||||
};
|
||||
|
||||
void actuators_swing_init(void)
|
||||
{
|
||||
actuators_fd = open("/dev/pwm", O_RDWR);
|
||||
|
||||
pwm_delos_quadruplet m = {{ 1, 1, 1, 1 }};
|
||||
int ret __attribute__((unused)) = ioctl(actuators_fd, PWM_DELOS_SET_SPEEDS, &m);
|
||||
#if ACTUATORS_SWING_DEBUG
|
||||
printf("Return Speeds: %d\n", ret);
|
||||
#endif
|
||||
|
||||
actuators_swing_commit();
|
||||
|
||||
unsigned int control_reg = (SiP6_PWM0_START|SiP6_PWM1_START|SiP6_PWM2_START|SiP6_PWM3_START);
|
||||
|
||||
ret = ioctl(actuators_fd, PWM_DELOS_SET_CTRL, &control_reg);
|
||||
#if ACTUATORS_SWING_DEBUG
|
||||
printf("Return control: %d\n", ret);
|
||||
#endif
|
||||
}
|
||||
|
||||
void actuators_swing_commit(void)
|
||||
{
|
||||
pwm_delos_quadruplet m;
|
||||
|
||||
m.val[0] = actuators_swing.rpm_ref[0] & 0xffff;
|
||||
m.val[1] = actuators_swing.rpm_ref[1] & 0xffff;
|
||||
m.val[2] = actuators_swing.rpm_ref[2] & 0xffff;
|
||||
m.val[3] = actuators_swing.rpm_ref[3] & 0xffff;
|
||||
|
||||
|
||||
if( actuators_swing.rpm_ref[0] > (PWM_TOTAL_RANGE) ) { m.val[0] = PWM_REG_SATURATION; }
|
||||
if( actuators_swing.rpm_ref[1] > (PWM_TOTAL_RANGE) ) { m.val[1] = PWM_REG_SATURATION; }
|
||||
if( actuators_swing.rpm_ref[2] > (PWM_TOTAL_RANGE) ) { m.val[2] = PWM_REG_SATURATION; }
|
||||
if( actuators_swing.rpm_ref[3] > (PWM_TOTAL_RANGE) ) { m.val[3] = PWM_REG_SATURATION; }
|
||||
|
||||
if( actuators_swing.rpm_ref[0] < 0 ) { m.val[0] = 0; }
|
||||
if( actuators_swing.rpm_ref[1] < 0 ) { m.val[1] = 0; }
|
||||
if( actuators_swing.rpm_ref[2] < 0 ) { m.val[2] = 0; }
|
||||
if( actuators_swing.rpm_ref[3] < 0 ) { m.val[3] = 0; }
|
||||
|
||||
/* The upper 16-bit word of the ratio register contains the number
|
||||
* of bits used to code the ratio command */
|
||||
m.val[0] |= PWM_REG_RATIO_PRECISION_MASK;
|
||||
m.val[1] |= PWM_REG_RATIO_PRECISION_MASK;
|
||||
m.val[2] |= PWM_REG_RATIO_PRECISION_MASK;
|
||||
m.val[3] |= PWM_REG_RATIO_PRECISION_MASK;
|
||||
|
||||
int ret __attribute__((unused)) = ioctl(actuators_fd, PWM_DELOS_SET_RATIOS, &m);
|
||||
|
||||
#if ACTUATORS_SWING_DEBUG
|
||||
RunOnceEvery(512, printf("Return ratios: %d (ratios: %d %d %d %d, pwm: %d %d %d %d\n",
|
||||
ret,
|
||||
m.val[0], m.val[1], m.val[2], m.val[3],
|
||||
actuators_swing.rpm_ref[0],
|
||||
actuators_swing.rpm_ref[1],
|
||||
actuators_swing.rpm_ref[2],
|
||||
actuators_swing.rpm_ref[3])
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||
* Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/swing/actuators.h
|
||||
* Actuator driver for the swing
|
||||
*/
|
||||
|
||||
#ifndef ACTUATORS_SWING_H_
|
||||
#define ACTUATORS_SWING_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct ActuatorsSwing {
|
||||
uint16_t rpm_ref[4]; ///< Reference RPM
|
||||
};
|
||||
|
||||
#define ActuatorsSwingSet(_i, _v) { actuators_swing.rpm_ref[_i] = _v; }
|
||||
#define ActuatorsSwingCommit() actuators_swing_commit();
|
||||
#define ActuatorsSwingInit() actuators_swing_init();
|
||||
|
||||
extern struct ActuatorsSwing actuators_swing;
|
||||
extern void actuators_swing_commit(void);
|
||||
extern void actuators_swing_init(void);
|
||||
|
||||
#endif /* ACTUATORS_SWING_H_ */
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||
*
|
||||
* 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, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/swing/baro_board.c
|
||||
* Paparazzi Swing Baro Sensor implementation.
|
||||
* Sensor is LPS22HB (I2C) from ST but is accessed through sysfs interface
|
||||
*/
|
||||
|
||||
#include "modules/sensors/baro.h"
|
||||
#include "modules/core/abi.h"
|
||||
#include "baro_board.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
static bool baro_swing_available;
|
||||
static int32_t baro_swing_raw;
|
||||
static pthread_mutex_t baro_swing_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Check baro thread
|
||||
* TODO something better ?
|
||||
*/
|
||||
static void *baro_read(void *data __attribute__((unused)))
|
||||
{
|
||||
struct input_event ev;
|
||||
ssize_t n;
|
||||
|
||||
int fd_sonar = open("/dev/input/baro_event", O_RDONLY);
|
||||
if (fd_sonar == -1) {
|
||||
printf("Unable to open baro event to read pressure\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
/* Check new pressure */
|
||||
n = read(fd_sonar, &ev, sizeof(ev));
|
||||
if (n == sizeof(ev) && ev.type == EV_ABS && ev.code == ABS_PRESSURE) {
|
||||
pthread_mutex_lock(&baro_swing_mutex);
|
||||
baro_swing_available = true;
|
||||
baro_swing_raw = ev.value;
|
||||
pthread_mutex_unlock(&baro_swing_mutex);
|
||||
}
|
||||
|
||||
// Wait 100ms
|
||||
//usleep(100000);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void baro_init(void)
|
||||
{
|
||||
baro_swing_available = false;
|
||||
baro_swing_raw = 0;
|
||||
|
||||
/* Start baro reading thread */
|
||||
pthread_t baro_thread;
|
||||
if (pthread_create(&baro_thread, NULL, baro_read, NULL) != 0) {
|
||||
printf("[swing_board] Could not create baro reading thread!\n");
|
||||
}
|
||||
pthread_setname_np(baro_thread, "pprz_baro_thread");
|
||||
|
||||
}
|
||||
|
||||
void baro_periodic(void) {}
|
||||
|
||||
|
||||
void baro_event(void)
|
||||
{
|
||||
pthread_mutex_lock(&baro_swing_mutex);
|
||||
if (baro_swing_available) {
|
||||
// From datasheet: raw_pressure / 4096 -> pressure in hPa
|
||||
// send data in Pa
|
||||
uint32_t now_ts = get_sys_time_usec();
|
||||
float pressure = 100.f * ((float)baro_swing_raw) / 4096.f;
|
||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, now_ts, pressure);
|
||||
baro_swing_available = false;
|
||||
}
|
||||
pthread_mutex_unlock(&baro_swing_mutex);
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||
*
|
||||
* 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, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/swing/baro_board.h
|
||||
* Paparazzi Swing Baro Sensor implementation.
|
||||
* Sensor is LPS22HB (I2C) from ST but is accessed through sysfs interface
|
||||
*/
|
||||
|
||||
#ifndef BOARDS_SWING_BARO_H
|
||||
#define BOARDS_SWING_BARO_H
|
||||
|
||||
// only for printing the baro type during compilation
|
||||
#ifndef BARO_BOARD
|
||||
#define BARO_BOARD BARO_SWING
|
||||
#endif
|
||||
|
||||
extern void baro_event(void);
|
||||
#define BaroEvent baro_event
|
||||
|
||||
#endif /* BOARDS_SWING_BARO_H */
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Paparazzi Team
|
||||
*
|
||||
* 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, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file boards/swing/board.c
|
||||
*
|
||||
* Swing specific board initialization function.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "boards/swing.h"
|
||||
#include "mcu.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <linux/input.h>
|
||||
#include "modules/energy/electrical.h"
|
||||
|
||||
/**
|
||||
* Battery reading thread
|
||||
*/
|
||||
static void *bat_read(void *data __attribute__((unused)))
|
||||
{
|
||||
FILE *fp;
|
||||
char path[16];
|
||||
|
||||
while (TRUE) {
|
||||
/* Open the command for reading. */
|
||||
fp = popen("cat /sys/devices/platform/p6-spi.2/spi2.0/vbat", "r");
|
||||
if (fp == NULL) {
|
||||
printf("Failed to read battery\n");
|
||||
} else {
|
||||
/* Read the output a line at a time - output it. */
|
||||
while (fgets(path, sizeof(path) - 1, fp) != NULL) {
|
||||
int raw_bat = atoi(path);
|
||||
// from /bin/mcu_vbat.sh: MILLIVOLTS_VALUE=$(( ($RAW_VALUE * 4250) / 1023 ))
|
||||
electrical.vsupply = (float)((raw_bat * 4250) / 1023) / 1000.f;
|
||||
}
|
||||
/* close */
|
||||
pclose(fp);
|
||||
}
|
||||
|
||||
// Wait 100ms
|
||||
// reading is done at 10Hz like the electrical_periodic from rotorcraft main program
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check button thread
|
||||
*/
|
||||
static void *button_read(void *data __attribute__((unused)))
|
||||
{
|
||||
struct input_event ev;
|
||||
ssize_t n;
|
||||
|
||||
/* Open power button event sysfs file */
|
||||
int fd_button = open("/dev/input/pm_mcu_event", O_RDONLY);
|
||||
if (fd_button == -1) {
|
||||
printf("Unable to open mcu_event to read power button state\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
/* Check power button (read is blocking) */
|
||||
n = read(fd_button, &ev, sizeof(ev));
|
||||
if (n == sizeof(ev) && ev.type == EV_KEY && ev.code == KEY_POWER && ev.value > 0) {
|
||||
printf("Stopping Paparazzi from power button and rebooting\n");
|
||||
usleep(1000);
|
||||
int ret __attribute__((unused)) = system("reboot.sh");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/*
|
||||
* Stop original processes using pstop/ptart commands
|
||||
* Don't kill to avoid automatic restart
|
||||
*
|
||||
*/
|
||||
int ret __attribute__((unused));
|
||||
ret = system("pstop delosd");
|
||||
ret = system("pstop dragon-prog");
|
||||
usleep(50000); /* Give 50ms time to end on a busy system */
|
||||
|
||||
/* Start bat reading thread */
|
||||
pthread_t bat_thread;
|
||||
if (pthread_create(&bat_thread, NULL, bat_read, NULL) != 0) {
|
||||
printf("[swing_board] Could not create battery reading thread!\n");
|
||||
}
|
||||
pthread_setname_np(bat_thread, "pprz_bat_thread");
|
||||
|
||||
/* Start button reading thread */
|
||||
pthread_t button_thread;
|
||||
if (pthread_create(&button_thread, NULL, button_read, NULL) != 0) {
|
||||
printf("[swing_board] Could not create button reading thread!\n");
|
||||
}
|
||||
pthread_setname_np(button_thread, "pprz_button_thread");
|
||||
|
||||
}
|
||||
|
||||
void board_init2(void)
|
||||
{
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Michal Podhradsky
|
||||
* Utah State University, http://aggieair.usu.edu/
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* @file ahrs_gx3.h
|
||||
*
|
||||
* Driver for Microstrain GX3 IMU/AHRS subsystem
|
||||
*
|
||||
* Takes care of configuration of the IMU, communication and parsing
|
||||
* the received packets. See GX3 datasheet for configuration options.
|
||||
*
|
||||
* @author Michal Podhradsky <michal.podhradsky@aggiemail.usu.edu>
|
||||
*/
|
||||
#ifndef AHRS_GX3_H
|
||||
#define AHRS_GX3_H
|
||||
|
||||
#include "generated/airframe.h"
|
||||
#include "modules/imu/imu.h"
|
||||
#include "modules/ins/ins.h"
|
||||
#include "modules/gps/gps.h"
|
||||
#include "mcu_periph/uart.h"
|
||||
|
||||
#include "state.h"
|
||||
#include "led.h"
|
||||
|
||||
#define GX3_MAX_PAYLOAD 128
|
||||
#define GX3_MSG_LEN 67
|
||||
#define GX3_HEADER 0xC8
|
||||
#define GX3_MIN_FREQ 300
|
||||
|
||||
#define IMU_GX3_LONG_DELAY 4000000
|
||||
|
||||
extern void gx3_packet_read_message(void);
|
||||
extern void gx3_packet_parse(uint8_t c);
|
||||
|
||||
struct GX3Packet {
|
||||
bool msg_available;
|
||||
uint32_t chksm_error;
|
||||
uint32_t hdr_error;
|
||||
uint8_t msg_buf[GX3_MAX_PAYLOAD];
|
||||
uint8_t status;
|
||||
uint8_t msg_idx;
|
||||
};
|
||||
|
||||
enum GX3PacketStatus {
|
||||
GX3PacketWaiting,
|
||||
GX3PacketReading
|
||||
};
|
||||
|
||||
|
||||
//AHRS
|
||||
struct AhrsGX3 {
|
||||
struct FloatQuat ltp_to_imu_quat; ///< Rotation from LocalTangentPlane to IMU frame as quaternions
|
||||
float mag_offset; ///< Difference between true and magnetic north
|
||||
|
||||
struct GX3Packet packet; ///< Packet struct
|
||||
float freq; ///< data frequency
|
||||
uint16_t chksm; ///< aux variable for checksum
|
||||
uint32_t time; ///< GX3 time stamp
|
||||
uint32_t ltime; ///< aux time stamp
|
||||
struct FloatVect3 accel; ///< measured acceleration in IMU frame
|
||||
struct FloatRates rate; ///< measured angular rates in IMU frame
|
||||
struct FloatRMat rmat; ///< measured attitude in IMU frame (rotational matrix)
|
||||
bool is_aligned;
|
||||
};
|
||||
|
||||
extern struct AhrsGX3 ahrs_gx3;
|
||||
|
||||
#ifndef PRIMARY_AHRS
|
||||
#define PRIMARY_AHRS ahrs_gx3
|
||||
#endif
|
||||
|
||||
extern void ahrs_gx3_init(void);
|
||||
extern void ahrs_gx3_align(void);
|
||||
extern void ahrs_gx3_register(void);
|
||||
extern void ahrs_gx3_publish_imu(void);
|
||||
|
||||
extern void imu_gx3_init(void);
|
||||
extern void imu_gx3_periodic(void);
|
||||
extern void imu_gx3_event(void);
|
||||
|
||||
#endif /* AHRS_GX3_H*/
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Felix Ruess <felix.ruess@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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_drotek_10dof_v2.c
|
||||
*
|
||||
* Driver for the Drotek 10DOF V2 IMU.
|
||||
* MPU6050 + HMC5883 + MS5611
|
||||
* Reading the baro is not part of the IMU driver.
|
||||
*
|
||||
* By default the axes orientation should be as printed on the pcb,
|
||||
* meaning z-axis pointing down if ICs are facing down.
|
||||
* The orientation can be switched so that the IMU can be mounted ICs facing up
|
||||
* by defining IMU_DROTEK_2_ORIENTATION_IC_UP.
|
||||
*/
|
||||
|
||||
#include "modules/imu/imu.h"
|
||||
#include "modules/core/abi.h"
|
||||
#include "mcu_periph/i2c.h"
|
||||
|
||||
#if !defined DROTEK_2_LOWPASS_FILTER && !defined DROTEK_2_SMPLRT_DIV
|
||||
#if (PERIODIC_FREQUENCY == 60) || (PERIODIC_FREQUENCY == 120)
|
||||
/* Accelerometer: Bandwidth 44Hz, Delay 4.9ms
|
||||
* Gyroscope: Bandwidth 42Hz, Delay 4.8ms sampling 1kHz
|
||||
*/
|
||||
#define DROTEK_2_LOWPASS_FILTER MPU60X0_DLPF_42HZ
|
||||
#define DROTEK_2_SMPLRT_DIV 9
|
||||
PRINT_CONFIG_MSG("Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
|
||||
#elif PERIODIC_FREQUENCY == 512
|
||||
/* Accelerometer: Bandwidth 260Hz, Delay 0ms
|
||||
* Gyroscope: Bandwidth 256Hz, Delay 0.98ms sampling 8kHz
|
||||
*/
|
||||
#define DROTEK_2_LOWPASS_FILTER MPU60X0_DLPF_256HZ
|
||||
#define DROTEK_2_SMPLRT_DIV 3
|
||||
PRINT_CONFIG_MSG("Gyro/Accel output rate is 2kHz at 8kHz internal sampling")
|
||||
#endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(DROTEK_2_SMPLRT_DIV)
|
||||
PRINT_CONFIG_VAR(DROTEK_2_LOWPASS_FILTER)
|
||||
|
||||
PRINT_CONFIG_VAR(DROTEK_2_GYRO_RANGE)
|
||||
PRINT_CONFIG_VAR(DROTEK_2_ACCEL_RANGE)
|
||||
|
||||
#ifndef DROTEK_2_MPU_I2C_ADDR
|
||||
#define DROTEK_2_MPU_I2C_ADDR MPU60X0_ADDR_ALT
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(DROTEK_2_MPU_I2C_ADDR)
|
||||
|
||||
#ifndef DROTEK_2_HMC_I2C_ADDR
|
||||
#define DROTEK_2_HMC_I2C_ADDR HMC58XX_ADDR
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(DROTEK_2_HMC_I2C_ADDR)
|
||||
|
||||
|
||||
struct ImuDrotek2 imu_drotek2;
|
||||
|
||||
void imu_drotek2_init(void)
|
||||
{
|
||||
/* MPU-60X0 */
|
||||
mpu60x0_i2c_init(&imu_drotek2.mpu, &(DROTEK_2_I2C_DEV), DROTEK_2_MPU_I2C_ADDR);
|
||||
// change the default configuration
|
||||
imu_drotek2.mpu.config.smplrt_div = DROTEK_2_SMPLRT_DIV;
|
||||
imu_drotek2.mpu.config.dlpf_cfg = DROTEK_2_LOWPASS_FILTER;
|
||||
imu_drotek2.mpu.config.gyro_range = DROTEK_2_GYRO_RANGE;
|
||||
imu_drotek2.mpu.config.accel_range = DROTEK_2_ACCEL_RANGE;
|
||||
|
||||
/* HMC5883 magnetometer */
|
||||
hmc58xx_init(&imu_drotek2.hmc, &(DROTEK_2_I2C_DEV), DROTEK_2_HMC_I2C_ADDR);
|
||||
|
||||
/* mag is declared as slave to call the configure function,
|
||||
* regardless if it is an actual MPU slave or passthrough
|
||||
*/
|
||||
imu_drotek2.mpu.config.nb_slaves = 1;
|
||||
/* set callback function to configure mag */
|
||||
imu_drotek2.mpu.config.slaves[0].configure = &imu_drotek2_configure_mag_slave;
|
||||
|
||||
// use hmc mag via passthrough
|
||||
imu_drotek2.mpu.config.i2c_bypass = true;
|
||||
}
|
||||
|
||||
void imu_drotek2_periodic(void)
|
||||
{
|
||||
// Start reading the latest gyroscope data
|
||||
mpu60x0_i2c_periodic(&imu_drotek2.mpu);
|
||||
|
||||
// Read HMC58XX at ~50Hz (main loop for rotorcraft: 512Hz)
|
||||
if (imu_drotek2.mpu.config.initialized) {
|
||||
RunOnceEvery(10, hmc58xx_read(&imu_drotek2.hmc));
|
||||
}
|
||||
}
|
||||
|
||||
void imu_drotek2_event(void)
|
||||
{
|
||||
uint32_t now_ts = get_sys_time_usec();
|
||||
|
||||
// If the MPU6050 I2C transaction has succeeded: convert the data
|
||||
mpu60x0_i2c_event(&imu_drotek2.mpu);
|
||||
|
||||
if (imu_drotek2.mpu.data_available) {
|
||||
#if IMU_DROTEK_2_ORIENTATION_IC_UP
|
||||
/* change orientation, so if ICs face up, z-axis is down */
|
||||
imu.gyro_unscaled.p = imu_drotek2.mpu.data_rates.rates.p;
|
||||
imu.gyro_unscaled.q = -imu_drotek2.mpu.data_rates.rates.q;
|
||||
imu.gyro_unscaled.r = -imu_drotek2.mpu.data_rates.rates.r;
|
||||
imu.accel_unscaled.x = imu_drotek2.mpu.data_accel.vect.x;
|
||||
imu.accel_unscaled.y = -imu_drotek2.mpu.data_accel.vect.y;
|
||||
imu.accel_unscaled.z = -imu_drotek2.mpu.data_accel.vect.z;
|
||||
#else
|
||||
/* default orientation as should be printed on the pcb, z-down, ICs down */
|
||||
RATES_COPY(imu.gyro_unscaled, imu_drotek2.mpu.data_rates.rates);
|
||||
VECT3_COPY(imu.accel_unscaled, imu_drotek2.mpu.data_accel.vect);
|
||||
#endif
|
||||
|
||||
imu_drotek2.mpu.data_available = false;
|
||||
imu_scale_gyro(&imu);
|
||||
imu_scale_accel(&imu);
|
||||
AbiSendMsgIMU_GYRO_INT32(IMU_DROTEK_ID, now_ts, &imu.gyro);
|
||||
AbiSendMsgIMU_ACCEL_INT32(IMU_DROTEK_ID, now_ts, &imu.accel);
|
||||
}
|
||||
|
||||
/* HMC58XX event task */
|
||||
hmc58xx_event(&imu_drotek2.hmc);
|
||||
if (imu_drotek2.hmc.data_available) {
|
||||
#if IMU_DROTEK_2_ORIENTATION_IC_UP
|
||||
imu.mag_unscaled.x = imu_drotek2.hmc.data.vect.x;
|
||||
imu.mag_unscaled.y = -imu_drotek2.hmc.data.vect.y;
|
||||
imu.mag_unscaled.z = -imu_drotek2.hmc.data.vect.z;
|
||||
#else
|
||||
VECT3_COPY(imu.mag_unscaled, imu_drotek2.hmc.data.vect);
|
||||
#endif
|
||||
imu_drotek2.hmc.data_available = false;
|
||||
imu_scale_mag(&imu);
|
||||
AbiSendMsgIMU_MAG_INT32(IMU_DROTEK_ID, now_ts, &imu.mag);
|
||||
}
|
||||
}
|
||||
|
||||
/** callback function to configure hmc5883 mag
|
||||
* @return TRUE if mag configuration finished
|
||||
*/
|
||||
bool imu_drotek2_configure_mag_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)),
|
||||
void *mpu __attribute__((unused)))
|
||||
{
|
||||
hmc58xx_start_configure(&imu_drotek2.hmc);
|
||||
if (imu_drotek2.hmc.initialized) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Felix Ruess <felix.ruess@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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_drotek_10dof_v2.h
|
||||
*
|
||||
* Driver for the Drotek 10DOF V2 IMU.
|
||||
* MPU6050 + HMC5883 + MS5611
|
||||
*/
|
||||
|
||||
#ifndef IMU_DROTEK_10DOF_V2_H
|
||||
#define IMU_DROTEK_10DOF_V2_H
|
||||
|
||||
#include "std.h"
|
||||
#include "generated/airframe.h"
|
||||
#include "modules/imu/imu.h"
|
||||
|
||||
#include "peripherals/mpu60x0_i2c.h"
|
||||
#include "peripherals/hmc58xx.h"
|
||||
|
||||
#ifndef DROTEK_2_GYRO_RANGE
|
||||
#define DROTEK_2_GYRO_RANGE MPU60X0_GYRO_RANGE_1000
|
||||
#endif
|
||||
|
||||
#ifndef DROTEK_2_ACCEL_RANGE
|
||||
#define DROTEK_2_ACCEL_RANGE MPU60X0_ACCEL_RANGE_8G
|
||||
#endif
|
||||
|
||||
// Set default sensitivity based on range if needed
|
||||
#if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
|
||||
#define IMU_GYRO_P_SENS MPU60X0_GYRO_SENS[DROTEK_2_GYRO_RANGE]
|
||||
#define IMU_GYRO_P_SENS_NUM MPU60X0_GYRO_SENS_FRAC[DROTEK_2_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_P_SENS_DEN MPU60X0_GYRO_SENS_FRAC[DROTEK_2_GYRO_RANGE][1]
|
||||
#define IMU_GYRO_Q_SENS MPU60X0_GYRO_SENS[DROTEK_2_GYRO_RANGE]
|
||||
#define IMU_GYRO_Q_SENS_NUM MPU60X0_GYRO_SENS_FRAC[DROTEK_2_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_Q_SENS_DEN MPU60X0_GYRO_SENS_FRAC[DROTEK_2_GYRO_RANGE][1]
|
||||
#define IMU_GYRO_R_SENS MPU60X0_GYRO_SENS[DROTEK_2_GYRO_RANGE]
|
||||
#define IMU_GYRO_R_SENS_NUM MPU60X0_GYRO_SENS_FRAC[DROTEK_2_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_R_SENS_DEN MPU60X0_GYRO_SENS_FRAC[DROTEK_2_GYRO_RANGE][1]
|
||||
#endif
|
||||
|
||||
// Set default sensitivity based on range if needed
|
||||
#if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
|
||||
#define IMU_ACCEL_X_SENS MPU60X0_ACCEL_SENS[DROTEK_2_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_X_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[DROTEK_2_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_X_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[DROTEK_2_ACCEL_RANGE][1]
|
||||
#define IMU_ACCEL_Y_SENS MPU60X0_ACCEL_SENS[DROTEK_2_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_Y_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[DROTEK_2_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_Y_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[DROTEK_2_ACCEL_RANGE][1]
|
||||
#define IMU_ACCEL_Z_SENS MPU60X0_ACCEL_SENS[DROTEK_2_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_Z_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[DROTEK_2_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_Z_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[DROTEK_2_ACCEL_RANGE][1]
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
struct ImuDrotek2 {
|
||||
struct Mpu60x0_I2c mpu;
|
||||
struct Hmc58xx hmc;
|
||||
};
|
||||
|
||||
extern struct ImuDrotek2 imu_drotek2;
|
||||
|
||||
extern void imu_drotek2_init(void);
|
||||
extern void imu_drotek2_periodic(void);
|
||||
extern void imu_drotek2_event(void);
|
||||
extern bool imu_drotek2_configure_mag_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
||||
|
||||
#endif /* IMU_DROTEK_10DOF_V2_H */
|
||||
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Antoine Drouin <poinix@gmail.com>
|
||||
* 2013 Felix Ruess <felix.ruess@gmail.com>
|
||||
* 2013 Eduardo Lavratti <agressiva@hotmail.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_gl1.c
|
||||
* Driver for I2C IMU using L3G4200, ADXL345, HMC5883 and BMP085.
|
||||
*/
|
||||
|
||||
#include "modules/imu/imu.h"
|
||||
#include "modules/core/abi.h"
|
||||
#include "mcu_periph/i2c.h"
|
||||
|
||||
PRINT_CONFIG_VAR(GL1_I2C_DEV)
|
||||
|
||||
/** adxl345 accelerometer output rate, lowpass is set to half of rate */
|
||||
#ifndef GL1_ACCEL_RATE
|
||||
# if PERIODIC_FREQUENCY <= 60
|
||||
# define GL1_ACCEL_RATE ADXL345_RATE_50HZ
|
||||
# elif PERIODIC_FREQUENCY <= 120
|
||||
# define GL1_ACCEL_RATE ADXL345_RATE_100HZ
|
||||
# else
|
||||
# define GL1_ACCEL_RATE ADXL345_RATE_200HZ
|
||||
# endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(GL1_ACCEL_RATE)
|
||||
|
||||
/** gyro internal lowpass frequency */
|
||||
#ifndef GL1_GYRO_LOWPASS
|
||||
# if PERIODIC_FREQUENCY <= 60
|
||||
# define GL1_GYRO_LOWPASS L3G4200_DLPF_1
|
||||
# elif PERIODIC_FREQUENCY <= 120
|
||||
# define GL1_GYRO_LOWPASS L3G4200_DLPF_2
|
||||
# else
|
||||
# define GL1_GYRO_LOWPASS L3G4200_DLPF_3
|
||||
# endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(GL1_GYRO_LOWPASS)
|
||||
|
||||
/** gyro sample rate divider */
|
||||
#ifndef GL1_GYRO_SMPLRT
|
||||
# if PERIODIC_FREQUENCY <= 60
|
||||
# define GL1_GYRO_SMPLRT L3G4200_DR_100Hz
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 100Hz")
|
||||
# else
|
||||
# define GL1_GYRO_SMPLRT L3G4200_DR_100Hz
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 100Hz")
|
||||
# endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(GL1_GYRO_SMPLRT)
|
||||
|
||||
#ifdef GL1_GYRO_SCALE
|
||||
# define L3G4200_SCALE GL1_GYRO_SCALE
|
||||
# else
|
||||
# define L3G4200_SCALE L3G4200_SCALE_2000
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(L3G4200_SCALE)
|
||||
|
||||
struct ImuGL1I2c imu_gl1;
|
||||
|
||||
void imu_gl1_init(void)
|
||||
{
|
||||
/* Set accel configuration */
|
||||
adxl345_i2c_init(&imu_gl1.acc_adxl, &(GL1_I2C_DEV), ADXL345_ADDR);
|
||||
// set the data rate
|
||||
imu_gl1.acc_adxl.config.rate = GL1_ACCEL_RATE;
|
||||
/// @todo drdy int handling for adxl345
|
||||
//imu_aspirin.acc_adxl.config.drdy_int_enable = true;
|
||||
|
||||
|
||||
/* Gyro configuration and initalization */
|
||||
l3g4200_init(&imu_gl1.gyro_l3g, &(GL1_I2C_DEV), L3G4200_ADDR_ALT);
|
||||
/* change the default config */
|
||||
// output data rate, bandwidth, enable axis (0x1f = 100 ODR, 25hz) (0x5f = 200hz ODR, 25hz)
|
||||
imu_gl1.gyro_l3g.config.ctrl_reg1 = ((GL1_GYRO_SMPLRT << 6) | (GL1_GYRO_LOWPASS << 4) | 0xf);
|
||||
// senstivity
|
||||
imu_gl1.gyro_l3g.config.ctrl_reg4 = (L3G4200_SCALE << 4) | 0x00;
|
||||
// filter config
|
||||
imu_gl1.gyro_l3g.config.ctrl_reg5 = 0x00; // only first LPF active
|
||||
|
||||
|
||||
/* initialize mag and set default options */
|
||||
hmc58xx_init(&imu_gl1.mag_hmc, &(GL1_I2C_DEV), HMC58XX_ADDR);
|
||||
imu_gl1.mag_hmc.type = HMC_TYPE_5883;
|
||||
}
|
||||
|
||||
|
||||
void imu_gl1_periodic(void)
|
||||
{
|
||||
adxl345_i2c_periodic(&imu_gl1.acc_adxl);
|
||||
|
||||
// Start reading the latest gyroscope data
|
||||
l3g4200_periodic(&imu_gl1.gyro_l3g);
|
||||
|
||||
// Read HMC58XX at 50Hz (main loop for rotorcraft: 512Hz)
|
||||
RunOnceEvery(10, hmc58xx_periodic(&imu_gl1.mag_hmc));
|
||||
}
|
||||
|
||||
void imu_gl1_event(void)
|
||||
{
|
||||
uint32_t now_ts = get_sys_time_usec();
|
||||
|
||||
adxl345_i2c_event(&imu_gl1.acc_adxl);
|
||||
if (imu_gl1.acc_adxl.data_available) {
|
||||
VECT3_COPY(imu.accel_unscaled, imu_gl1.acc_adxl.data.vect);
|
||||
imu.accel_unscaled.x = imu_gl1.acc_adxl.data.vect.y;
|
||||
imu.accel_unscaled.y = imu_gl1.acc_adxl.data.vect.x;
|
||||
imu.accel_unscaled.z = -imu_gl1.acc_adxl.data.vect.z;
|
||||
imu_gl1.acc_adxl.data_available = false;
|
||||
imu_scale_accel(&imu);
|
||||
AbiSendMsgIMU_ACCEL_INT32(IMU_GL1_ID, now_ts, &imu.accel);
|
||||
}
|
||||
|
||||
/* If the lg34200 I2C transaction has succeeded: convert the data */
|
||||
l3g4200_event(&imu_gl1.gyro_l3g);
|
||||
if (imu_gl1.gyro_l3g.data_available) {
|
||||
RATES_COPY(imu.gyro_unscaled, imu_gl1.gyro_l3g.data.rates);
|
||||
imu.gyro_unscaled.p = imu_gl1.gyro_l3g.data.rates.q;
|
||||
imu.gyro_unscaled.q = imu_gl1.gyro_l3g.data.rates.p;
|
||||
imu.gyro_unscaled.r = -imu_gl1.gyro_l3g.data.rates.r;
|
||||
imu_gl1.gyro_l3g.data_available = false;
|
||||
imu_scale_gyro(&imu);
|
||||
AbiSendMsgIMU_GYRO_INT32(IMU_GL1_ID, now_ts, &imu.gyro);
|
||||
}
|
||||
|
||||
/* HMC58XX event task */
|
||||
hmc58xx_event(&imu_gl1.mag_hmc);
|
||||
if (imu_gl1.mag_hmc.data_available) {
|
||||
// VECT3_COPY(imu.mag_unscaled, imu_gl1.mag_hmc.data.vect);
|
||||
imu.mag_unscaled.y = imu_gl1.mag_hmc.data.vect.x;
|
||||
imu.mag_unscaled.x = imu_gl1.mag_hmc.data.vect.y;
|
||||
imu.mag_unscaled.z = -imu_gl1.mag_hmc.data.vect.z;
|
||||
imu_gl1.mag_hmc.data_available = false;
|
||||
imu_scale_mag(&imu);
|
||||
AbiSendMsgIMU_MAG_INT32(IMU_GL1_ID, now_ts, &imu.mag);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Antoine Drouin <poinix@gmail.com>
|
||||
* 2013 Felix Ruess <felix.ruess@gmail.com>
|
||||
* 2013 Eduardo Lavratti <agressiva@hotmail.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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_gl1.h
|
||||
* Interface for I2c IMU using using L3G4200, ADXL345, HMC5883 and BMP085.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IMU_GL1_H
|
||||
#define IMU_GL1_H
|
||||
|
||||
#include "generated/airframe.h"
|
||||
#include "modules/imu/imu.h"
|
||||
|
||||
/* include default GL1 sensitivity/channel definitions */
|
||||
#include "modules/imu/imu_gl1_defaults.h"
|
||||
|
||||
#include "peripherals/l3g4200.h"
|
||||
#include "peripherals/hmc58xx.h"
|
||||
#include "peripherals/adxl345_i2c.h"
|
||||
|
||||
struct ImuGL1I2c {
|
||||
struct Adxl345_I2c acc_adxl;
|
||||
struct L3g4200 gyro_l3g;
|
||||
struct Hmc58xx mag_hmc;
|
||||
};
|
||||
|
||||
extern struct ImuGL1I2c imu_gl1;
|
||||
|
||||
extern void imu_gl1_init(void);
|
||||
extern void imu_gl1_periodic(void);
|
||||
extern void imu_gl1_event(void);
|
||||
|
||||
#endif /* IMU_GL1_H */
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2013 The Paparazzi Team
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_gl1_defaults.h
|
||||
* Default sensitivity definitions for IMU GL1.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IMU_GL1_DEFAULTS_H
|
||||
#define IMU_GL1_DEFAULTS_H
|
||||
|
||||
#include "generated/airframe.h"
|
||||
|
||||
/** default gyro sensitivy and neutral from the datasheet
|
||||
* L3G4200 has 8.75 LSB/(deg/s)
|
||||
* sens = 1/xxx * pi/180 * 2^INT32_RATE_FRAC
|
||||
* sens = 1/xxx * pi/180 * 4096 = ?????
|
||||
*
|
||||
* 250deg = 114.28 = 0.625
|
||||
* 500deg = 57.14 = 1.25
|
||||
* 2000deg = 14.28 = 5.006
|
||||
*/
|
||||
#if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
|
||||
#define IMU_GYRO_P_SENS 5.006
|
||||
#define IMU_GYRO_P_SENS_NUM 2503
|
||||
#define IMU_GYRO_P_SENS_DEN 500
|
||||
#define IMU_GYRO_Q_SENS 5.006
|
||||
#define IMU_GYRO_Q_SENS_NUM 2503
|
||||
#define IMU_GYRO_Q_SENS_DEN 500
|
||||
#define IMU_GYRO_R_SENS 5.006
|
||||
#define IMU_GYRO_R_SENS_NUM 2503
|
||||
#define IMU_GYRO_R_SENS_DEN 500
|
||||
#endif
|
||||
|
||||
/** default accel sensitivy from the ADXL345 datasheet
|
||||
* sensitivity of x & y axes depends on supply voltage:
|
||||
* - 256 LSB/g @ 2.5V
|
||||
* - 265 LSB/g @ 3.3V
|
||||
* z sensitivity stays at 256 LSB/g
|
||||
* fixed point sens: 9.81 [m/s^2] / 256 [LSB/g] * 2^INT32_ACCEL_FRAC
|
||||
* x/y sens = 9.81 / 265 * 1024 = 37.91
|
||||
* z sens = 9.81 / 256 * 1024 = 39.24
|
||||
*
|
||||
* what about the offset at 3.3V?
|
||||
*/
|
||||
#if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
|
||||
#define IMU_ACCEL_X_SENS 37.91
|
||||
#define IMU_ACCEL_X_SENS_NUM 3791
|
||||
#define IMU_ACCEL_X_SENS_DEN 100
|
||||
#define IMU_ACCEL_Y_SENS 37.91
|
||||
#define IMU_ACCEL_Y_SENS_NUM 3791
|
||||
#define IMU_ACCEL_Y_SENS_DEN 100
|
||||
#define IMU_ACCEL_Z_SENS 39.24
|
||||
#define IMU_ACCEL_Z_SENS_NUM 3924
|
||||
#define IMU_ACCEL_Z_SENS_DEN 100
|
||||
#endif
|
||||
|
||||
#endif /* IMU_GL1_DEFAULTS_H */
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Antoine Drouin <poinix@gmail.com>
|
||||
* 2013 Felix Ruess <felix.ruess@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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_ppzuav.h
|
||||
*
|
||||
* Driver for the PPZUAV IMU.
|
||||
*
|
||||
* 9DoM IMU with ITG-3200, ADXL345 and HMC5843, all via I2C.
|
||||
*/
|
||||
|
||||
#include "modules/imu/imu.h"
|
||||
#include "modules/core/abi.h"
|
||||
#include "mcu_periph/i2c.h"
|
||||
|
||||
/* i2c default suitable for Tiny/Twog */
|
||||
#ifndef IMU_PPZUAV_I2C_DEV
|
||||
#define IMU_PPZUAV_I2C_DEV i2c0
|
||||
#endif
|
||||
|
||||
/** adxl345 accelerometer output rate, lowpass is set to half of rate */
|
||||
#ifndef IMU_PPZUAV_ACCEL_RATE
|
||||
# if PERIODIC_FREQUENCY <= 60
|
||||
# define IMU_PPZUAV_ACCEL_RATE ADXL345_RATE_50HZ
|
||||
# elif PERIODIC_FREQUENCY <= 120
|
||||
# define IMU_PPZUAV_ACCEL_RATE ADXL345_RATE_100HZ
|
||||
# else
|
||||
# define IMU_PPZUAV_ACCEL_RATE ADXL345_RATE_200HZ
|
||||
# endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(IMU_PPZUAV_ACCEL_RATE)
|
||||
|
||||
|
||||
/** gyro internal lowpass frequency */
|
||||
#ifndef IMU_PPZUAV_GYRO_LOWPASS
|
||||
# if PERIODIC_FREQUENCY <= 60
|
||||
# define IMU_PPZUAV_GYRO_LOWPASS ITG3200_DLPF_20HZ
|
||||
# elif PERIODIC_FREQUENCY <= 120
|
||||
# define IMU_PPZUAV_GYRO_LOWPASS ITG3200_DLPF_42HZ
|
||||
# else
|
||||
# define IMU_PPZUAV_GYRO_LOWPASS ITG3200_DLPF_98HZ
|
||||
# endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(IMU_PPZUAV_GYRO_LOWPASS)
|
||||
|
||||
|
||||
/** gyro sample rate divider */
|
||||
#ifndef IMU_PPZUAV_GYRO_SMPLRT_DIV
|
||||
# if PERIODIC_FREQUENCY <= 60
|
||||
# define IMU_PPZUAV_GYRO_SMPLRT_DIV 19
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 50Hz")
|
||||
# else
|
||||
# define IMU_PPZUAV_GYRO_SMPLRT_DIV 9
|
||||
PRINT_CONFIG_MSG("Gyro output rate is 100Hz")
|
||||
# endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(IMU_PPZUAV_GYRO_SMPLRT_DIV)
|
||||
|
||||
|
||||
struct ImuPpzuav imu_ppzuav;
|
||||
|
||||
void imu_ppzuav_init(void)
|
||||
{
|
||||
/* Set accel configuration */
|
||||
adxl345_i2c_init(&imu_ppzuav.acc_adxl, &(IMU_PPZUAV_I2C_DEV), ADXL345_ADDR);
|
||||
/* set the data rate */
|
||||
imu_ppzuav.acc_adxl.config.rate = IMU_PPZUAV_ACCEL_RATE;
|
||||
|
||||
/* Gyro configuration and initalization */
|
||||
itg3200_init(&imu_ppzuav.gyro_itg, &(IMU_PPZUAV_I2C_DEV), ITG3200_ADDR);
|
||||
/* change the default config */
|
||||
imu_ppzuav.gyro_itg.config.smplrt_div = IMU_PPZUAV_GYRO_SMPLRT_DIV;
|
||||
imu_ppzuav.gyro_itg.config.dlpf_cfg = IMU_PPZUAV_GYRO_LOWPASS;
|
||||
|
||||
/* initialize mag and set default options */
|
||||
hmc58xx_init(&imu_ppzuav.mag_hmc, &(IMU_PPZUAV_I2C_DEV), HMC58XX_ADDR);
|
||||
/* set the type to the old HMC5843 */
|
||||
imu_ppzuav.mag_hmc.type = HMC_TYPE_5843;
|
||||
}
|
||||
|
||||
|
||||
void imu_ppzuav_periodic(void)
|
||||
{
|
||||
adxl345_i2c_periodic(&imu_ppzuav.acc_adxl);
|
||||
|
||||
// Start reading the latest gyroscope data
|
||||
itg3200_periodic(&imu_ppzuav.gyro_itg);
|
||||
|
||||
// Read HMC58XX at 50Hz (main loop for rotorcraft: 512Hz)
|
||||
RunOnceEvery(10, hmc58xx_periodic(&imu_ppzuav.mag_hmc));
|
||||
}
|
||||
|
||||
void imu_ppzuav_event(void)
|
||||
{
|
||||
uint32_t now_ts = get_sys_time_usec();
|
||||
|
||||
adxl345_i2c_event(&imu_ppzuav.acc_adxl);
|
||||
if (imu_ppzuav.acc_adxl.data_available) {
|
||||
imu.accel_unscaled.x = -imu_ppzuav.acc_adxl.data.vect.x;
|
||||
imu.accel_unscaled.y = imu_ppzuav.acc_adxl.data.vect.y;
|
||||
imu.accel_unscaled.z = -imu_ppzuav.acc_adxl.data.vect.z;
|
||||
imu_ppzuav.acc_adxl.data_available = false;
|
||||
imu_scale_accel(&imu);
|
||||
AbiSendMsgIMU_ACCEL_INT32(IMU_PPZUAV_ID, now_ts, &imu.accel);
|
||||
}
|
||||
|
||||
/* If the itg3200 I2C transaction has succeeded: convert the data */
|
||||
itg3200_event(&imu_ppzuav.gyro_itg);
|
||||
if (imu_ppzuav.gyro_itg.data_available) {
|
||||
imu.gyro_unscaled.p = -imu_ppzuav.gyro_itg.data.rates.p;
|
||||
imu.gyro_unscaled.q = imu_ppzuav.gyro_itg.data.rates.q;
|
||||
imu.gyro_unscaled.r = -imu_ppzuav.gyro_itg.data.rates.r;
|
||||
imu_ppzuav.gyro_itg.data_available = false;
|
||||
imu_scale_gyro(&imu);
|
||||
AbiSendMsgIMU_GYRO_INT32(IMU_PPZUAV_ID, now_ts, &imu.gyro);
|
||||
}
|
||||
|
||||
/* HMC58XX event task */
|
||||
hmc58xx_event(&imu_ppzuav.mag_hmc);
|
||||
if (imu_ppzuav.mag_hmc.data_available) {
|
||||
imu.mag_unscaled.x = -imu_ppzuav.mag_hmc.data.vect.y;
|
||||
imu.mag_unscaled.y = -imu_ppzuav.mag_hmc.data.vect.x;
|
||||
imu.mag_unscaled.z = -imu_ppzuav.mag_hmc.data.vect.z;
|
||||
imu_ppzuav.mag_hmc.data_available = false;
|
||||
imu_scale_mag(&imu);
|
||||
AbiSendMsgIMU_MAG_INT32(IMU_PPZUAV_ID, now_ts, &imu.mag);
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Antoine Drouin <poinix@gmail.com>
|
||||
* 2013 Felix Ruess <felix.ruess@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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_ppzuav.h
|
||||
*
|
||||
* Interface and defaults for the PPZUAV IMU.
|
||||
*
|
||||
* 9DoM IMU with ITG-3200, ADXL345 and HMC5843, all via I2C.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IMU_PPZUAV_H
|
||||
#define IMU_PPZUAV_H
|
||||
|
||||
#include "generated/airframe.h"
|
||||
#include "modules/imu/imu.h"
|
||||
|
||||
#include "peripherals/itg3200.h"
|
||||
#include "peripherals/hmc58xx.h"
|
||||
#include "peripherals/adxl345_i2c.h"
|
||||
|
||||
#if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
|
||||
/** default gyro sensitivy and neutral from the datasheet
|
||||
* ITG3200 has 14.375 LSB/(deg/s)
|
||||
* sens = 1/14.375 * pi/180 * 2^INT32_RATE_FRAC
|
||||
* sens = 1/14.375 * pi/180 * 4096 = 4.973126
|
||||
*/
|
||||
#define IMU_GYRO_P_SENS 4.973
|
||||
#define IMU_GYRO_P_SENS_NUM 4973
|
||||
#define IMU_GYRO_P_SENS_DEN 1000
|
||||
#define IMU_GYRO_Q_SENS 4.973
|
||||
#define IMU_GYRO_Q_SENS_NUM 4973
|
||||
#define IMU_GYRO_Q_SENS_DEN 1000
|
||||
#define IMU_GYRO_R_SENS 4.973
|
||||
#define IMU_GYRO_R_SENS_NUM 4973
|
||||
#define IMU_GYRO_R_SENS_DEN 1000
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
|
||||
/** default accel sensitivy from the ADXL345 datasheet
|
||||
* sensitivity of x & y axes depends on supply voltage:
|
||||
* - 256 LSB/g @ 2.5V
|
||||
* - 265 LSB/g @ 3.3V
|
||||
* z sensitivity stays at 256 LSB/g
|
||||
* fixed point sens: 9.81 [m/s^2] / 256 [LSB/g] * 2^INT32_ACCEL_FRAC
|
||||
* x/y sens = 9.81 / 265 * 1024 = 37.91
|
||||
* z sens = 9.81 / 256 * 1024 = 39.24
|
||||
*/
|
||||
#define IMU_ACCEL_X_SENS 37.91
|
||||
#define IMU_ACCEL_X_SENS_NUM 3791
|
||||
#define IMU_ACCEL_X_SENS_DEN 100
|
||||
#define IMU_ACCEL_Y_SENS 37.91
|
||||
#define IMU_ACCEL_Y_SENS_NUM 3791
|
||||
#define IMU_ACCEL_Y_SENS_DEN 100
|
||||
#define IMU_ACCEL_Z_SENS 39.24
|
||||
#define IMU_ACCEL_Z_SENS_NUM 3924
|
||||
#define IMU_ACCEL_Z_SENS_DEN 100
|
||||
#endif
|
||||
|
||||
|
||||
struct ImuPpzuav {
|
||||
struct Adxl345_I2c acc_adxl;
|
||||
struct Itg3200 gyro_itg;
|
||||
struct Hmc58xx mag_hmc;
|
||||
};
|
||||
|
||||
extern struct ImuPpzuav imu_ppzuav;
|
||||
|
||||
extern void imu_ppzuav_init(void);
|
||||
extern void imu_ppzuav_periodic(void);
|
||||
extern void imu_ppzuav_event(void);
|
||||
|
||||
#endif /* IMU_PPZUAV_H */
|
||||
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||
* Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_swing.c
|
||||
* Driver for the Swing accelerometer and gyroscope
|
||||
*/
|
||||
|
||||
#include "modules/imu/imu.h"
|
||||
#include "modules/core/abi.h"
|
||||
#include "mcu_periph/i2c.h"
|
||||
|
||||
|
||||
/* defaults suitable for Swing */
|
||||
#ifndef SWING_MPU_I2C_DEV
|
||||
#define SWING_MPU_I2C_DEV i2c0
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(SWING_MPU_I2C_DEV)
|
||||
|
||||
#if !defined SWING_LOWPASS_FILTER && !defined SWING_SMPLRT_DIV
|
||||
#if (PERIODIC_FREQUENCY == 60) || (PERIODIC_FREQUENCY == 120)
|
||||
/* Accelerometer: Bandwidth 44Hz, Delay 4.9ms
|
||||
* Gyroscope: Bandwidth 42Hz, Delay 4.8ms sampling 1kHz
|
||||
*/
|
||||
#define SWING_LOWPASS_FILTER MPU60X0_DLPF_42HZ
|
||||
#define SWING_SMPLRT_DIV 9
|
||||
PRINT_CONFIG_MSG("Gyro/Accel output rate is 100Hz at 1kHz internal sampling")
|
||||
#elif PERIODIC_FREQUENCY == 512
|
||||
/* Accelerometer: Bandwidth 260Hz, Delay 0ms
|
||||
* Gyroscope: Bandwidth 256Hz, Delay 0.98ms sampling 8kHz
|
||||
*/
|
||||
#define SWING_LOWPASS_FILTER MPU60X0_DLPF_256HZ
|
||||
#define SWING_SMPLRT_DIV 3
|
||||
PRINT_CONFIG_MSG("Gyro/Accel output rate is 2kHz at 8kHz internal sampling")
|
||||
#endif
|
||||
#endif
|
||||
PRINT_CONFIG_VAR(SWING_SMPLRT_DIV)
|
||||
PRINT_CONFIG_VAR(SWING_LOWPASS_FILTER)
|
||||
|
||||
PRINT_CONFIG_VAR(SWING_GYRO_RANGE)
|
||||
PRINT_CONFIG_VAR(SWING_ACCEL_RANGE)
|
||||
|
||||
/** Basic Navstik IMU data */
|
||||
struct ImuSwing imu_swing;
|
||||
|
||||
/**
|
||||
* Navstik IMU initializtion of the MPU-60x0 and HMC58xx
|
||||
*/
|
||||
void imu_swing_init(void)
|
||||
{
|
||||
/* MPU-60X0 */
|
||||
mpu60x0_i2c_init(&imu_swing.mpu, &(SWING_MPU_I2C_DEV), MPU60X0_ADDR);
|
||||
imu_swing.mpu.config.smplrt_div = SWING_SMPLRT_DIV;
|
||||
imu_swing.mpu.config.dlpf_cfg = SWING_LOWPASS_FILTER;
|
||||
imu_swing.mpu.config.gyro_range = SWING_GYRO_RANGE;
|
||||
imu_swing.mpu.config.accel_range = SWING_ACCEL_RANGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle all the periodic tasks of the Navstik IMU components.
|
||||
* Read the MPU60x0 every periodic call
|
||||
*/
|
||||
void imu_swing_periodic(void)
|
||||
{
|
||||
// Start reading the latest gyroscope data
|
||||
mpu60x0_i2c_periodic(&imu_swing.mpu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle all the events of the Navstik IMU components.
|
||||
* When there is data available convert it to the correct axis and save it in the imu structure.
|
||||
*/
|
||||
void imu_swing_event(void)
|
||||
{
|
||||
uint32_t now_ts = get_sys_time_usec();
|
||||
|
||||
/* MPU-60x0 event taks */
|
||||
mpu60x0_i2c_event(&imu_swing.mpu);
|
||||
|
||||
if (imu_swing.mpu.data_available) {
|
||||
/* default orientation of the MPU is upside down and in plane mode
|
||||
* turn it to have rotorcraft mode by default */
|
||||
RATES_ASSIGN(imu.gyro_unscaled,
|
||||
-imu_swing.mpu.data_rates.rates.r,
|
||||
-imu_swing.mpu.data_rates.rates.q,
|
||||
-imu_swing.mpu.data_rates.rates.p);
|
||||
VECT3_ASSIGN(imu.accel_unscaled,
|
||||
-imu_swing.mpu.data_accel.vect.z,
|
||||
-imu_swing.mpu.data_accel.vect.y,
|
||||
-imu_swing.mpu.data_accel.vect.x);
|
||||
|
||||
imu_swing.mpu.data_available = false;
|
||||
imu_scale_gyro(&imu);
|
||||
imu_scale_accel(&imu);
|
||||
AbiSendMsgIMU_GYRO_INT32(IMU_BOARD_ID, now_ts, &imu.gyro);
|
||||
AbiSendMsgIMU_ACCEL_INT32(IMU_BOARD_ID, now_ts, &imu.accel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
|
||||
* Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modules/imu/imu_swing.h
|
||||
* Interface for the Swing accelerometer and gyroscope
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IMU_SWING_H
|
||||
#define IMU_SWING_H
|
||||
|
||||
#include "generated/airframe.h"
|
||||
#include "modules/imu/imu.h"
|
||||
|
||||
#include "peripherals/mpu60x0_i2c.h"
|
||||
|
||||
#ifndef SWING_GYRO_RANGE
|
||||
#define SWING_GYRO_RANGE MPU60X0_GYRO_RANGE_1000
|
||||
#endif
|
||||
|
||||
#ifndef SWING_ACCEL_RANGE
|
||||
#define SWING_ACCEL_RANGE MPU60X0_ACCEL_RANGE_8G
|
||||
#endif
|
||||
|
||||
// Set default sensitivity based on range if needed
|
||||
#if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
|
||||
#define IMU_GYRO_P_SENS MPU60X0_GYRO_SENS[SWING_GYRO_RANGE]
|
||||
#define IMU_GYRO_P_SENS_NUM MPU60X0_GYRO_SENS_FRAC[SWING_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_P_SENS_DEN MPU60X0_GYRO_SENS_FRAC[SWING_GYRO_RANGE][1]
|
||||
#define IMU_GYRO_Q_SENS MPU60X0_GYRO_SENS[SWING_GYRO_RANGE]
|
||||
#define IMU_GYRO_Q_SENS_NUM MPU60X0_GYRO_SENS_FRAC[SWING_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_Q_SENS_DEN MPU60X0_GYRO_SENS_FRAC[SWING_GYRO_RANGE][1]
|
||||
#define IMU_GYRO_R_SENS MPU60X0_GYRO_SENS[SWING_GYRO_RANGE]
|
||||
#define IMU_GYRO_R_SENS_NUM MPU60X0_GYRO_SENS_FRAC[SWING_GYRO_RANGE][0]
|
||||
#define IMU_GYRO_R_SENS_DEN MPU60X0_GYRO_SENS_FRAC[SWING_GYRO_RANGE][1]
|
||||
#endif
|
||||
|
||||
// Set default sensitivity based on range if needed
|
||||
#if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
|
||||
#define IMU_ACCEL_X_SENS MPU60X0_ACCEL_SENS[SWING_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_X_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[SWING_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_X_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[SWING_ACCEL_RANGE][1]
|
||||
#define IMU_ACCEL_Y_SENS MPU60X0_ACCEL_SENS[SWING_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_Y_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[SWING_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_Y_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[SWING_ACCEL_RANGE][1]
|
||||
#define IMU_ACCEL_Z_SENS MPU60X0_ACCEL_SENS[SWING_ACCEL_RANGE]
|
||||
#define IMU_ACCEL_Z_SENS_NUM MPU60X0_ACCEL_SENS_FRAC[SWING_ACCEL_RANGE][0]
|
||||
#define IMU_ACCEL_Z_SENS_DEN MPU60X0_ACCEL_SENS_FRAC[SWING_ACCEL_RANGE][1]
|
||||
#endif
|
||||
|
||||
|
||||
/** Everything that is in the swing IMU */
|
||||
struct ImuSwing {
|
||||
struct Mpu60x0_I2c mpu; ///< The MPU gyro/accel device
|
||||
};
|
||||
|
||||
extern struct ImuSwing imu_swing;
|
||||
|
||||
extern void imu_swing_init(void);
|
||||
extern void imu_swing_periodic(void);
|
||||
extern void imu_swing_event(void);
|
||||
|
||||
#endif /* IMU_SWING_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Michal Podhradsky
|
||||
* Utah State University, http://aggieair.usu.edu/
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* @file imu_um6.h
|
||||
*
|
||||
* Driver for CH Robotics UM6 IMU/AHRS subsystem
|
||||
*
|
||||
* Takes care of configuration of the IMU, communication and parsing
|
||||
* the received packets. See UM6 datasheet for configuration options.
|
||||
* Should be used with ahrs_extern_euler AHRS subsystem.
|
||||
*
|
||||
* @author Michal Podhradsky <michal.podhradsky@aggiemail.usu.edu>
|
||||
*/
|
||||
#ifndef IMU_UM6_H
|
||||
#define IMU_UM6_H
|
||||
|
||||
#include "generated/airframe.h"
|
||||
#include "modules/imu/imu.h"
|
||||
#include "mcu_periph/uart.h"
|
||||
#include "modules/ahrs/ahrs.h"
|
||||
|
||||
#define IMU_UM6_BUFFER_LENGTH 32
|
||||
#define IMU_UM6_DATA_OFFSET 5
|
||||
#define IMU_UM6_LONG_DELAY 4000000
|
||||
|
||||
#define IMU_UM6_COMMUNICATION_REG 0x00
|
||||
#define IMU_UM6_MISC_CONFIG_REG 0x01
|
||||
#define IMU_UM6_GET_FIRMWARE_CMD 0xAA
|
||||
#define IMU_UM6_ZERO_GYROS_CMD 0xAC
|
||||
#define IMU_UM6_RESET_EKF_CMD 0xAD
|
||||
#define IMU_UM6_GET_DATA 0xAE
|
||||
#define IMU_UM6_SET_ACCEL_REF 0xAF
|
||||
#define IMU_UM6_SET_MAG_REF 0xB0
|
||||
|
||||
#define IMU_UM6_GYRO_PROC 0x5C
|
||||
#define IMU_UM6_ACCEL_PROC 0x5E
|
||||
#define IMU_UM6_MAG_PROC 0x60
|
||||
#define IMU_UM6_EULER 0x62
|
||||
#define IMU_UM6_QUAT 0x64
|
||||
|
||||
extern void UM6_packet_read_message(void);
|
||||
extern void UM6_packet_parse(uint8_t c);
|
||||
extern void imu_um6_publish(void);
|
||||
|
||||
extern struct UM6Packet UM6_packet;
|
||||
|
||||
extern uint8_t PacketLength;
|
||||
extern uint8_t PacketType;
|
||||
extern uint8_t PacketAddr;
|
||||
|
||||
extern uint16_t chk_calc;
|
||||
extern uint16_t chk_rec;
|
||||
|
||||
extern enum UM6Status UM6_status;
|
||||
extern volatile uint8_t UM6_imu_available;
|
||||
|
||||
extern struct FloatEulers UM6_eulers;
|
||||
extern struct FloatQuat UM6_quat;
|
||||
|
||||
struct UM6Packet {
|
||||
bool msg_available;
|
||||
uint32_t chksm_error;
|
||||
uint32_t hdr_error;
|
||||
uint8_t msg_buf[IMU_UM6_BUFFER_LENGTH];
|
||||
uint8_t status;
|
||||
uint8_t msg_idx;
|
||||
};
|
||||
|
||||
enum UM6PacketStatus {
|
||||
UM6PacketWaiting,
|
||||
UM6PacketReadingS,
|
||||
UM6PacketReadingN,
|
||||
UM6PacketReadingPT,
|
||||
UM6PacketReadingAddr,
|
||||
UM6PacketReadingData
|
||||
};
|
||||
|
||||
enum UM6Status {
|
||||
UM6Uninit,
|
||||
UM6Running
|
||||
};
|
||||
|
||||
extern void imu_um6_init(void);
|
||||
extern void imu_um6_periodic(void);
|
||||
|
||||
static inline void imu_um6_event(void)
|
||||
{
|
||||
if (uart_char_available(&(UM6_LINK))) {
|
||||
while (uart_char_available(&(UM6_LINK)) && !UM6_packet.msg_available) {
|
||||
UM6_packet_parse(uart_getch(&(UM6_LINK)));
|
||||
}
|
||||
if (UM6_packet.msg_available) {
|
||||
UM6_packet.msg_available = false;
|
||||
UM6_packet_read_message();
|
||||
imu_um6_publish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* IMU_UM6_H*/
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (C) 2012-2017 The Paparazzi Team
|
||||
#
|
||||
# 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, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
from parrot_utils import ParrotUtils
|
||||
|
||||
class Swing(ParrotUtils):
|
||||
uav_name = 'Swing'
|
||||
address = '192.168.4.1'
|
||||
version_file = None
|
||||
upload_path = '/data/edu/'
|
||||
prompt = '$ '
|
||||
|
||||
def uav_status(self):
|
||||
print('Parrot version:\t\t' + str(self.check_version()))
|
||||
|
||||
def init_extra_parser(self):
|
||||
# nothing here
|
||||
pass
|
||||
|
||||
def parse_extra_args(self, args):
|
||||
# nothing here
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
swing = Swing()
|
||||
swing.parse_args()
|
||||
exit(0)
|
||||
|
||||
Reference in New Issue
Block a user