Exemplo n.º 1
0
 public static void AfterClass()
 {
     pdp.Dispose();
     pdp = null;
     fixture.Teardown();
     fixture = null;
 }
Exemplo n.º 2
0
 public static void AfterClass()
 {
     pdp.Dispose();
     pdp = null;
     fixture.Teardown();
     fixture = null;
 }
 public void TestCreatePDPUpperLimit()
 {
     SimData.ResetHALData(false);
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         PowerDistributionPanel pdp = new PowerDistributionPanel(PDPModules);
         pdp.GetCurrent(0);
     });
 }
Exemplo n.º 4
0
 public void TestCreatePDPUpperLimit()
 {
     SimData.ResetHALData(false);
     Assert.Throws <ArgumentOutOfRangeException>(() =>
     {
         PowerDistributionPanel pdp = new PowerDistributionPanel(PDPModules);
         pdp.GetCurrent(0);
     });
 }
Exemplo n.º 5
0
        /// <summary>
        /// Initialize the controllers.
        /// </summary>
        public static void Init()
        {
            // Instantiates all the hardware devices with the respective ports.
            #region InstantiateDevices
            can_01 = new CANTalon(1);
            can_02 = new CANTalon(2);
            //can_02.MotorControlMode = ControlMode.Follower;
            //can_02.Set(can_01.DeviceId);
            //can_02.ReverseOutput(true);
            can_03 = new CANTalon(3);
            can_04 = new CANTalon(4);
            //can_04.MotorControlMode = ControlMode.Follower;
            //can_04.Set(can_03.DeviceId);
            can_05   = new CANTalon(5);
            can_06   = new CANTalon(6);
            can_07   = new CANTalon(7);
            can_08   = new CANTalon(8);
            can_09   = new CANTalon(9);
            can_10   = new CANTalon(10);
            can_11   = new Compressor(11);
            can_12   = new PowerDistributionPanel(12);
            pcm_11_0 = new Solenoid(11, 0);
            pcm_11_1 = new Solenoid(11, 1);
            pcm_11_2 = new Solenoid(11, 2);
            usb_0    = new Joystick(0);
            usb_1    = new Joystick(1);
            usb_2    = new Joystick(2);
            sw_0     = new DriveTrainObject(Left1, Left2, Right1, Right2);
            #endregion

            // Clears the sticky faults on all CAN devices.
            #region ClearCANStickyFaults
            can_01.ClearStickyFaults();
            can_02.ClearStickyFaults();
            can_03.ClearStickyFaults();
            can_04.ClearStickyFaults();
            can_05.ClearStickyFaults();
            can_06.ClearStickyFaults();
            can_07.ClearStickyFaults();
            can_08.ClearStickyFaults();
            can_09.ClearStickyFaults();
            can_10.ClearStickyFaults();
            can_11.ClearAllPCMStickyFaults();
            can_12.ClearStickyFaults();
            #endregion

            // Disable motor safety so that it doesn't stop motors from being output to.
            #region DisableSafety
            can_01.SafetyEnabled = false;
            can_02.SafetyEnabled = false;
            can_03.SafetyEnabled = false;
            can_04.SafetyEnabled = false;
            can_05.SafetyEnabled = false;
            can_06.SafetyEnabled = false;
            can_07.SafetyEnabled = false;
            can_08.SafetyEnabled = false;
            can_09.SafetyEnabled = false;
            can_10.SafetyEnabled = false;
            sw_0.SafetyEnabled   = false;
            #endregion

            Intake2.Inverted       = true;
            Shooter_Pivot.Inverted = true;

            Intake1.Inverted  = true;
            Agitator.Inverted = true;

            // Initializes the camera server with the default options.
            CameraServer.Instance.StartAutomaticCapture();
            //UsbCamera cam = new UsbCamera("cam0", 0);
            //cam.SetResolution(320, 240);
            //CameraServer.Instance.StartAutomaticCapture(cam);
            // Instantiates the NavX.
            NavX = new AHRS(SPI.Port.MXP);

            // Creates a new copy of the turntable.
            TurntableEncoder = new Encoder(8, 9);

            #region PID Controllers
            // Handles moving forwards and backwards for the shooter using the Pixy as the sensor.
            CamForward = new CamForwardPID(3.00, 0.00, 0.00, 0.00);

            // Handles the setpoint needed for the shooter using Pixy data.
            ShooterPos = new ShooterPosPID(3.00, 0.00, 0.00, 0.00);

            // Creates a new instance of the turn controller.
            TurnController = new TurningPID(new PIDF
            {
                kP = 0.0465, // 0.054
                kI = 0.00,
                kD = 0.00,
                kF = 0.00
            });

            // Sets the tolerance of the PID controller to 0.02.
            // Cancels the turning if the error is within 0.02.
            TurnController.Controller.SetAbsoluteTolerance(0.2);

            // Adds the PID controller to the Live Window for easier testing.
            LiveWindow.AddActuator("PID Controllers", "Turn Control", TurnController.Controller);
            #endregion
        }
Exemplo n.º 6
0
 public static void BeforeClass()
 {
     pdp = new PowerDistributionPanel();
 }
Exemplo n.º 7
0
 public PowerChannel(PowerDistributionPanel panel, int port, string name)
 {
     Panel = panel;
     Port  = port;
     Name  = name;
 }
Exemplo n.º 8
0
 public PowerSubsystem()
 {
     System.Console.WriteLine("Init power subsystem.");
     pdp = new PowerDistributionPanel();
 }
Exemplo n.º 9
0
 public static void BeforeClass()
 {
     pdp = new PowerDistributionPanel();
 }