Exemplo n.º 1
0
/// update - should be called at 10hz
void AP_LandingGear::update()
{
    // if there is a force deploy active, disable retraction, then reset force deploy to consume it
    // gear will be deployed automatically because _retract_enabled is false.
    // this will disable retract switch until it is cycled through deploy position
    if ( _force_deploy){
            enable(false);
            force_deploy(false);
        }

    if (!_retract_enabled) {
        // force deployment if retract is not enabled
        deploy();
        // retract is disabled until switch is placed into deploy position to prevent accidental retraction on bootup if switch was left in retract position
        enable(_command_mode == LandingGear_Deploy);
        return;
    }

    if (_command_mode == LandingGear_Deploy){
        deploy();
    }

    if (_command_mode == LandingGear_Retract){
        retract();
    }    
}
void redDevansh() // Places preload (1-2) + 2 buckies (2-4) + TURN LEFT Knocks buckies (1-6)
{
	deploy();
	intake(1);
	wait10Msec(10);
	moveStraight(1, 0, 455); //picks up
	wait10Msec(50);
	moveStraight(-1, 0, 475);//comes back
	intake(0);
			// end part 1: prepare dump
	waitForButton();
	lift(BUMP);
	holdArm();
	intake(-1);
	resetValues(1200);
		// end part 2: dump
	waitForButton();
	liftDown();
	wait10Msec(100);
	moveStraight(1, 0, 700);
		// end part 3: prepare hit
	spin(-1, 0, 200);
	intake(-1);
	lift(BUMP);
	holdArm();
	noRamp(1, 250);
	resetValues(0);
		// end part 4: hit
}
	/* Psuedocode
			 Ramp Forward -> [Cross Barrier] -> Raise Arm HIGH -> Hold Arm HIGH -> Ramp Zero -> [Reach Goal] -> Outtake -> [Finish Outtake]
			 	-> Stop Intake -> Ramp Forward -> Ramp Zero -> [Reach Barrier] -> Lower Arm LOW -> Ramp Backward -> [Reach Square] -> Hard Zero
			 Wait Until Press -> Raise Arm BARRIER -> Hold Arm BARRIER -> Ramp Forward -> Ramp Zero -> [Reach Barrier] -> Ramp Backward
			 	-> [Reach Square] -> Hard Zero -> Wait Until Press -> Ramp Forward -> Ramp Zero -> [Reach Barrier]
	*/
	void Alex() // Caches preload (5) + Knocks 2 big balls (10)
	{
		deploy();
		moveStraight(1, 0, 1600); // 1600 is just before goal
		lift(HIGH); // nearest 100
		holdArm();
		moveStraight(1, 0, 300); // reaches goal
		//wait1Msec(1000);
		intake(-1);
		wait1Msec(500); // outtake
		intake(0);
		moveStraight(-1, 0, 400); //move back away from goal...Apparently Safety is greater than move forward
		liftDown();
		moveStraight(-1, 0, 1500);
		waitForButton();
		lift(BARRIER);
		holdArm();
		intake(-1);
		moveStraight(1, 0, 550); //estimated guess based on 10Q's values
		wait1Msec(300);
		moveStraight(-1, 0, 550);
		waitForButton();
		moveStraight(1, 0, 950);
		wait1Msec(300);
		moveStraight(-1, 0, 950);
		resetValues(100);
	}
