CSU Telemaster

<!DOCTYPE airframe SYSTEM "airframe.dtd">
<airframe name="Telemaster">
 <servos>
 <servo name="THROTTLE" 	no="0" min="1000" neutral="1000" max="2000"/> 
 <servo name="AILERON" 		no="6" min="1000" neutral="1500" max="2000"/>
 <servo name="ELEVATOR" 		no="2" min="1000" neutral="1500" max="2000"/>
 <servo name="RUDDER" 	 no="7" min="2000" neutral="1500" max="1000"/>
 <servo name="GYRO_GAIN"		no="3" min="1000" neutral="1500" max="2000"/> 
 </servos>
 
 <commands>
 <axis name="THROTTLE" failsafe_value="0"/> 
 <axis name="ROLL" failsafe_value="0"/>
 <axis name="PITCH" failsafe_value="0"/> 
 <axis name="YAW" failsafe_value="0"/> 
 <axis name="GAIN" failsafe_value="0"/>
 </commands>
 <rc_commands>
 <set command="ROLL" value="@ROLL"/>
 <set command="PITCH" value="@PITCH"/>
 <set command="THROTTLE" value="@THROTTLE"/> 
 <set command="YAW" value="@YAW"/>
 <set command="GAIN" value="@GAIN"/>
 </rc_commands> 
 <command_laws>
 <set servo="THROTTLE" 		value="@THROTTLE"/>
 <set servo="AILERON" 		value="@ROLL"/>
 <set servo="ELEVATOR" 		value="@PITCH"/>
 <set servo="RUDDER" 		value="@YAW"/>
 <set servo="GYRO_GAIN"		value="@GAIN"/>			
 </command_laws>
 
 <define name="MAX_ROLL" value="RadOfDeg(50)"/>
 <define name="MAX_PITCH" value="RadOfDeg(40)"/>
 
 
 <define name="IR1" value="ADC_2"/>
 <define name="IR2" value="ADC_1"/>
 <define name="IR_TOP" value="ADC_0"/>
 <define name="IR_NB_SAMPLES" value="16"/>
 
 
 <define name="ADC_IR1_NEUTRAL" value="512"/>
 <define name="ADC_IR2_NEUTRAL" value="516"/>
 <define name="ADC_TOP_NEUTRAL" value="511"/>
 <define name="LATERAL_CORRECTION" value="1"/>
 <define name="LONGITUDINAL_CORRECTION" value="1"/>
 <define name="VERTICAL_CORRECTION" value="1."/>
 <define name="HORIZ_SENSOR_ALIGNED" value="1"/>
 <define name="IR1_SIGN" value="-1"/>
 <define name="IR2_SIGN" value="-1"/>
 <define name="TOP_SIGN" value="1"/>
 <define name="ROLL_NEUTRAL_DEFAULT" value="0" unit="deg"/>
 <define name="PITCH_NEUTRAL_DEFAULT" value="0" unit="deg"/>
 <define name="CORRECTION_UP" value="1."/>
 <define name="CORRECTION_DOWN" value="1."/>
 <define name="CORRECTION_LEFT" value="1."/>
 <define name="CORRECTION_RIGHT" value="1."/>
 
 
 <define name="CATASTROPHIC_BAT_LEVEL" value="-1" unit="V"/>
 <define name="CRITIC_BAT_LEVEL" value="-1" unit="V"/>
 <define name="LOW_BAT_LEVEL" value="-1" unit="V"/>
 <define name="MAX_BAT_LEVEL" value="0" unit="V"/>
 
 
 <define name="NOMINAL_AIRSPEED" value="15." unit="m/s"/>
 <define name="CARROT" value="4." unit="s"/>
 <define name="KILL_MODE_DISTANCE" value="(2.0*MAX_DIST_FROM_HOME)"/>
 <define name="CONTROL_RATE" value="60" unit="Hz"/>
 <define name="NO_XBEE_API_INIT" value="TRUE"/> 
 <define name="ALT_KALMAN_ENABLED" value="TRUE"/>
 <define name="TRIGGER_DELAY" value="1."/>
 <define name="DEFAULT_CIRCLE_RADIUS" value="100."/>
 <define name="MIN_CIRCLE_RADIUS" value="60."/>
 
 
 
 <define name="POWER_CTL_BAT_NOMINAL" value="0" unit="volt"/>
 
 <define name="ALTITUDE_PGAIN" value="-0.075" unit="(m/s)/m"/>
 <define name="ALTITUDE_MAX_CLIMB" value="4." unit="m/s"/>
 
 <define name="AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE" value="0.75" unit="%"/>
 <define name="AUTO_THROTTLE_MIN_CRUISE_THROTTLE" value="0.4" unit="%"/>
 <define name="AUTO_THROTTLE_MAX_CRUISE_THROTTLE" value="1.0" unit="%"/>
 <define name="AUTO_THROTTLE_LOITER_TRIM" value="2000" unit="pprz_t"/>
 <define name="AUTO_THROTTLE_DASH_TRIM" value="-1000" unit="pprz_t"/>
 <define name="AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT" value="0.1" unit="%/(m/s)"/>
 <define name="AUTO_THROTTLE_PGAIN" value="-0.02" unit="%/(m/s)"/>
 <define name="AUTO_THROTTLE_IGAIN" value="0.1"/>
 <define name="AUTO_THROTTLE_PITCH_OF_VZ_PGAIN" value="0.05" unit="rad/(m/s)"/>
 <define name="AUTO_PITCH_PGAIN" value="-0.20"/>
 <define name="AUTO_PITCH_IGAIN" value="0.025"/>
 <define name="AUTO_PITCH_MAX_PITCH" value="RadOfDeg(40)"/>
 <define name="AUTO_PITCH_MIN_PITCH" value="RadOfDeg(-40)"/>
 <define name="THROTTLE_SLEW" value="1.0"/>
 
 
 <define name="COURSE_PGAIN" value="-0.75"/>
 <define name="ROLL_MAX_SETPOINT" value="RadOfDeg(35)" unit="radians"/>
 <define name="PITCH_MAX_SETPOINT" value="RadOfDeg(25)" unit="radians"/>
 <define name="PITCH_MIN_SETPOINT" value="RadOfDeg(-25)" unit="radians"/>
 <define name="PITCH_PGAIN" value="-6000."/>
 <define name="PITCH_DGAIN" value="1.5"/>
 <define name="ELEVATOR_OF_ROLL" value="2500"/>
 <define name="ROLL_ATTITUDE_GAIN" value="-7400"/>
 <define name="ROLL_RATE_GAIN" value="-200"/>
 
 
 <define name="NAV_PITCH" value="0."/>
 <define name="NAV_GLIDE_PITCH_TRIM" value="0"/>
 
 
 <define name="BLEND_START" value="20"/>
 <define name="BLEND_END" value="10"/>
 <define name="CLIMB_THROTTLE" value="0.9"/>
 <define name="CLIMB_PITCH" value="RadOfDeg(18)"/>
 <define name="DESCENT_THROTTLE" value="0.1"/>
 <define name="DESCENT_PITCH" value="RadOfDeg(-20)"/>
 <define name="CLIMB_NAV_RATIO" value="0.8"/>
 <define name="DESCENT_NAV_RATIO" value="1.0"/>
 
 
 <define name="DELAY_WITHOUT_GPS" value="3" unit="s"/>
 <define name="DEFAULT_THROTTLE" value="0.4" unit="%"/>
 <define name="DEFAULT_ROLL" value="RadOfDeg(15)" unit="rad"/>
 <define name="DEFAULT_PITCH" value="RadOfDeg(0)" unit="rad"/>
 <define name="HOME_RADIUS" value="90" unit="m"/>
 
 
 
 <define name="DEVICE_TYPE" value="PPRZ"/>
 <define name="DEVICE_ADDRESS" value="...."/>
 
 <makefile>
