void update_control(FlightCtrlState state) { for (int i = 0; i < 3; i++) { float raw_input = Common.Clampf(ControlUtils.getControlFromState(state, i), 1.0f); input_buf[i].Put(raw_input); if (HasControlSurfaces) { float csurf_input = 0.0f; if (AtmosphereAutopilot.AeroModel == AtmosphereAutopilot.AerodinamycsModel.Stock) { if (csurf_buf[i].Size >= 1 && sequential_dt) { csurf_input = stock_actuator_blend(csurf_buf[i].getLast(), raw_input); } else { csurf_input = raw_input; } } else if (AtmosphereAutopilot.AeroModel == AtmosphereAutopilot.AerodinamycsModel.FAR) { if (csurf_buf[i].Size >= 1 && sequential_dt) { csurf_input = far_exponential_blend(csurf_buf[i].getLast(), raw_input); } else { csurf_input = raw_input; } } csurf_buf[i].Put(csurf_input); } else { csurf_buf[i].Put(0.0f); } if (any_gimbals) { if (gimbal_buf[i].Size >= 1 && sequential_dt && !float.IsPositiveInfinity(gimbal_spd_norm)) { gimbal_buf[i].Put(exponential_blend(gimbal_buf[i].getLast(), raw_input, gimbal_spd_norm, 0.0f)); } else { gimbal_buf[i].Put(raw_input); } } else { gimbal_buf[i].Put(0.0f); } } }
protected virtual float get_required_input(FlightCtrlState cntrl, float target_value) { return(ControlUtils.getControlFromState(cntrl, axis)); }