void redUdit()
{
	deploy();
	intake(true);
	wait10Msec(10);
	moveStraight(1, 0, 475);
	wait10Msec(50);
	moveStraight(-1, 0, 475);
	//stopIntake();
	lift(BUMP);
	holdArm();
	waitForButton();
	intake(false);
	wait10Msec(100);
	waitForButton();
	resetValues(0);
	liftDown();
	// end Devansh
	waitForButton();
	intake(true);
	moveStraight(1, 0, (HALF_TILE));
	wait10Msec(50);
	pickUpBall(1);
	spin(-1, 0, 200);
	crossBump();
	lift(BARRIER);
	holdArm();
	wait10Msec(30);
	moveStraight(1, 0, 550);
	intake(false);
	// end udit
	resetValues(1000);
}
void redDevansh() // Places preload (1-2) + 2 buckies (2-4) + TURN LEFT Knocks buckies (1-6) + Places two Balls (2)
{
	deploy();
	intake(true);
	wait10Msec(10);
	moveStraight(1, 0, 475);
	wait10Msec(50);
	moveStraight(-1, 0, 475);
	//stopIntake();
	lift(BUMP);
	holdArm();
	waitForButton();
	intake(false);
	wait10Msec(100);
	waitForButton();
	resetValues(0);
	liftDown();
	// end Devansh
	waitForButton();
	intake(true);
	moveStraight(1, 0, (HALF_TILE));
	wait10Msec(50);
	pickUpBall(1);
	spin(-1, 0, 200);
	crossBump();
	lift(BARRIER);
	holdArm();
	wait10Msec(30);
	moveStraight(1, 0, 550);
	intake(false);
	// end udit
	resetValues(1000);
}
/* Psuedocode
Ramp Forward -> [Cross Barrier] -> Raise Arm HIGH -> Hold Arm HIGH -> Ramp Zero -> [Reach Goal] -> Outtake -> [Finish Outtake]
-> Stop Intake -> Ramp Forward -> Ramp Zero -> [Reach Barrier] -> Lower Arm LOW -> Ramp Backward -> [Reach Square] -> Hard Zero
Wait Until Press -> Raise Arm BARRIER -> Hold Arm BARRIER -> Ramp Forward -> Ramp Zero -> [Reach Barrier] -> Ramp Backward
-> [Reach Square] -> Hard Zero -> Wait Until Press -> Ramp Forward -> Ramp Zero -> [Reach Barrier]
*/
void Alex() // Caches preload (5) + Knocks 2 big balls (10)
{
	deploy();
	moveStraight(1, 0, 1550); // 1600 is just before goal...changed for some reason
	lift(HIGH); // only accurate to the nearest 100... may need to adjust HIGH value
	holdArm();
	moveStraight(1, 0, 300); // reaches goal
	//wait1Msec(1000);
	intake(false);
	wait1Msec(1000); // outtake
	stopIntake();
	moveStraight(-1, 0, 400); // move back away from goal...Apparently Safety is greater than move forward
	liftDown();
	moveStraight(-1, 0, 1500);
	waitForButton();
	lift(BARRIER);
	holdArm();
	intake(false);
	moveStraight(1, 0, 550); // estimated guess based on 10Q's values - WORKS
	wait1Msec(300);
	moveStraight(-1, 0, 550);
	waitForButton();
	moveStraight(1, 0, 950); // A bit of trouble... Not sure if you want to spin rollers for this hit...
	wait1Msec(300); // outtaking pushes the ball away + needs good aiming
	moveStraight(-1, 0, 950);
	resetValues(100);
}
Exemplo n.º 7
0
task autonomous()
{
	deploy();
	while(true)
	{
		if(SensorValue[waitingButtonRed] == 1)
		{
			if(SensorValue[AutonSelect] < ALEX)
			{
				Alex(); // 15 middle zone
			}
			else if(SensorValue[AutonSelect] < UDIT)
			{
				RedUdit(); // projected 30 pts + spare change (6-14)
			}
			else if(SensorValue[AutonSelect] < DEVANSH)
			{
				skills(); // safe 3-6
		 	}
			else{}
			break;
		}
		else if(SensorValue[waitingButtonBlue] == 1)
		{
			if(SensorValue[AutonSelect] < ALEX)
			  Alex();
			else if(SensorValue[AutonSelect] < UDIT)
				blueUdit();
			else if(SensorValue[AutonSelect] < DEVANSH)
				skills();
			else{}
			break;
		}
	}
}
Exemplo n.º 8
0
	void Alex2() // Knocks 2 big balls (10) then caches preload
	{
		deploy();

		lift(BARRIER);
		holdArm();
		intake(-1);
		moveStraight(1, 0, 580); //estimated guess based on 10Q's values
		wait1Msec(300);
		//moveStraight(-1, 0, 550);
		moveStraight(-1, 0, 580);

		waitForButton();
		moveStraight(1, 0, 950);
		wait1Msec(300);
		//moveStraight(-1, 0, 950);
		moveStraight(-1, 0, 950);
		resetValues(100);

		waitForButton();
		moveStraight(1, 0, 1420); // maintenence and recalibrating needed
		lift(HIGH); // nearest 100
		holdArmHigh();
		moveStraight(1, 0, 500); // reaches goal
		//wait1Msec(1000);
		intake(-1);
		wait1Msec(500); // outtake
		moveStraight(-1, 0, 400); //move back away from goal...Apparently Safety is greater than move forward
		motor[LeftArm] = motor[RightArm] = -127;
		wait1Msec(800);
		motor[LeftArm] = motor[RightArm] = 0;
			// end score bucky
		moveStraight(-1, 0, 1300); // now user readjust for first ball
	}
