void TeleopPeriodic()
	{
		Camera();
		DriveControl();
		PrimeMotors();
		Load();
		HighGoal();
		LowGoal();
		ReadDistance();
		UpdateServo();
	}
Beispiel #2
0
task main()
{
	initializeRobot();


	//while ( true ) {} //  FIXME: remove this!!!


	waitForStart();   // wait for start of tele-op phase


	//  FIXME: this worked!!!
	//MechanismElevatorTargetEncoder = kElevatorTargetMidDispenser;
	//StartTask(MechanismElevatorTargetTask);
	//wait10Msec(1000);



	//  FIXME: remove below 2 trash lines!!!
	//MechanismElevatorTarget(kElevatorTargetMidDispenser);   //  THIS WORKS FINE
	//wait10Msec(1000);



	while (true)
	{
		Controller primary, secondary;
		UpdatePrimaryController(primary);
		UpdateSecondaryController(secondary);

		if ( primary.isFresh || secondary.isFresh )
		{
		  DriveControl(primary);
		  MechanismControl(secondary);
    }

#ifdef DEBUG
		nxtDisplayCenteredTextLine(0, (string)nMotorEncoder[Elevator]);
    nxtDisplayCenteredTextLine(1, (string)motor[Elevator]);
#endif


		if ( MagnetBatonPresent() )
		{
			motor[IndicatorLight] = 100;  //  turn the light on
		}
		else
		{
			motor[IndicatorLight] = 0;
		}
	}
}
Beispiel #3
0
task main(){
	while(true)
	{
		//Handle reverse controls
		ProcessReverse();
		//Wheel Control
		WheelControl();
		//Drive Control
		DriveControl();
		//Dump Control
		DumpControl();
		//Arm Control
		ArmControl();
		//Shoot the servo
		ShootServo();
		//Controls servo in front for calc box
		Box();
	}
}
Beispiel #4
0
//Here, the distinctions between the autonomous personality and driver personality is defined.
task main()
{
	InitializeLCDScreen();
	InitializePIDControllers();
	InitializeDebugStream();
	InitializeTimers();
	InitializeEncoders();
	SenAutoPot = SensorValue(AutoSelector);
	UpdateAutonomousRoutine();
	while(true)
	{
		Input();
		if(!IsRobotDisabled) //Simulation Allowed but Competiton still works if defined
		{
			if (IsRobotInAutonomousMode || IsRobotInVirtualAutonomousMode ||
				(DriverMode != DriverJoystickControl && DriverMode != DriverMotorTest))
			{
				AutonomousControl();
				UpdateScreen(DispAutonomousMode);
				#ifdef LOGENCODERS
					LogEncoders();
				#endif
				if (!IsRobotInAutonomousMode)
					if (!JoystickCheck(true))
						IsRobotInVirtualAutonomousMode = false;
			}
			else
			{
				AutonomousStep=0;
				UpdateAutonomousRoutine();
				UpdateScreen(DispDriverMode);
				if (DriverMode == DriverJoystickControl)
				{
					AutonomousReset(Finish);
					SubroutineCheck();
					DriveControl();
					IntakeControl();
					LiftControl();
					DescorerControl();
				}
				else if (DriverMode == DriverMotorTest)
				{
					if (!JoystickCheck(false))
						DriverMode = DriverJoystickControl;
				}
			}
		}
		else
		{
			AutonomousStep=0;
			AutonomousReset(Finish);
			UpdateAutonomousRoutine();
			UpdateScreen(DispDisabledMode);
		}
		Output();
		MainNonDelayedLoopTime = time1[T4];
		while (time1[T4] < MinLoopMS) {}
		MainLoopTime = time1[T4];
		ClearTimer(T4);
	}
}