commit mini quad related last changes

This commit is contained in:
Gautier Hattenberger
2010-07-01 13:08:47 +00:00
parent efb18dc099
commit af2db553f1
7 changed files with 56 additions and 17 deletions
+15 -7
View File
@@ -1,4 +1,10 @@
<airframe name="BOOZ2_A4">
<airframe name="NFF">
<modules main_freq="512">
<load name="booz_drop.xml"/>
<load name="booz_cam.xml"/>
<!--load name="sonar_maxbotix_booz.xml"/-->
</modules>
<servos min="0" neutral="0" max="0xff">
<servo name="PITCH" no="0" min="0" neutral="0" max="255"/>
@@ -173,13 +179,14 @@
<section name="CAM" prefix="BOOZ_CAM_">
<define name="TILT_NEUTRAL" value="1500"/>
<define name="TILT_MIN" value="1000"/>
<define name="TILT_MAX" value="2000"/>
<define name="TILT_ANGLE_MIN" value="RadOfDeg(-85.)" unit="rad"/>
<define name="TILT_ANGLE_MAX" value="RadOfDeg( 30.)" unit="rad"/>
<define name="TILT_MIN" value="1060"/>
<define name="TILT_MAX" value="2250"/>
<define name="TILT_ANGLE_MIN" value="RadOfDeg(-90.)" unit="rad"/>
<define name="TILT_ANGLE_MAX" value="RadOfDeg( 0.)" unit="rad"/>
<define name="PAN_NEUTRAL" value="0"/>
<define name="PAN_MIN" value="0"/>
<define name="PAN_MAX" value="25736"/> <!-- 360 deg (2^12) -->
<!--define name="SetPwm(_v)" value="Booz2SetPwm1Value(_v)"/-->
</section>
@@ -187,6 +194,7 @@
<define name="BOOZ_ANALOG_BARO_THRESHOLD" value="800"/>
<define name="BOOZ2_FACE_REINJ_1" value="1024"/>
<define name="DEFAULT_CIRCLE_RADIUS" value="10."/>
<define name="BoozDropPwm(_v)" value="Booz2SetPwm1Value(_v)"/>
</section>
<makefile>
@@ -218,9 +226,9 @@ ap.CFLAGS += -DUSE_GPS_ACC4R
ap.CFLAGS += -DB2_GUIDANCE_H_USE_REF
ap.CFLAGS += -DUSE_ADAPT_HOVER -DUSE_INS_NAV_INIT -DBOOZ_START_DELAY=3
ap.CFLAGS += -DUSE_ADAPT_HOVER -DUSE_INS_NAV_INIT -DBOOZ_START_DELAY=3 -DUSE_PWM1
#ap.srcs += $(SRC_BOOZ_ARCH)/booz2_pwm_hw.c
ap.srcs += $(SRC_BOOZ_ARCH)/booz2_pwm_hw.c
ap.CFLAGS += -DUSE_MODULES
+2 -2
View File
@@ -9,8 +9,8 @@
<periodic fun="booz_drop_periodic()" freq="10."/>
<makefile>
<flag name="USE_DROP"/>
<flag name="DROP_SERVO_OPEN" value="1700"/>
<flag name="DROP_SERVO_CLOSED" value="900"/>
<flag name="DROP_SERVO_OPEN" value="2120"/>
<flag name="DROP_SERVO_CLOSED" value="1060"/>
<file name="booz_drop.c"/>
</makefile>
</module>
+2 -2
View File
@@ -10,8 +10,8 @@
<key_press key="F1" value="0"/>
<key_press key="F2" value="1"/>
</dl_setting>
<dl_setting var="booz_cam_tilt_pwm" min="1000" step="1" max="2000" module="booz_cam" shortname="tilt_pwm"/>
<dl_setting var="booz_cam_tilt" min="-90" step="1" max="45" module="booz_cam" shortname="tilt" alt_unit="deg" alt_unit_coef="0.0139882">
<dl_setting var="booz_cam_tilt_pwm" min="1000" step="1" max="2500" module="booz_cam" shortname="tilt_pwm"/>
<dl_setting var="booz_cam_tilt" min="-90" step="1" max="0" module="booz_cam" shortname="tilt" alt_unit="deg" alt_unit_coef="0.0139882">
<strip_button name="Look Foreward" icon="lookfore.png" value="0"/>
<strip_button name="Look Down" icon="lookdown.png" value="-6434"/>
</dl_setting>
+13 -1
View File
@@ -31,7 +31,7 @@ void booz2_pwm_init_hw( void ) {
/* start PWM5 */
/* select P0.21 as PWM5 */
PWM_PINSEL |= PWM_PINSEL_VAL << PWM_PINSEL_BIT;
PWM0_PINSEL |= PWM0_PINSEL_VAL << PWM0_PINSEL_BIT;
/* select pwm period */
PWMMR0 = PWM_PERIOD;
/* select pwm value to 50% at init (1500 us) */
@@ -45,6 +45,18 @@ void booz2_pwm_init_hw( void ) {
/* enable PWM5 */
PWMPCR = PWMPCR_ENA5;
#ifdef USE_PWM1
/* start PWM2 */
PWM1_PINSEL |= PWM1_PINSEL_VAL << PWM1_PINSEL_BIT;
/* select pwm value to 50% at init (1500 us) */
PWMMR2 = PWM_DUTY;
/* commit values */
PWMLER = PWMLER_LATCH2;
/* enable PWM2 */
PWMPCR |= PWMPCR_ENA2;
#endif
}
+9 -1
View File
@@ -30,9 +30,17 @@
extern void booz2_pwm_init_hw(void);
#define Booz2SetPwmValue(_v) { \
// Default PWM is PWM0
#define Booz2SetPwmValue(_v) Booz2SetPwm0Value(_v)
#define Booz2SetPwm0Value(_v) { \
PWMMR5 = SYS_TICS_OF_USEC(_v); \
PWMLER = PWMLER_LATCH5; \
}
#define Booz2SetPwm1Value(_v) { \
PWMMR2 = SYS_TICS_OF_USEC(_v); \
PWMLER = PWMLER_LATCH2; \
}
#endif /* BOOZ2_PWM_HW_H */
+7 -2
View File
@@ -23,7 +23,7 @@
#include "booz_drop.h"
#include "booz2_pwm_hw.h"
#include "airframe.h"
bool_t booz_drop_ball;
int16_t booz_drop_servo;
@@ -35,6 +35,11 @@ int16_t booz_drop_servo;
#define DROP_SERVO_CLOSED 900
#endif
// PWM definition
#ifndef BoozDropPwm
#define BoozDropPwm(_v) Booz2SetPwmValue(_v)
#endif
void booz_drop_init(void) {
booz_drop_ball = FALSE;
booz_drop_periodic();
@@ -45,5 +50,5 @@ void booz_drop_periodic(void) {
booz_drop_servo = DROP_SERVO_OPEN;
else
booz_drop_servo = DROP_SERVO_CLOSED;
Booz2SetPwmValue(booz_drop_servo);
BoozDropPwm(booz_drop_servo);
}
+8 -2
View File
@@ -62,17 +62,23 @@ int16_t booz_cam_pan;
#define BOOZ_CAM_USE_TILT_ANGLES 1
#endif
// PWM definition
#ifndef BOOZ_CAM_SetPwm
#define BOOZ_CAM_SetPwm(_v) Booz2SetPwmValue(_v)
#endif
void booz_cam_init(void) {
booz_cam_mode = BOOZ_CAM_MODE_NONE;
#ifdef BOOZ_CAM_USE_TILT
booz_cam_tilt_pwm = BOOZ_CAM_TILT_NEUTRAL;
Booz2SetPwmValue(booz_cam_tilt_pwm);
BOOZ_CAM_SetPwm(booz_cam_tilt_pwm);
booz_cam_tilt = 0;
#endif
#ifdef BOOZ_CAM_USE_PAN
booz_cam_pan = BOOZ_CAM_PAN_NEUTRAL;
#endif
LED_ON(CAM_SWITCH_LED); // CAM OFF
LED_OFF(CAM_SWITCH_LED); // CAM ON
}
void booz_cam_periodic(void) {
@@ -124,7 +130,7 @@ void booz_cam_periodic(void) {
break;
}
#ifdef BOOZ_CAM_USE_TILT
Booz2SetPwmValue(booz_cam_tilt_pwm);
BOOZ_CAM_SetPwm(booz_cam_tilt_pwm);
#endif
}