Skip to content
Permalink
Browse files

[boards] preliminary OpenPilot revo board support

  • Loading branch information...
flixr committed Mar 17, 2016
1 parent 0634a82 commit eb5ecd494b393520fc47fbc8ce932f93b29a3f4c
@@ -0,0 +1,186 @@
<!DOCTYPE airframe SYSTEM "../airframe.dtd">

<!-- this is a quadrotor frame in X-configuration equiped with
* Autopilot: OpenPilot Revo with STM32F4
* IMU: MPU6000 & MS5611
* Actuators: PWM motor controllers http://wiki.paparazziuav.org/wiki/Subsystem/actuators#PWM
* GPS: Ublox http://wiki.paparazziuav.org/wiki/Subsystem/gps
* RC: Spektrum satellite http://wiki.paparazziuav.org/wiki/Subsystem/radio_control#Spektrum
-->

<airframe name="Quadrotor OpenPilot Revo">

<firmware name="rotorcraft">
<target name="ap" board="openpilot_revo_1.0">
</target>

<target name="nps" board="pc">
<module name="fdm" type="jsbsim"/>
</target>

<module name="radio_control" type="spektrum">
<define name="RADIO_MODE" value="RADIO_FLAP"/>
<define name="RADIO_KILL_SWITCH" value="RADIO_GEAR"/>
</module>

<module name="motor_mixing"/>
<module name="actuators" type="pwm">
<define name="SERVO_HZ" value="400"/>
</module>

<module name="telemetry" type="transparent"/>
<module name="imu" type="mpu6000_hmc5883">
<configure name="IMU_MPU_SPI_DEV" value="spi1"/>
<configure name="IMU_MPU_SPI_SLAVE_IDX" value="SPI_SLAVE1"/>
<configure name="IMU_HMC_I2C_DEV" value="i2c1"/>
</module>
<module name="gps" type="ublox"/>
<module name="stabilization" type="int_quat"/>
<module name="ahrs" type="float_mlkf">
<!-- Uncomment to enable all axis update from the Magnetometer. Do
it only if you have a very well calibrated and tested
magnetometer otherwise your attitude will drift. -->
<!--define name="AHRS_MAG_UPDATE_ALL_AXES" value="1"/-->
</module>
<module name="ins" type="hff"/>

<module name="gps_ubx_ucenter"/>
<module name="geo_mag"/>
<module name="air_data"/>
</firmware>


<servos driver="Pwm">
<servo name="FR" no="0" min="1000" neutral="1100" max="2000"/>
<servo name="BR" no="1" min="1000" neutral="1100" max="2000"/>
<servo name="BL" no="2" min="1000" neutral="1100" max="2000"/>
<servo name="FL" no="3" min="1000" neutral="1100" max="2000"/>
</servos>

<commands>
<axis name="ROLL" failsafe_value="0"/>
<axis name="PITCH" failsafe_value="0"/>
<axis name="YAW" failsafe_value="0"/>
<axis name="THRUST" failsafe_value="0"/>
</commands>

<section name="MIXING" prefix="MOTOR_MIXING_">
<!-- front left (CW), front right (CCW), back right (CW), back left (CCW) -->
<define name="TYPE" value="QUAD_X"/>
</section>

<command_laws>
<call fun="motor_mixing_run(autopilot_motors_on,FALSE,values)"/>
<set servo="FR" value="motor_mixing.commands[MOTOR_FRONT_RIGHT]"/>
<set servo="BR" value="motor_mixing.commands[MOTOR_BACK_RIGHT]"/>
<set servo="BL" value="motor_mixing.commands[MOTOR_BACK_LEFT]"/>
<set servo="FL" value="motor_mixing.commands[MOTOR_FRONT_LEFT]"/>
</command_laws>

<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="BODY_TO_IMU_PHI" value="0." unit="deg"/>
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/>
<define name="BODY_TO_IMU_PSI" value="0." unit="deg"/>
</section>

<section name="AHRS" prefix="AHRS_">
<!-- values used if no GPS fix, on 3D fix is update by geo_mag module -->
<define name="H_X" value="0.3770441"/>
<define name="H_Y" value="0.0193986"/>
<define name="H_Z" value="0.9259921"/>
</section>



<section name="STABILIZATION_ATTITUDE" prefix="STABILIZATION_ATTITUDE_">
<!-- setpoints -->
<define name="SP_MAX_PHI" value="45." unit="deg"/>
<define name="SP_MAX_THETA" value="45." unit="deg"/>
<define name="SP_MAX_R" value="90." unit="deg/s"/>
<define name="DEADBAND_A" value="0"/>
<define name="DEADBAND_E" value="0"/>
<define name="DEADBAND_R" value="250"/>

<!-- reference -->
<define name="REF_OMEGA_P" value="400" unit="deg/s"/>
<define name="REF_ZETA_P" value="0.85"/>
<define name="REF_MAX_P" value="400." unit="deg/s"/>
<define name="REF_MAX_PDOT" value="RadOfDeg(8000.)"/>

<define name="REF_OMEGA_Q" value="400" unit="deg/s"/>
<define name="REF_ZETA_Q" value="0.85"/>
<define name="REF_MAX_Q" value="400." unit="deg/s"/>
<define name="REF_MAX_QDOT" value="RadOfDeg(8000.)"/>

