task main()
{
  initializeRobot();

  State currentState;
  memset(&currentState, 0, sizeof(State));

  //waitForStart(); // Wait for the beginning of autonomous phase.

  while (currentState.IRBeaconDir != 8)
  {
  	getLatestInput(&currentState);
  	handleIRInputs(&currentState);
  	updateAllMotors(&currentState);
  }

  while (currentState.touched != 1)
  {
  	getLatestInput(&currentState);
  	handleColorInputs(&currentState);
  	handleTouchInputs(&currentState);
  	updateAllMotors(&currentState);
	}
}
Пример #2
0
task main()
{
	initializeRobot();

	State actualState;
	State desiredState;

	// Initialize everything in the desired state to 0.
	memset(&desiredState, 0, sizeof(desiredState));
	desiredState.wristPosition = 100;
	desiredState.desiredDriveSpeed = DRIVESPEED;

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

	while (true)
	{
		// Wait for the next update from the joystick.
		UserInput input;
		getLatestInput(&desiredState, &input);

		// Process the joystick input
		handleDriveInputs(&desiredState, &input);
		handleArmInputs(&desiredState, &input);
		handleWristInputs(&desiredState, &input);
		handleLiftInputs(&desiredState, &input);
		handleTineInputs(&desiredState, &input);
		handleOutriggerInputs(&desiredState, &input);

		computeDriveMotorSpeeds(&desiredState);
		computeActualState(&desiredState, &actualState);

		updateAllMotors(&actualState);

		// Display variable values for debugging purposes
		showDiagnostics(&desiredState, &actualState, &input);
	}
}