Skip to content

Commit

Permalink
Merge branch 'dev' into 4.0_beta
Browse files Browse the repository at this point in the history
* rotorcrafts: additional motor arming options: #174
* rotorcrafts: easier setting/tuning of nominal hover throttle if adaptive filter is not used: #177
* rotorcrafts: some more fixed when changing vertical guidance modes
* bat_checker module
* updated some ADC stuff for lisa/m: #159
  You should now be able to use ADC_1, ADC_2, ADC_3 for the ADCs on the ANALOG1
  • Loading branch information
flixr committed Apr 10, 2012
2 parents ad1915a + 5349657 commit f1e0468
Show file tree
Hide file tree
Showing 37 changed files with 810 additions and 224 deletions.
1 change: 0 additions & 1 deletion conf/airframes/CDW/debug_i2c.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@
<firmware name="rotorcraft">
<!-- <define name="USE_PERSISTENT_SETTINGS"/> -->
<!-- <define name="USE_INS_NAV_INIT"/> -->
<define name="USE_ADAPT_HOVER"/>
<define name="FAILSAFE_GROUND_DETECT"/>
<define name="USE_GPS_ACC4R"/>
<target name="ap" board="lisa_l_1.0">
Expand Down
1 change: 0 additions & 1 deletion conf/airframes/ENAC/quadrotor/blender.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<firmware name="rotorcraft">
<define name="USE_INS_NAV_INIT"/>
<define name="USE_ADAPT_HOVER"/>
<!--define name="GUIDANCE_H_USE_REF"/-->

<target name="ap" board="booz_1.0">
Expand Down
1 change: 0 additions & 1 deletion conf/airframes/ENAC/quadrotor/booz2_g1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

<firmware name="rotorcraft">
<define name="USE_INS_NAV_INIT"/>
<define name="USE_ADAPT_HOVER"/>
<!--define name="GUIDANCE_H_USE_REF"/-->

<target name="ap" board="booz_1.0">
Expand Down
2 changes: 0 additions & 2 deletions conf/airframes/ENAC/quadrotor/navgo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<firmware name="rotorcraft">
<define name="USE_INS_NAV_INIT"/>
<define name="USE_ADAPT_HOVER"/>
<define name="USE_ATTITUDE_REF" value="0"/>
<!--define name="GUIDANCE_H_USE_REF"/-->

Expand Down Expand Up @@ -105,7 +104,6 @@

<!-- Magnetic field for Toulouse (declination -16°) -->
<section name="AHRS" prefix="AHRS_">
<define name="MAG_UPDATE_YAW_ONLY" value="1"/>
<define name="PROPAGATE_FREQUENCY" value="512"/>
<define name="H_X" value=" 0.513081"/>
<define name="H_Y" value="-0.00242783"/>
Expand Down
1 change: 0 additions & 1 deletion conf/airframes/NoVa_L.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@
<firmware name="rotorcraft">
<!-- <define name="USE_PERSISTENT_SETTINGS"/> -->
<!-- <define name="USE_INS_NAV_INIT"/> -->
<define name="USE_ADAPT_HOVER"/>
<define name="FAILSAFE_GROUND_DETECT"/>
<define name="USE_GPS_ACC4R"/>
<target name="ap" board="lisa_l_1.0">
Expand Down
1 change: 0 additions & 1 deletion conf/airframes/Poine/booz2_a7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@
<firmware name="rotorcraft">
<!-- <define name="USE_PERSISTENT_SETTINGS"/> -->
<!-- <define name="USE_INS_NAV_INIT"/> -->
<define name="USE_ADAPT_HOVER"/>
<define name="FAILSAFE_GROUND_DETECT"/>
<define name="USE_GPS_ACC4R"/>
<target name="ap" board="lisa_l_1.0">
Expand Down
38 changes: 19 additions & 19 deletions conf/airframes/fraser_lisa_m_rotorcraft.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<define name="ACTUATORS_START_DELAY" value="3"/>
<define name="USE_INS_NAV_INIT"/>
<configure name="AHRS_ALIGNER_LED" value="3"/>
<define name="USE_KILL_SWITCH_FOR_MOTOR_ARMING"/>
</target>
<target name="sim" board="pc">
<subsystem name="fdm" type="nps"/>
Expand Down Expand Up @@ -107,39 +108,38 @@

<section name="AHRS" prefix="AHRS_">
<define name="PROPAGATE_FREQUENCY" value="512"/>
<define name="MAG_UPDATE_YAW_ONLY"/>
<define name="H_X" value="0.3770441"/>
<define name="H_Y" value="0.0193986"/>
<define name="H_Z" value="0.9259921"/>
</section>

