Ejemplo n.º 1
0
task main()
{
  initializeRobot();

  waitForStart();

  moveforward();
  wait1Msec(1000);
  
  ereset();
 	
  moveforward();
  wait1Msec(300);
}
Ejemplo n.º 2
0
int make_square(char buf[80], int sock)
{
	int i;
	for(i = 0; i<4; i++)
	{
	moveforward(20, 50, buf, sock);
    turnNinety(2, buf, sock);
	}
}
Ejemplo n.º 3
0
int make_star(char buf[80], int sock)
{
	int i;
	for(i = 0; i<16; i++)
	{
	moveforward(20, 25, buf, sock);
    turn324deg(5, buf, sock);
	}
}
Ejemplo n.º 4
0
task main()
{
	initializeRobot();

	ereset();

	waitForStart();

	ch = 1;

	brake();
	wait1Msec(300);
	{
		motor[motorH] = 50;
		motor[motorI] = 50;
		wait1Msec(300);
		motor[motorH] = 0;
		motor[motorI] = 0;

		movebackward();
		wait1Msec(2000);

		servo[servo3] = 247;

		brake(); //temporary stop
		wait1Msec(300);

		turnleft(); //turn  left to face the center goal structure
		wait1Msec(1100);

		brake(); //temporary stop
		wait1Msec(100);

		turnright();
		wait1Msec(1100);

		brake();
		wait1Msec(100);

		movebackward();// move forward to the center goal structure
		wait1Msec(2525);

		brake();
		wait1Msec(1000);

		if (SensorRaw(irs) > 3 && SensorRaw(irs) < 7)//checks for the ir value to know if the center goal structure is at postion 1
		{ //center goal structure is in the 1

			moveforward(); // move forward to be adjacent to the kickstand
			wait1Msec(650);

			brake(); //temporary stop
			wait1Msec(50);

			turnright(); //turn right to face the kickstand
			wait1Msec(1550);

			brake(); //temporary stop
			wait1Msec(100);

			moveforward(); //moveforward to knock down the kickstand and to be adjacent to the ir beacon and center goal
			wait1Msec(1250);

			brake();
			wait10Msec(3000);

			motor[motorH] = -50;//resets the initialize
			motor[motorI] = -50;
			wait1Msec(300);
			motor[motorH] = 0;//stops the 80/20 so that it does not move
			motor[motorI] = 0;
		}

		else if(SensorRaw(irs) <= 3 || SensorRaw(irs) >= 7)//if the ir sensor senses a value between 3 and 7
		{ //center goal is in position 2/3
			movebackward();//move the robot back to be adjacent to the ir beacon
			wait1Msec(900);

			turnleft();//turns left to check for position 2.
			wait1Msec(900);

			movebackward();//moves abckwards to be next to the ir beacon
			wait1Msec(1250);

			ch = 0;//gives the integer chicks the value of of 0
		}

		if (SensorRaw(irs) >= 7 && SensorRaw(irs) <= 8)//if ir value is between 7 and 8
		{ //center goal structure is in the 3 position

			while(SensorRaw(irs) < 5)//if it senses a value less than 5 until it senses at 5
			{
				movebackward();
			}
			moveforward();//moves the robot forward to be adjacent to the
			wait1Msec(500);

			turnright();//turn right to face the kickstand
			wait1Msec(900);

			moveforward();//knocks down the kickstand
			wait1Msec(1000);
		}

		else
		{ //center goal structure is in the 2 position
			moveforward();//move forward to be adjacent to the kickstand
			wait1Msec(1259);

			turnright();//turn right to face the kickstand
			wait1Msec(1600);

			moveforward();//move forward to knock down the kickstand
			wait1Msec(1500);
		}
	}
}