public void Setup()
 {
     _tal.ConfigForwardLimitSwitchSource(CTRE.Phoenix.MotorControl.LimitSwitchSource.FeedbackConnector, CTRE.Phoenix.MotorControl.LimitSwitchNormal.NormallyOpen);
     _tal.ConfigReverseLimitSwitchSource(CTRE.Phoenix.MotorControl.LimitSwitchSource.FeedbackConnector, CTRE.Phoenix.MotorControl.LimitSwitchNormal.NormallyOpen);
     _tal.ConfigSelectedFeedbackSensor(CTRE.Phoenix.MotorControl.FeedbackDevice.CTRE_MagEncoder_Relative);
     _tal.SetStatusFramePeriod(StatusFrameEnhanced.Status_8_PulseWidth, 1);
 }
        public void Setup()
        {
            TalonSRX armTalon = (TalonSRX)_gearBox.MasterMotorController;

            armTalon.SetInverted(false);
            armTalon.SetStatusFramePeriod(StatusFrame.Status_1_General_, 10); //Send updates every 10ms instead of 10ms
            armTalon.SetStatusFramePeriod(StatusFrameEnhanced.Status_8_PulseWidth, 1);
            armTalon.SetSensorPhase(true);                                    //reversed sensor
            armTalon.ConfigForwardLimitSwitchSource(LimitSwitchSource.FeedbackConnector, LimitSwitchNormal.NormallyClosed);
            armTalon.ConfigReverseLimitSwitchSource(LimitSwitchSource.FeedbackConnector, LimitSwitchNormal.NormallyClosed);

            armTalon.ConfigClearPositionOnLimitR(false, 10);            //enable on reverse limit
            armTalon.ConfigClearPositionOnLimitF(false, 10);
        }
示例#3
0
        static Hardware()
        {
            _leftDrive  = new VictorSPX(1);
            _rightDrive = new VictorSPX(2);
            _lid        = new TalonSRX(9);

            _leftDrive.ConfigFactoryDefault();
            _rightDrive.ConfigFactoryDefault();
            _lid.ConfigFactoryDefault();

            _lid.ConfigForwardLimitSwitchSource(CTRE.Phoenix.MotorControl.LimitSwitchSource.FeedbackConnector, CTRE.Phoenix.MotorControl.LimitSwitchNormal.NormallyOpen);
            _lid.ConfigReverseLimitSwitchSource(CTRE.Phoenix.MotorControl.LimitSwitchSource.FeedbackConnector, CTRE.Phoenix.MotorControl.LimitSwitchNormal.NormallyOpen);
            _lid.ConfigContinuousCurrentLimit(2);

            // on port 3: Hardware Pin 1 is CTRE.HERO.IO.Port3.Pin3.
            //            Hardware Pin 6 is CTRE.HERO.IO.Port3.Pin8.
            _testOutputPort = new OutputPort(CTRE.HERO.IO.Port5.Pin8, false);

            b0_supply = new OutputPort(CTRE.HERO.IO.Port3.Pin3, false);
            b0_tank   = new OutputPort(CTRE.HERO.IO.Port3.Pin4, false);
            b0_shot   = new OutputPort(CTRE.HERO.IO.Port3.Pin5, false);
            b1_supply = new OutputPort(CTRE.HERO.IO.Port3.Pin6, false);
            b1_tank   = new OutputPort(CTRE.HERO.IO.Port3.Pin7, false);
            b1_shot   = new OutputPort(CTRE.HERO.IO.Port3.Pin8, false);

            voltage = new AnalogInput(CTRE.HERO.IO.Port8.Analog_Pin5);

            lid_limit_switch     = new InputPort(CTRE.HERO.IO.Port8.Pin6, false, Port.ResistorMode.PullUp);
            lid_limit_switch_led = new OutputPort(CTRE.HERO.IO.Port5.Pin3, false);

            UsbHostDevice usb = CTRE.Phoenix.UsbHostDevice.GetInstance();

            _gamepad = new GameController(usb);
            usb.SetSelectableXInputFilter(UsbHostDevice.SelectableXInputFilter.XInputDevices);

            _display = new Display();
        }