当前位置: 首页>>代码示例>>C++>>正文


C++ drive函数代码示例

本文整理汇总了C++中drive函数的典型用法代码示例。如果您正苦于以下问题:C++ drive函数的具体用法?C++ drive怎么用?C++ drive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drive函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: users

 QDir users(const QString &prefixHash)
 {
     return drive(prefixHash).absoluteFilePath("users");
 }
开发者ID:Iaroslav464,项目名称:WineWizard,代码行数:4,代码来源:filesystem.cpp

示例2: main

task main()
{
	infra ();
	drive () ;

}
开发者ID:ApesofWrath,项目名称:FTC2013,代码行数:6,代码来源:saads.c

示例3: cypher


//.........这里部分代码省略.........
			 case KNIFE:
			 case KILL:
				murder();
				break;

			 case UNDRESS:
			 case RAVAGE:
				ravage();
				break;

			 case SAVE:
				save();
				break;

			 case FOLLOW:
				lflag = follow();
				break;

			 case GIVE:
				give();
				break;

			 case KISS:
				kiss();
				break;

			 case LOVE:
				 love();
				 break;

			 case RIDE:
				lflag = ride();
				break;

			 case DRIVE:
				lflag = drive();
				break;

			 case LIGHT:
				 light();
				 break;

			 case LAUNCH:
				if (!launch())
					return(-1);
				else 
					lflag = 0;
				break;

			case LANDIT:
				if (!land())
					return(-1);
				else
					lflag = 0;
				break;

			case TIME:
				chime();
				break;

			 case SLEEP:
				zzz();
				break;

			 case DIG:
				dig();
				break;

			 case JUMP:
				lflag = jump();
				break;

			 case BURY:
				bury();
				break;

			 case SWIM:
				puts("Surf's up!");
				break;

			 case DRINK:
				drink();
				break;

			 case QUIT:
				die();

			 default:
				puts("How's that?");
				return(-1);
				break;

			 
		}
		if (wordnumber < wordcount && *words[wordnumber++] == ',')
			continue;
		else return(lflag);
       }
       return(lflag);
}
开发者ID:jonathangray,项目名称:csrg,代码行数:101,代码来源:cypher.c

示例4: if

void Mobot::navigate(int p1x, int p1y, int p2x, int p2y) {
  // Assume that only one of dx or dy is nonzero and that their value is
  // either -1 or +1. Same goes for headingX and headingY.

  //             + -y
  //             |
  //             |
  //             |
  //     <--------------->
  //     -x      |      +x
  //             |
  //             |
  //             + +y
  //
  // Counterclockwise: positive degrees
  // Clockwise: negative degrees

  int dx = p2x - p1x;
  int dy = p2y - p1y;

  int turnDegrees = 0;

  if (dx != 0) {
    // If in the opposite direction, turn around
    if (dx * headingX < 0) {
      turnDegrees = 180;
    }

    else if (dx * headingY > 0) {
      turnDegrees = 90;
    }

    else if (dx * headingY < 0) {
      turnDegrees = -90;
    }
  }

  else if (dy != 0) {
    // If in the opposite direction, turn around
    if (dy * headingY < 0) {
      turnDegrees = 180;
    }

    else if (dy * headingX > 0) {
      turnDegrees = -90;
    }

    else if (dy * headingX < 0) {
      turnDegrees = 90;
    }
  }

  headingX = dx;
  headingY = dy;

  if (turnDegrees != 0) {
    turn(turnDegrees);
  }

  drive(resolution);
}
开发者ID:danielsuo,项目名称:mobot,代码行数:61,代码来源:Mobot.cpp

示例5: drive

void ScrollMachine::wheel(int steps)
{
	speed_ += steps * trans_;
	if (int(speed_) == 0) speed_ = steps;
	drive();
}
开发者ID:corelon,项目名称:paco,代码行数:6,代码来源:ScrollMachine.cpp

示例6: main

