示例#1
0
task autonomous()
{
	/*while (bIfiAutonomousMode)
	{
		getInput();
		processAutonomous();
		//doOutput();
	}*/
	/*Drive(FORWARD);			//Drive
	Lift(UP);				//Raise Lift
	wait1Msec(2000);
	SingleTurnRight(127);	//Wiggle Right
	wait1Msec(700);
	Drive(STOP);
	wait1Msec(100);
	SingleTurnLeft(127);	//Wiggle Left
	wait1Msec(900);
	SingleTurnRight(127);	//Wiggle Back Right
	wait1Msec(200);
	Drive(FORWARD);			//Drive
	wait1Msec(700);
	SingleTurnRight(127);	//Turn More Right
	wait1Msec(500);
	Drive(FORWARD);			//Drive into goal
	wait1Msec(1500);
	Drive(BACKWARD);		//Back up a bit
	wait1Msec(500);
	Drive(STOP);
	Intake(OUT);			//Release the Muffins!
	wait1Msec(1500);
	wait1Msec(1500);
	Intake(OUT);
	wait1Msec(1500);

	Intake(STOP);*/

	Lift(UP);				//Raise Lift
	wait1Msec(1100);
	while(true)
	{
	Drive(FORWARD);			//Drive
	wait1Msec(1500);
	Drive(STOP);
  wait1Msec(500);
	Lift(20);				//Hold the cage up
	wait1Msec(500);
	Intake(OUT);			//Release the Muffins!
	wait1Msec(5000);
	Intake(STOP);
  Drive(BACKWARD);
  wait1Msec(1800);
  Drive(STOP);
                    //Again again!
  while (nLCDButtons == 0)
  {
  }
  wait1Msec(200);
  }

}
示例#2
0
void RedIsolationPickupAutonomous()
{
  SensorValue[Gyroscope] = 0;
  StartTask(KeepArmInPosition);

  armPosition = minArm;
  Intake(127);
  Forward(45, 125, "none");
  StopMoving();


  Backward(127, 90, "none");
  Intake(0);
  StopMoving();

  TurnLeftDegrees(40);

  armPosition = midGoalHeight;
  wait10Msec(70);
  Intake(127);
  Forward(100, 60, "none");
  StopMoving();
  armPosition = midGoalHeight - 100;
  wait10Msec(50);
  StopTask(KeepArmInPosition);

  StopArm();

  StartTask(StayInPosition);
  wait10Msec(500);
  Intake(0);
  wait10Msec(1000);
  StopTask(StayInPosition);
}
示例#3
0
void InteractionGoalAutonomous()
{
  SensorValue[Gyroscope] = 0;
  StartTask(KeepArmInPosition);
  Intake(127);
  armPosition = maxArm;
  wait10Msec(50);
  Intake(0);
  Forward(65, 70, "none");
  StopTask(KeepArmInPosition);
}
示例#4
0
void RedInteractionCurvyAutonomous()
{
  Intake(127);
  Forward(127, 40, "none");
  Intake(0);
  VariableMove(20, 127, 80);
  SensorValue[Gyroscope] = 0;
  Forward(127, 80, "none");
  StopMoving();
  StartTask(StayInPosition);
  wait10Msec(1500);
  StopTask(StayInPosition);
}
示例#5
0
//////////////////////////////////////////////////////////////////////////////////////
//                                                                                  //
//                                 Autony Mouses                                    //
//                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////
void InteractionInterceptionAutonomous()
{
  SensorValue[Gyroscope] = 0;
  Intake(127);
  Backward(127, 90, "none");
  StopMoving();
  Intake(0);
  StartTask(StayInPosition);
	wait10Msec(1500);
	StopTask(StayInPosition);
	Backward(127, 25, "none");
	StopMoving();
	StartTask(StayInPosition);
	wait10Msec(500);
	StopTask(StayInPosition);
}
示例#6
0
void IsolationBlockAutonomous()
{
  SensorValue[Gyroscope] = 0;
	StartTask(KeepArmInPosition);
	armPosition = midGoalHeight;
	wait10Msec(25);
	Intake(127);
	Forward(100, 80, "none");
	StopMoving();
	armPosition = midGoalHeight - 100;
	wait10Msec(80);
	StopTask(KeepArmInPosition);

  StopArm();

	StartTask(StayInPosition);
	wait10Msec(500);
	Intake(0);
	wait10Msec(1000);
	StopTask(StayInPosition);
}
示例#7
0
task usercontrol() // main task but for driver mode.
{
	while (true)
	{
		startTask(Pid);
		startTask(SpeedControls);
		Drive();
		Intake();
		flyWheelRun();
		Pnumatics();
	}
}
示例#8
0
void RedInteractionAntiWallBot2Autonomous()
{
  SensorValue[Gyroscope] = 0;
  StartTask(KeepArmInPosition);
  Intake(127);
  Forward(127, 20, "none");
  Intake(0);
  StopMoving();

  armPosition = 1200;
  VariableMove(127, -10, 90);
  StopMoving();

  turnLeft(127);
  wait10Msec(20);
  Forward(127, 40, "none");
  StopMoving();
  StartTask(StayInPosition);
  wait10Msec(2000);
  StopTask(StayInPosition);
  StopTask(KeepArmInPosition);
}
示例#9
0
task usercontrol()
{
	motor[port1] = 0;
	motor[port2] = 0;
	motor[port3] = 0;
	motor[port4] = 0;
	motor[port5] = 0;
	motor[port6] = 0;
	motor[port7] = 0;
	motor[port8] = 0;
	motor[port9] = 0;
	motor[port10] = 0;
	while(true)
	{
Wheels();
Intake();
FlyWheels();
	}
}
示例#10
0
task usercontrol() // main task but for driver mode.
{
	while (true)
	{
		if (time1[T1]>200)
		{
			Speed();
			resetTimer(T1);
			SensorValue[LeftSpeed] = 0;
			SensorValue[RightSpeed] = 0;
			if (time1[T4]>1000)
			{
				Pid();
			}
		}
		Drive();
		Intake();
		flyWheelRun();
		Pnumatics();
		SpeedControls();
		SpeedControls2();
	}
}
示例#11
0
void IsolationScoringAutonomous()
{
  SensorValue[Gyroscope] = 0;
	StartTask(KeepArmInPosition);

  armPosition = minArm;
  Intake(127);
  Forward(45, 135, "none");
  Backward(127, 35, "none");
  Intake(0);
  armPosition = midGoalHeight+50;
  Backward(127, 80, "none");
  StopMoving();

  while (SensorValue[Bump] == 0) {}

  Forward(65, 60, "none");
  StopMoving();
  wait10Msec(20);
  Intake(-127);
  wait10Msec(90);
  Intake(70);
  Backward(35, 30, "none");
  StopMoving();
  Intake(-127);
  wait10Msec(120);
  Intake(0);

  //VariableMove(-70, -20, 80);
  Backward(45, 20, "none");
  armPosition = minArm;
  Backward(45, 20, "none");
  StopMoving();
  wait10Msec(200);

  StopTask(KeepArmInPosition);

  StopArm();
}
示例#12
0
void ProgrammingSkillsAutonomous()
{
  armPosition = SensorValue[ArmPoten];
  SensorValue[Gyroscope] = 0;
  StartTask(KeepArmInPosition);

// A: Pick up stack at intersection
  armPosition = stackHeight;
  Intake(127);
  wait10Msec(40);
  Forward(45, 35, "none");

// B: Forward on line to doubler, pick up doubler, stop at intersection
  ForwardOnLine(45, 50, "none");
  Intake(0);
  ForwardOnLine(45, 100, "none");
  ForwardOnLine(45, 40, "none");  ///

  Intake(127);
  armPosition = minArm + 20;

  Forward(55, 100, "Intersection");
  StopMoving();
  armPosition = minArm + 100;
  Backward(45, 10, "Intersection"):
  Backward(45, 7, "none"):
  StopMoving();

// C: Turn 90° left to face 30" goal, forward, score doubler + 5 objects in 30" goal
  TurnLeftDegrees(91);
  Intake(0);
  armPosition = maxArm + 50;
  wait10Msec(100);
  Forward(50, 33.5, "none");
  StopMoving();
  Intake(-127);
  wait10Msec(60);
  Intake(-65);
  wait10Msec(60);
  Intake(-120);
  wait10Msec(40);
  Intake(-65);
  wait10Msec(60);
  Intake(-120);
  wait10Msec(80);
  // Intake(-127);
  // wait10Msec(250);
  Intake(0);

// D: Back up, lower arm, forward and pick up stack in front of 30" goal         //start of what grace programmed
  Backward(50, 50, "Intersection");
  wait10Msec(5);
  StopMoving();
  wait10Msec(20);
  armPosition = stackHeight + 20;
  wait10Msec(90);
  Intake(127);
  Forward(35, 28, "none"):
  StopMoving();

// E: Back up, turn 90° right to face 11.5" goal, score 11.5" goal
  Backward(35, 40, "Intersection");
  Backward(35, 8, "none");
  StopMoving();
  TurnRightDegrees(90);
  Intake(0);
  armPosition = lowGoalHeight;
  wait10Msec(20);
  Forward(35, 16, "none");
  StopMoving();
  wait10Msec(10);
  Intake(-85);
  wait10Msec(50);
  Intake(-0);
  wait10Msec(20);
  Intake(-85);
  wait10Msec(70);
  Intake(0);

// F: Back up to intersection, turn 90° right, forward a lot, pick up stack, score stack on 11.5" goal

  Backward(85, 30, "none");
  armPosition = stackHeight;
  // Backward(85, 50, "none");
  // Backward(65, 35, "none");
  // Backward(45, 40, "none");
  Backward(85, 120, "none");
  Backward(35, 70, "Intersection");
  wait10Msec(1);
  StopMoving();
  TurnRightDegrees(90);
  ForwardOnLine(35, 20, "none");
  ForwardOnLine(45, 80, "none");

  Intake(127);
  ForwardOnLine(45, 53, "none");

  // armPosition = stackHeight;////


  Forward(45, 40, "Intersection");
  StopMoving();
  armPosition = lowGoalHeight + 40;
  wait10Msec(40);
  Forward(45, 25, "none");
  StopMoving();
  Intake(-100);
  wait10Msec(55);
  Intake(-0);
  wait10Msec(20);
  Intake(-85);
  wait10Msec(55);
  Intake(0);

// G: Back up, pick up stack in front of 11.5" goal, back up to intersection, turn 90° left
  Backward(55, 28, "none");
  StopMoving();
  armPosition = stackHeight + 20;
  Intake(127);
  Forward(45, 40, "none");
  StopMoving();
  Backward(55, 60, "Intersection");
  Backward(45, 5, "none");
  StopMoving();
  TurnLeftDegrees(90);
  Backward(85, 40, "none");
  StopMoving();
  Intake(0);

//======================================== PART 2 ===============================================================

  while (SensorValue[Bump] == 0) {}

// A2: Go forward
  SensorValue[Gyroscope] = 0;
  Forward(50, 30, "none");

// B2: Forward on line to doubler, pick up doubler, stop at intersection
  ForwardOnLine(45, 130, "none");

   // ForwardOnLine(45, 20, "none");///

  Intake(127);
  armPosition = minArm + 40;
  Forward(55, 100, "Intersection");
  StopMoving();
  armPosition = minArm + 120;
  Backward(45, 10, "Intersection"):
  Backward(45, 5, "none"):
  StopMoving();

// C2: Turn 90° right to face 30" goal, forward, score doubler + 5 objects in 30" goal
  Intake(0);
  TurnRightDegrees(91);
  // Intake(0);
  StartTask(KeepArmInPosition);
  armPosition = maxArm + 50;
  wait10Msec(90);
  Forward(40, 40.5, "none");
  StopMoving();
  Intake(-100);
  wait10Msec(60);
  Intake(-55);
  wait10Msec(90);
  Intake(-100);
  wait10Msec(50);
  Intake(-55);
  wait10Msec(60);
  Intake(0);

// D2: Back up, lower arm, forward and pick up stack in front of 30" goal
  Backward(55, 50, "Intersection");
  StopMoving();
  wait10Msec(20);
  armPosition = stackHeight;
  wait10Msec(100);
  Intake(127);
  Forward(45, 22, "none"):
  StopMoving();

// E2: Back up, turn 180° left to face 20" goal, forward and pick up 2 objects
  Backward(55, 50, "Intersection");
  StopMoving();
  TurnLeftDegrees(186);
  Intake(0);
  armPosition = stackHeight + 180;
  wait10Msec(10);
  Intake(127);
  Forward(55, 14, "none");
  StopMoving();
  wait10Msec(5);
  armPosition = stackHeight + 300;
  Backward(55, 6, "none");
  armPosition = minArm + 60;
  wait10Msec(5);
  Forward(55, 30, "none");
  Backward(55, 20, "none");
  StopMoving();

//F2: Raise arm to midgoal height, score 2 and 2 on 20" goals
  armPosition = midGoalHeight + 40;
  wait10Msec(100);
  Intake(0);
  Forward(55, 13, "none");
  StopMoving();
  wait10Msec(10);
  Intake(-95);
  wait10Msec(300);

  /*
  wait10Msec(80);
  Intake(100);
  Forward(55, 27, "none");
  StopMoving();
  Intake(-95);
  wait10Msec(160);
  */

  StopTask(KeepArmInPosition);

}
示例#13
0
task usercontrol()
{
  // StartTask(KeepArmInPosition);
  armPosition = SensorValue[ArmPoten];
  while (true)
  {
//  #########################################-  Arm and Intake -########################################################

    // if (!armPositionTaskActive) LiftArm(127 * vexRT[Btn5U] - 127 * vexRT[Btn5D]);                      //Main joystick Control
    // Intake(127 * vexRT[Btn6U] - 127 * vexRT[Btn6D]);

    // if (!armPositionTaskActive) LiftArm(vexRT[Ch3Xmtr2]);                                              //Partner joystick Control
    // Intake(vexRT[Ch2Xmtr2]);

    if (!armPositionTaskActive) LiftArm(vexRT[Ch3Xmtr2] + 127 * vexRT[Btn5U] - 127 * vexRT[Btn5D]);       //Dual Control
    Intake(vexRT[Ch2Xmtr2] + 127 * vexRT[Btn6U] - 127 * vexRT[Btn6D]);

//  ############################################-  Drive -##############################################################

	  motor[FrontLeft] = abs(vexRT[Ch3]+vexRT[Ch1]) > 10 ? vexRT[Ch3]+vexRT[Ch1] : 0;
	  motor[BackLeft] = abs(vexRT[Ch3]+vexRT[Ch1]) > 10 ? vexRT[Ch3]+vexRT[Ch1] : 0;
	  motor[FrontRight] = abs(-vexRT[Ch3]+vexRT[Ch1]) > 10 ? -vexRT[Ch3]+vexRT[Ch1] : 0;
	  motor[BackRight] = abs(-vexRT[Ch3]+vexRT[Ch1]) > 10 ? -vexRT[Ch3]+vexRT[Ch1] : 0;

//  ##########################################- Arm Presets -###########################################################

    if (vexRT[Btn5DXmtr2] == 1)
      MoveArmToPreset(stackHeight);
    if (vexRT[Btn5UXmtr2] == 1)
      MoveArmToPreset(lowGoalHeight);
    if (vexRT[Btn6UXmtr2] == 1)
      MoveArmToPreset(midGoalHeight);
		if (vexRT[Btn6DXmtr2] == 1)
      MoveArmToPreset(maxArm);

    if (vexRT[Btn8U] == 1)
      armPosition = maxArm;
    if (vexRT[Btn8L] == 1)
      armPosition = midGoalHeight;
    if (vexRT[Btn8R] == 1)
      armPosition = lowGoalHeight;
    if (vexRT[Btn8D] == 1)
      armPosition = minArm;

    if (abs(vexRT[Ch3Xmtr2]) > 20) // || time10(T2) > armPresetTimer)
    {
      StopTask(KeepArmInPosition);
      armPositionTaskActive = false;
    }


    if (vexRT[Btn7U] == 1) ProgrammingSkillsAutonomous();
    if (vexRT[Btn7D] == 1)
    {
      Forward(127, 40, "none");
		  VariableMove(127, 20, 70);
		  Forward(127, 120, "none");
		  StopMoving();
		  StartTask(StayInPosition);
		  wait10Msec(1500);
		  StopTask(StayInPosition);
    }
    if (vexRT[Btn7R] == 1) {TurnLeftDegrees(90); wait10Msec(50); }
    if (vexRT[Btn8L] == 1) {TurnRightDegrees(90); wait10Msec(50); }

  }
}
示例#14
0
 // First time this trading symbol occurs
 SymbolMetrics( const Trade& trade ) :
    SymbolMetrics()
 {
    m_lastTimeOccurence = trade.GetTimestamp();
    Intake( trade );
 }
示例#15
0
 void Intake( const std::vector< Trade >& trades )
 {
    for( const auto& trade : trades )
       Intake( trade );
 }