CONFIG = \"tiny_2_1_1.h\"
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
FLASH_MODE=IAP
ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DLED -DTIME_LED=1
ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c
ap.CFLAGS += -DINTER_MCU
ap.srcs += inter_mcu.c 
ap.srcs += commands.c
########## RC actuators + radio
ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c
ap.CFLAGS += -DRADIO_CONTROL
ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c 
########## Telemetry configuration
ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B9600
ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c pprz_transport.c
########## ADC
ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
ap.srcs += $(SRC_ARCH)/adc_hw.c
########## GPS
ap.CFLAGS += -DGPS -DUBX -DUSE_UART0 -DGPS_LINK=Uart0 -DUART0_BAUD=B38400 -DGPS_USE_LATLONG
ap.srcs += gps_ubx.c gps.c latlong.c
########## IR sensors
ap.CFLAGS += -DINFRARED -DALT_KALMAN
ap.srcs += infrared.c estimator.c
########## Nav
ap.CFLAGS += -DNAV -DAGR_CLIMB -DLOITER_TRIM
ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c
ap.srcs += nav_survey_rectangle.c
ap.srcs += nav_line.c
########## Heading Hold Gyro
ap.srcs += gyrogain.h
sim.srcs += gyrogain.h
########## Lights
ap.CFLAGS += -DUSE_LIGHT
ap.srcs += light.c
ap.CFLAGS += -DUSE_MODULES
# Config for SITL simulation
include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile
sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
sim.srcs += nav_line.c nav_survey_rectangle.c
sim.CFLAGS += -DUSE_MODULES
 </makefile>
</airframe>
Category:User_Projects