task main()
{
	waitForStart();
	//servoChangeRate[handJoint] = 10;
	nMotorEncoder[spear] = 0;
	writeDebugStreamLine("encoder set to: %d", nMotorEncoder[spear]);

	int maxVal = 40;

	while (true)
	{
		getJoystickSettings(joystick);

		int cont1_left_yval = avoidWeird(joystick.joy1_y1, 20); //y coordinate for the left joystick on controller 1
		int cont1_left_xval = avoidWeird(joystick.joy1_x1, 75); //x coordinate for the left joystick on controller 1
		int cont1_right_yval = avoidWeird(joystick.joy1_y2, 20);
		int cont1_dPad = joystick.joy1_TopHat; //Value of the dPad for controller 2

		//if (joy1Btn(4) == 1)
		//{
		//	if ((ServoValue[handJoint] + 5) < maxHandValue)
		//	{
		//		servo[handJoint] = ServoValue[handJoint] + 5;
		//	}
		//}
		//if (joy1Btn(2) == 1)
		//{
		//	if ((ServoValue[handJoint] - 5) > minHandValue)
		//	{
		//		servo[handJoint] = ServoValue[handJoint] - 5;
		//	}
		//}

		if (joy1Btn(1) == 1){
			nMotorEncoder[spear] = 0;
		}

		if (joy1Btn(4) == 1){
			spearMovement(20);
		}
		if (joy1Btn(2) == 1){
			spearMovement(-20);
		}
		if (joy1Btn(2) != 1 && joy1Btn(4) != 1){
			spearMovement(0);
		}

		//if (joy1Btn(6) == 1)
		//{
		//	fold_arm(false);
		//}
		//if (joy1Btn(5) == 1)
		//{
		//	fold_arm(true);
		//}

		if (joy1Btn(1) == 1){
			maxVal = 100;
		}

		if (joy1Btn(1) != 1){
			maxVal = 40;
		}

		//if (joy2Btn(1) == 1)
		//{
		//	servo[ramp] = 0;
		//}
		//if (joy2Btn(3) == 1)
		//{
		//	servo[ramp] = 255;
		//}
		//if (joy2Btn(1) != 1 && joy2Btn(3) != 1)
		//{
		//	servo[ramp] = 128;
		//}

		drive(cont1_left_yval, cont1_left_xval, maxVal);
		//shoulderMovement(cont1_right_yval);
		//handMovement(cont1_dPad);
	}
}
开发者ID:journeys-FTC,项目名称:ring-it-up,代码行数:82,代码来源:teleop.c

示例7: main

int main ( void )
{
  uint8_t *bufcontents;
  uint8_t i;
  uint8_t tv[] = "foobar1";
  uint16_t ticker = 0;
  uint8_t rc;
  aes128_ctx_t ctx;

  uint8_t key[] = "0123456789ABCDEF";
  uint8_t IV[] = "FEDCBA9876543210";
  uint8_t text[] = "Hello rfm12 world. I've gonna cipher you       ";
	
  drive(LED1);
  drive(LED2);

  toggle_output(LED1);
	
  uart_init();

  _delay_ms(250);
  _delay_ms(250);

  sei();

  toggle_output(LED2);
  uart_putstr ("AVR Boot Ok\r\n");
  _delay_ms(250);
  toggle_output(LED2);

  aes128_init(key,&ctx);

  while (1) {
    uart_putstr("key = ");
    uart_putstr(key);
    uart_putstr("\r\n");

    uart_putstr("text = ");
    uart_putstr(text);
    uart_putstr("\r\n");

    /* Ciphering in CBC mode */
    memxor(text,IV,16);
    aes128_enc(text,&ctx);
    memxor(text+16,text,16);
    aes128_enc(text+16,&ctx);
    memxor(text+32,text+16,16);
    aes128_enc(text+32,&ctx);

    uart_putstr("text ciphered = \r\n");
    uart_hexdump(text,sizeof(text));

    /* Deciphering in CBC mode */
    aes128_dec(text+32,&ctx);
    memxor(text+32,text+16,16);
    aes128_dec(text+16,&ctx);
    memxor(text+16,text,16);
    aes128_dec(text,&ctx);
    memxor(text,IV,16);

    uart_putstr("text unciphered = ");
    uart_putstr(text);
    uart_putstr("\r\n");

    /* Let change the IV */
    IV[0]++;

    _delay_ms(250);
    _delay_ms(250);
    _delay_ms(250);
    _delay_ms(250);
  }
}
开发者ID:Conorta,项目名称:DIY-Wireless-Bug,代码行数:73,代码来源:main.c

