Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make mpu9250 compatible with mpu6500, by providing option to disable mag * Upgrade QTC version, add more QTCreator compatibility with chibios * F3 support * Add priliminary support stm32f3 discovery board using chibios * Add support for the stm32f37 xvert board by means of chibios * Give INDI simple full control authority * Motor driver for the vertx * Create define out of required THD_WORKING_AREA space
- Loading branch information
1 parent
2581a97
commit 2a6ad55
Showing
36 changed files
with
4,984 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
<!DOCTYPE airframe SYSTEM "../airframe.dtd"> | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- this is a quadrotor frame equiped with | ||
* Autopilot: xvert | ||
* IMU: MPU6500 + external HMC58XX | ||
* Actuators: 2 PWM servo's, 2 escs through some proprietary atmega uart protocol | ||
* GPS: Ublox through I2C | ||
* RC: Datalink | ||
--> | ||
<airframe name="xvert"> | ||
<firmware name="rotorcraft"> | ||
<target name="ap" board="xvert_1.0"/> | ||
<define name="BAT_CHECKER_DELAY" value="80" /> | ||
<!-- amount of time it take for the bat to check --> | ||
<!-- to avoid bat low spike detection when strong pullup withch draws short sudden power--> | ||
<define name="CATASTROPHIC_BATTERY_KILL_DELAY" value="80" /> | ||
|
||
<!-- To fix the 32k ram limit issue:--> | ||
<!--<define name="PPRZ_TRIG_INT_USE_FLOAT"/>--> | ||
<define name="PPRZ_TRIG_CONST" value="const"/> | ||
<define name="THD_WORKING_AREA_MAIN" value="1024"/> | ||
|
||
<configure name="USE_MAGNETOMETER" value="FALSE"/> | ||
|
||
<!-- in seconds--> | ||
<module name="telemetry" type="transparent" > | ||
<define name="MODEM_BAUD" value="57600"/> | ||
</module> | ||
<module name="guidance" type="hybrid"/> | ||
<module name="motor_mixing"/> | ||
<module name="sys_mon"/> | ||
<module name="gps" type="ubx_ucenter"/> | ||
<module name="send_imu_mag_current"/> | ||
<module name="air_data"/> | ||
<module name="imu" type="mpu9250_i2c"> | ||
<configure name="IMU_MPU9250_I2C_DEV" value="i2c1"/> | ||
<define name="IMU_MPU9250_READ_MAG" value="FALSE"/> | ||
<define name="IMU_MPU9250_I2C_ADDR" value="MPU9250_ADDR"/> | ||
<define name="AHRS_ICQ_MAG_ID" value="MAG_HMC58XX_SENDER_ID" /> <!-- Meaning the external hmc--> | ||
</module> | ||
<module name="stabilization" type="indi_simple" /> | ||
<module name="ahrs" type="float_cmpl_quat" > | ||
<define name="AHRS_USE_GPS_HEADING" value="FALSE"/> | ||
</module> | ||
<module name="ins" type="float_invariant"> | ||
<define name="INS_PROPAGATE_FREQUENCY" value="500"/> | ||
<define name="INS_FINV_MAG_ID" value="MAG_HMC58XX_SENDER_ID"/> | ||
</module> | ||
<module name="actuators" type="xvert"> | ||
<define name="SERVO_HZ" value="400" /> | ||
</module> | ||
<module name="radio_control" type="datalink"/> | ||
<module name="gps" type="ubx_i2c"> | ||
<configure name="GPS_UBX_I2C_DEV" value="i2c2"/> | ||
</module> | ||
<module name="mag" type="hmc58xx"> | ||
<configure name="MAG_HMC58XX_I2C_DEV" value="i2c2"/> | ||
<define name="MODULE_HMC58XX_UPDATE_AHRS" value="TRUE"/> | ||
<define name="HMC58XX_CHAN_X" value="1"/> | ||
<define name="HMC58XX_CHAN_Y" value="0"/> | ||
<define name="HMC58XX_CHAN_Z" value="2"/> | ||
<define name="HMC58XX_CHAN_X_SIGN" value="-"/> | ||
<define name="HMC58XX_CHAN_Y_SIGN" value="+"/> | ||
<define name="HMC58XX_CHAN_Z_SIGN" value="+"/> | ||
</module> | ||
</firmware> | ||
|
||
<section name="INS" prefix="INS_"> | ||
<define name="H_X" value="0.5138"/> | ||
<define name="H_Y" value="0.00019"/> | ||
<define name="H_Z" value="0.8578"/> | ||
</section> | ||
|
||
<section name="IMU" prefix="IMU_"> | ||
<!-- replace this with your own calibration --> | ||
<define name="MAG_X_NEUTRAL" value="30"/> | ||
<define name="MAG_Y_NEUTRAL" value="127"/> | ||
<define name="MAG_Z_NEUTRAL" value="140"/> | ||
<define name="MAG_X_SENS" value="7.11726808648" integer="16"/> | ||
<define name="MAG_Y_SENS" value="7.09366475279" integer="16"/> | ||
<define name="MAG_Z_SENS" value="6.84467824688" integer="16"/> | ||
|
||
<define name="ACCEL_X_NEUTRAL" value="-52"/> | ||
<define name="ACCEL_Y_NEUTRAL" value="-4"/> | ||
<define name="ACCEL_Z_NEUTRAL" value="-7"/> | ||
<define name="ACCEL_X_SENS" value="2.45056441681" integer="16"/> | ||
<define name="ACCEL_Y_SENS" value="2.44991708802" integer="16"/> | ||
<define name="ACCEL_Z_SENS" value="2.44199722843" integer="16"/> | ||
|
||
<define name="BODY_TO_IMU_PHI" value="90." unit="deg"/> | ||
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/> | ||
<define name="BODY_TO_IMU_PSI" value="90." unit="deg"/> | ||
</section> | ||
<commands> | ||
<axis name="PITCH" failsafe_value="0"/> | ||
<axis name="ROLL" failsafe_value="0"/> | ||
<axis name="YAW" failsafe_value="0"/> | ||
<axis name="THRUST" failsafe_value="0"/> | ||
</commands> | ||
<servos driver="Xvert"> | ||
<servo name="RM" no="0" min="1160" neutral="1200" max="1880"/> | ||
<servo name="LM" no="1" min="1160" neutral="1200" max="1880"/> | ||
<servo name="ELEVON_RIGHT" no="2" min="1000" neutral="1500" max="2000"/> | ||
<servo name="ELEVON_LEFT" no="3" min="1000" neutral="1500" max="2000"/> | ||
</servos> | ||
|
||
<command_laws> | ||
<call fun="motor_mixing_run(autopilot_get_motors_on(),FALSE,values)"/> | ||
<set servo="RM" value="motor_mixing.commands[0]"/> | ||
<set servo="LM" value="motor_mixing.commands[1]"/> | ||
|
||
<!-- Mode dependent actuator laws for the elevons. The elevons act different in rc attitude flight mode--> | ||
<!-- First the correct feedback is stored in variables --> | ||
<let var="aileron_feedback_left" value="@YAW"/> | ||
<let var="aileron_feedback_right" value="@YAW"/> | ||
|
||
<let var="elevator_feedback_left" value="-@PITCH"/> | ||
<let var="elevator_feedback_right" value="+@PITCH"/> | ||
|
||
<!-- if using PID with gain scheduling --> | ||
<let var="forward_left" value="$aileron_feedback_left + $elevator_feedback_left"/> | ||
<let var="forward_right" value="$aileron_feedback_right + $elevator_feedback_right"/> | ||
|
||
<!-- This statement tells the autopilot to use the hover feedback if in mode attitude direct and to use the forward feedback in all other cases--> | ||
<set servo="ELEVON_LEFT" value="$forward_left" /> | ||
<set servo="ELEVON_RIGHT" value="$forward_right" /> | ||
</command_laws> | ||
|
||
<section name="AIR_DATA" prefix="AIR_DATA_"> | ||
<define name="CALC_AIRSPEED" value="FALSE" /> | ||
<define name="CALC_TAS_FACTOR" value="FALSE" /> | ||
<define name="CALC_AMSL_BARO" value="TRUE" /> | ||
</section> | ||
|
||
<section name="RC_SETPOINT" prefix="STABILIZATION_ATTITUDE_"> | ||
<!-- setpoint limits for attitude stabilization rc flight --> | ||
<define name="SP_MAX_PHI" value="45" unit="deg" /> | ||
<define name="SP_MAX_THETA" value="45" unit="deg" /> | ||
<define name="SP_MAX_R" value="300" unit="deg/s" /> | ||
<define name="DEADBAND_A" value="0" /> | ||
<define name="DEADBAND_E" value="0" /> | ||
<define name="DEADBAND_R" value="50" /> | ||
</section> | ||
|
||
<section name="STABILIZATION_ATTITUDE_INDI" prefix="STABILIZATION_INDI_"> | ||
<!-- control effectiveness --> | ||
<define name="G1_P" value="0.01292" /> | ||
<define name="G1_Q" value="0.014867" /> | ||
<define name="G1_R" value="0.012055" /> | ||
<define name="G2_R" value="0.0" /> | ||
<!-- For the bebop2 we need to filter the roll rate due to the dampers --> | ||
<define name="FILTER_ROLL_RATE" value="FALSE" /> | ||
<define name="FILTER_PITCH_RATE" value="FALSE" /> | ||
<define name="FILTER_YAW_RATE" value="FALSE" /> | ||
<!-- reference acceleration for attitude control --> | ||
<define name="REF_ERR_P" value="100.0" /> | ||
<define name="REF_ERR_Q" value="100.0" /> | ||
<define name="REF_ERR_R" value="100.0" /> | ||
<define name="REF_RATE_P" value="14.0" /> | ||
<define name="REF_RATE_Q" value="14.0" /> | ||
<define name="REF_RATE_R" value="14.0" /> | ||
<!-- second order filter parameters --> | ||
<define name="FILT_CUTOFF" value="3.2"/> | ||
<define name="FILT_CUTOFF_R" value="3.2"/> | ||
<!-- first order actuator dynamics --> | ||
<define name="ACT_DYN_P" value="0.04" /> | ||
<define name="ACT_DYN_Q" value="0.04" /> | ||
<define name="ACT_DYN_R" value="0.04" /> | ||
<!-- Adaptive Learning Rate --> | ||
<define name="USE_ADAPTIVE" value="FALSE" /> | ||
<define name="ADAPTIVE_MU" value="0.0001" /> | ||
<!-- max rates (conservative) --> | ||
<define name="STABILIZATION_INDI_MAX_RATE" value="343.77" unit="deg/s"/> | ||
<define name="STABILIZATION_INDI_MAX_R" value="200" unit="deg/s"/> <!--Does not seem to be applied--> | ||
<define name="FULL_AUTHORITY" value="TRUE"/> | ||
</section> | ||
<section name="GUIDANCE_V" prefix="GUIDANCE_V_"> | ||
<define name="HOVER_KP" value="350" /> | ||
<define name="HOVER_KD" value="85" /> | ||
<define name="HOVER_KI" value="20" /> | ||
<define name="NOMINAL_HOVER_THROTTLE" value="0.6" /> | ||
<define name="ADAPT_THROTTLE_ENABLED" value="TRUE" /> | ||
</section> | ||
<section name="GUIDANCE_H" prefix="GUIDANCE_H_"> | ||
<!-- Good weather --> | ||
<define name="MAX_BANK" value="20" unit="deg" /> | ||
<define name="REF_MAX_SPEED" value="2" unit="m/s" /> | ||
<!-- Bad weather --> | ||
<!-- define name="MAX_BANK" value="32" unit="deg"/ --> | ||
<define name="PGAIN" value="50" /> | ||
<define name="DGAIN" value="100" /> | ||
<define name="IGAIN" value="30" /> | ||
</section> | ||
<section name="NAVIGATION" prefix="NAV_"> | ||
<define name="CLIMB_VSPEED" value="4.5" /> | ||
<define name="DESCEND_VSPEED" value="-1.0" /> | ||
</section> | ||
<section name="AUTOPILOT"> | ||
<define name="MODE_STARTUP" value="AP_MODE_ATTITUDE_DIRECT" /> | ||
<define name="MODE_MANUAL" value="AP_MODE_ATTITUDE_DIRECT" /> | ||
<define name="MODE_AUTO1" value="AP_MODE_HOVER_Z_HOLD" /> | ||
<define name="MODE_AUTO2" value="AP_MODE_RC_DIRECT" /> | ||
<define name="NO_RC_THRUST_LIMIT" value="TRUE" /> | ||
</section> | ||
|
||
<section name="BAT"> | ||
<!-- 2S LiPo with 950mAh --> | ||
<define name="LOW_BAT_LEVEL" value="7.5" unit="V"/> | ||
<define name="CRITIC_BAT_LEVEL" value="7.3" unit="V"/> | ||
<define name="CATASTROPHIC_BAT_LEVEL" value="7.0" unit="V"/> | ||
<define name="MAX_BAT_LEVEL" value="8.4" unit="V"/> | ||
</section> | ||
|
||
<section name="MIXING" prefix="MOTOR_MIXING_"> | ||
<define name="TRIM_ROLL" value="0"/> | ||
<define name="TRIM_PITCH" value="0"/> | ||
<define name="TRIM_YAW" value="0"/> | ||
<define name="NB_MOTOR" value="2"/> | ||
<define name="SCALE" value="256"/> | ||
<define name="PITCH_COEF" value="{ 0, 0}"/> | ||
<define name="ROLL_COEF" value="{ -256, 256 }"/> | ||
<define name="YAW_COEF" value="{ 0, 0 }"/> | ||
<define name="THRUST_COEF" value="{ 256, 256 }"/> | ||
</section> | ||
</airframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Hey Emacs, this is a -*- makefile -*- | ||
# | ||
# stm32f3_discovery_chibios.makefile | ||
# | ||
# | ||
|
||
BOARD=stm32f3_discovery | ||
BOARD_VERSION=1.0 | ||
BOARD_DIR=$(BOARD)/chibios/v$(BOARD_VERSION) | ||
BOARD_CFG=\"boards/$(BOARD_DIR)/board.h\" | ||
|
||
ARCH=chibios | ||
$(TARGET).ARCHDIR = $(ARCH) | ||
|
||
RTOS=chibios | ||
|
||
## FPU on F3 | ||
USE_FPU=hard | ||
|
||
$(TARGET).CFLAGS += -DSTM32F3 -DPPRZLINK_ENABLE_FD | ||
|
||
############################################################################## | ||
# Architecture or project specific options | ||
# | ||
# Define project name here (target) | ||
PROJECT = $(TARGET) | ||
|
||
# Project specific files and paths (see Makefile.chibios for details) | ||
CHIBIOS_BOARD_PLATFORM = STM32F3xx/platform.mk | ||
CHIBIOS_BOARD_LINKER = STM32F303xC.ld | ||
CHIBIOS_BOARD_STARTUP = startup_stm32f3xx.mk | ||
|
||
############################################################################## | ||
# Compiler settings | ||
# | ||
MCU = cortex-m4 | ||
|
||
|
||
# default flash mode is via DFU-UTIL | ||
# possibilities: DFU-UTIL, SWD, STLINK | ||
FLASH_MODE ?= DFU-UTIL | ||
|
||
HAS_LUFTBOOT = FALSE | ||
|
||
# | ||
# default LED configuration | ||
# | ||
RADIO_CONTROL_LED ?= 4 | ||
BARO_LED ?= none | ||
AHRS_ALIGNER_LED ?= 5 | ||
GPS_LED ?= 6 | ||
SYS_TIME_LED ?= 3 | ||
|
||
# | ||
# default UART configuration (modem, gps, spektrum) | ||
# | ||
|
||
MODEM_PORT ?= UART1 | ||
MODEM_BAUD ?= B57600 | ||
|
||
GPS_PORT ?= UART2 | ||
GPS_BAUD ?= B38400 | ||
|
||
RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT ?= UART3 | ||
SBUS_PORT ?= UART3 | ||
|
||
|
||
# | ||
# default actuator configuration | ||
# | ||
# you can use different actuators by adding a configure option to your firmware section | ||
# e.g. <configure name="ACTUATORS" value="actuators_ppm/> | ||
# and by setting the correct "driver" attribute in servo section | ||
# e.g. <servo driver="Ppm"> | ||
# | ||
ACTUATORS ?= actuators_pwm |
Oops, something went wrong.
@kevindehecker This line