/** * Setup all of the configuration parameters. */ public void SetupConfig() { /* Factory Default all hardware to prevent unexpected behaviour */ _talon.ConfigFactoryDefault(); /* specify sensor characteristics */ _talon.ConfigSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0); _talon.SetSensorPhase(false); /* make sure positive motor output means sensor moves in position direction */ /* brake or coast during neutral */ _talon.SetNeutralMode(NeutralMode.Brake); /* closed-loop and motion-magic parameters */ _talon.Config_kF(kSlotIdx, 0.1153f, kTimeoutMs); // 8874 native sensor units per 100ms at full motor output (+1023) _talon.Config_kP(kSlotIdx, 2.00f, kTimeoutMs); _talon.Config_kI(kSlotIdx, 0f, kTimeoutMs); _talon.Config_kD(kSlotIdx, 20f, kTimeoutMs); _talon.Config_IntegralZone(kSlotIdx, 0, kTimeoutMs); _talon.SelectProfileSlot(kSlotIdx, 0); /* select this slot */ _talon.ConfigNominalOutputForward(0f, kTimeoutMs); _talon.ConfigNominalOutputReverse(0f, kTimeoutMs); _talon.ConfigPeakOutputForward(1.0f, kTimeoutMs); _talon.ConfigPeakOutputReverse(-1.0f, kTimeoutMs); _talon.ConfigMotionCruiseVelocity(8000, kTimeoutMs); // 8000 native units _talon.ConfigMotionAcceleration(16000, kTimeoutMs); // 16000 native units per sec, (0.5s to reach cruise velocity). /* Home the relative sensor, * alternatively you can throttle until limit switch, * use an absolute signal like CtreMagEncoder_Absolute or analog sensor. */ _talon.SetSelectedSensorPosition(0, kTimeoutMs); }
private void SetupPositionServo() { TalonSRX armTalon = (TalonSRX)_gearBox.MasterMotorController; armTalon.ConfigNominalOutputForward(0); armTalon.ConfigNominalOutputReverse(0); armTalon.ConfigPeakOutputForward(1); armTalon.ConfigPeakOutputReverse(-1); armTalon.ConfigAllowableClosedloopError(0, Constants.TOLERANCE); armTalon.Config_kP(Constants.KPARM); armTalon.Config_kI(Constants.KIARM); armTalon.Config_kD(Constants.KDARM); _controlMode = ControlMode.MotionMagic; armTalon.SelectProfileSlot(0); armTalon.ConfigMotionAcceleration(60); armTalon.ConfigMotionCruiseVelocity(22); }
public void Config(int talonId0, int talonId1) { talon0 = new TalonSRX(talonId0); talon1 = new TalonSRX(talonId1); talon0.ConfigSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0); talon0.SetSensorPhase(false); talon0.SetNeutralMode(NeutralMode.Brake); talon0.Config_kF(kSlotId, 0.1153f, kTimeout); talon0.Config_kP(kSlotId, 2.00f, kTimeout); talon0.Config_kI(kSlotId, 0f, kTimeout); talon0.Config_kD(kSlotId, 20f, kTimeout); talon0.Config_IntegralZone(kSlotId, 0, kTimeout); talon0.SelectProfileSlot(kSlotId, 0); talon0.ConfigNominalOutputForward(0f, kTimeout); talon0.ConfigNominalOutputReverse(0f, kTimeout); talon0.ConfigPeakOutputForward(1.0f, kTimeout); talon0.ConfigPeakOutputReverse(-1.0f, kTimeout); talon0.ConfigMotionCruiseVelocity(8000, kTimeout); talon0.ConfigMotionAcceleration(16000, kTimeout); }
public Lift() { const int MAX_CURRENT = 15; const int TIMEOUT_MS = 100; LeftActuator.ConfigContinuousCurrentLimit(MAX_CURRENT, TIMEOUT_MS); RightActuator.ConfigContinuousCurrentLimit(MAX_CURRENT, TIMEOUT_MS); LeftActuator.SetNeutralMode(NeutralMode.Brake); RightActuator.SetNeutralMode(NeutralMode.Brake); LeftActuator.ConfigSelectedFeedbackSensor(FeedbackDevice.Analog); RightActuator.ConfigSelectedFeedbackSensor(FeedbackDevice.Analog); const float P = 33.57f; const float I = 0; LeftActuator.Config_kP(P); RightActuator.Config_kP(P); LeftActuator.Config_kI(I); RightActuator.Config_kI(I); LeftActuator.ConfigMotionAcceleration(150); RightActuator.ConfigMotionAcceleration(150); RightActuator.ConfigMotionCruiseVelocity(4); LeftActuator.ConfigMotionCruiseVelocity(4); ExcavationBelt.ConfigContinuousCurrentLimit(MAX_CURRENT, TIMEOUT_MS); //REMOVE ME EVENTUALLY ExcavationBelt.SetInverted(true); CollectionBelt.ConfigContinuousCurrentLimit(MAX_CURRENT, TIMEOUT_MS); Digger.ConfigContinuousCurrentLimit(MAX_CURRENT, TIMEOUT_MS); Digger.SetInverted(true); }
public void Settings() { talon0.ConfigMotionCruiseVelocity(analog1, kTimeout); talon0.ConfigMotionAcceleration(analog2, kTimeout); }