您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vexRT函数代码示例

51自学网 2021-06-03 09:38:03
  C++
这篇教程C++ vexRT函数代码示例写得很实用,希望能帮到您。

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

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

示例1: reverseFlywheel

task reverseFlywheel () {	while(true) {		if(vexRT(Btn7L) && flywheelVelocity > flywheelReverseStartThreshold) {			stopFlywheel();			clearLCDLine(1);			while(flywheelVelocity>0) {				setFlywheel(flywheelVelocity>flywheelSlowDownVelocity?0:-pow(abs((flywheelVelocity/1000)-flywheelSlowDownVelocity/1000),1.3));				clearLCDLine(0);				displayLCDNumber(0,0,flywheelVelocity);				displayLCDNumber(0,10,motor[flywheel1]);				delay(25);			}		}		else {			while(vexRT(Btn7L)) {				stopFlywheel();				setFlywheel(-127);				delay(25);			}			if(flywheelVelocity < 0 && !debugFlywheelActive) {				setFlywheel(0);			}		}		delay(25);	}}
开发者ID:Abner3,项目名称:2016MarkIII,代码行数:26,


示例2: usercontrol

task usercontrol(){//	startTask(shooter);	startTask(drive);	startTask(intake);	speedUpFlywheel();	while(true){		if(vexRT(Btn8U)){			motor[LUflywheel] = 127;			motor[LDflywheel] = 127;			motor[RUflywheel] = 127;			motor[RDflywheel] = 127;		}		else if(vexRT(Btn8D)){			motor[LDflywheel] = 100;			motor[RUflywheel] = 100;			motor[RDflywheel] = 100;		}		else if(vexRT(Btn8L))			slowDownFlywheel();		wait1Msec(25);	}}
开发者ID:jcgrif,项目名称:2016,代码行数:25,


示例3: usercontrol

	task usercontrol()	{		startTask(shooter);		startTask(drive);		startTask(intake);		startTask(flywheelVelocity);		//speedUpFlywheel();		while(true){			if(vexRT(Btn8U)){				motor[LUflywheel] = 127;				motor[LDflywheel] = 127;				motor[RUflywheel] = 127;				motor[RDflywheel] = 127;			}			else if(vexRT(Btn8D)){				motor[LDflywheel] = 90;				motor[RUflywheel] = 90;				motor[RDflywheel] = 90;			}			if(vexRT(Btn8L)){				stopTask(flywheelP);				slowDownFlywheel();			}			wait1Msec(25);		}	}
开发者ID:jcgrif,项目名称:2016,代码行数:29,


示例4: usercontrol

task usercontrol() {	while (true) {		if(vexRT(Btn7U)){			motor(flywheel1) = -127;			motor(flywheel2) = -127;			motor(flywheel3) = -127;			motor(flywheel4) = -127;		}		else if(vexRT(Btn7D)){			motor(flywheel1) = 100;			motor(flywheel2) = 100;			motor(flywheel3) = 100;			motor(flywheel4) = 100;		}		else{			motor(flywheel1) = 0;			motor(flywheel2) = 0;			motor(flywheel3) = 0;			motor(flywheel4) = 0;		}	}}
开发者ID:Abner3,项目名称:2016MarkIII,代码行数:29,


示例5: chaDrive

void chaDrive(){	int LY = vexRT(Ch3);	int LX = vexRT(Ch4);	int RX = vexRT(Ch1);	if(abs(LY+LX) <=deadZone){		LY = 0;		LX = 0;	}	if(abs(RX) <=17){		RX = 0;	}	if(abs(RX) >17){	LX = 0;	LY = 0;}	mTR(LX - LY + RX);	mBR(-LY - LX + RX);  mBL(LY - LX + RX);	mTL(LX + LY + RX);}
开发者ID:ESRobotics,项目名称:4326A-2015-16-Code,代码行数:33,


示例6: armMotor

void armMotor(){	if(vexRT[Btn6U] == 1){		// If 6U is pressed, arm goes up		motor[topRightLift] = 127;		motor[topLeftLift] = 127;		motor[bottomLeftLift] = 127;		motor[bottomRightLift] = 127;	}	else if(vexRT[Btn6D] == 1){		// If 6D is pressed, arm goes down		motor[topRightLift] = -127;		motor[topLeftLift] = -127;		motor[bottomLeftLift] = -127;		motor[bottomRightLift] = -127;	}	else{		// otherwise, do nothing		motor[topRightLift] = 0;		motor[topLeftLift] = 0;		motor[bottomLeftLift] = 0;		motor[bottomRightLift] = 0;	}	if(vexRT(Btn8U) == 1){		//If 8U is pressed, bring arm to maximum height		userArm(rightMaxPot,leftMaxPot,RAISE ,127);	}	else if(vexRT(Btn8D) == 1){		//If 8D is pressed, bring arm to minimum height		userArm(rightMinPot,leftMinPot,LOWER ,127);	}}
开发者ID:warobotics,项目名称:Presentation-Code,代码行数:32,


示例7: usercontrol

task usercontrol() {	startTask(drive);	while(true) {		if(vexRT(Btn8U)) {			shooterPowerDown();			autoFeeder = false;		}		if(vexRT(Btn8D) || autoStartShooter) {			autoFeeder = true;			if(fastMode) {				speed = 103;				feederWaitTime = 1000;				} else {				speed = 98;				feederWaitTime = 1500;			}			startTask(shooterDJ);		}		if(vexRT(Btn5D))			motor[feeder] = 127;		else if(!autoFeeder)			motor[feeder] = 0;		if(vexRT(Btn5U))			motor[intake1] = 127;		else			motor[intake1] = 0;		if(vexRT(Btn6D)) {			speed = 55;			startTask(shooter);		}		wait1Msec(25);	}}
开发者ID:jcgrif,项目名称:2016,代码行数:33,


示例8: usercontrol

task usercontrol() {	while (true) {		driveForwardTurnStrafe(DRIVE_SLEW_RATE, vexRT(Ch3), vexRT(Ch4), vexRT(Ch1));		liftSpeeds(LIFT_SLEW_RATE, straight( buttonsToSpeed(Btn5U, Btn5D) ) );		intakeSpeed(INTAKE_SLEW_RATE, buttonsToSpeed(Btn6U, Btn6D) );		constantLoopTime(); //Important for slew	}}
开发者ID:ArtskydJ,项目名称:jpc-autonomous-framework,代码行数:8,


示例9: drive

	task drive(){		while(true){			motor[LFdrive] = vexRT(Ch3);			motor[LBMdrive] = vexRT(Ch3);			motor[RFdrive] = vexRT(Ch2);			motor[RBMdrive] = vexRT(Ch2);			wait1Msec(25);		}	}
开发者ID:jcgrif,项目名称:2016,代码行数:9,


示例10: SlowButton

//Slow down the controls if a button is pressedvoid SlowButton(){	if(vexRT(Btn8D) == true)	{		boolSlowButton = true;	}	if(vexRT(Btn8U) == true)	{		boolSlowButton = false;	}}
开发者ID:ebuttonsdude,项目名称:InnovationCenterBEST,代码行数:12,


示例11: controlSwitch

//FUNCTION that controls switches between arcade drive and tank drivevoid controlSwitch(){	 //Declaring and initializing variables  	int btn1 = vexRT(Btn7L);  	int btn2 = vexRT(Btn7R);  	//Says if btn1 is pressed it goes to tank control, otherwise it goes to arcade drive  	if(btn1==1){  		switched=true;  	}else if(btn2==1){  		switched=false;  }}
开发者ID:StemBestRobotics,项目名称:RobotCode,代码行数:12,


示例12: manualDrive

void manualDrive(){	if( abs( vexRT(Ch3) ) > 15 )		motor[DriveLF] = motor[DriveLB] = vexRT(Ch3);	else		motor[DriveLF] = motor[DriveLB] = 0;	if( abs( vexRT(Ch2) ) > 15 )		motor[DriveRB] = motor[DriveRF] = vexRT(Ch2);	else		motor[DriveRB] = motor[DriveRF] = 0;}
开发者ID:joseph-zhong,项目名称:Robotics,代码行数:12,


示例13: shooter

task shooter(){	while(true){		if(vexRT(Btn6U)){			while(!vexRT(Btn6D))				speedUpFlywheel();		}		else if(vexRT(Btn6D)){			while(!vexRT(Btn6U))				slowDownFlywheel();		}		wait1Msec(25);	}}
开发者ID:jcgrif,项目名称:2016,代码行数:13,


示例14: gearShift

 //This function controls the speed of the wheels, so the drivers will be able to change the speed of the robot based on te situation void gearShift(){	 //Declare and initialize variables	 int buttonUp = vexRT(Btn8L);	 int buttonDown = vexRT(Btn8D);	 //Says if buttonUp is pressed, motor controls are full speed	 if (buttonUp==1){		speedControl=1;	 }	 //Says if buttonDown is pressed, motor controls are half speed	 if (buttonDown==1){	 	speedControl=0.5;	 } }
开发者ID:StemBestRobotics,项目名称:RobotCode,代码行数:14,


示例15: checkMode

void checkMode(){	if(vexRT(Btn5U) == 1){		currentMode = SHOOTING_MODE;		} else if(vexRT(Btn5D) == 1){		currentMode = COLLECTING_MODE;	}	if(vexRT(Btn5UXmtr2) == 1){		currentMode2 = SHOOTING_MODE;		} else if(vexRT(Btn5DXmtr2) == 1){		currentMode2 = COLLECTING_MODE;	}}
开发者ID:EvolvedAwesome,项目名称:Marist-7201N-Vex-Robotics,代码行数:13,


示例16: main

//Robot B Driver Control programtask main(){	// Set the motors initially	int Presets[4] = {0, 55, 75, 127};	int currentPreset = 0;	motor[REF] = Presets[currentPreset];	motor[RF] = motor[REF];	motor[LF] = motor[RF];	while(true)	{		// Flywheel Speed		if(vexRT(Btn8U))			currentPreset = 0;		else if (vexRT(Btn8R))			currentPreset = 1;		else if (vexRT(Btn8D))			currentPreset = 2;		else if (vexRT(Btn8L))			currentPreset = 3;		motor[REF] = Presets[currentPreset];		motor[RF] = motor[REF];		motor[LF] = motor[RF];		// Fit the input to an exponential curve		// Squares are always positive, so a ternary operator is needed for negative numbers		// The abs is just in case we decide to go with odd exponents or even roots (like 3/2)		// We devide by 128 because the program can theoretically reach -128		int verticalL = pow(abs(vexRT(Ch3))/128.0,2.7)*127.0 *((vexRT(Ch3)>0)?(1):(-1));		int verticalR = pow(abs(vexRT(Ch2))/128.0,2.7)*127.0 *((vexRT(Ch2)>0)?(1):(-1));		// Move Robot		motor[LRW] = verticalL;		motor[LFW] = motor[LRW];		motor[RRW] = verticalR;		motor[RFW] = motor[RRW];		//Feeder control		if(vexRT(Btn6U))			motor[I1] = 127;		else if(vexRT(Btn5U))			motor[I1] = -127;		else	 	   motor[I1] = 0;	 	motor[I2] = motor[I1];	}}
开发者ID:LaTechVEX,项目名称:NothingButNet2015,代码行数:52,


示例17: main

task main(){	int x = 30;	while(true) {		gearSpeed(x);		if(vexRT(Btn8U)==1){			x += 10;		}		if(vexRT(Btn8D)==1){			x += 10;		}		delay(10);	}}
开发者ID:humford,项目名称:MastersVex2015,代码行数:14,


示例18: StandardDrive

//this code is also called tank drive. One joystick controls 1 side of the robot base.void StandardDrive(){	if(boolSlowButton == true)	{		motor[RightMotor] = vexRT(Ch2)/3;		motor[LeftMotor] = vexRT(Ch3)/3;	}	else	{		motor[RightMotor] = vexRT(Ch2);		motor[LeftMotor] = vexRT(Ch3);	}}
开发者ID:ebuttonsdude,项目名称:InnovationCenterBEST,代码行数:15,


示例19: drive

void drive(){	if(vexRT(Ch3) >= drivingThreshhold)	{		left(vexRT(Ch3));	}	else if(vexRT(Ch3) <= -drivingThreshhold)	{		left(vexRT(Ch3));	}	else	{		left(0);	}	if(vexRT(Ch2) >= drivingThreshhold)	{		right(vexRT(Ch2));	}	else if(vexRT(Ch2) <= -drivingThreshhold)	{	  right(vexRT(Ch2));	}	else	{		right(0);	}	if(destroyAllHumans == 1)	{		killeveryone();	}}
开发者ID:usoris,项目名称:4558,代码行数:31,


示例20: reverseFlywheel

void reverseFlywheel() {	if(vexRT(Btn7L)) {		if(getFlywheelVelocity()>10) {			stopTask(abi);			motor[flywheel4] = -5;			while(VexRT(Btn7L) && getFlywheelVelocity()>10) { delay(25); }		} else {			motor[flywheel4] = -127;			while(vexRT(Btn7L)) { delay(25); }			while(motor[flywheel4]<0) { motor[flywheel4]+=2; delay(25); }			motor[flywheel4] = 0;		}	}}
开发者ID:Abner3,项目名称:2016MarkIII,代码行数:14,


示例21: shooter

task shooter () {	bool canRunAgain = true;	while (true)	{		if(vexRT(Btn7U))			speed++;		if(vexRT(Btn7D))			speed--;		FwMotorSet(speed);		//sprintf( str, "%4d %4d", target_velocity,  motor_velocity, nImmediateBatteryLevel/1000.0 );		wait1Msec(200);	}}
开发者ID:jcgrif,项目名称:2016,代码行数:15,


示例22: main

//+++++++++++++++++++++++++++++++++++++++++++++| MAIN |+++++++++++++++++++++++++++++++++++++++++++++++task main(){	// Set the motors initially	int Presets[4] = {0, 55, 85, 127};	int currentPreset = 0;	motor[Inside1] = Presets[currentPreset];	motor[Inside2] = motor[Inside1];	motor[Outside1] = motor[Inside1];	motor[Outside2] = motor[Inside1];	while(true)	{		// Flywheel Speed	 if(vexRT(Btn8U))		currentPreset = 0;	 else if (vexRT(Btn8R))	  currentPreset = 1;	 else if (vexRT(Btn8D))	   currentPreset = 2;	 else if (vexRT(Btn8L))	   currentPreset = 3;		motor[Inside1] = Presets[currentPreset];		motor[Inside2] = motor[Inside1];		motor[Outside1] = motor[Inside1];		motor[Outside2] = motor[Inside1];		//Fit the input to an exponential curve		//Squares are always positive, so a ternary operator is needed for negative numbers		//The abs is just in case we decide to go with odd exponents		int verticalL = abs(pow(vexRT(Ch3)/127.0,2.0))*127.0 *((vexRT(Ch3)>0)?(1):(-1));		int verticalR = abs(pow(vexRT(Ch2)/127.0,2.0))*127.0 *((vexRT(Ch2)>0)?(1):(-1));		// Move Robot	  motor[LRWheel] = verticalL;	  motor[LFWheel] = motor[LRWheel];    motor[RRWheel] = verticalR;    motor[RFWheel] = motor[RRWheel];	   if(vexRT(Btn6U))	     SensorValue[Feeder] = 1;	 	 else if (vexRT(Btn5U))	     SensorValue[Feeder] = 0;	}}
开发者ID:LaTechVEX,项目名称:NothingButNet2015,代码行数:49,


示例23: intakeControl

task intakeControl () {	while(true) {		string speed;		sprintf(speed, "%d", indexerSpeed);		line(1,speed);		while(true) {			motor[intake] = ((vexRT(Btn5U)||autonIndex)-vexRT(Btn5D))*127;			while (vexRT(Btn5U) || autonIntake) {				if(vexRT(Btn6D) && sensorValue[indexHigh]) {					motor[indexer] = -127;					delay(250);				} else if(vexRT(Btn6U) || autonShoot) {					//if(sensorValue[indexHigh] && getFlywheelVelocity()<currentGoalVelocity+30) {					if(SensorValue[indexHigh]) {						while(time1[T1]<=waitTime) {							motor[indexer] = -7;							delay(25);						}						if(getFlywheelVelocity()>0) {							motor[indexer] = 127;							while(SensorValue[indexHigh] && (vexRT(Btn6U)||autonShoot)) { delay(5); }							clearTimer(T1);						}						else {							motor[indexer] = -7;						}					}					else {						motor[indexer] = 127;					}					delay(50);				} else if(SensorValue[indexLow] || SensorValue[indexHigh]) {					motor[indexer] = -7;				} else {					motor[indexer] = (vexRT(Btn5U)-vexRT(Btn5D))*127;				}				delay(25);			}			if(vexRT(Btn6D) && SensorValue[indexHigh]) {						motor[indexer] = -127;						delay(250);			}			motor[indexer] = vexRT(Btn5D)?-127:0;			delay(25);		}	}}
开发者ID:Abner3,项目名称:2016MarkIII,代码行数:48,


示例24: intake

task intake(){	while(true){		if(vexRT(Btn5U)){			motor[intake1] = 127;		}		else if(vexRT(Btn5D)){			motor[feeder] = 90;		}		else{			motor[intake1] = 0;			motor[feeder] = 0;		}		wait1Msec(25);	}}
开发者ID:jcgrif,项目名称:2016,代码行数:16,


示例25: main

task main(){	while(true)	{		//Tank Drive		motor[RMotor]=vexRT(Ch2)*0.75;		motor[LMotor]=vexRT(Ch3)*0.75;		//Arm Control		if (vexRT[Btn6U]==1)		{			motor[Arm]=60;		}		else if (vexRT[Btn6D]==1)		{			motor[Arm]=-60;		}		else		{			motor[Arm]=15;		}		//Claw Control		if (vexRT[Btn5U]==1)		{			motor[Claw]=-60;		}		else		{			motor[Claw]=40;		}		//Thumb Control		if (vexRT[Btn5U]==1)		{			motor[Thumb]=60;		}		else if (vexRT[Btn5D]==1)		{			motor[Thumb]=-30;		}		else		{			motor[Thumb]=0;		}	}}
开发者ID:Roborioles,项目名称:2015_VEX_CLAWBOT,代码行数:47,


示例26: doorMotorControl

 /*This is the function that controls the motor for the corn doorif the first button is pressed the door opensif the second button is pressed the door closesotherwise the motor does not move */ void doorMotorControl(){ 	//Declare and initialize btn1 as a button on the vex controller, which may be changed based on driver requests. 	int btn1 = vexRT(Btn6U); 	int btn2 = vexRT(Btn6D); 	if((btn1 == 1)&&(SensorValue(limit)==1)){ 		//This opens the corn door 		motor[doorMotor] = 175; 	} 	else if(btn2 == 1){ 		//This part will turn the motor to close the door 		motor[doorMotor] = -175; 	}	 else{		//This part says that if the buttons are not pushed, the motor does not turn		 motor[doorMotor] = 0;	 } }
开发者ID:StemBestRobotics,项目名称:RobotCode,代码行数:24,


示例27: cheesyDrive

void cheesyDrive(){	int wheel;	int throttle;	bool quickTurn = false;	wheel = vexRT(Ch1);		//set right axis on joystick equal to wheel	throttle = vexRT(Ch3);//set left axis on joystick equal to throttle	if(abs(wheel) > QUICKSENS) quickTurn = true;	//if I'm beyond a certain point on my axis, enable quickturn	if(quickTurn) wheel *= QUICKVAL;	//If i'm in quickturn, turn a lot faster than normal	else{		float newThrottle = throttle / 127;		//If I'm not in quickturn turn a little bit slower for control		wheel = newThrottle * SPEEDVAL * wheel;	}	leftSide = throttle + wheel;	//Enable arcade drive with the new values of wheel and throttle	rightSide = throttle - wheel;	leftSide = limit_motor(leftSide);	//Limit both motors in case they're beyond 127	rightSide = limit_motor(rightSide);}
开发者ID:TytanRock,项目名称:33B_VexCode-2015-2016,代码行数:19,


示例28: intakeControl

task intakeControl () {	while(true) {		motor[intake] = ((vexRT(Btn5U)||intakeAutonomousIntake)-vexRT(Btn5D))*100;		//Move ball from high limit switch to low limit switch		if(vexRT(Btn6D) && SensorValue[indexHigh]) {			motor[indexer] = -127;			delay(intakeMoveDownTime);		}		//Shooting control		if (vexRT(Btn6U) || intakeAutonomousShoot) {			//if(intakeLongShot?abs(currentShot.velocity-flywheelVelocity)<currentShot.velocityThreshold:true)) {			if(time1[T1]>300 || !intakeLongShot) {				writeDebugStreamLine("%d", flywheelVelocity);				motor[indexer] = 127;				wait1Msec(150);				clearTimer(T1);			}			else {				motor[indexer] = (SensorValue[indexHigh])?0:127;			}		}		//Move ball down even if there is a sensor we want		else if (vexRT(Btn5D))			motor[indexer] = -127;		//Stop ball if ball is at a sensor		else if(SensorValue[indexLow]<intakeLightThreshold && !SensorValue[indexHigh]) {			motor[indexer] = 70;			clearTimer(T2);			while(time1[T2] < intakeMoveUpTime && !SensorValue[indexHigh]) { delay(20); }			motor[indexer] = 0;		}		else			motor[indexer] = 0;		delay(25);	}}
开发者ID:Abner3,项目名称:2016MarkIII,代码行数:42,


示例29: shooterDJ

task shooterDJ () {	startTask(feederWait);	int timesFed = 0;	bool canRunAgain = true;	while (true)	{		if(vexRT(Btn7U))			speed++;		if(vexRT(Btn7D))			speed--;		if(SensorValue[ballHigh]&&canRunAgain) {			timesFed++;			speed+=15;//7;		}		if(timesFed>0 & canRunAgain)			canRunAgain = false;		FwMotorSet(speed);		//sprintf( str, "%4d %4d", target_velocity,  motor_velocity, nImmediateBatteryLevel/1000.0 );		wait1Msec(200);	}}
开发者ID:jcgrif,项目名称:2016,代码行数:21,


示例30: main

task main() { //This holds the main tasks the robot initially starts with.	startTask(drive); //This starts the drivetask so we can actually drive the robot.	startTask(manipulator);	while(on) {		rightX = vexRT(Ch1);		if(abs(rightX)<thresh){ //This adds a deadzone in the controller's right X axis, so that drivers have more reliable control of the robot.			rightX = 0;		}		rightY = vexRT(Ch2);		if(abs(rightY)<thresh){ //This adds a deadzone in the controller's right Y axis, so that drivers have more reliable control of the robot.			rightY = 0;		}		leftY = vexRT(Ch3);		if(abs(leftY)<thresh){ //This adds a deadzone in the controller's left Y axis, so that drivers have more reliable control of the robot.			leftY = 0;		}		leftX = vexRT(Ch4);		if(abs(leftX)<thresh){ //This adds a deadzone in the controller's left X axis, so that drivers have more reliable control of the robot.			leftX = 0;		}	}}
开发者ID:MetroHomeschoolRobotics,项目名称:mhr_best_2016_code,代码行数:22,



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


C++ vf_get_image函数代码示例
C++ verticalScrollBar函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。