Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        public override void TeleopPeriodic()
        {
            Scheduler.Instance.Run();
            Joystick stick = Oi.Pilot;
            //train._drive.ArcadeDrive(1, 1);

            stick.SetRumble(RumbleType.LeftRumble, stick.GetRawAxis(XboxMap.LeftTrigger));
            stick.SetRumble(RumbleType.RightRumble, stick.GetRawAxis(XboxMap.RightTrigger));

            SmartDashboard.PutNumber("POV", Oi.Pilot.GetPOV(0));
			SmartDashboard.PutString("Drive Mode", Oi.DriveStyle.ToString());
			SmartDashboard.PutString("Gear", Oi.ShifterGear.ToString());

            SmartDashboard.PutData("Compressor On", new CompressorOnCommand());
            SmartDashboard.PutData("Compressor Off", new CompressorOffCommand());

            Air.Update();
            Match.Update();
            Power.Update();

        }
Ejemplo n.º 3
0
        /// <summary>
        /// This function is called periodically during test mode
        /// </summary>
        public override void TestPeriodic()
        {
            time.Stop();
            elapsedTimes = 0;
            if (elapsed)
            {
                if (stick.GetRawButton(1))
                {
                    SmartDashboard.PutString("DB/String 3", SmartDashboard.GetString("DB/String 3", "") + char.ToString('a'));
                    //Console.WriteLine('a');
                    testTime.Stop();
                    testTime.Start();
                    flag = 'a';
                    drive.TankDrive(-.6, -.6);
                }
                else if (stick.GetRawButton(2))
                {
                    SmartDashboard.PutString("DB/String 3", SmartDashboard.GetString("DB/String 3", "") + char.ToString('b'));
                    //Console.WriteLine('b');
                    testTime.Stop();
                    testTime.Start();
                    flag = 'b';
                    drive.TankDrive(.6, .6);
                }
                else if (stick.GetRawButton(3))
                {
                    SmartDashboard.PutString("DB/String 3", SmartDashboard.GetString("DB/String 3", "") + char.ToString('x'));
                    //Console.WriteLine('x');
                    testTime.Stop();
                    testTime.Start();
                    flag = 'x';
                    drive.TankDrive(.6, -.6);
                }
                else if (stick.GetRawButton(4))
                {
                    SmartDashboard.PutString("DB/String 3", SmartDashboard.GetString("DB/String 3", "") + char.ToString('y'));
                    //Console.WriteLine('y');
                    testTime.Stop();
                    testTime.Start();
                    flag = 'y';
                    drive.TankDrive(-.6, .6);
                }
                else
                {
                    drive.TankDrive(0f, 0f);
                }
            }

            else
            {
                if (flag == 'a')
                {
                    drive.TankDrive(-.6, -.6);
                }
                else if (flag == 'b')
                {
                    drive.TankDrive(.6, .6);
                }

                else if (flag == 'x')
                {
                    drive.TankDrive(.6, -.6);
                }
                else if (flag == 'y')
                {
                    drive.TankDrive(-.6, .6);
                }
            }
        }