/// <summary> /// Creates a new arm which is driven by an encoder /// </summary> /// <param name="input">The motor driving the system</param> /// <param name="output">The encoder giving feedback to the system</param> /// <param name="encoderCPR">The CPR of the encoder. If not a 1:1 ratio on the axle, scale this beforehand</param> /// <param name="model">The transmission model to use</param> /// <param name="startRadians">The location in radians you want the system to start at.</param> /// <param name="invertInput">Inverts the motor input</param> public AngularEncoderMechanism(ISimSpeedController input, SimEncoder output, double encoderCPR, DCMotor model, double startRadians, bool invertInput) { m_input = input; m_output = output; m_model = model; m_invert = invertInput; m_scaler = encoderCPR / (Math.PI * 2); CurrentRadians = 0; m_offset = startRadians; AdjustedRadians = m_offset; m_maxRadians = double.MaxValue; m_minRadians = double.MinValue; }
public LinearEncoderMechanism(ISimSpeedController input, SimEncoder output, double encoderCPR, DCMotor model, double spoolRadius, double startHeight, bool invertInput)//, double topLimit = double.MaxValue / 500) { m_input = input; m_output = output; m_model = model; m_invert = invertInput; RadiansPerMeter = 1 / spoolRadius; m_scaler = encoderCPR / (Math.PI * 2); m_offset = startHeight; CurrentMeters = m_offset; m_maxRadians = double.MaxValue; m_minRadians = double.MinValue; }