Beispiel #1
0
task main() {
	float pointDistance[] = { 19.0, 10.0, 19.0, 10.0 };
	float totalDistance = 0.0;
	int i;

	startRobot();
	waitForStart();

	if (PLAY_SOUNDS == true) {
		PlaySound(soundBeepBeep);
	}

	if (WAIT_FOR_START == true) {
		wait1Msec(START_DELAY);
	}

	// Connor's portion
	for (i = 0; i < 4; i++) {
		if (i == 0 && ALT_ROUTE == true) {
			driveDistance(ALT_DISTANCE1, FORWARD, ADJ_NO);
			turnRobot(ALT_DEGREES, FORWARD, TURNTYPE_A);
			driveDistance(ALT_DISTANCE2, REVERSE, ADJ_NO);
		}
		else {
			driveDistance(pointDistance[i], DIRECTION_A, ADJ_YES);
		}
		totalDistance += pointDistance[i];

		if (QUICK_ROUTE == true || i == 3 || readIR(i+1) == true) {
			wait1Msec(250);
			servo[blockServo] = 80;
			servo[flagServo] = 65;
			wait1Msec(500);
			servo[blockServo] = 254;
			servo[flagServo] = 65;
			wait1Msec(250);
			break;
		}
	}

	// Devan's portion
	if (DIRECTION_A == DIRECTION_B) {
		driveDistance(CULM_DISTANCE - totalDistance, DIRECTION_B, ADJ_YES);
	}
	else {
		driveDistance(totalDistance - 6.5, DIRECTION_B, ADJ_NO);
	}
	turnRobot(TURN_DEGREES_B, DIRECTION_B, TURNTYPE_B);
	driveDistance(35.0, DIRECTION_B, ADJ_NO);
	turnRobot(TURN_DEGREES_B, DIRECTION_B, TURNTYPE_B);
	driveDistance(PARK_DISTANCE, DIRECTION_B, ADJ_NO);

	if (PLAY_SOUNDS == true) {
		PlaySound(soundBeepBeep);
		wait1Msec(500);
	}
}
Beispiel #2
0
/************************************************************
*  robot -
*/
int robot( char cmd, int index )
{
  int stat;
  
  if (stat = startRobot( cmd, index ))
  {
     fprintf(stdout,"ERROR%d\n", stat);
     fflush(stdout);
     return (stat);
  }

  if (stat = cmdAck(serialPort,600))   /* 10 min to timeout */
  {
     fprintf(stdout,"ERROR%d\n", stat);
     fflush(stdout);
     return(stat);
  }

  return (0);             /* nicely DONE */
}