<define name="REF_OMEGA_R" value="250" unit="deg/s"/>
<define name="REF_ZETA_R" value="0.85"/>
<define name="REF_MAX_R" value="180." unit="deg/s"/>
<define name="REF_MAX_RDOT" value="RadOfDeg(1800.)"/>

<!-- feedback -->
<define name="PHI_PGAIN" value="1000"/>
<define name="PHI_DGAIN" value="400"/>
<define name="PHI_IGAIN" value="200"/>

<define name="THETA_PGAIN" value="1000"/>
<define name="THETA_DGAIN" value="400"/>
<define name="THETA_IGAIN" value="200"/>

<define name="PSI_PGAIN" value="500"/>
<define name="PSI_DGAIN" value="300"/>
<define name="PSI_IGAIN" value="10"/>

<!-- feedforward -->
<define name="PHI_DDGAIN" value="300"/>
<define name="THETA_DDGAIN" value="300"/>
<define name="PSI_DDGAIN" value="300"/>
</section>

<section name="GUIDANCE_V" prefix="GUIDANCE_V_">
<define name="HOVER_KP" value="150"/>
<define name="HOVER_KD" value="80"/>
<define name="HOVER_KI" value="20"/>
<define name="NOMINAL_HOVER_THROTTLE" value="0.5"/>
<define name="ADAPT_THROTTLE_ENABLED" value="TRUE"/>
</section>

<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<define name="MAX_BANK" value="20" unit="deg"/>
<define name="USE_SPEED_REF" value="TRUE"/>
<define name="PGAIN" value="50"/>
<define name="DGAIN" value="100"/>
<define name="AGAIN" value="70"/>
<define name="IGAIN" value="20"/>
</section>

<section name="SIMULATOR" prefix="NPS_">
<define name="ACTUATOR_NAMES" value="ne_motor, se_motor, sw_motor, nw_motor" type="string[]"/>
<define name="JSBSIM_MODEL" value="simple_x_quad" type="string"/>
<define name="SENSORS_PARAMS" value="nps_sensors_params_default.h" type="string"/>
<!-- mode switch on joystick channel 5 (axis numbering starting at zero) -->
<define name="JS_AXIS_MODE" value="4"/>
</section>

<section name="AUTOPILOT">
<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_NAV"/>
</section>

<section name="BAT">
<define name="CATASTROPHIC_BAT_LEVEL" value="9.3" unit="V"/>
<define name="CRITIC_BAT_LEVEL" value="9.6" unit="V"/>
<define name="LOW_BAT_LEVEL" value="10.1" unit="V"/>
<define name="MAX_BAT_LEVEL" value="12.4" unit="V"/>
</section>

</airframe>
@@ -0,0 +1,58 @@
# Hey Emacs, this is a -*- makefile -*-
#
# openpilot_revo_1.0.makefile
#
# https://www.openpilot.org/products/openpilot-revolution-platform/
#

BOARD=openpilot_revo
BOARD_VERSION=1.0
BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\"

ARCH=stm32
ARCH_L=f4
HARD_FLOAT=yes
$(TARGET).ARCHDIR = $(ARCH)
$(TARGET).LDSCRIPT=$(SRC_ARCH)/openpilot_revo.ld

# -----------------------------------------------------------------------

# default flash mode is via usb dfu bootloader (luftboot)
# other possibilities: DFU-UTIL, SWD, JTAG_BMP, STLINK, SERIAL
FLASH_MODE ?= DFU-UTIL



#
# 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 ?= UART2

MODEM_PORT ?= UART1
MODEM_BAUD ?= B57600

GPS_PORT ?= UART3
GPS_BAUD ?= B38400




#
# 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
@@ -198,6 +198,15 @@ else ifeq ($(BOARD), naze32)
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c

# OpenPilot Revo
elf ifeq ($(BOARD), revo)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C
BARO_BOARD_CFLAGS += -DUSE_I2C1
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c1
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c

endif # check board

ifneq ($(BARO_LED),none)
@@ -0,0 +1,35 @@
/*
* Hey Emacs, this is a -*- makefile -*-
*
* Copyright (C) 2016 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.
*/

/* Linker script for OpenPilot Revo (STM32F405RGT6, 1024K flash, 192K RAM). */

/* Define memory regions. */
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
/* Reserving 128kb flash for persistent settings. */
rom (rx) : ORIGIN = 0x08000000, LENGTH = 896K
}

/* Include the common ld script. */
INCLUDE libopencm3_stm32f4.ld
@@ -0,0 +1,17 @@
/*
* board specific functions for the openpilot_revo board
*
*/

#ifndef BOARDS_OPENPILOT_REVO_BARO_H
#define BOARDS_OPENPILOT_REVO_BARO_H

// only for printing the baro type during compilation
#ifndef BARO_BOARD
#define BARO_BOARD BARO_MS5611_I2C
#endif

extern void baro_event(void);
#define BaroEvent baro_event

#endif /* BOARDS_OPENPILOT_REVO_BARO_H */

0 comments on commit eb5ecd4

Please sign in to comment.
You can’t perform that action at this time.