Exemplo n.º 9
0
	void AlexAlt() // Caches preload (5) + Knocks 2 big balls (10)
	{
		deploy();
		moveStraight(1, 0, 1600); // maintenence and recalibrating needed
		liftTime(1,300);
		holdArmHigh();
		moveStraight(1, 0, 650); // reaches goal
		//wait1Msec(1000);
		intake(-1);
		wait1Msec(500); // outtake
		moveStraight(-1, 0, 400); //move back away from goal...Apparently Safety is greater than move forward
		liftDown();
			// end score bucky
		moveStraight(-1, 0, 1400); // now user readjust for first ball
		waitForButton();
		lift(BARRIER);
		holdArm();
		intake(-1);
		moveStraight(1, 0, 580); //estimated guess based on 10Q's values
		wait1Msec(300);
		//moveStraight(-1, 0, 550);
		moveStraight(-1, 0, 580);
		waitForButton();
		moveStraight(1, 0, 950);
		wait1Msec(300);
		//moveStraight(-1, 0, 950);
		moveStraight(-1, 0, 950);
		resetValues(100);
	}
void redUdit()
{
	deploy();
	intake(1);
	wait10Msec(10);
	moveStraight(1, 0, 475); //picks up
	wait10Msec(50);
	moveStraight(-1, 0, 475);//comes back
	//intake(0)();
	spin(1, 0, 400);
	lift(BUMP);
	holdArm();
	waitForButton();
	intake(-1);
	wait10Msec(100);
	resetValues(0);
	liftDown(); // added
	// end Devansh
	waitForButton();
	intake(1);
	moveStraight(1, 0, (HALF_TILE));
	wait10Msec(50);
	pickUpBall(1);
	spin(-1, 0, 200);
	crossBump();
	lift(BARRIER);
	holdArm();
	wait10Msec(30);
	moveStraight(1, 0, 550);
	intake(-1);
	// end udit
	resetValues(1000);
}
Exemplo n.º 11
0
/// initialise state of landing gear
void AP_LandingGear::init()
{
    if (_pin_deployed != -1) {
        hal.gpio->pinMode(_pin_deployed, HAL_GPIO_INPUT);
        // set pullup/pulldown to default to non-deployed state
        hal.gpio->write(_pin_deployed, !_pin_deployed_polarity);
        log_wow_state(wow_state_current);
    }
    
    if (_pin_weight_on_wheels != -1) {
        hal.gpio->pinMode(_pin_weight_on_wheels, HAL_GPIO_INPUT);
        // set pullup/pulldown to default to flying state
        hal.gpio->write(_pin_weight_on_wheels, !_pin_weight_on_wheels_polarity);
        log_wow_state(wow_state_current);
    }
    
    switch ((enum LandingGearStartupBehaviour)_startup_behaviour.get()) {
        default:
        case LandingGear_Startup_WaitForPilotInput:
            // do nothing
            break;
        case LandingGear_Startup_Retract:
            retract();
            break;
        case LandingGear_Startup_Deploy:
            deploy();
            break;
    }
}
Exemplo n.º 12
0
	void BlueSai() //potential 20pt auton
	{
		deploy();

		// go for second ball knockdown
		noRamp(1,1800);


	}
	void Udit()
	{
		deploy();
		intake(true);
		moveStraight(1, 0, 150);
		wait10Msec(30);
		moveStraight(-1, 0, 150);
		lift(BUMP);
		moveStraight(-1, 0, 150);
		setRight(127); setLeft(127);
	}
