示例#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);
	}
}
示例#2
0
文件: 1-3.c 项目: sorig-UCL/comp1010
void drawStar(double size)
{
    int i;
    for (i = 0; i<5; i++)
    {
        driveRobot(size, 60, 1.0);
        stopMotorsAndWait(1);
        if (i < 4) {            
            turnRobot(144);
        }        
    }    
}
示例#3
0
文件: 1-3.c 项目: sorig-UCL/comp1010
void drawSquare(double size)
{
    int i;
    for (i = 0; i < 4; i++)
    {
        driveRobot(size, 60, 1.0);
        stopMotorsAndWait(1);
        if (i < 3) {            
            turnRobot(90);
        }
    }
}
示例#4
0
文件: 1-3.c 项目: sorig-UCL/comp1010
void drawTriangle(double size)
{
    int i;
    for (i = 0; i < 3; i++)
    {
        driveRobot(size, 60, 1.0);
        stopMotorsAndWait(1);
        if (i < 2) {            
            turnRobot(120);
        }        
    }    
}