Example #1
0
 public void robotClimb(double value)
 {
     if ((value <= 1.0) && (value >= -1.0))
     {
         motorRobotClimb.SetSpeed(value);
     }
     else
     {
         Console.WriteLine("INVALID value: " + value.ToString());
     }
 }
Example #2
0
 public void shootBall(double value)
 {
     if ((value <= 1.0) && (value >= -1.0))
     {
         motorBallShoot.SetSpeed(-value);
     }
     else
     {
         Console.WriteLine("INVALID value: " + value.ToString());
     }
 }
Example #3
0
 public void readyBall(int clockwise, double value)
 {
     if ((value <= 1.0) && (value >= -1.0))
     {
         motorBallReady.SetSpeed(value * clockwise);
     }
     else
     {
         Console.WriteLine("INVALID value: " + value.ToString());
     }
 }
Example #4
0
        /// <summary>
        /// This function is called periodically during operator control
        /// </summary>
        public override void TeleopPeriodic()
        {
            //while teleop is enabled, and the drivestation is enabled, run this code

            while (IsOperatorControl && IsEnabled)
            {
                //clear out values for new run
                SmartDashboard.PutString("DB/String 3", "");


                if (stick.GetRawButton(5))
                {
                    drive.TankDrive(stick.GetRawAxis(5), stick.GetRawAxis(1));
                }
                else
                {
                    if (!stick.GetRawButton(6))
                    {
                        drive.TankDrive(stick.GetRawAxis(5) / 1.3, stick.GetRawAxis(1) / 1.3);
                    }
                    else
                    {
                        drive.TankDrive(-stick.GetRawAxis(1) / 1.3, -stick.GetRawAxis(5) / 1.3);
                    }
                }



                SmartDashboard.PutNumber("DB/String 0", stick.GetRawAxis(5));
                SmartDashboard.PutNumber("DB/String 1", stick.GetRawAxis(1));



                //stick.GetRawButton(0) should be the "a" button
                //GetRawButton(1) should be "b"
                double speed = 0.0;
                // if (stick.GetRawButton(8))
                //{

                if (stick.GetRawButton(1) || stick.GetRawButton(2))
                {
                    speed += (stick.GetRawButton(1) ? 0.5 : 0.0);
                    speed += (stick.GetRawButton(2) ? 0.5 : 0.0);
                }
                //}
                climber.SetSpeed(-speed);

                getRope.SetSpeed(stick.GetRawAxis(2) / 2 - stick.GetRawAxis(3) / 2);
                //create a delay of .1 second
                Timer.Delay(0.1);
            }
        }
Example #5
0
        public void drivingMotorControlRaw(string where, double value)
        {
            switch (where)
            {
            case "left":
                motorFrontLeft.SetSpeed(value);
                motorRearLeft.SetSpeed(value);
                break;

            case "right":
                motorFrontRight.SetSpeed(value);
                motorRearRight.SetSpeed(value);
                break;

            default:
                Console.WriteLine("no method for " + where);
                break;
            }
        }
Example #6
0
 public void climb(double a)
 {
     motorClimb.SetSpeed(1 * a * RobotMap.robotClimbSpeedConstant);
 }
Example #7
0
 public void gearIntake(double a)
 {
     motorGearIntake.SetSpeed(((a > 0)?1:-1) * ((System.Math.Abs(a) > 1)?1:System.Math.Abs(a)) * RobotMap.gearIntakeSpeedConstant);
 }
Example #8
0
 public void gearUp(double a)
 {
     motorGearUp.SetSpeed(1 * a * RobotMap.gearUpSpeedConstant);
 }