/// <summary> /// Constructor /// </summary> /// <param name="name">name of the control</param> /// <param name="joystick">WPI joysick the control will use</param> /// <param name="axis">the axis to use</param> /// <param name="fitFunction">the fit function to use, see Filters class in Base</param> /// <param name="reversed">if the control is reversed</param> /// <param name="deadZone">the deadzone of the axis</param> /// <param name="multiplier">the output multiplier</param> /// <param name="power">the power for the fit function, see Filters class in Base</param> /// <param name="isEnabled">determins whether the control is enabled or not</param> public AxisControl(string name, Joystick joystick, int axis, MotorControlFitFunction fitFunction, bool reversed, double deadZone, bool isEnabled, double multiplier = 1, double power = 2) { IsEnabled = isEnabled; ControlName = name; ControlType = ControlItemType.AxisControl; this.deadZone = deadZone; this.multiplier = multiplier; this.power = power; this.axis = axis; this.joystick = joystick; IsReversed = reversed; switch (fitFunction) { case MotorControlFitFunction.Linear: this.fitFunction = Filters._LinearValueEstimator; break; case MotorControlFitFunction.Quadratic: this.fitFunction = Filters._QuadraticValueEstimator; break; case MotorControlFitFunction.Polynomial: this.fitFunction = Filters._PolynomialValueEstimator; break; case MotorControlFitFunction.Exponential: this.fitFunction = Filters._ExponentialValueEstimator; break; default: throw new ArgumentOutOfRangeException(nameof(fitFunction), fitFunction, null); } }
/// <summary> /// Constructor /// </summary> /// <param name="name">name of the control</param> /// <param name="fitFunction">fit function to use, see Filters class</param> /// <param name="fitPower">power for fit function, see Filters class</param> /// <param name="bindTo">IComponent bindings by CommonName</param> /// <param name="axis">axis on the controller</param> /// <param name="deadZone">deadzone on the axis</param> /// <param name="powerMultiplier">output power multiplier</param> /// <param name="reversed">if the control should be reversed</param> /// <param name="isEnabled">Defines if the control is enabled by default or not</param> public DriverControlSchema(string name, MotorControlFitFunction fitFunction, double fitPower, List <CommonName> bindTo, int axis, double deadZone, double powerMultiplier = 1, bool reversed = false, bool isEnabled = true) { Name = name; ControlType = ControlType.Axis; Bindings = bindTo; Axis = axis; DeadZone = deadZone; PowerMultiplier = powerMultiplier; Reversed = reversed; FitFunction = fitFunction; FitPower = fitPower; IsEnabled = isEnabled; }