public DriveHelper(ref Drive drive_) { drive = drive_; oldTurn = quickStopAccumulator = oldSpeed = oldWheel = negInertiaAccumulator = lastShift = 0; throttleAccel = new InputFilter(0); wheelAccel = new InputFilter(0); isHighGear = false; }
/// <summary> /// Instantiates the Motor COntrollers, Encoders, Gyroscope. /// </summary> public Drive() { #region Instantiating L1 = new RampMotor<Talon>(Constants.Drive_L1Channel); L2 = new RampMotor<Talon>(Constants.Drive_L2Channel); L3 = new RampMotor<Talon>(Constants.Drive_L3Channel); R1 = new RampMotor<Talon>(Constants.Drive_R1Channel); R2 = new RampMotor<Talon>(Constants.Drive_R2Channel); R3 = new RampMotor<Talon>(Constants.Drive_R3Channel); LShift = new Solenoid(Constants.Drive_LShiftChannel); RShift = new Solenoid(Constants.Drive_RShiftChannel); LEncode = new Encoder(Constants.Drive_LEncoderAChannel, Constants.Drive_LEncoderBChannel); REncode = new Encoder(Constants.Drive_REncoderAChannel, Constants.Drive_REncoderBChannel); LSpeedFilter = new InputFilter(0); RSpeedFilter = new InputFilter(0); gyro = new Gyro(Constants.Drive_GyroChannel); #endregion //Invert the Right Side Motors and Encoder R1.Inverted = true; R2.Inverted = true; R3.Inverted = true; REncode.ReverseDirection = true; L1.MaxChange = Constants.Drive_MaxPowerChange; L2.MaxChange = Constants.Drive_MaxPowerChange; L3.MaxChange = Constants.Drive_MaxPowerChange; R1.MaxChange = Constants.Drive_MaxPowerChange; R2.MaxChange = Constants.Drive_MaxPowerChange; R3.MaxChange = Constants.Drive_MaxPowerChange; gyro.Reset(); LShift.Set(false); RShift.Set(false); //Secondary Motors are set to the same max acceleration as the primary motors by default, until we get these numbers tuned. shiftingMotorValue = Constants.Drive_MaxPowerChange; }