Пример #1
0
        //is that ; supposed to be there?

        private LED()
        {
            lightie_boies = Robotmap.GETCANController();

            // H-Hewo?? somewon pwease hewlp me
            // I'm havwing a wittle bit of twobule figuwring out what to do next 3;
        }
Пример #2
0
        private void Start() //Sets motor speed
        {
            //Lower sensor says when a ball passes through a the tube and incruments the ball
            //upper sensor tells us tha twe have balls in the tube.
            Robotmap map = Robotmap.GetInstance();

            transferMotor.Set(CTRE.Phoenix.MotorControl.ControlMode.PercentOutput, transferMotorSpeed);
            bool ballPresent = IsLowerSensorTripped();

            if (ballPresent)
            {
                numberOfBalls += 1;
            }
            bool ballPresentTop = IsUpperSensorTripped();

            if (!ballPresentTop && numberOfBalls > 0)
            {
                numberOfBalls = 0;
            }
            if (numberOfBalls == 0)
            {
                glowing.set_color(LED.MECHANISM_LED.GREEN);
                eject.setState(Intake.INTAKESTATE.Sweep);
            }
            else if (numberOfBalls == 1)
            {
                glowing.set_color(LED.MECHANISM_LED.YELLOW);
                eject.setState(Intake.INTAKESTATE.Sweep);
            }
            else
            {
                glowing.set_color(LED.MECHANISM_LED.RED);
                eject.setState(Intake.INTAKESTATE.Expel);
            }
        }
Пример #3
0
        private Deliver() //constructor same name as class name
        {                 //Defining the servo
            Robotmap map = Robotmap.GetInstance();

            deliverServo   = Robotmap.GETCANController();
            m_currentState = DELIVERSTATE.HoldBalls;
        }
Пример #4
0
        private Intake()
        {
            Robotmap map = Robotmap.GetInstance();

            intakeMotor = new TalonSRX(map.GetIntake_ID()); // Creates the TalonSRX motor.
            intakeMotor.SetInverted(true);                  // If you get value i will invert it. if it is going the wrong way it can be inverted.
            m_currentState = INTAKESTATE.Off;
        }
Пример #5
0
 // Create/Return Robotmap Singleton
 public static Robotmap GetInstance()
 {
     if (instance == null)
     {
         instance = new Robotmap();
     }
     return(instance);
 }
Пример #6
0
        private void OpenGrabber()
        {
            Robotmap map        = Robotmap.GetInstance();
            float    pulses     = LinearInterpolation.Calculate(OPENGRABBER, -1.0f, minPWMSignalRange, 1.0f, maxPWMSignalRange);
            float    percentOut = pulses / pwmOutput;

            CANController.SetPWMOutput(map.GetFlagGrabberServo_ID(), pulses); //move servo
        } //FLAGSURVO LOOK LOOK LOOOK LOOK LOOK LOOK LOOK DO THIS FIX IT HE SHOWED YOU YOU GOTTA DO IT LLLLLLOOOOOOOOOOOK
Пример #7
0
        private void CloseGrabber()
        {
            Robotmap map        = Robotmap.GetInstance();
            float    pulses     = LinearInterpolation.Calculate(CLOSEGRABBER, -1.0f, minPWMSignalRange, 1.0f, maxPWMSignalRange);
            float    percentOut = pulses / pwmOutput;

            CANController.SetPWMOutput(map.GetFlagGrabberServo_ID(), percentOut); //move servo
        }
Пример #8
0
        private void deliver()
        {
            Robotmap map        = Robotmap.GetInstance();
            float    pulses     = LinearInterpolation.Calculate(DELIVER, -1.0f, minPWMSignalRange, 1.0f, maxPWMSignalRange);
            float    percentOut = pulses / pwmOutput;

            deliverServo.EnablePWMOutput((int)map.GetDeliverMec_ID(), true);
            deliverServo.SetPWMOutput(map.GetDeliverMec_ID(), percentOut); //move servo
        }
Пример #9
0
        // Create/Return CANifier Singleton
        public static CANifier GETCANController()
        {
            Robotmap map = Robotmap.GetInstance();

            if (m_canifier == null)
            {
                m_canifier = new CANifier((ushort)map.GetCANIFIER_ID());
            }
            return(m_canifier);
        }
Пример #10
0
        private FlagGrabber()

        {
            Robotmap theWholeShabang = Robotmap.GetInstance();

            CANController = Robotmap.GETCANController();
            CANController.EnablePWMOutput((int)theWholeShabang.GetFlagGrabberServo_ID(), true); //move servo

            m_currentState = FlagGrabberSTATE.GRABBER_OPEN;
        }
Пример #11
0
        private Transfer()
        {
            Robotmap map = Robotmap.GetInstance();

            transferMotor = new TalonSRX(map.GetTransfer_ID()); //Creates the motor
            transferMotor.SetInverted(true);

            CANController = Robotmap.GETCANController(); //Creates the first sensor

            numberOfBalls = 0;                           //The original amount of balls

            glowing = LED.GetInstance();

            m_currentState = TRANSFER_STATE.TRANSFER_OFF;
            eject          = Intake.GetInstance();
        }
Пример #12
0
        private Chassis()
        {
            Robotmap map = Robotmap.GetInstance();

            //Constants for variables to use
            left_motor = new TalonSRX(map.GetLeftDrive_ID());
            left_motor.SetNeutralMode(NeutralMode.Brake);
            left_motor.SetInverted(true); // Can invert the direction the motors are moving

            right_motor = new TalonSRX(map.GetRightDrive_ID());
            right_motor.SetNeutralMode(NeutralMode.Brake);
            right_motor.SetInverted(false);                      // Can invert the direction the motors are moving

            drive_assister = new PigeonIMU(map.Get_ID_Pigeon()); //TODO Get real name of pigeon from Christina

            bumper_switch = Robotmap.GETCANController();
        }
Пример #13
0
        public bool IsUpperSensorTripped()
        {
            Robotmap map = Robotmap.GetInstance();

            return(CANController.GetGeneralInput(map.GetUpperSensor_ID())); // sensors are being wired in reverse
        }
Пример #14
0
        public bool Is_Bumper_Switch_Pressed()
        {
            Robotmap map = Robotmap.GetInstance();

            return(!bumper_switch.GetGeneralInput(map.GetBumperSensor_ID()));  //Finds if bumper switch is pressed (wired in reverse)
        }