-------------------------------------------------------
--- Yawstring controls for WA28-Espadon by BERJU83 ---
-------------------------------------------------------
-- Yawstring math function inspired from Windsock team ASG29_B21 ---

----------------------------------- LOCATE OR CREATE DATAREFS -----------------------------------


Posbeta = find_dataref("sim/flightmodel2/position/beta")
TAspeed = find_dataref("sim/flightmodel2/position/true_airspeed")
Yawstring = create_dataref("custom/WA28/yawstring", "number")

 
------------------------------- FUNCTIONS -------------------------------


function update_Yawstring()
	Yawstring = Yawstring + ((YawstringNEW - Yawstring) * (10 * SIM_PERIOD))
end

function after_physics()
	YawstringNEW = Posbeta * 1.5 + (math.random() - 0.5) * TAspeed / 10
	update_Yawstring()
end