示例8: operatorControl

/*
 * Runs the user operator control code. This function will be started in its own task with the
 * default priority and stack size whenever the robot is enabled via the Field Management System
 * or the VEX Competition Switch in the operator control mode. If the robot is disabled or
 * communications is lost, the operator control task will be stopped by the kernel. Re-enabling
 * the robot will restart the task, not resume it from where it left off.
 *
 * If no VEX Competition Switch or Field Management system is plugged in, the VEX Cortex will
 * run the operator control task. Be warned that this will also occur if the VEX Cortex is
 * tethered directly to a computer via the USB A to A cable without any VEX Joystick attached.
 *
 * Code running in this task can take almost any action, as the VEX Joystick is available and
 * the scheduler is operational. However, proper use of delay() or taskDelayUntil() is highly
 * recommended to give other tasks (including system tasks such as updating LCDs) time to run.
 *
 * This task should never exit; it should end with some kind of infinite loop, even if empty.
 */
void operatorControl() {
#ifdef AUTO
	autonomous();
#elif defined(TEST)

#define DEFAULT_SHOOTER_SPEED 0
#define SHOOTER_SPEED_INCREMENT 5

	int8_t xSpeed, ySpeed, rotation;
	int8_t lifterSpeed/*, intakeSpeed*/;

	int16_t shooterSpeed = DEFAULT_SHOOTER_SPEED; //shooter is on when robot starts
	int8_t frontIntakeSpeed = INTAKE_SPEED;
	bool isShooterOn = true;
	bool isAutoShootOn = false;

	//lfilterClear();

	toggleBtnInit(JOYSTICK_SLOT, INTAKE_BUTTON_GROUP, JOY_UP);		// intake forward
	toggleBtnInit(JOYSTICK_SLOT, INTAKE_BUTTON_GROUP, JOY_LEFT);	// intake off
	toggleBtnInit(JOYSTICK_SLOT, INTAKE_BUTTON_GROUP, JOY_RIGHT);	// intake off
	toggleBtnInit(JOYSTICK_SLOT, INTAKE_BUTTON_GROUP, JOY_DOWN);	// intake backward
	toggleBtnInit(JOYSTICK_SLOT, CONTROL_BUTTON_GROUP, JOY_DOWN);   // shooter on off
	toggleBtnInit(JOYSTICK_SLOT, CONTROL_BUTTON_GROUP, JOY_RIGHT);   // auto shoot on off
	toggleBtnInit(JOYSTICK_SLOT, SHOOTER_ADJUST_BUTTON_GROUP, JOY_UP);   // shooter speed up
	toggleBtnInit(JOYSTICK_SLOT, SHOOTER_ADJUST_BUTTON_GROUP, JOY_DOWN);   // shooter speed down

	while (true) {
		printf("ultra distance (in): %f\r\n", ultrasonicGet(ultra) / 2.54);

		toggleBtnUpdateAll();

		// drive
		xSpeed = (int8_t) joystickGetAnalog(JOYSTICK_SLOT, STRAFE_AXIS);
		ySpeed = (int8_t) joystickGetAnalog(JOYSTICK_SLOT, DRIVE_AXIS);
		rotation = (int8_t) joystickGetAnalog(JOYSTICK_SLOT, ROTATION_AXIS) / 2;

		if (abs(ySpeed) < DIAGONAL_DRIVE_DEADBAND) {
			ySpeed = 0;
		}

		if (abs(xSpeed) < DIAGONAL_DRIVE_DEADBAND) {
			xSpeed = 0;
		}

		drive(xSpeed, ySpeed, rotation, false);

		// lifter up down
		if (joystickGetDigital(JOYSTICK_SLOT, LIFTER_BUTTON_GROUP, JOY_UP)) {
			lifterSpeed = LIFTER_SPEED;
		} else if (joystickGetDigital(JOYSTICK_SLOT, LIFTER_BUTTON_GROUP, JOY_DOWN)) {
			lifterSpeed = -LIFTER_SPEED;
		} else {
			lifterSpeed = 0;
		}

		lifter(lifterSpeed);
		takeInInternal(lifterSpeed);

		if (isShooterOn) {
			if (isAutoShootOn) {
				shooterSpeed = calculateShooterSpeed();
			} else {
				// shooter increase speed
				if (toggleBtnGet(JOYSTICK_SLOT, SHOOTER_ADJUST_BUTTON_GROUP, JOY_UP) == BUTTON_PRESSED) {
					shooterSpeed += SHOOTER_SPEED_INCREMENT;

					if (shooterSpeed > SHOOTER_MAX_SPEED) {
						shooterSpeed = SHOOTER_MAX_SPEED;
					}
				}

				// shooter decrease speed
				if (toggleBtnGet(JOYSTICK_SLOT, SHOOTER_ADJUST_BUTTON_GROUP, JOY_DOWN) == BUTTON_PRESSED) {
					shooterSpeed -= SHOOTER_SPEED_INCREMENT;

					if (shooterSpeed < SHOOTER_MIN_SPEED) {
						shooterSpeed = SHOOTER_MIN_SPEED;
					}
				}
			}

//			 auto shooter on off
//.........这里部分代码省略.........
开发者ID:f-jiang,项目名称:vex-robot-2015,代码行数:101,代码来源:opcontrol.c

示例9: drive

void DifferentialPilot::drive
    (Robot* rob, Point goalPoint, float theta_goal, MoveType moveType)
{
    return drive(rob, goalPoint.x, goalPoint.y, theta_goal, moveType);
}
开发者ID:mllofriu,项目名称:robobulls2,代码行数:5,代码来源:differential_pilot.cpp

示例10: drive

void Robot::writeMotorsSpeed(int motorLeft, int motorRight)
{
	motorLeft = (float)motorLeft * motorsDiffMultiplier;

	drive(motorLeft, motorRight);
}
开发者ID:acosinwork,项目名称:arduino_projects,代码行数:6,代码来源:Robot.cpp

示例11: drive

void AFK_Camera::driveAndUpdateProjection(const Vec3<float>& velocity, const Vec3<float>& axisDisplacement)
{
    drive(velocity, axisDisplacement);
    updateProjection();
}
开发者ID:KaiEkkrin,项目名称:afk,代码行数:5,代码来源:camera.cpp

示例12: main

task main() {
    //Code: drive(auto_command,time);
    //replace auto_command and time with values necessary (if you don't replace them, code won't run)
    //auto_command values are: "rpoint", "lpoint", "up", "down", "rswing", "lswing", "rswingback", "lswingback"
    //time values is the time, in milliseconds, you want the robot to be doing the action specified in auto_command

    //Use the sonar sensor by: SensorValue[sonarSensor].  It can get a distance from 0cm to 80cm
    //drive("up", 10000);      move forward 10000 milliseconds (10sec)
    //drive("lpoint", 1000);   left point turn for 1000 milliseconds (1sec)
    //drive("up", 10000);      move forward again for 10000 milliseconds (10sec)


    waitForStart();

    /*
    int count = 0;

    string BatteryLevel = externalBatteryAvg;
    string selection = "";


    nxtDisplayCenteredBigTextLine (3, BatteryLevel);
    wait1Msec(3000);
    */


//Drive forward off of home red cliff
    drive(0,4596);
    drive(65535,100);

//Turn left 90 degrees
    drive(6,3185);
    drive(65535,100);

//Drive forward to bowling ball
    drive(0,1036);
    drive(65535,100);

//Turn left 90 degrees
    drive(6,4037);
    drive(65535,100);

//Turn left a bit
    drive(6,516);
    drive(65535,100);
    drive(0,657);//Drive past bowling ball
    drive(65535,100);
    drive(2,188);//Turn right into bowling ball
    drive(65535,100);
    drive(2,237);//Turn right into bowling ball
    drive(65535,100);
    drive(0,425);//Drive forward
    drive(65535,100);
    drive(2,279);//Turn right into bowling ball
    drive(65535,100);
    drive(2,424);//Turn right into bowling ball
    drive(65535,100);
    drive(0,799);//Drive forward a bit
    drive(65535,100);
    drive(2,468);//Turn right into bowling ball
    drive(65535,100);
    drive(0,516);//Drive forward a bit
    drive(65535,100);
    drive(2,2065);//Turn right into bowling ball
    drive(65535,100);
    drive(0,1409);//Drive forward
    drive(65535,100);
    drive(2,8299);//Turn right, line up with bowling ball
    drive(65535,100);
    drive(2,424);//Turn right, line up with bowling ball

//Drive bowling ball into front zone
    drive(65535,100);
    drive(0,4408);//Drive forward
    drive(65535,100);
    drive(2,424);//Realign with bowling ball
    drive(65535,100);
    drive(0,2908);//Drive forward
    drive(65535,100);
    drive(2,608);//Realign with bowling ball
    drive(65535,100);
    drive(0,1312);//Drive forward
    drive(0,1920);//Drive forward
    drive(65535,100);
    drive(0,424);//Drive forward
    drive(65535,100);

    drive(4,9756);//Drive backwards
    drive(65535,100);
    drive(4,376);//Drive backwards
    drive(4,3516);//Drive backwards

}
开发者ID:RMRobotics,项目名称:FTC-2011-12,代码行数:93,代码来源:AutonomousRedCliff_V1.c

示例13: main

task main()
{
	bDisplayDiagnostics=false;
	nMotorEncoder[sense]=0;
	/*
	motor[sense]=5;
	while(SensorValue[ir]!=5);
	motor[sense]=0;
	nxtDisplayCenteredBigTextLine(0,"%d",nMotorEncoder[sense]);
	motor[sense]=-5;
	while(nMotorEncoder[sense]>0);
	motor[sense]=0;
	wait1Msec(100000);
	StopAllTasks();
	*/

	init();
	theta=0;
	//downRamp();
	waitForStart();
	//wait1Msec(13000);
	StartTask(gyroThread);
	StartTask(graph);
	StartTask(grabber);
	//wait1msec(2000);
	//servo[bucket]=160;
//wait1Msec(100000);
	/*
forwardToLine();
	rotateLeft(20,20);
	drive(0);
	wait1Msec(250);
//	forwardToTube();
*/
//	servo[grab]=210;

//	wait1Msec(200);
//	bringTubeBack();


//servo[grab]=255;
//wait1Msec(1000);
//drive(50);
//wait1msec(2500);
if(STARTINGPOS==0){
	drive(0);
	grabState=2;
	forwardToTube2();
	bringTubeBack();
	wait1Msec(1000);
	//dump();
}
else{
	grabState=1;
	drive(50);
	wait1Msec(2000);
	drive(30);
	grabState=0;
	wait1Msec(1000);
	forwardToTube2();
	backToZone();
}
//backToZone();
//		while(true)readAnalogInput(HTPB,0);//before edge
	//downRamp();
	//clearTimer(T1);
	/*
	motor[claw]=50;
	wait1Msec(250);
	motor[claw]=5;
	motor[right]=50;
	motor[left]=0;
	wait1Msec(1000);
	motor[left]=-50;
	wait1Msec(8000);
	drive(0);*/
	while(true);
}
开发者ID:ecgrobotics,项目名称:FTC-731,代码行数:78,代码来源:autoOLD.c

示例14: timedDrive

void timedDrive(int direction, float seconds) {
	drive(direction);
	Wait(seconds);
	drive(NO_WHERE);
}
开发者ID:tony-w,项目名称:Rasware2013,代码行数:5,代码来源:Wheels.c

示例15: backwardTouch

void backwardTouch(int speed)
{
    drive(speed);
    while(!TOUCH_BACK_OR);
    create_stop();
}
开发者ID:NHHSBotball,项目名称:Botball2011,代码行数:6,代码来源:lib.move.misc.c


注:本文中的drive函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。