<section name="INS" prefix="INS_">
<define name="BARO_SENS" value="3.3" integer="16"/>
<define name="BARO_SENS" value="22.3" integer="16"/>
</section>

<section name="STABILIZATION_RATE" prefix="STABILIZATION_RATE_">
<!-- setpoints -->
<define name="SP_MAX_P" value="10000" />
<define name="SP_MAX_Q" value="10000" />
<define name="SP_MAX_R" value="10000" />
<define name="DEADBAND_P" value="0" />
<define name="DEADBAND_Q" value="0" />
<define name="DEADBAND_R" value="200" />
<define name="REF_TAU" value="4" />
<define name="SP_MAX_P" value="10000"/>
<define name="SP_MAX_Q" value="10000"/>
<define name="SP_MAX_R" value="10000"/>
<define name="DEADBAND_P" value="0"/>
<define name="DEADBAND_Q" value="0"/>
<define name="DEADBAND_R" value="200"/>
<define name="REF_TAU" value="4"/>

<!-- feedback -->
<define name="GAIN_P" value="400" />
<define name="GAIN_Q" value="400" />
<define name="GAIN_R" value="350" />
<define name="GAIN_P" value="400"/>
<define name="GAIN_Q" value="400"/>
<define name="GAIN_R" value="350"/>

<define name="IGAIN_P" value="75" />
<define name="IGAIN_Q" value="75" />
<define name="IGAIN_R" value="50" />
<define name="IGAIN_P" value="75"/>
<define name="IGAIN_Q" value="75"/>
<define name="IGAIN_R" value="50"/>

<!-- feedforward -->
<define name="DDGAIN_P" value="300" />
<define name="DDGAIN_Q" value="300" />
<define name="DDGAIN_R" value="300" />
<define name="DDGAIN_P" value="300"/>
<define name="DDGAIN_Q" value="300"/>
<define name="DDGAIN_R" value="300"/>
</section>


Expand Down Expand Up @@ -203,7 +203,7 @@
<define name="RC_CLIMB_COEF" value ="163"/>
<!-- BOOZ_SPEED_I_OF_F(1.5) * 20% -->
<define name="RC_CLIMB_DEAD_BAND" value ="160000"/>
<!--define name="INV_M" value ="0.21"/-->
<!--define name="NOMINAL_HOVER_THROTTLE" value="0.5"/-->
</section>

<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions conf/boards/lisa_m_2.0.makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#
# lisa_m_2.0.makefile
#
# http://paparazzi.enac.fr/wiki/Lisa/M
# http://paparazzi.enac.fr/wiki/Lisa/M_v20
#

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

ARCH=stm32
Expand Down
21 changes: 21 additions & 0 deletions conf/modules/bat_checker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE module SYSTEM "module.dtd">

<!--
Battery checker module
@define BAT_CHECKER_DELAY Number of seconds the battery voltage has to be
below LOW_BAT_LEVEL before the warning signal is
activated.
@define BAT_CHECKER_LED The LED to use for the warning signal.
-->
<module name="bat_checker">
<header>
<file name="bat_checker.h"/>
</header>
<init fun="init_bat_checker()"/>
<periodic fun="bat_checker_periodic()" freq="2" autorun="TRUE"/>
<makefile>
<define name="bat_checker_periodic_FREQ" value="2"/>
<file name="bat_checker.c"/>
</makefile>
</module>

1 change: 1 addition & 0 deletions conf/settings/settings_booz2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<dl_setting var="guidance_v_kd" min="0" step="1" max="600" module="guidance/guidance_v" shortname="kd"/>
<dl_setting var="guidance_v_ki" min="0" step="1" max="300" module="guidance/guidance_v" shortname="ki" handler="SetKi" />
<dl_setting var="guidance_v_z_sp" min="-5" step="0.5" max="3" module="guidance/guidance_v" shortname="sp" unit="2e-8m" alt_unit="m" alt_unit_coef="0.00390625"/>
<dl_setting var="guidance_v_nominal_throttle" min="0.1" step="0.01" max="0.9" module="guidance/guidance_v" shortname="nominal_throttle" handler="SetNominalHoverThrottle" alt_unit="%" alt_unit_coef="0.000104167"/>
<dl_setting var="ins_vf_realign" min="0" step="1" max="1" module="subsystems/ins" shortname="vf_realign" values="OFF|ON"/>
</dl_settings>

Expand Down
10 changes: 8 additions & 2 deletions sw/airborne/arch/stm32/mcu_periph/i2c_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,30 @@ static inline void i2c_reset_init(struct i2c_periph *p);
#endif