Exemplo n.º 14
0
/// set landing gear position to retract, deploy or deploy-and-keep-deployed
void AP_LandingGear::set_position(LandingGearCommand cmd)
{
    switch (cmd) {
        case LandingGear_Retract:
            retract();
            break;
        case LandingGear_Deploy:
            deploy();
            break;
    }
}
Exemplo n.º 15
0
int
main(void)
{
	/* graceful exit */
	atexit(cleanup);

	if (deploy() < 0)
		errx(EXIT_FAILURE, "error connecting to X");

	for (;;)
		events_loop();

	return EXIT_FAILURE;
}
void blueUdit()
{
	deploy();
	intake(1);
	wait10Msec(10);
	moveStraight(1, 0, 475); //picks up
	wait10Msec(50);
	moveStraight(-1, 0, 475);//comes back
	//intake(0)();
	spin(1, 0, 400);
	lift(BUMP);
	holdArm();
	waitForButton();
	intake(-1);
	wait10Msec(100);
	resetValues(0);
	liftDown(); // added

	waitForButton();
	//liftDown();
	// end Devansh
	//waitForButton();
	intake(1);
	moveStraight(1, 0, (HALF_TILE));
	wait10Msec(50);
	pickUpBall(1);
	spin(1, 0, 200);
	//crossBump();
	lift(BUMP);
	nMotorEncoder[LeftMWheel] = 0;
	if(true)
	{
		setRight(127);
		wait10Msec(10);
		setLeft(127);
	}
	while (abs(nMotorEncoder[LeftMWheel]) < 500)
	{
		setRight(127); setLeft(127);
	}
	setRight(0); setLeft(0);
	lift(BARRIER);
	holdArm();
	wait10Msec(30);
	moveStraight(1, 0, 550);
	intake(-1);
	// end udit
	resetValues(1000);
}
Exemplo n.º 17
0
  void skills()
  {
  	deploy();

  	wait10Msec(20);
    intakeSlow(1);
		moveStraight(1, 0, 430); //picks up
		wait10Msec(50);
		moveStraight(-1, 0, 430);//comes back
		intake(1);


		lift(BUMP - 50);
		holdArm();
		moveStraight(-1,0,700);//hops bump
		waitForButton();

	  liftDown();
	  intake(0);

  	waitForButton();
		moveStraight(1, 0, 1400); // maintenence and recalibrating needed
		wait10Msec(30);
		lift(HIGH);
		holdArmHigh();
		moveStraight(1, 0, 430); // reaches goal
		//wait1Msec(1000);
		intake(-1);
		wait10Msec(150); // outtake
		moveStraight(-1, 0, 400); //move back away from goal...Apparently Safety is greater than move forward
		lift(LOW);
		wait10Msec(50);

		intake(0);
			// end score bucky
		moveStraight(-1, 0, 1400); // now user readjust for first ball
		waitForButton();

		moveStraight(1,0,600);
	  spin(1,0,200);
	  lift(BARRIER);
		holdArmHigh();
		moveStraight(1, 0, 475);
		wait10Msec(40);
		moveStraight(-1, 0, 275);


	}
Exemplo n.º 18
0
	void redUdit()
	{
		deploy();
		wait10Msec(20);
		moveStraight(1, 0, 450); //picks up
		wait10Msec(50);
		moveStraight(-1, 0, 450);//comes back
		intake(0);

		waitForButton();
		moveStraight(1, 0, (610));
		spin(-1,0, 240);
		moveStraight(1, 0, (575));
		lift(BARRIER - 300);
		holdArm();
		intake(-1);
		wait10Msec(130);
		liftDown();
		intake(0);

	}
	void redDevansh() // Places preload (1-2) + 2 buckies (2-4) + TURN LEFT Knocks buckies (1-6) + Places two Balls (2)
	{
			deploy();
			intake(1);
			wait10Msec(10);
			moveStraight(1, 0, 150); // 200 estimated based on 10Q values
			wait10Msec(50);
			moveStraight(-1, 0, 150);
			intake(0);
			waitForButton();
			lift(BUMP);
			holdArm();
			intake(-1);
			waitForButton();
			resetValues(0);
			liftDown();
			wait10Msec(20);
			intake(1);
			moveStraight(1, 0, (TILE + HALF_TILE)); // theory
			wait10Msec(50); // intake ball hopefully
			lift(BUMP);
			holdArm();
			intake(0);
			spin(0, -1, RIGHT_ANGLE); // RED SIDE TURN LEFT knocks buckies hopefully
			wait10Msec(30);
			intake(-1); // outtake ball hopefully
			wait10Msec(300);
			intake(0);
			spin(0, 1, RIGHT_ANGLE);
			liftDown();
			intake(1);
			moveStraight(1, 0, (TILE + HALF_TILE)); // theory
			lift(BUMP);
			holdArm();
			intake(0);
			spin(0, -1, RIGHT_ANGLE); // RED SIDE TURN LEFT
			wait10Msec(30);
			intake(-1);
			resetValues(10);
	}
