Пример #1
0
task main()
{
	nxtState currentState;
	initialize(currentState);

	while(true){
		updateInput(currentState);
		updateRobot(currentState);
		showDiagnostics(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);
	}
}