mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-24 05:45:59 +08:00
more and more configuration
This commit is contained in:
@@ -25,8 +25,6 @@ include conf/Makefile.local
|
||||
LIB=sw/lib
|
||||
AIRBORNE=sw/airborne
|
||||
CONFIGURATOR=sw/configurator
|
||||
FBW=$(AIRBORNE)/fly_by_wire
|
||||
AP=$(AIRBORNE)/autopilot
|
||||
COCKPIT=sw/ground_segment/cockpit
|
||||
TMTC=sw/ground_segment/tmtc
|
||||
MULTIMON=sw/ground_segment/multimon
|
||||
@@ -74,23 +72,23 @@ sim_static :
|
||||
sim_sitl :
|
||||
cd $(SIMULATOR); $(MAKE) sim_sitl PAPARAZZI_HOME=$(PAPARAZZI_SRC) PAPARAZZI_SRC=$(PAPARAZZI_SRC) AIRCRAFT=$(AIRCRAFT)
|
||||
|
||||
fbw fly_by_wire:
|
||||
cd $(FBW); $(MAKE) all
|
||||
fbw fly_by_wire: ac_h
|
||||
cd $(AIRBORNE); $(MAKE) TARGET=fbw all
|
||||
|
||||
ap autopilot:
|
||||
cd $(AP); $(MAKE) all
|
||||
ap autopilot: ac_h
|
||||
cd $(AIRBORNE); $(MAKE) TARGET=ap all
|
||||
|
||||
upload_fbw: hard_ac
|
||||
cd $(FBW); $(MAKE) upload
|
||||
cd $(AIRBORNE); $(MAKE) TARGET=fbw upload
|
||||
|
||||
upload_ap: hard_ac
|
||||
cd $(AP); $(MAKE) upload
|
||||
cd $(AIRBORNE); $(MAKE) TARGET=ap upload
|
||||
|
||||
erase_fbw:
|
||||
cd $(FBW); $(MAKE) erase
|
||||
cd $(AIRBORNE); $(MAKE) TARGET=fbw erase
|
||||
|
||||
erase_ap:
|
||||
cd $(AP); $(MAKE) erase
|
||||
cd $(AIRBORNE); $(MAKE) TARGET=ap erase
|
||||
|
||||
airborne: fbw ap
|
||||
|
||||
|
||||
+14
-5
@@ -26,10 +26,10 @@
|
||||
# Edit the configuration part to suit your local install
|
||||
#
|
||||
|
||||
OBJDIR = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/$(TARGETDIR)
|
||||
OBJDIR = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/$(TARGET)
|
||||
SRC_ARCH = $(PAPARAZZI_SRC)/sw/airborne/avr
|
||||
|
||||
CC = $(ATMELBIN)/avr-gcc -mmcu=$(ARCH)
|
||||
CC = $(ATMELBIN)/avr-gcc -mmcu=$($(TARGET).ARCH)
|
||||
LD = $(CC) $(ATMEL_LIBPATH)
|
||||
SIZE = $(ATMELBIN)/avr-size
|
||||
OBJCOPY = $(ATMELBIN)/avr-objcopy
|
||||
@@ -60,7 +60,8 @@ CFLAGS = \
|
||||
$(INCLUDES) \
|
||||
-Wall \
|
||||
-Wstrict-prototypes \
|
||||
$(LOCAL_CFLAGS) \
|
||||
$($(TARGET).CFLAGS) \
|
||||
$(LOCAL_CFLAGS) \
|
||||
-O2 \
|
||||
|
||||
LDFLAGS = -lm \
|
||||
@@ -70,10 +71,15 @@ LDFLAGS = -lm \
|
||||
#
|
||||
|
||||
$(TARGET).srcsnd = $(notdir $($(TARGET).srcs))
|
||||
$(TARGET).objs = $($(TARGET).srcsnd:%.c=$(OBJDIR)/%.o)
|
||||
$(TARGET).objso = $($(TARGET).srcsnd:%.c=$(OBJDIR)/%.o)
|
||||
$(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o)
|
||||
|
||||
|
||||
all compile: $($(TARGET).objs) $(OBJDIR)/$(TARGET).elf
|
||||
#all:
|
||||
# @echo !!!!!!!
|
||||
# @echo $($(TARGET).objs)
|
||||
# @echo !!!!!!!
|
||||
|
||||
load upload: $(TARGET).install
|
||||
|
||||
@@ -121,6 +127,9 @@ $(OBJDIR)/%.o: %.c
|
||||
$(OBJDIR)/%.o: $(SRC_ARCH)/%.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: $(SRC_ARCH)/%.S
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.hex: $(OBJDIR)/%.elf
|
||||
$(OBJCOPY) -O ihex -R .eeprom $< $@
|
||||
|
||||
@@ -134,7 +143,7 @@ erase: check_arch
|
||||
$(UISP) $(ISP_FLAGS) --erase
|
||||
|
||||
check_arch :
|
||||
if ($(UISP) $(UISP_FLAGS) 2>&1 | tr '[:upper:]' '[:lower:]' | grep $(ARCH)); then : ; else echo "Wrong architecture (mcu0 vs mcu1 ?)"; exit 1; fi
|
||||
if ($(UISP) $(UISP_FLAGS) 2>&1 | tr '[:upper:]' '[:lower:]' | grep $($(TARGET).ARCH)); then : ; else echo "Wrong architecture (mcu0 vs mcu1 ?)"; exit 1; fi
|
||||
|
||||
avr_clean:
|
||||
rm -rf $(OBJDIR)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<airframe name="FlyingTux" ctl_board="V1_2" gps="SAM_LS">
|
||||
<airframe name="FlyingTux">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1"/>
|
||||
<define name="IR2" value="0"/>
|
||||
@@ -90,8 +90,9 @@
|
||||
<define name="THETA0" value="45" unit="deg"/>
|
||||
<define name="PHI0" value="45" unit="deg"/>
|
||||
</section>
|
||||
<makefile>
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/v1_2.makefile
|
||||
|
||||
ap.CFLAGS += -DUBX
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
<airframe name="Gorazoptere_brushless_3DMG" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<section name="IMU_3DMG" prefix="IMU_">
|
||||
</section>
|
||||
<section name="RATE_LOOP">
|
||||
<define name="ROLL_DOT_PGAIN" value="-192."/>
|
||||
<define name="ROLL_DOT_IGAIN" value="0."/>
|
||||
<define name="ROLL_DOT_DGAIN" value="0."/>
|
||||
<define name="PITCH_DOT_PGAIN" value="-192."/>
|
||||
<define name="PITCH_DOT_IGAIN" value="0."/>
|
||||
<define name="PITCH_DOT_DGAIN" value="0."/>
|
||||
<define name="YAW_DOT_PGAIN" value="-100."/>
|
||||
<define name="YAW_DOT_IGAIN" value="0."/>
|
||||
<define name="YAW_DOT_DGAIN" value="0."/>
|
||||
</section>
|
||||
<section name="DESIRED_OF_RADIO" prefix="DESIRED_OF_RADIO_">
|
||||
<define name="ROLL_DOT" value="0.015"/>
|
||||
<define name="PITCH_DOT" value="0.015"/>
|
||||
<define name="YAW_DOT" value="0.015"/>
|
||||
</section>
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="0"/>
|
||||
<define name="IR2" value="1"/>
|
||||
</section>
|
||||
<servos min="1000" neutral="1500" max="2000">
|
||||
<servo name="MOTOR_FRONT" no="1" min="1250" neutral="1250" max="1850"/>
|
||||
<servo name="MOTOR_BACK" no="2" min="1250" neutral="1250" max="1850"/>
|
||||
<servo name="MOTOR_LEFT" no="3" min="1250" neutral="1250" max="1850"/>
|
||||
<servo name="MOTOR_RIGHT" no="4" min="1250" neutral="1250" max="1850"/>
|
||||
</servos>
|
||||
<command>
|
||||
<let var="roll" value="0.3 * @ROLL"/>
|
||||
<let var="pitch" value="0.3 * @PITCH"/>
|
||||
<let var="yaw" value="0.4 * @YAW"/>
|
||||
<let var="throttle" value="2.0 * @THROTTLE"/>
|
||||
<set servo="MOTOR_FRONT" value="$throttle + $pitch - $yaw"/>
|
||||
<set servo="MOTOR_BACK" value="$throttle - $pitch - $yaw"/>
|
||||
<set servo="MOTOR_RIGHT" value="$throttle + $roll + $yaw"/>
|
||||
<set servo="MOTOR_LEFT" value="$throttle - $roll + $yaw"/>
|
||||
</command>
|
||||
<section name="INFRARED" prefix="IR_">
|
||||
<define name="ROLL_NEUTRAL_DEFAULT" value="-1024"/>
|
||||
<define name="PITCH_NEUTRAL_DEFAULT" value="0"/>
|
||||
<define name="DEFAULT_CONTRAST" value="200"/>
|
||||
<define name="RAD_OF_IR_CONTRAST" value="0.75"/>
|
||||
<linear name="RollOfIrs" arity="2" coeff1="-1" coeff2="-1"/>
|
||||
<linear name="PitchOfIrs" arity="2" coeff1="-1" coeff2="1"/>
|
||||
</section>
|
||||
<section name="PID">
|
||||
<define name="ROLL_PGAIN" value="15000."/>
|
||||
<define name="PITCH_OF_ROLL" value="0.0"/>
|
||||
<define name="PITCH_PGAIN" value="15000."/>
|
||||
<define name="MAX_ROLL" value="0.35"/>
|
||||
<define name="MAX_PITCH" value="0.35"/>
|
||||
<define name="MIN_PITCH" value="-0.35"/>
|
||||
</section>
|
||||
<section name="ALT" prefix="CLIMB_">
|
||||
<define name="PITCH_PGAIN" value="-0.1"/>
|
||||
<define name="PITCH_IGAIN" value="0.025"/>
|
||||
<define name="PGAIN" value="-0.03"/>
|
||||
<define name="IGAIN" value="0.1"/>
|
||||
<define name="MAX" value="1."/>
|
||||
<define name="LEVEL_GAZ" value="0.31"/>
|
||||
<define name="PITCH_OF_VZ_PGAIN" value="0.05"/>
|
||||
<define name="GAZ_OF_CLIMB" value="0.2" unit="%/(m/s)"/>
|
||||
</section>
|
||||
<section name="NAV">
|
||||
<define name="COURSE_PGAIN" value="-0.2"/>
|
||||
<define name="ALTITUDE_PGAIN" value="-0.025"/>
|
||||
<define name="NAV_PITCH" value="0."/>
|
||||
</section>
|
||||
<section name="BAT">
|
||||
<define name="MILLIAMP_PER_PERCENT" value="2.16"/>
|
||||
<define name="VOLTAGE_ADC_A" value="0.0175"/>
|
||||
<define name="VOLTAGE_ADC_B" value="0.088"/>
|
||||
<define name="VoltageOfAdc(adc)" value="(VOLTAGE_ADC_A * adc + VOLTAGE_ADC_B)"/>
|
||||
<define name="LOW_BATTERY" value="93" unit="1e-1V"/>
|
||||
</section>
|
||||
<section name="MISC">
|
||||
<define name="NOMINAL_AIRSPEED" value="10." unit="m/s"/>
|
||||
<define name="CARROT" value="5." unit="s"/>
|
||||
</section>
|
||||
</airframe>
|
||||
@@ -1,4 +1,4 @@
|
||||
<airframe name="Gorazoptere_brushless_ANALOG" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<airframe name="Gorazoptere_brushless_ANALOG">
|
||||
<section name="IMU_ANALOG" prefix="IMU_">
|
||||
<define name="INIT_EULER_DOT_VARIANCE_MAX" value="3"/>
|
||||
<define name="INIT_EULER_DOT_NB_SAMPLES_MIN" value ="10"/>
|
||||
@@ -114,12 +114,18 @@
|
||||
<define name="CARROT" value="5." unit="s"/>
|
||||
</section>
|
||||
<makefile>
|
||||
LOCAL_CFLAGS += -DTELEMETER
|
||||
AP_EXTRA_SRCS += i2c_ap.c srf08.c
|
||||
LOCAL_CFLAGS += -DRATE_LOOP -DIMU_ANALOG
|
||||
FBW_EXTRA_SRCS += control.c imu.c
|
||||
LOCAL_CFLAGS += -DAHRS
|
||||
AP_EXTRA_SRCS += ahrs.S ahrs.c
|
||||
LOCAL_CFLAGS += -DIMU_RESET_ON_BOOT
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile
|
||||
|
||||
LOCAL_CFLAGS += -DIMU_ANALOG
|
||||
|
||||
fbw.CFLAGS += -DRATE_LOOP
|
||||
fbw.EXTRA_SRCS += control.c imu.c
|
||||
fbw.CFLAGS += -DIMU_RESET_ON_BOOT
|
||||
|
||||
ap.CFLAGS += -DUBX
|
||||
ap.CFLAGS += -DTELEMETER
|
||||
ap.EXTRA_SRCS += $(SRC_ARCH)/i2c_ap.c srf08.c
|
||||
ap.CFLAGS += -DAHRS
|
||||
ap.EXTRA_SRCS += $(SRC_ARCH)/ahrs_asm.S ahrs.c
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!-- hacker A20-34S / apc 7*5 / 2 lipos 950 mah / 8a au sol -->
|
||||
<airframe name="Ladybug" ctl_board="V1_2" gps="SAM_LS">
|
||||
<airframe name="Ladybug">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1"/>
|
||||
<define name="IR2" value="0"/>
|
||||
@@ -90,8 +90,9 @@
|
||||
<define name="THETA0" value="45" unit="deg"/>
|
||||
<define name="PHI0" value="-45" unit="deg"/>
|
||||
</section>
|
||||
<makefile>
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/v1_2.makefile
|
||||
|
||||
ap.CFLAGS += -DUBX
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<airframe name="Microjet one" ctl_board="V1_2" gps="SAM_LS">
|
||||
<airframe name="Microjet one">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1"/>
|
||||
<define name="IR2" value="0"/>
|
||||
@@ -79,4 +79,9 @@
|
||||
<define name="DEFAULT_PITCH" value="0.08" unit="rad"/>
|
||||
<define name="HOME_RADIUS" value="50" unit="m"/>
|
||||
</section>
|
||||
<makefile>
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/v1_2.makefile
|
||||
|
||||
ap.CFLAGS += -DUBX
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
<airframe name="Microjet two" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1"/>
|
||||
<define name="IR2" value="0"/>
|
||||
</section>
|
||||
<servos min="1000" neutral="1500" max="2000">
|
||||
<servo name="GAZ" no="3" min="1000" neutral="1000" max="2000"/>
|
||||
<servo name="AILEVON_LEFT" no="0" min="1000" neutral="1520" max="2000"/>
|
||||
<servo name="AILEVON_RIGHT" no="2" min="1000" neutral="1523" max="2000"/>
|
||||
</servos>
|
||||
<command>
|
||||
<set servo="GAZ" value="2 * @THROTTLE"/>
|
||||
<let var="aileron" value="@ROLL * AILEVON_AILERON_RATE"/>
|
||||
<let var="elevator" value="@PITCH * AILEVON_ELEVATOR_RATE"/>
|
||||
<set servo="AILEVON_LEFT" value="$aileron + $elevator"/>
|
||||
<set servo="AILEVON_RIGHT" value="$aileron - $elevator"/>
|
||||
</command>
|
||||
<section name="MIXER">
|
||||
<define name="AILEVON_AILERON_RATE" value="0.55"/>
|
||||
<define name="AILEVON_ELEVATOR_RATE" value="0.75"/>
|
||||
</section>
|
||||
<section name="INFRARED" prefix="IR_">
|
||||
<define name="ROLL_NEUTRAL_DEFAULT" value="0"/>
|
||||
<define name="PITCH_NEUTRAL_DEFAULT" value="-1040"/>
|
||||
<define name="DEFAULT_CONTRAST" value="400"/>
|
||||
<define name="RAD_OF_IR_CONTRAST" value="0.9"/>
|
||||
<linear name="RollOfIrs" arity="2" coeff1="-1" coeff2="1"/>
|
||||
<linear name="PitchOfIrs" arity="2" coeff1="-1" coeff2="-1"/>
|
||||
</section>
|
||||
<section name="PID">
|
||||
<define name="ROLL_PGAIN" value="7000."/>
|
||||
<define name="PITCH_OF_ROLL" value="0.2"/>
|
||||
<define name="PITCH_PGAIN" value="10000."/>
|
||||
<define name="MAX_ROLL" value="0.4"/>
|
||||
<define name="MAX_PITCH" value="0.25"/>
|
||||
<define name="MIN_PITCH" value="-0.35"/>
|
||||
</section>
|
||||
<section name="ALT" prefix="CLIMB_">
|
||||
<define name="PGAIN" value="-0.025"/>
|
||||
<define name="IGAIN" value="0.01"/>
|
||||
<define name="MAX" value="1."/>
|
||||
<define name="LEVEL_GAZ" value="0.25"/>
|
||||
<define name="GAZ_OF_CLIMB" value="0.2" unit="% / m/s"/>
|
||||
<define name="PITCH_OF_VZ_PGAIN" value="0.00"/>
|
||||
</section>
|
||||
<section name="NAV">
|
||||
<define name="COURSE_PGAIN" value="-0.3"/>
|
||||
<define name="ALTITUDE_PGAIN" value="-0.05"/>
|
||||
<define name="NAV_PITCH" value="0."/>
|
||||
</section>
|
||||
<section name="BAT" channel="3">
|
||||
<define name="VOLTAGE_ADC_A" value="0.016892"/>
|
||||
<define name="VOLTAGE_ADC_B" value="0.083604"/>
|
||||
<define name="VoltageOfAdc(adc)" value="(VOLTAGE_ADC_A * adc + VOLTAGE_ADC_B)"/>
|
||||
<define name="LOW_BATTERY" value="90" unit="1e-1V"/>
|
||||
</section>
|
||||
<section name="SERVOS" channel="6">
|
||||
<define name="SERVOS_VOLTAGE_ADC_A" value="0.005661"/>
|
||||
<define name="SERVOS_VOLTAGE_ADC_B" value="0.014948"/>
|
||||
<define name="ServosVoltageOfAdc(adc)" value="(SERVOS_VOLTAGE_ADC_A * adc + SERVOS_VOLTAGE_ADC_B)"/>
|
||||
</section>
|
||||
<section name="MISC">
|
||||
<define name="NOMINAL_AIRSPEED" value="15."/>
|
||||
<define name="CARROT" value="5." unit="s"/>
|
||||
</section>
|
||||
<section name="FAILSAFE" prefix="FAILSAFE_">
|
||||
<define name="DELAY_WITHOUT_GPS" value="2" unit="s"/>
|
||||
<define name="DEFAULT_GAZ" value="CLIMB_LEVEL_GAZ+0.05" unit="%"/>
|
||||
<define name="DEFAULT_ROLL" value="0.17" unit="rad"/>
|
||||
<define name="DEFAULT_PITCH" value="0.08" unit="rad"/>
|
||||
<define name="HOME_RADIUS" value="50" unit="m"/>
|
||||
</section>
|
||||
</airframe>
|
||||
@@ -1,97 +0,0 @@
|
||||
<airframe name="Microjet three" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1" nb_sample="8"/> <!-- 8 samples correspond to X Hz rafraichissement -->
|
||||
<define name="IR2" value="0" nb_sample="8"/>
|
||||
</section>
|
||||
<servos min="1000" neutral="1500" max="2000">
|
||||
<servo name="GAZ" no="3" min="1000" neutral="1000" max="2000"/>
|
||||
<servo name="AILEVON_LEFT" no="0" min="1000" neutral="1568" max="2000"/>
|
||||
<servo name="AILEVON_RIGHT" no="2" min="1000" neutral="1450" max="2000"/>
|
||||
</servos>
|
||||
<command>
|
||||
<set servo="GAZ" value="2 * @THROTTLE"/>
|
||||
<let var="aileron" value="@ROLL * AILEVON_AILERON_RATE"/>
|
||||
<let var="elevator" value="@PITCH * AILEVON_ELEVATOR_RATE"/>
|
||||
<set servo="AILEVON_LEFT" value="$aileron + $elevator"/>
|
||||
<set servo="AILEVON_RIGHT" value="$aileron - $elevator"/>
|
||||
</command>
|
||||
<section name="MIXER">
|
||||
<define name="AILEVON_AILERON_RATE" value="0.55"/>
|
||||
<define name="AILEVON_ELEVATOR_RATE" value="0.75"/>
|
||||
</section>
|
||||
<section name="INFRARED" prefix="IR_">
|
||||
<define name="ROLL_NEUTRAL_DEFAULT" value="0"/>
|
||||
<define name="PITCH_NEUTRAL_DEFAULT" value="-880"/>
|
||||
<define name="DEFAULT_CONTRAST" value="400"/>
|
||||
<define name="RAD_OF_IR_CONTRAST" value="0.6"/>
|
||||
<linear name="RollOfIrs" arity="2" coeff1="-1" coeff2="1"/>
|
||||
<linear name="PitchOfIrs" arity="2" coeff1="-1" coeff2="-1"/>
|
||||
<define name="RAD_OF_IR_MAX_VALUE" value="0.0045"/>
|
||||
<define name="RAD_OF_IR_MIN_VALUE" value="0.00075"/>
|
||||
</section>
|
||||
<section name="PID">
|
||||
<define name="ROLL_PGAIN" value="7000."/>
|
||||
<define name="PITCH_OF_ROLL" value="0.2"/>
|
||||
<define name="PITCH_PGAIN" value="10000."/>
|
||||
<define name="MAX_ROLL" value="0.4"/>
|
||||
<define name="MAX_PITCH" value="0.25"/>
|
||||
<define name="MIN_PITCH" value="-0.35"/>
|
||||
</section>
|
||||
<section name="ALT" prefix="CLIMB_">
|
||||
<define name="PGAIN" value="-0.025"/>
|
||||
<define name="IGAIN" value="0.01"/>
|
||||
<define name="MAX" value="1."/>
|
||||
<define name="LEVEL_GAZ" value="0.35"/>
|
||||
<define name="GAZ_OF_CLIMB" value="0.2" unit="% / m/s"/>
|
||||
<define name="PITCH_OF_VZ_PGAIN" value="0.00"/>
|
||||
<define name="PITCH_PGAIN" value="-0.1"/>
|
||||
<define name="PITCH_IGAIN" value="1.0"/>
|
||||
</section>
|
||||
<section name="NAV">
|
||||
<define name="COURSE_PGAIN" value="-0.3"/>
|
||||
<define name="ALTITUDE_PGAIN" value="-0.05"/>
|
||||
<define name="NAV_PITCH" value="0."/>
|
||||
</section>
|
||||
<section name="BAT" channel="3">
|
||||
<define name="VOLTAGE_ADC_A" value="0.016892"/>
|
||||
<define name="VOLTAGE_ADC_B" value="0.083604"/>
|
||||
<define name="VoltageOfAdc(adc)" value="(VOLTAGE_ADC_A * adc + VOLTAGE_ADC_B)"/>
|
||||
<define name="LOW_BATTERY" value="90" unit="1e-1V"/>
|
||||
</section>
|
||||
<section name="SERVOS" channel="6">
|
||||
<define name="SERVOS_VOLTAGE_ADC_A" value="0.005661"/>
|
||||
<define name="SERVOS_VOLTAGE_ADC_B" value="0.014948"/>
|
||||
<define name="ServosVoltageOfAdc(adc)" value="(SERVOS_VOLTAGE_ADC_A * adc + SERVOS_VOLTAGE_ADC_B)"/>
|
||||
</section>
|
||||
<section name="MISC">
|
||||
<define name="NOMINAL_AIRSPEED" value="13."/>
|
||||
<define name="CARROT" value="5." unit="s"/>
|
||||
</section>
|
||||
<section name="AUTO1" prefix="AUTO1_">
|
||||
<define name="MAX_ROLL" value="0.6"/>
|
||||
<define name="MAX_PITCH" value="0.5"/>
|
||||
</section>
|
||||
<!--
|
||||
<section name="SIMU">
|
||||
<define name="ROLL_RESPONSE_FACTOR" value="10."/>
|
||||
<define name="YAW_RESPONSE_FACTOR" value="2."/>
|
||||
<define name="WEIGHT" value="0.45"/>
|
||||
</section>
|
||||
-->
|
||||
<section name="SIMU">
|
||||
<define name="ROLL_RESPONSE_FACTOR" value="5."/>
|
||||
<define name="YAW_RESPONSE_FACTOR" value="1."/>
|
||||
<define name="WEIGHT" value="0.45"/>
|
||||
</section>
|
||||
<section name="FAILSAFE" prefix="FAILSAFE_">
|
||||
<define name="DELAY_WITHOUT_GPS" value="2" unit="s"/>
|
||||
<define name="DEFAULT_GAZ" value="CLIMB_LEVEL_GAZ+0.05" unit="%"/>
|
||||
<define name="DEFAULT_ROLL" value="0.17" unit="rad"/>
|
||||
<define name="DEFAULT_PITCH" value="0.08"unit="rad"/>
|
||||
<define name="HOME_RADIUS" value="50" unit="m"/>
|
||||
</section>
|
||||
<section name="CAM" prefix="CAM_">
|
||||
<define name="THETA0" value="90" unit="deg"/>
|
||||
<define name="PHI0" value="0" unit="deg"/>
|
||||
</section>
|
||||
</airframe>
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- axi 2204-54 / GWS 8*4.3 / 3 lipos 740mah / 9.5a -->
|
||||
|
||||
<airframe name="Plaster White 1" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<airframe name="Plaster White 1">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1"/>
|
||||
<define name="IR2" value="0"/>
|
||||
@@ -91,4 +91,9 @@
|
||||
<define name="THETA0" value="45" unit="deg"/>
|
||||
<define name="PHI0" value="-45" unit="deg"/>
|
||||
</section>
|
||||
<makefile>
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile
|
||||
|
||||
ap.CFLAGS += -DUBX
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<airframe name="Twin1" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<airframe name="Twin1">
|
||||
<section name="control board">
|
||||
<define name="AVR_ARCH" value="1"/>
|
||||
</section>
|
||||
@@ -87,10 +87,13 @@
|
||||
<define name="PHI0" value="30" unit="deg"/>
|
||||
</section>
|
||||
<makefile>
|
||||
ARCHDIR=avr
|
||||
LOCAL_CFLAGS += -DDATALINK
|
||||
AP_EXTRA_SRCS += traffic_info.c datalink.c
|
||||
LOCAL_CFLAGS += -DWAVECARD
|
||||
AP_EXTRA_SRCS += wavecard.c
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile
|
||||
|
||||
ap.CFLAGS += -DUBX
|
||||
# ap.CFLAGS += -DSIMUL
|
||||
ap.LOCAL_CFLAGS += -DDATALINK
|
||||
ap.EXTRA_SRCS += traffic_info.c datalink.c
|
||||
ap.LOCAL_CFLAGS += -DWAVECARD
|
||||
ap.EXTRA_SRCS += wavecard.c
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<airframe name="Twin2" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<airframe name="Twin2">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1"/>
|
||||
<define name="IR2" value="2"/>
|
||||
@@ -84,8 +84,12 @@
|
||||
<define name="PHI0" value="-30" unit="deg"/>
|
||||
</section>
|
||||
<makefile>
|
||||
LOCAL_CFLAGS += -DDATALINK
|
||||
AP_EXTRA_SRCS += traffic_info.c datalink.c
|
||||
LOCAL_CFLAGS += -DMOBILE_CAM
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile
|
||||
|
||||
ap.CFLAGS += -DUBX
|
||||
ap.CFLAGS += -DDATALINK
|
||||
ap.EXTRA_SRCS += traffic_info.c datalink.c
|
||||
ap.CFLAGS += -DMOBILE_CAM
|
||||
ap.EXTRA_SRCS += cam.c
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
<airframe name="Twinstar trois" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1"/>
|
||||
<define name="IR2" value="2"/>
|
||||
</section>
|
||||
<servos min="1000" neutral="1500" max="2000">
|
||||
<servo name="MOTOR_LEFT" no="3" min="1000" neutral="1000" max="2000"/>
|
||||
<servo name="MOTOR_RIGHT" no="9" min="1000" neutral="1000" max="2000"/>
|
||||
<servo name="AILERON_LEFT" no="0" max="1190" neutral="1600" min="1850"/>
|
||||
<servo name="AILERON_RIGHT" no="2" max="1375" neutral="1650" min="2000"/>
|
||||
<servo name="ELEVATOR" no="6" max="1816" neutral="1530" min="1220"/>
|
||||
<servo name="RUDDER" no="7" max="1270" neutral="1550" min="1850"/>
|
||||
<servo name="CAM_ROLL" no="8" max="1816" neutral="1530" min="1220"/>
|
||||
<servo name="CAM_PITCH" no="4" max="1270" neutral="1450" min="1850"/>
|
||||
</servos>
|
||||
<command>
|
||||
<set servo="MOTOR_LEFT" value="2 * @THROTTLE"/>
|
||||
<set servo="MOTOR_RIGHT" value="2 * @THROTTLE"/>
|
||||
<set servo="ELEVATOR" value="@PITCH"/>
|
||||
<let var="roll" value="@ROLL"/>
|
||||
<set servo="AILERON_LEFT" value="($roll > 0 ? 1 : AILERON_DIFF) * $roll"/>
|
||||
<set servo="AILERON_RIGHT" value="($roll > 0 ? AILERON_DIFF : 1) * $roll"/>
|
||||
<set servo="RUDDER" value="@YAW + @ROLL*COMBI_SWITCH"/>
|
||||
<set servo="CAM_ROLL" value="@GAIN1"/>
|
||||
<set servo="CAM_PITCH" value="@CALIB"/>
|
||||
</command>
|
||||
<section name="MIXER">
|
||||
<define name="AILERON_DIFF" value="0.66"/>
|
||||
<define name="COMBI_SWITCH" value="1.0"/>
|
||||
</section>
|
||||
<section name="INFRARED" prefix="IR_">
|
||||
<define name="ROLL_NEUTRAL_DEFAULT" value="6" unit="deg"/>
|
||||
<define name="PITCH_NEUTRAL_DEFAULT" value="5" unit="deg"/>
|
||||
<define name="DEFAULT_CONTRAST" value="200"/>
|
||||
<define name="RAD_OF_IR_CONTRAST" value="0.75"/>
|
||||
<linear name="RollOfIrs" arity="2" coeff1="-1" coeff2="-1"/>
|
||||
<linear name="PitchOfIrs" arity="2" coeff1="-1" coeff2="1"/>
|
||||
<define name="RAD_OF_IR_MAX_VALUE" value="0.01"/>
|
||||
<define name="RAD_OF_IR_MIN_VALUE" value="0.00075"/>
|
||||
<define name="ADC_ROLL_NEUTRAL" value="-1026"/>
|
||||
<define name="ADC_PITCH_NEUTRAL" value="5"/>
|
||||
</section>
|
||||
<section name="PID">
|
||||
<define name="ROLL_PGAIN" value="10000."/>
|
||||
<define name="PITCH_OF_ROLL" value="0.0"/>
|
||||
<define name="PITCH_PGAIN" value="15000."/>
|
||||
<define name="MAX_ROLL" value="0.35"/>
|
||||
<define name="MAX_PITCH" value="0.35"/>
|
||||
<define name="MIN_PITCH" value="-0.35"/>
|
||||
<define name="AILERON_OF_GAZ" value="0.0"/>
|
||||
</section>
|
||||
<section name="ALT" prefix="CLIMB_">
|
||||
<define name="PITCH_PGAIN" value="-0.1"/>
|
||||
<define name="PITCH_IGAIN" value="0.025"/>
|
||||
<define name="PGAIN" value="-0.03"/>
|
||||
<define name="IGAIN" value="0.1"/>
|
||||
<define name="MAX" value="1."/>
|
||||
<define name="LEVEL_GAZ" value="0.31"/>
|
||||
<define name="PITCH_OF_VZ_PGAIN" value="0.05"/>
|
||||
<define name="GAZ_OF_CLIMB" value="0.2" unit="%/(m/s)"/>
|
||||
</section>
|
||||
<section name="NAV">
|
||||
<define name="COURSE_PGAIN" value="-0.2"/>
|
||||
<define name="ALTITUDE_PGAIN" value="-0.025"/>
|
||||
<define name="NAV_PITCH" value="0."/>
|
||||
</section>
|
||||
<section name="BAT">
|
||||
<define name="MILLIAMP_PER_PERCENT" value="0.86"/>
|
||||
<define name="VOLTAGE_ADC_A" value="0.0175"/>
|
||||
<define name="VOLTAGE_ADC_B" value="0.088"/>
|
||||
<define name="VoltageOfAdc(adc)" value="(VOLTAGE_ADC_A * adc + VOLTAGE_ADC_B)"/>
|
||||
<define name="LOW_BATTERY" value="93" unit="1e-1V"/>
|
||||
</section>
|
||||
<section name="MISC">
|
||||
<define name="NOMINAL_AIRSPEED" value="10." unit="m/s"/>
|
||||
<define name="CARROT" value="5." unit="s"/>
|
||||
</section>
|
||||
<section name="SIMU">
|
||||
<define name="ROLL_RESPONSE_FACTOR" value="2."/>
|
||||
<define name="YAW_RESPONSE_FACTOR" value="1.25"/>
|
||||
<define name="WEIGHT" value="1.3"/>
|
||||
</section>
|
||||
<section name="FAILSAFE" prefix="FAILSAFE_">
|
||||
<define name="DELAY_WITHOUT_GPS" value="2" unit="s"/>
|
||||
<define name="DEFAULT_GAZ" value="CLIMB_LEVEL_GAZ+0.05" unit="%"/>
|
||||
<define name="DEFAULT_ROLL" value="0.17" unit="rad"/>
|
||||
<define name="DEFAULT_PITCH" value="0.08" unit="rad"/>
|
||||
<define name="HOME_RADIUS" value="50" unit="m"/>
|
||||
</section>
|
||||
</airframe>
|
||||
@@ -1,4 +1,4 @@
|
||||
<airframe name="Twinstar four" ctl_board="V1_2_1" gps="SAM_LS">
|
||||
<airframe name="Twinstar four">
|
||||
<section name="adc" prefix="ADC_CHANNEL_">
|
||||
<define name="IR1" value="1"/>
|
||||
<define name="IR2" value="2"/>
|
||||
@@ -86,9 +86,12 @@
|
||||
<define name="HOME_RADIUS" value="50" unit="m"/>
|
||||
</section>
|
||||
<makefile>
|
||||
LOCAL_CFLAGS += -DDATALINK
|
||||
AP_EXTRA_SRCS += traffic_info.c datalink.c
|
||||
LOCAL_CFLAGS += -DWAVECARD
|
||||
AP_EXTRA_SRCS += wavecard.c
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/v1_2_1.makefile
|
||||
|
||||
ap.CFLAGS += -DUBX
|
||||
ap.LOCAL_CFLAGS += -DDATALINK
|
||||
ap.EXTRA_SRCS += traffic_info.c datalink.c
|
||||
ap.LOCAL_CFLAGS += -DWAVECARD
|
||||
ap.EXTRA_SRCS += wavecard.c
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -21,63 +21,19 @@
|
||||
#
|
||||
|
||||
|
||||
FBW=../fly_by_wire
|
||||
|
||||
|
||||
LOCAL_CFLAGS= $(CTL_BRD_FLAGS) $(GPS_FLAGS) $(SIMUL_FLAGS)
|
||||
|
||||
VARINCLUDE=$(PAPARAZZI_HOME)/var/include
|
||||
ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
|
||||
|
||||
ARCH = atmega128
|
||||
TARGET = autopilot
|
||||
TARGETDIR = autopilot
|
||||
|
||||
# LOW_FUSE = e0
|
||||
LOW_FUSE = a0
|
||||
HIGH_FUSE = 99
|
||||
|
||||
ifeq ($(SIMUL),1)
|
||||
SIMUL_FLAGS= -DSIMUL
|
||||
endif
|
||||
|
||||
EXT_FUSE = ff
|
||||
LOCK_FUSE = ff
|
||||
INCLUDES = -I .. -I ../../include -I $(VARINCLUDE) -I $(ACINCLUDE) -I ../avr -I $(PAPARAZZI_SRC)/sw/airborne/autopilot
|
||||
|
||||
GPS = gps_ubx.c
|
||||
GPS_FLAGS=-DUBX
|
||||
|
||||
ifndef ARCHDIR
|
||||
ARCHDIR=avr
|
||||
endif
|
||||
INCLUDES = -I ../include -I $(VARINCLUDE) -I $(ACINCLUDE) -I $(ARCHI) -I $(PAPARAZZI_SRC)/sw/airborne
|
||||
|
||||
SRC_ARCH = $(PAPARAZZI_SRC)/sw/airborne/$(ARCHDIR)
|
||||
|
||||
$(TARGET).srcs = \
|
||||
main.c \
|
||||
$(SRC_ARCH)/modem.c \
|
||||
link_mcu.c \
|
||||
$(SRC_ARCH)/link_mcu_ap.c \
|
||||
$(SRC_ARCH)/spi_ap.c \
|
||||
$(SRC_ARCH)/adc_ap.c \
|
||||
$(GPS) \
|
||||
infrared.c \
|
||||
pid.c \
|
||||
nav.c \
|
||||
$(SRC_ARCH)/uart_ap.c \
|
||||
estimator.c \
|
||||
if_calib.c \
|
||||
mainloop.c \
|
||||
cam.c \
|
||||
|
||||
|
||||
include $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/Makefile.ac
|
||||
$(TARGET).srcs += $(AP_EXTRA_SRCS)
|
||||
include ../../../conf/Makefile.local
|
||||
include ../../../conf/Makefile.avr
|
||||
$(TARGET).srcs += $($(TARGET).EXTRA_SRCS)
|
||||
include ../../conf/Makefile.local
|
||||
include ../../conf/Makefile.$(ARCHI)
|
||||
|
||||
autopilot.install : warn_conf
|
||||
$(TARGET).install : warn_conf
|
||||
|
||||
warn_conf :
|
||||
@echo
|
||||
@@ -88,10 +44,5 @@ warn_conf :
|
||||
@echo '###########################################################'
|
||||
@echo
|
||||
|
||||
|
||||
wavecard_glib : wavecard_glib.c wavecard.c wavecard_glib_utils.c
|
||||
gcc -Wall -o $@ $^ `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0`
|
||||
|
||||
|
||||
clean : avr_clean
|
||||
rm -f *.out *.cm* messages.h flight_plan.h ubx_protocol.h inflight_calib.h wavecard_glib
|
||||
clean :
|
||||
rm *~
|
||||
@@ -1,24 +0,0 @@
|
||||
# $Id$
|
||||
# Copyright (C) 2003 Pascal Brisset Antoine Drouin
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,309 +0,0 @@
|
||||
#include <signal.h>
|
||||
#include <termios.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "wavecard.h"
|
||||
#include "wavecard_glib.h"
|
||||
#include "wavecard_glib_utils.h"
|
||||
|
||||
|
||||
struct WcGlib wc_glib;
|
||||
static void wc_glib_setup_sig_handler( void );
|
||||
static void wc_glib_quit( int i );
|
||||
static guint usage (int argc, char** argv);
|
||||
static guint parse_options (int argc, char** argv);
|
||||
static gboolean timeout_callback(gpointer data);
|
||||
void request_remote_rssi ( void );
|
||||
void request_self_address ( void );
|
||||
|
||||
#define NEXT_RSSI() { \
|
||||
wc_glib.requested_remote_rssi++; \
|
||||
wc_glib.requested_remote_rssi %= get_nb_hosts(); \
|
||||
if (wc_glib.requested_remote_rssi == wc_glib.self_id) { \
|
||||
wc_glib.requested_remote_rssi++; \
|
||||
wc_glib.requested_remote_rssi %= get_nb_hosts(); \
|
||||
} \
|
||||
}
|
||||
|
||||
void on_wc_res_read_radio_param() {
|
||||
g_message("got WC_RES_READ_RADIO_PARAM");
|
||||
if (wc_payload[1] == 0) {
|
||||
switch (wc_glib.requested_radio_param) {
|
||||
case WC_RADIO_PARAM_AWAKENING_PERIOD :
|
||||
g_message("awakening period %d", wc_payload[2]);
|
||||
break;
|
||||
case WC_RADIO_PARAM_WAKE_UP_TYPE:
|
||||
g_message("wake_up_type %d", wc_payload[2]);
|
||||
break;
|
||||
case WC_RADIO_PARAM_RADIO_ACKNOLEDGE :
|
||||
g_message("radio_acknoledge %d", wc_payload[2]);
|
||||
break;
|
||||
case WC_RADIO_PARAM_WAKE_UP_LENGTH : {
|
||||
uint16_t* len = (uint16_t*)&wc_payload[2];
|
||||
g_message("wake_up_length %d", *len);
|
||||
}
|
||||
break;
|
||||
case WC_RADIO_PARAM_RADIO_ADDRESS : {
|
||||
memcpy(wc_glib.self_addr, wc_payload, WC_ADDR_LEN);
|
||||
wc_glib.status = WC_STATUS_GOT_SELFADDRESS;
|
||||
GString* str = g_string_new("self_address ");
|
||||
wc_glib_append_addr(str, &wc_payload[2]);
|
||||
g_string_append_printf(str, " %s ", get_host_by_addr(&wc_payload[2])->name);
|
||||
g_message(str->str);
|
||||
g_string_free(str, TRUE);
|
||||
request_remote_rssi();
|
||||
}
|
||||
break;
|
||||
case WC_RADIO_PARAM_SWITCH_MODE_STATUS:
|
||||
g_message("switch_mode_status %s", wc_payload[2]?"ON":"OFF");
|
||||
break;
|
||||
default:
|
||||
g_message("radio param %02x %d", wc_glib.requested_radio_param, wc_payload[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
g_message("WC_RES_READ_RADIO_PARAM failed");
|
||||
}
|
||||
|
||||
static void priv_parse_payload() {
|
||||
printf("got_message ");
|
||||
int i;
|
||||
for(i = 0; i < wc_length - 3; i++)
|
||||
printf("%02x ", wc_payload[i]);
|
||||
printf("\n");
|
||||
switch (wc_payload[0]) {
|
||||
|
||||
case WC_RES_READ_RADIO_PARAM :
|
||||
on_wc_res_read_radio_param();
|
||||
g_source_remove(wc_glib.timeout_id);
|
||||
break;
|
||||
case WC_RES_WRITE_RADIO_PARAM :
|
||||
g_message("WC_RES_WRITE_RADIO_PARAM %s", wc_payload[1]?"FAILED":"OK");
|
||||
break;
|
||||
case WC_RES_SEND_SERVICE :
|
||||
g_message("got WC_RES_SEND_SERVICE");
|
||||
break;
|
||||
case WC_SERVICE_RESPONSE :
|
||||
g_message("got WC_SERVICE_RESPONSE");
|
||||
printf("addr : "); wc_glib_print_addr(&wc_payload[1]);
|
||||
printf("\n");
|
||||
g_message("acquitement %d", wc_payload[7]);
|
||||
g_message("type %d", wc_payload[8]);
|
||||
g_message("rssi %d", wc_payload[9]);
|
||||
g_message("periode reveil %d", wc_payload[10]);
|
||||
g_message("type_2 %d", wc_payload[11]);
|
||||
break;
|
||||
|
||||
case WC_RES_SEND_FRAME :
|
||||
g_message("got WC_RES_SEND_FRAME");
|
||||
break;
|
||||
|
||||
case WC_RES_READ_REMOTE_RSSI : {
|
||||
g_source_remove(wc_glib.timeout_id);
|
||||
float percent = (float)wc_payload[1] / (float)0x2F * 100.;
|
||||
GTimeVal now;
|
||||
g_get_current_time(&now);
|
||||
g_message("%ld.%06ld got WC_RES_READ_REMOTE_RSSI %s %.1f", now.tv_sec, now.tv_usec, get_host_by_id(wc_glib.requested_remote_rssi)->name, percent );
|
||||
NEXT_RSSI();
|
||||
request_remote_rssi();
|
||||
}
|
||||
break;
|
||||
|
||||
case WC_RES_READ_LOCAL_RSSI :
|
||||
g_message("got WC_RES_READ_LOCAL_RSSI %d", wc_payload[1] );
|
||||
break;
|
||||
|
||||
case WC_RECEIVED_FRAME :
|
||||
g_message("got WC_RECEIVED_FRAME");
|
||||
GString* str = g_string_new("sender_address ");
|
||||
wc_glib_append_addr(str, &wc_payload[1]);
|
||||
g_string_append_printf(str, "data : %*s ", wc_length - WC_ADDR_LEN, &wc_payload[1+WC_ADDR_LEN]);
|
||||
g_message(str->str);
|
||||
g_string_free(str, TRUE);
|
||||
break;
|
||||
|
||||
case WC_ACK :
|
||||
g_message("got ACK");
|
||||
break;
|
||||
|
||||
case WC_NAK :
|
||||
g_message("got NAK");
|
||||
break;
|
||||
|
||||
default:
|
||||
g_message("received unhandled %02x", wc_payload[0]);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean on_data_received(GIOChannel *source, GIOCondition condition, gpointer data) {
|
||||
guchar buf[128];
|
||||
gsize len;
|
||||
GError *err = NULL;
|
||||
g_io_channel_read_chars(source, buf, 3, &len, &err);
|
||||
int i;
|
||||
// g_message("received");
|
||||
// print_both(len, buf);
|
||||
for (i=0; i<len; i++)
|
||||
parse_wc(buf[i]);
|
||||
|
||||
if (wc_msg_received) {
|
||||
parse_payload();
|
||||
priv_parse_payload();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void request_self_address ( void ) {
|
||||
wc_glib.requested_radio_param = WC_RADIO_PARAM_RADIO_ADDRESS;
|
||||
WcSendReadRadioParamReq(WC_RADIO_PARAM_RADIO_ADDRESS);
|
||||
wc_glib.status = WC_STATUS_SELFADDRESS_REQUESTED;
|
||||
wc_glib.timeout_id = g_timeout_add(1000, timeout_callback, in_ch);
|
||||
}
|
||||
|
||||
void request_remote_rssi ( void ) {
|
||||
WcSendReqReadRemoteRssi(get_host_by_id(wc_glib.requested_remote_rssi)->addr);
|
||||
wc_glib.status = WC_STATUS_REMOTE_RSSI_REQUESTED;
|
||||
wc_glib.timeout_id = g_timeout_add(4000, timeout_callback, in_ch);
|
||||
}
|
||||
|
||||
uint8_t hello[] = "HELLO WORLD W";
|
||||
|
||||
static gboolean timeout_callback(gpointer data) {
|
||||
switch (wc_glib.status) {
|
||||
case WC_STATUS_SELFADDRESS_REQUESTED :
|
||||
g_message("local wavecard not responding");
|
||||
request_self_address();
|
||||
break;
|
||||
case WC_STATUS_REMOTE_RSSI_REQUESTED :
|
||||
g_message("distant wavecard not responding %s", get_host_by_id(wc_glib.requested_remote_rssi)->name);
|
||||
NEXT_RSSI();
|
||||
request_remote_rssi ();
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
static uint8_t foo1 = 1;
|
||||
if ( foo1 == 1) {
|
||||
wc_glib.requested_radio_param = WC_RADIO_PARAM_RADIO_ADDRESS;
|
||||
WcSendReadRadioParamReq(WC_RADIO_PARAM_RADIO_ADDRESS);
|
||||
}
|
||||
else if ( foo1 == 2) {
|
||||
wc_glib.requested_radio_param = WC_RADIO_PARAM_SWITCH_MODE_STATUS;
|
||||
//WcSendWriteRadioParamReq(WC_RADIO_PARAM_SWITCH_MODE_STATUS, 0);
|
||||
WcSendReadRadioParamReq(WC_RADIO_PARAM_SWITCH_MODE_STATUS);
|
||||
}
|
||||
else if ( foo1 == 3) {
|
||||
//wc_glib.requested_radio_param = WC_RADIO_PARAM_RADIO_ACKNOLEDGE;
|
||||
//WcSendWriteRadioParamReq(WC_RADIO_PARAM_RADIO_ACKNOLEDGE, 1);
|
||||
WcSendReadRadioParamReq(WC_RADIO_PARAM_RADIO_ACKNOLEDGE);
|
||||
}
|
||||
// else if ( foo1 == 2) {
|
||||
// WcSendReqSelectChannel(0x01);
|
||||
// WcSendReqReadChannel();
|
||||
// }
|
||||
else if ( foo1 == 4) {
|
||||
//WcSendReqSelectPhyconfig(0x00a3);
|
||||
WcSendReqReadPhyconfig();
|
||||
}
|
||||
else if ( foo1 == 5) {
|
||||
wc_glib.requested_remote_rssi = 0;
|
||||
WcSendReqReadRemoteRssi(get_host_by_id(wc_glib.requested_remote_rssi)->addr);
|
||||
}
|
||||
// else if (foo1 == 5) {
|
||||
// WcSendReqReadLocalRssi(wc_glib.distant_addr);
|
||||
// }
|
||||
// else if (foo1 == 6) {
|
||||
// WcSendReqSendService(wc_glib.distant_addr, 0x20);
|
||||
// }
|
||||
// else if (foo1 == 7) {
|
||||
// WcSendFirmwareReq();
|
||||
// }
|
||||
else if (foo1 > 7) {
|
||||
static uint8_t foo = 1;
|
||||
hello[12] = foo++;
|
||||
// if (!wc_glib.options.silent) WcSendMsg(wc_glib.distant_addr, strlen(hello), hello);
|
||||
}
|
||||
foo1++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int main (int argc, char** argv) {
|
||||
|
||||
if (parse_options(argc, argv))
|
||||
return usage(argc, argv);
|
||||
|
||||
wc_glib_setup_sig_handler();
|
||||
wc_glib.in_ch = open_serial_port(wc_glib.options.serial_device);
|
||||
in_ch = wc_glib.in_ch;
|
||||
g_io_add_watch (wc_glib.in_ch, G_IO_IN , on_data_received, NULL);
|
||||
// g_timeout_add(2000, timeout_callback, in_ch);
|
||||
wc_glib.ml = g_main_loop_new(NULL, FALSE);
|
||||
request_self_address();
|
||||
g_main_loop_run(wc_glib.ml);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void wc_glib_setup_sig_handler( void ) {
|
||||
struct sigaction act;
|
||||
act.sa_handler = wc_glib_quit;
|
||||
act.sa_restorer = NULL;
|
||||
if (sigaction(SIGINT, &act, NULL) < 0)
|
||||
g_message("Could not install signal handler for quitting\n i will be unable to close log\n");
|
||||
}
|
||||
|
||||
static void wc_glib_quit( int i ) {
|
||||
printf("\nquitting\n");
|
||||
g_main_loop_quit(wc_glib.ml);
|
||||
}
|
||||
|
||||
static guint usage (int argc, char** argv) {
|
||||
g_message("%s [-h] [-d serial_device]", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static guint parse_options (int argc, char** argv) {
|
||||
const gchar *optstr = "h:d:s:p";
|
||||
gchar ch;
|
||||
wc_glib.options.serial_device = "/dev/ttyS0";
|
||||
wc_glib.options.silent = FALSE;
|
||||
while ((ch=getopt(argc,argv,optstr)) != -1) {
|
||||
switch(ch) {
|
||||
case 'h':
|
||||
return -1;
|
||||
case 'd':
|
||||
wc_glib.options.serial_device = strdup(optarg);
|
||||
break;
|
||||
case 's':
|
||||
wc_glib.options.silent = TRUE;
|
||||
break;
|
||||
case 'p':
|
||||
wc_glib.options.poll_mode = TRUE;
|
||||
break;
|
||||
case '?':
|
||||
printf("unrecognized option: %c\n",optopt);
|
||||
return -1;
|
||||
default:
|
||||
printf("error? condition unaccounted for?\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_message("%s starting", argv[0]);
|
||||
g_message(" serial device : %s", wc_glib.options.serial_device);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#ifndef WAVECARD_GLIB_H
|
||||
#define WAVECARD_GLIB_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wavecard.h"
|
||||
|
||||
struct WcGlibOptions {
|
||||
gchar* serial_device;
|
||||
gboolean silent;
|
||||
gboolean poll_mode;
|
||||
};
|
||||
|
||||
#define WC_STATUS_SELFADDRESS_REQUESTED 0
|
||||
#define WC_STATUS_GOT_SELFADDRESS 1
|
||||
#define WC_STATUS_REMOTE_RSSI_REQUESTED 2
|
||||
|
||||
struct WcGlib {
|
||||
GMainLoop* ml;
|
||||
GIOChannel* in_ch;
|
||||
uint8_t requested_radio_param;
|
||||
uint8_t requested_remote_rssi;
|
||||
uint8_t self_addr[WC_ADDR_LEN];
|
||||
uint8_t self_id;
|
||||
uint8_t status;
|
||||
guint timeout_id;
|
||||
guint last_poll;
|
||||
struct WcGlibOptions options;
|
||||
};
|
||||
|
||||
GIOChannel* in_ch;
|
||||
|
||||
extern struct WcGlib wc_glib;
|
||||
|
||||
#define WcPut1CtlByte(_byte) { \
|
||||
int bytes_written; \
|
||||
uint8_t b = _byte; \
|
||||
g_io_channel_write_chars (wc_glib.in_ch, &b, 1, &bytes_written, NULL); \
|
||||
g_io_channel_flush(wc_glib.in_ch, NULL); \
|
||||
}
|
||||
|
||||
#endif /* WAVECARD_GLIB_H */
|
||||
@@ -1,128 +0,0 @@
|
||||
#include "wavecard_glib_utils.h"
|
||||
#include "wavecard.h"
|
||||
#include <signal.h>
|
||||
#include <termios.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
|
||||
struct WavecardAddr hosts[] = {
|
||||
{ { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x34 }, "ground_station"},
|
||||
{ { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x35 }, "twinstar3"},
|
||||
{ { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x2d }, "microjet4"},
|
||||
{ { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x36 }, "plaster1"},
|
||||
{ { 0x01, 0x18, 0x04, 0xc0, 0x01, 0x37 }, "gorazoptere"}
|
||||
};
|
||||
uint8_t nb_hosts = 5;
|
||||
|
||||
struct WavecardAddr* get_host_by_addr ( uint8_t* addr) {
|
||||
uint8_t i;
|
||||
while (i<nb_hosts) {
|
||||
if (!memcmp(addr, hosts[i].addr, WC_ADDR_LEN))
|
||||
return &hosts[i];
|
||||
i++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct WavecardAddr* get_host_by_id ( uint8_t id) {
|
||||
return (id < nb_hosts) ? &hosts[id] : NULL;
|
||||
}
|
||||
|
||||
uint8_t get_nb_hosts () { return nb_hosts;}
|
||||
|
||||
GIOChannel* open_serial_port( const gchar* serial_dev) {
|
||||
GIOChannel* input_channel;
|
||||
struct termios orig_termios;
|
||||
struct termios cur_termios;
|
||||
int fd = open(serial_dev, O_RDWR | O_NONBLOCK);
|
||||
|
||||
if (fd == -1) {
|
||||
g_message("opening serial device %s : %s", serial_dev, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (tcgetattr(fd, &orig_termios)) {
|
||||
g_message("getting serial device attr (%s) : %s", serial_dev, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
cur_termios = orig_termios;
|
||||
|
||||
/* input modes */
|
||||
cur_termios.c_iflag &= ~(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR
|
||||
|ICRNL |IUCLC|IXON|IXANY|IXOFF|IMAXBEL);
|
||||
/* pas IGNCR sinon il vire les 0x0D */
|
||||
cur_termios.c_iflag |= BRKINT;
|
||||
|
||||
/* output_flags */
|
||||
cur_termios.c_oflag &=~(OPOST|OLCUC|ONLCR|OCRNL|ONOCR|ONLRET|OFILL|OFDEL);
|
||||
|
||||
/* control modes */
|
||||
cur_termios.c_cflag &= ~(CSIZE|CSTOPB|CREAD|PARENB|PARODD|HUPCL|CLOCAL|CRTSCTS);
|
||||
cur_termios.c_cflag |= CREAD|CS8|CLOCAL;
|
||||
|
||||
/* local modes */
|
||||
cur_termios.c_lflag &= ~(ISIG|ICANON|IEXTEN|ECHO|FLUSHO|PENDIN);
|
||||
cur_termios.c_lflag |= NOFLSH;
|
||||
|
||||
if (cfsetispeed(&cur_termios, B9600)) {
|
||||
g_message("setting serial device speed (%s) : %s", serial_dev, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (tcsetattr(fd, TCSADRAIN, &cur_termios)) {
|
||||
g_message("setting serial device attr (%s) : %s", serial_dev, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
input_channel = g_io_channel_unix_new(fd);
|
||||
g_io_channel_set_encoding(input_channel, NULL, NULL);
|
||||
return input_channel;
|
||||
}
|
||||
|
||||
static void print_hex(gsize len, guchar* buf) {
|
||||
const char d2h[] = "0123456789ABCDEF";
|
||||
int i=0;
|
||||
for (i=0; i<len; i++)
|
||||
printf("%c%c ", d2h[(int)buf[i]/16], d2h[(int)buf[i]%16]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#define LINE_LEN 8
|
||||
void print_both(gsize len, guchar* buf) {
|
||||
const char d2h[] = "0123456789ABCDEF";
|
||||
int i,j;
|
||||
for (i=0; i<len && i < LINE_LEN; i++) {
|
||||
printf("%c%c ", d2h[(int)buf[i]/16], d2h[(int)buf[i]%16]);
|
||||
}
|
||||
if (i<LINE_LEN)
|
||||
for (j=0; j<LINE_LEN-i; j++)
|
||||
printf(" ");
|
||||
printf("\t");
|
||||
for (i=0; i<len && i < LINE_LEN; i++)
|
||||
if (isalnum(buf[i]))
|
||||
printf("%c", buf[i]);
|
||||
else
|
||||
printf(".");
|
||||
printf("\n");
|
||||
if (i<len) print_both(len-i, buf+i);
|
||||
}
|
||||
|
||||
void wc_glib_print_addr(uint8_t* addr) {
|
||||
int i;
|
||||
for(i = 0; i < WC_ADDR_LEN ; i++)
|
||||
printf("%02x ", addr[i]);
|
||||
}
|
||||
|
||||
void wc_glib_append_addr(GString* str, uint8_t* addr) {
|
||||
int i;
|
||||
for(i = 0; i < WC_ADDR_LEN ; i++)
|
||||
g_string_append_printf(str, "%02x ", addr[i]);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef WAVECARD_GLIB_UTILS_H
|
||||
#define WAVECARD_GLIB_UTILS_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "wavecard.h"
|
||||
|
||||
struct WavecardAddr {
|
||||
uint8_t addr[WC_ADDR_LEN];
|
||||
gchar* name;
|
||||
};
|
||||
|
||||
struct WavecardAddr* get_host_by_addr ( uint8_t* addr);
|
||||
struct WavecardAddr* get_host_by_name ( uint8_t* name);
|
||||
struct WavecardAddr* get_host_by_id ( uint8_t id);
|
||||
uint8_t get_nb_hosts ();
|
||||
|
||||
GIOChannel* open_serial_port( const gchar* serial_dev);
|
||||
void print_both(gsize len, guchar* buf);
|
||||
void wc_glib_print_addr(uint8_t* addr);
|
||||
void wc_glib_append_addr(GString* str, uint8_t* addr);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* WAVECARD_GLIB_UTILS_H */
|
||||
Executable → Regular
Executable → Regular
@@ -1,77 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
# Copyright (C) 2003 Pascal Brisset, Antoine Drouin
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
LOCAL_CFLAGS= $(CTL_BRD_FLAGS)
|
||||
|
||||
ARCH = atmega8
|
||||
TARGET = fbw
|
||||
TARGETDIR = fbw
|
||||
#LOW_FUSE = 3f # crystal #
|
||||
#LOW_FUSE = 31 # internal 1MHz #
|
||||
#LOW_FUSE = 1e # ceramic resonator slow rising power p26 #
|
||||
LOW_FUSE = 2e # ceramic resonator slow rising power p26 #
|
||||
HIGH_FUSE = cb
|
||||
EXT_FUSE = ff
|
||||
LOCK_FUSE = ff
|
||||
VARINCLUDE = $(PAPARAZZI_HOME)/var/include
|
||||
ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
|
||||
INCLUDES = -I ../../include -I .. -I ../avr -I $(VARINCLUDE) -I $(ACINCLUDE) -I $(PAPARAZZI_SRC)/sw/airborne/fly_by_wire
|
||||
|
||||
ifeq ($(CTL_BRD_VERSION),V1_2_1)
|
||||
CTL_BRD_FLAGS=-DCTL_BRD_V1_2_1
|
||||
endif
|
||||
|
||||
ifeq ($(CTL_BRD_VERSION),V1_2)
|
||||
CTL_BRD_FLAGS=-DCTL_BRD_V1_2
|
||||
endif
|
||||
|
||||
SRC_ARCH = $(PAPARAZZI_SRC)/sw/airborne/avr
|
||||
|
||||
$(TARGET).srcs = \
|
||||
main.c \
|
||||
$(SRC_ARCH)/ppm.c \
|
||||
$(SRC_ARCH)/servo.c \
|
||||
$(SRC_ARCH)/spi_fbw.c \
|
||||
$(SRC_ARCH)/uart_fbw.c \
|
||||
$(SRC_ARCH)/adc_fbw.c \
|
||||
|
||||
|
||||
include $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/Makefile.ac
|
||||
$(TARGET).srcs += $(FBW_EXTRA_SRCS)
|
||||
include ../../../conf/Makefile.local
|
||||
include ../../../conf/Makefile.avr
|
||||
|
||||
fbw.install : warn_conf
|
||||
|
||||
warn_conf :
|
||||
@echo
|
||||
@echo '###########################################################'
|
||||
@grep AIRFRAME_NAME $(ACINCLUDE)/airframe.h
|
||||
@grep RADIO_NAME $(ACINCLUDE)/radio.h
|
||||
@echo '###########################################################'
|
||||
@echo
|
||||
|
||||
|
||||
$(OBJDIR)/servo.o : $(ACINCLUDE)/airframe.h
|
||||
|
||||
clean : avr_clean
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
# $Id$
|
||||
# Copyright (C) 2003 Pascal Brisset Antoine Drouin
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user