Exemplo n.º 20
0
	void RedSai() //potential 20pt auton
	{
		deploy();

		// go for second ball knockdown
		moveStraight(1, 0, 950);
		wait1Msec(300);
		moveStraight(-1, 0, 950);
		resetValues(100);

		waitForButton();
		moveStraight(1,0,1500); //move forward
		spin(-1,0,180); // turn towards the cache
		lift(HIGH); // nearest 100
		holdArmHigh();
		moveStraight(1, 0, 650); // reaches goal
		intake(-1);
		wait1Msec(1000); // outtake




	}
Exemplo n.º 21
0
void AP_LandingGear::update(float height_above_ground_m)
{
    if (_pin_weight_on_wheels == -1) {
        last_wow_event_ms = 0;
        wow_state_current = LG_WOW_UNKNOWN;
    } else {
        LG_WOW_State wow_state_new = hal.gpio->read(_pin_weight_on_wheels) == _pin_weight_on_wheels_polarity ? LG_WOW : LG_NO_WOW;
        
        if (wow_state_new != wow_state_current) {
            // we changed states, lets note the time.
            last_wow_event_ms = AP_HAL::millis();
            log_wow_state(wow_state_new);
        }
        
        wow_state_current = wow_state_new;
    }
    
    if (_pin_deployed == -1) {
        last_gear_event_ms = 0;
        
        // If there was no pilot input and state is still unknown - leave it as it is
        if (gear_state_current != LG_UNKNOWN) {
            gear_state_current = (_deployed == true ? LG_DEPLOYED : LG_RETRACTED);
        }
    } else {
        LG_LandingGear_State gear_state_new;
        
        if (_deployed) {
            gear_state_new = (deployed() == true ? LG_DEPLOYED : LG_DEPLOYING);
        } else {
            gear_state_new = (deployed() == false ? LG_RETRACTED : LG_RETRACTING);
        }
        
        if (gear_state_new != gear_state_current) {
            // we changed states, lets note the time.
            last_gear_event_ms = AP_HAL::millis();
            
            log_wow_state(wow_state_current);
        }
        
        gear_state_current = gear_state_new;
    }

    /*
      check for height based triggering
     */
    int16_t alt_m = constrain_int16(height_above_ground_m, 0, INT16_MAX);

    if (hal.util->get_soft_armed()) {
        // only do height based triggering when armed
        if ((!_deployed || !_have_changed) &&
            _deploy_alt > 0 &&
            alt_m <= _deploy_alt &&
            _last_height_above_ground > _deploy_alt) {
            deploy();
        }
        if ((_deployed || !_have_changed) &&
            _retract_alt > 0 &&
            _retract_alt >= _deploy_alt &&
            alt_m >= _retract_alt &&
            _last_height_above_ground < _retract_alt) {
            retract();
        }
    }

    _last_height_above_ground = alt_m;
}
	bool touch()
	{

	{

	void crossBump()
	{
		/*
		lift(BUMP);
		holdArm();
		nMotorEncoder[LeftMWheel] = 0;
		while(abs(nMotorEncoder[LeftMWheel]) < 300)
		{
			setRight(100); setLeft(100);
		}
		while(abs(nMotorEncoder[LeftMWheel]) < 600)
		{
			setRight(50); setLeft(50);
		}
		while(abs(nMotorEncoder[LeftMWheel]) < 800)
		{
			setRight(35); setLeft(35);
		}
		//liftDown();
		setRight(0); setLeft(0);
		//resetValues(0);
		*/

	}

	/* Psuedocode
			 Ramp Forward -> [Cross Barrier] -> Raise Arm HIGH -> Hold Arm HIGH -> Ramp Zero -> [Reach Goal] -> Outtake -> [Finish Outtake]
			 	-> Stop Intake -> Ramp Forward -> Ramp Zero -> [Reach Barrier] -> Lower Arm LOW -> Ramp Backward -> [Reach Square] -> Hard Zero
			 Wait Until Press -> Raise Arm BARRIER -> Hold Arm BARRIER -> Ramp Forward -> Ramp Zero -> [Reach Barrier] -> Ramp Backward
			 	-> [Reach Square] -> Hard Zero -> Wait Until Press -> Ramp Forward -> Ramp Zero -> [Reach Barrier]
	*/
	void Alex() // Caches preload (5) + Knocks 2 big balls (10)
	{
		deploy();

		moveStraight(1, 0, 1550); // 1600 is just before goal
		lift(HIGH); // nearest 100
		holdArmHigh();
		moveStraight(1, 0, 300); // reaches goal
		//wait1Msec(1000);
		intake(-1);
		wait1Msec(500); // outtake
		moveStraight(-1, 0, 400); //move back away from goal...Apparently Safety is greater than move forward
		liftDown();
			// end score bucky
		moveStraight(-1, 0, 1400); // now user readjust for first ball
		waitForButton();
		lift(BARRIER);
		holdArm();
		intake(-1);
		moveStraight(1, 0, 580); //estimated guess based on 10Q's values
		wait1Msec(300);
		//moveStraight(-1, 0, 550);
		moveStraight(-1, 0, 580);
		waitForButton();
		moveStraight(1, 0, 950);
		wait1Msec(300);
		//moveStraight(-1, 0, 950);
		moveStraight(-1, 0, 950);
		resetValues(100);
	}

void blueDevansh() // Places preload (1-2) + 2 buckies (2-4) + TURN RIGHT Knocks buckies (1-6)
{
	deploy();
	intake(1);
	wait10Msec(10);
	moveStraight(1, 0, 455); //picks up
	wait10Msec(50);
	moveStraight(-1, 0, 475);//comes back
	intake(0);
			// end part 1: prepare dump
	waitForButton();
	lift(BUMP);
	holdArm();
	intake(-1);
	resetValues(1200);
		// end part 2: dump
	waitForButton();
	liftDown();
	wait10Msec(100);
	moveStraight(1, 0, 700);
		// end part 3: prepare hit
	spin(1, 0, 200);
	intake(-1);
	lift(BUMP);
	holdArm();
	noRamp(1, 250);
	resetValues(0);
		// end part 4: hit
}
Exemplo n.º 23
0
void progSkills()
{
	//while (SensorValue[bumper] == 0) {}
	SensorValue[rightBackS] = 0;
	while (abs(SensorValue[rightBackS]) < 70) moveStraight(-90);
	baseStop();
	// Deploy
	deploy();

	moveLiftAuto(1,3100);
	moveLift(20);
	SensorValue[rightBackS] = 0;
	while (abs(SensorValue[rightBackS]) < 40) moveStraight(40);
	baseStop();
	/*
	moveStraight(127);
	wait1Msec(200);
	moveStraight(-127);
	wait1Msec(200);
	*/
	moveStraight(127);
	wait1Msec(200);
	intake(-1);
	moveStraight(	-127);
	wait1Msec(200);
	baseStop();

	//intake(-1);
	wait1Msec(2000);

	moveStraight(50);
	wait1Msec(100);
	baseStop();

	intake(1);
	moveLift(-30);
	wait1Msec(500);
	intake(0);

	liftStop();
	moveStraight(-40);
	wait1Msec(200);
	baseStop();

	SensorValue[leftBackS] = 0;
	SensorValue[rightBackS] = 0;
	while (((abs(SensorValue[leftBackS])+abs(SensorValue[rightBackS]))/2) < 450)
	{
		while (SensorValue[rightLiftS] < 4000)
		{
			moveLift(-70);
			turnOnSpot(2,90);
		}
		liftStop();
	}
	baseStop();
	intake(1);
	moveStraight(70);
	wait1Msec(1000);
	baseStop();

	SensorValue[leftBackS] = 0;
	SensorValue[rightBackS] = 0;
	while (((abs(SensorValue[leftBackS])+abs(SensorValue[rightBackS]))/2) < 500)
	{
		turnOnSpot(2,90);
	}
	baseStop();
	moveStraight(127);
	wait1Msec(2000);
	baseStop();

	while(SensorValue[bumper] == 0) {}
	intake(-1);

	while(SensorValue[bumper] == 0) {}
	intake(0);
	// Raise Lift
	// Output

	while(SensorValue[bumper] == 0) {}
	intake (1);
	moveStraight(127);
	wait10Msec(50);
	turnOnSpot(1,60);
	wait10Msec(30);
	turnOnSpot(2,60);
	wait10Msec(30);
	baseStop();

	SensorValue[leftBackS] = 0;
	SensorValue[rightBackS] = 0;
	while (((abs(SensorValue[leftBackS])+abs(SensorValue[rightBackS]))/2) < 500)
	{
		turnOnSpot(1,90);
	}
	intake(-1);
	wait10Msec(100);
}
Exemplo n.º 24
0
void redSkyriseAuton()
{
	//while (SensorValue[bumper] == 0) {}
	deploy();
	intake(1);
	SensorValue[rightBackS] = 0;
	while(abs(SensorValue[rightBackS]) < 200)
	{
		moveStraight(127);
	}
	baseStop();
	wait1Msec(1000);

	SensorValue[rightBackS] = 0;
	SensorValue[leftBackS] = 0;
	while(((abs(SensorValue[rightBackS]) + abs(SensorValue[leftBackS]))/2) < 500)
	{
		turnOnSpot(1,90);
	}
	baseStop();

	intake(-1);
	wait1Msec(5000);
	intake(0);

	SensorValue[rightBackS] = 0;
	while(abs(SensorValue[rightBackS]) < 100)
	{
		moveStraight(-90);
	}
	baseStop();

	/*
	SensorValue[rightBackS] = 0;
	while (abs(SensorValue[rightBackS]) < 70) moveStraight(-90);
	baseStop();
	// Deploy
	deploy();
	//Raise Lift
	moveLiftAuto(1,3500);
	intake(1);
	moveLift(-1);
	wait1Msec(300);
	moveLift(0);
	moveStraight(127);
	wait1Msec(1000);
	baseStop();
	moveLiftAuto(-1,3450);
	wait1Msec(500);
	moveLiftAuto(1,3000);
	SensorValue[rightBackS] = 0;
	while (abs(SensorValue[rightBackS]) < 200)
	{
	moveStraight(-60);
	}
	baseStop();
	SensorValue[rightBackS] = 0;
	SensorValue[leftBackS] = 0;
	while(((abs(SensorValue[rightBackS])+abs(SensorValue[leftBackS]))/2) < 480)
	{
	moveLeftSide(-90);
	}
	moveLeftSide(1);
	wait1Msec(50);
	baseStop();

	SensorValue[rightBackS] = 0;
	while (abs(SensorValue[rightBackS]) < 180)
	{
	moveStraight(70);
	}
	baseStop();

	moveLiftAuto(-1,3550);
	moveStraight(30);
	moveLiftAuto(-1,3900);
	while(abs(SensorValue[rightBackS]) < 200)
	{
	moveStraight(-60);
	}
	baseStop();
	//Move Forward
	//Move Backward
	//Turn around
	//Drop Lift
	//Score Skyrise*/
}
Exemplo n.º 25
0
int main() {
	int i;
	struct timespec start, end, diff[8];
	table* t;
	int widths[] = { 20, 20, 20 };
	machine* server;
	half_long_string hl_str;

	config_server();

	deploy(machines[0], "./rpc_times_server");
	deploy(machines[2], "./rpc_times_server");
	deploy(machines[3], "./rpc_times_server");

	sleep(5);

	// 1028 bytes arg
	for (i = 0; i < 1024; i++) {
		hl_str.str1[i] = 65 + i % 26;
		hl_str.str2[i] = 65 + i % 26;
	}

	{
		// Local call 4 bytes
		printf("Calling Local (no RPC): 4 bytes");
		fflush(stdout);
		clock_gettime(CLOCK_REALTIME, &start);
		local_call_4(1000);
		clock_gettime(CLOCK_REALTIME, &end);
		diff[0].tv_nsec = end.tv_nsec - start.tv_nsec;
		diff[0].tv_sec = end.tv_sec - start.tv_sec;

		// Local call 2048 bytes
		printf(", 2048 bytes\t\tOK\n");
		clock_gettime(CLOCK_REALTIME, &start);
		local_call_2048(hl_str);
		clock_gettime(CLOCK_REALTIME, &end);
		diff[1].tv_nsec = end.tv_nsec - start.tv_nsec;
		diff[1].tv_sec = end.tv_sec - start.tv_sec;
	}
	{
		server = machines[4];
		// Remote call 4 bytes
		printf("Calling Local RPC: 4 bytes");
		clock_gettime(CLOCK_REALTIME, &start);
		rpc_call_4(server->ip, 1000);
		clock_gettime(CLOCK_REALTIME, &end);
		diff[2].tv_nsec = end.tv_nsec - start.tv_nsec;
		diff[2].tv_sec = end.tv_sec - start.tv_sec;

		// Remote call 2048 bytes
		printf(", 2048 bytes\t\tOK\n");
		clock_gettime(CLOCK_REALTIME, &start);
		rpc_call_2048(server->ip, hl_str);
		clock_gettime(CLOCK_REALTIME, &end);
		diff[3].tv_nsec = end.tv_nsec - start.tv_nsec;
		diff[3].tv_sec = end.tv_sec - start.tv_sec;
	}
	{
		server = machines[2];
		// Remote call 4 bytes (Remote: Fedora)
		printf("Calling Remote Homogeneous: 4 bytes");
		clock_gettime(CLOCK_REALTIME, &start);
		rpc_call_4(server->ip, 1000);
		clock_gettime(CLOCK_REALTIME, &end);
		diff[4].tv_nsec = end.tv_nsec - start.tv_nsec;
		diff[4].tv_sec = end.tv_sec - start.tv_sec;

		// Remote call 2048 bytes (Remote: Fedora)
		printf(", 2048 bytes\t\tOK\n");
		clock_gettime(CLOCK_REALTIME, &start);
		rpc_call_2048(server->ip, hl_str);
		clock_gettime(CLOCK_REALTIME, &end);
		diff[5].tv_nsec = end.tv_nsec - start.tv_nsec;
		diff[5].tv_sec = end.tv_sec - start.tv_sec;
	}
	{
		server = machines[2];
		// Remote call 4 bytes (Remote: Alpha)
		printf("Calling Remote heterogeneous: 4 bytes");
		clock_gettime(CLOCK_REALTIME, &start);
		rpc_call_4(server->ip, 1000);
		clock_gettime(CLOCK_REALTIME, &end);
		diff[6].tv_nsec = end.tv_nsec - start.tv_nsec;
		diff[6].tv_sec = end.tv_sec - start.tv_sec;

		// Remote call 2048 bytes (Remote: Alpha)
		printf(", 2048 bytes\t\tOK\n");
		clock_gettime(CLOCK_REALTIME, &start);
		rpc_call_2048(server->ip, hl_str);
		clock_gettime(CLOCK_REALTIME, &end);
		diff[7].tv_nsec = end.tv_nsec - start.tv_nsec;
		diff[7].tv_sec = end.tv_sec - start.tv_sec;
	}

	printf("\nResultados\n");
	printf("==========\n");

	// Initialize table
	t = table_initialize(3, widths);
	// Write row data
	table_add_row(t);
	table_add_data(t, 0, 0, "");
	table_add_data(t, 0, 1, "4b in, 4b out");
	table_add_data(t, 0, 2, "2x1024 in, 2048 out");

	// Write row data
	table_add_row(t);
	table_add_data(t, 1, 0, "Local call");
	table_add_data(t, 1, 1, "%lis %09li ns", diff[0].tv_sec, diff[0].tv_nsec);
	table_add_data(t, 1, 2, "%lis %09li ns", diff[1].tv_sec, diff[1].tv_nsec);

	// Write row data
	table_add_row(t);
	table_add_data(t, 2, 0, "RPC (local)");
	table_add_data(t, 2, 1, "%lis %09li ns", diff[2].tv_sec, diff[2].tv_nsec);
	table_add_data(t, 2, 2, "%lis %09li ns", diff[3].tv_sec, diff[3].tv_nsec);

	// Write row data
	table_add_row(t);
	table_add_data(t, 3, 0, "RPC (remota)");
	table_add_data(t, 3, 1, "%lis %09li ns", diff[4].tv_sec, diff[4].tv_nsec);
	table_add_data(t, 3, 2, "%lis %09li ns", diff[5].tv_sec, diff[5].tv_nsec);

	// Write row data
	table_add_row(t);
	table_add_data(t, 4, 0, "RPC (hetero)");
	table_add_data(t, 4, 1, "%lis %09li ns", diff[6].tv_sec, diff[6].tv_nsec);
	table_add_data(t, 4, 2, "%lis %09li ns", diff[7].tv_sec, diff[7].tv_nsec);

	// Print table
	table_print(t);

	return 0;
}
Exemplo n.º 26
0
void CRod::init(int color)
{
	if(color ==1) deploy();
	else undeploy();
}