<?xml version="1.0"?>
<flight_control name="FCS: Dragonfly">
	
	<!--	Deflection angles ( based on [3] ):
			Elevator	(dist to axis: 540mm)
				up	167mm	0.30rad		17.19deg
				down	318mm	0.532rad	30.48deg
			Rudder		(dist to axis: 870mm)
				left	354mm	0.386rad	22.12deg
				right	354mm	0.386rad	22.12deg
			Aileron		(dist to axis: 310mm)
				up	136mm	0.413rad	23.66deg
				down	49mm	0.157rad	 9.00deg
	-->
	
	<channel name="Pitch">
		<summer name="Pitch Trim Sum">
			<input>fcs/elevator-cmd-norm</input>
			<input>fcs/pitch-trim-cmd-norm</input>
			<clipto>
				<min> -1 </min>
				<max>  1 </max>
			</clipto>
		</summer>
		
		<aerosurface_scale name="Elevator Control">
			<input>fcs/pitch-trim-sum</input>
			<range>
				<min> -0.30 </min>
				<max>  0.532 </max>
			</range>
			<output>fcs/elevator-pos-rad</output>
		</aerosurface_scale>
		
		<pure_gain name="Elevator Norm">
			<input>fcs/elevator-pos-rad</input>
			<gain>1.87969</gain> <!-- 1/0.532 -->
			<output>fcs/elevator-pos-norm</output>
		</pure_gain>
		
	</channel>
	
	<channel name="Roll">
		<summer name="Roll Trim Sum">
			<input>fcs/aileron-cmd-norm</input>
			<input>fcs/roll-trim-cmd-norm</input>
			<clipto>
				<min> -1 </min>
				<max>  1 </max>
			</clipto>
		</summer>
		
		<aerosurface_scale name="Aileron Control Rad">
			<input>-fcs/roll-trim-sum</input> 
			<range>
				<min>-0.285</min>
				<max> 0.285</max>
			</range>
		</aerosurface_scale>
		
		<aerosurface_scale name="Aileron Control Deg">
			<input>-fcs/roll-trim-sum</input> 
			<range>
				<min>-16.33</min>
				<max> 16.33</max>
			</range>
		</aerosurface_scale>
		
		
		<aerosurface_scale name="Left Aileron Control">
			<input>fcs/roll-trim-sum</input>
			<range>
				<min> -0.413 </min>
				<max>  0.157 </max>
			</range>
			<output>fcs/left-aileron-pos-rad</output>
		</aerosurface_scale>
		
		<aerosurface_scale name="Right Aileron Control">
			<input>fcs/roll-trim-sum</input>
			<range>
				<min> -0.157 </min>
				<max>  0.413 </max>
			</range>
			<output>fcs/right-aileron-pos-rad</output>
		</aerosurface_scale>
		
		
		<pure_gain name="Left Aileron Norm">
			<input>fcs/left-aileron-pos-rad</input>
			<gain>2.4213</gain> <!-- 1/0.413 -->
			<output>fcs/left-aileron-pos-norm</output>
		</pure_gain>
		
		<pure_gain name="Right Aileron Norm">
			<input>fcs/right-aileron-pos-rad</input>
			<gain>2.4213</gain> <!-- 1/0.413 -->
			<output>fcs/right-aileron-pos-norm</output>
		</pure_gain>
		
	</channel>
	
	<channel name="Yaw">
		<summer name="Rudder Command Sum">
			<input>fcs/rudder-cmd-norm</input>
			<input>fcs/yaw-trim-cmd-norm</input>
			<clipto>
				<min>-1</min>
				<max>1</max>
			</clipto>
			<output>fcs/rudder-pos-norm</output>
		</summer>
		
		<aerosurface_scale name="Rudder Control">
			<input>fcs/rudder-command-sum</input>
			<range>
				<min> -0.386 </min>
				<max>  0.386 </max>
			</range>
			<output>fcs/rudder-pos-rad</output>
		</aerosurface_scale>
		
	</channel>
	
	<channel name="Banner-On-Hook">
		<kinematic name="Banner On Hook">
			<input>fcs/speedbrake-cmd-norm</input>
			<traverse>
				<setting>
					<position>0</position>
					<time>0</time>
				</setting>
				<setting>
					<position>1</position>
					<time>2</time>
				</setting>
			</traverse>
			<output>fcs/speedbrake-pos-norm</output>
		</kinematic>
	</channel>
	
	<channel name="Human animation">
		<switch>
			<default value="0"/>
			<test value="1">
				inertia/pointmass-weight-lbs[0] gt 20
			</test>
			<output>fcs/show-pilot</output>
		</switch>
		<switch>
			<default value="0"/>
			<test value="1">
				inertia/pointmass-weight-lbs[1] gt 20
			</test>
			<output>fcs/show-copilot</output>
		</switch>
	</channel>
	
</flight_control>
