Description
Currently, the raw PWM signals (1000-2000) received from the STM32 microcontroller via TelemetryDecoder.cs contain minor hardware noise and communication jitter (e.g., fluctuating between 1498 and 1502 while the stick is stationary). Because these raw values are directly mapped to the control surface deflection angles (SetFlapAngle in radians) within the Gasgiant physics engine, the noise causes micro-fluttering on the ailerons, elevator, and rudder. This constant oscillation induces unrealistic aerodynamic anomalies and instability during the HIL simulation.
Expected Behavior
Control surfaces should remain perfectly stable when the transmitter sticks are stationary. The deflection should be smooth, ignoring high-frequency hardware noise without introducing significant input lag.
Implement a digital filtering algorithm—such as an Exponential Moving Average (EMA) or a Simple Low-Pass Filter—within TelemetryDecoder.cs. The filter must process the raw PWM inputs before they are converted to radians and dispatched to the AeroSurface instances.
Description
Currently, the raw PWM signals (1000-2000) received from the STM32 microcontroller via
TelemetryDecoder.cscontain minor hardware noise and communication jitter (e.g., fluctuating between 1498 and 1502 while the stick is stationary). Because these raw values are directly mapped to the control surface deflection angles (SetFlapAnglein radians) within the Gasgiant physics engine, the noise causes micro-fluttering on the ailerons, elevator, and rudder. This constant oscillation induces unrealistic aerodynamic anomalies and instability during the HIL simulation.Expected Behavior
Control surfaces should remain perfectly stable when the transmitter sticks are stationary. The deflection should be smooth, ignoring high-frequency hardware noise without introducing significant input lag.
Implement a digital filtering algorithm—such as an Exponential Moving Average (EMA) or a Simple Low-Pass Filter—within
TelemetryDecoder.cs. The filter must process the raw PWM inputs before they are converted to radians and dispatched to theAeroSurfaceinstances.Implement an EMA (Exponential Moving Average) algorithm in
TelemetryDecoder.cs.Expose a
smoothingFactor(oralpha) variable in the Unity Inspector to allow real-time tuning of the filter's intensity.Apply the filtering logic independently to
aileronPWM,elevatorPWM,throttlePWM, andrudderPWM.Conduct a latency test to find the optimal balance between signal smoothness and responsiveness.
Visual fluttering of 3D control surfaces in Unity is completely eliminated.
The physics engine receives perfectly stable radian values when inputs are idle.
The filter does not introduce an input lag exceeding 20ms (must remain imperceptible for flight control).