#ifdef USE_I2C1
#ifndef I2C1_BITRATE
#define I2C1_BITRATE 200000
#endif
static I2C_InitTypeDef I2C1_InitStruct = {
.I2C_Mode = I2C_Mode_I2C,
.I2C_DutyCycle = I2C_DutyCycle_2,
.I2C_OwnAddress1 = 0x00,
.I2C_Ack = I2C_Ack_Enable,
.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
.I2C_ClockSpeed = 200000
.I2C_ClockSpeed = I2C1_BITRATE
};
#endif

#ifdef USE_I2C2
#ifndef I2C2_BITRATE
#define I2C2_BITRATE 300000
#endif
static I2C_InitTypeDef I2C2_InitStruct = {
.I2C_Mode = I2C_Mode_I2C,
.I2C_DutyCycle = I2C_DutyCycle_2,
.I2C_OwnAddress1 = 0x00,
.I2C_Ack = I2C_Ack_Enable,
.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
.I2C_ClockSpeed = 300000
.I2C_ClockSpeed = I2C2_BITRATE
};
#endif

Expand Down
67 changes: 50 additions & 17 deletions sw/airborne/boards/lisa_m_1.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,68 @@
#define LED_3_GPIO_PIN GPIO_Pin_2
#define LED_3_AFIO_REMAP ((void)0)

// GPIO pins
#define LED_4_BANK
#define LED_4_GPIO GPIOC
#define LED_4_GPIO_CLK RCC_APB2Periph_GPIOC
#define LED_4_GPIO_PIN GPIO_Pin_12
#define LED_4_AFIO_REMAP ((void)0)

#define LED_5_BANK
#define LED_5_GPIO GPIOC
#define LED_5_GPIO_CLK RCC_APB2Periph_GPIOC
#define LED_5_GPIO_PIN GPIO_Pin_10
#define LED_5_AFIO_REMAP ((void)0)


/* configuration for aspirin - and more generaly IMUs */
#define IMU_ACC_DRDY_RCC_GPIO RCC_APB2Periph_GPIOB
#define IMU_ACC_DRDY_GPIO GPIOB
#define IMU_ACC_DRDY_GPIO_PORTSOURCE GPIO_PortSourceGPIOB

/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
#ifndef ADC_CHANNEL_VSUPPLY
#define ADC_CHANNEL_VSUPPLY 2
#endif


#define DefaultVoltageOfAdc(adc) (0.00485*adc)

/* Onboard ADCs */
/*
ADC1 PC3/ADC13
ADC2 PA0/ADC0
ADC3 PC0/ADC10
ADC4 PC1/ADC11
ADC5 PC5/ADC15
ADC6 PA1/ADC1
ADC7 PC2/ADC12
BATT PC4/ADC14
ADC_1 PC3/ADC13
ADC_2 PC0/ADC10
ADC_3 PC1/ADC11
ADC_4 PC5/ADC15
ADC_6 PC2/ADC12
BATT PC4/ADC14
*/
#define BOARD_ADC_CHANNEL_1 ADC_Channel_13
#define BOARD_ADC_CHANNEL_2 ADC_Channel_0
// FIXME - removed for now and used for battery monitoring
//#define BOARD_ADC_CHANNEL_3 ADC_Channel_10
#define BOARD_ADC_CHANNEL_3 ADC_Channel_14
#define BOARD_ADC_CHANNEL_4 ADC_Channel_11
#define BOARD_ADC_CHANNEL_2 ADC_Channel_10
#define BOARD_ADC_CHANNEL_3 ADC_Channel_11
// we can only use ADC1,2,3; the last channel is for bat monitoring
#define BOARD_ADC_CHANNEL_4 ADC_Channel_14

/* provide defines that can be used to access the ADC_x in the code or airframe file
* these directly map to the index number of the 4 adc channels defined above
* 4th (index 3) is used for bat monitoring by default
*/
#define ADC_1 0
#define ADC_2 1
#define ADC_3 2

/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
#ifndef ADC_CHANNEL_VSUPPLY
#define ADC_CHANNEL_VSUPPLY 3
#endif

/* GPIO mapping for ADC1 pins, overwrites the default in arch/stm32/mcu_periph/adc_arch.c */
// FIXME, this is not very nice, is also stm lib specific
#ifdef USE_AD1
#define ADC1_GPIO_INIT(gpio) { \
(gpio).GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4; \
(gpio).GPIO_Mode = GPIO_Mode_AIN; \
GPIO_Init(GPIOC, (&gpio)); \
}
#endif // USE_AD1



#define BOARD_HAS_BARO 1

Expand Down
Loading

0 comments on commit f1e0468

Please sign in to comment.