當前位置: 首頁>>代碼示例>>C++>>正文


C++ Collection::ExtendArm方法代碼示例

本文整理匯總了C++中Collection::ExtendArm方法的典型用法代碼示例。如果您正苦於以下問題:C++ Collection::ExtendArm方法的具體用法?C++ Collection::ExtendArm怎麽用?C++ Collection::ExtendArm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Collection的用法示例。


在下文中一共展示了Collection::ExtendArm方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1:

	/**
	 * Initialization code for autonomous mode should go here.
	 * 
	 * Use this method for initialization code which will be called each time
	 * the robot enters autonomous mode.
	 */
	void RA14Robot::AutonomousInit() {
		Config::LoadFromFile("config.txt");
		auto_case = (int) Config::GetSetting("auto_case", 1);
		alreadyInitialized = true;
		auto_timer->Reset();
		auto_timer->Start();
		missionTimer->Start();
		myDrive->ResetOdometer();
		myCamera->Set(Relay::kForward);
		myCollection->ExtendArm();
		cout<<"Reseting Gyro"<<endl;
		gyro->Reset();
		//myOdometer->Reset();
		//myDrive->ShiftUp();
		myDrive->ShiftDown();
		//shift to high gear
		if (!fout.is_open()) {
			cout << "Opening logging.csv..." << endl;
			fout.open("logging.csv");
			logheaders();
		}
		auto_state = 0;
#ifndef DISABLE_SHOOTER
		myCam->Reset();
		myCam->Enable();
#endif //Ends DISABLE_SHOOTER
	}
開發者ID:RAR1741,項目名稱:RA14_RobotCode,代碼行數:33,代碼來源:RobotMain.cpp

示例2: if


//.........這裏部分代碼省略.........
					myCam->Process(true, false, false);
					auto_state = 5;
					break;
				case 5:
					myCam->Process(false, false, false);
					
					if(myDrive->GetOdometer() <= 216 - Config::GetSetting("auto_firing_distance", 96)) //216 is distance from robot to goal
					{
						myDrive->Drive(corrected, speed);
					} else {
						// now at the firing spot.
						auto_state = 6;
						myDrive->Drive(0,0);
					}
					break;
				case 6:
					myCollection->RetractArm();
					break;
				default:
					cout << "Error, unrecognized state " << auto_state << endl;
			}
#endif //Ends DISABLE_SHOOTER
			
			break;
			
			case 4:	/* One ball Autonomous - Drive forward specific distance, stop then shoot.*/
#ifndef DISABLE_SHOOTER
		
					switch(auto_state) {
		
						case 0:		//Reset odometer, lower the arm and set launcher to ready to fire
							myDrive->ShiftUp();
							myDrive->ResetOdometer();
							myCollection->ExtendArm();
							myCam->Process(false,true,false);
							auto_state = 1;
							break;
						case 1:		// Start driving forward
							// myDrive->Drive(-.5, -.5);
							//myDrive->Drive(lDrive, rDrive);
							myDrive->DriveArcade(corrected, speed);
							auto_state = 2;
							break;
						case 2:		// Continue driving until required distance
							if(myDrive->GetOdometer() >= Config::GetSetting("auto_drive_distance", 96)) {
								myDrive->Drive(0, 0);
								auto_state = 3;
							}
							break;
						case 3:		// Fire launcher
							myCam->Process(true,false,false);
							auto_state = 4;
							break;
						case 4:		// Idle state
							break;
					}
			
#endif //Ends DISABLE_SHOOTER
			
			break;
			
			case 5:	// Two Ball Autonomous - Drag ball 2 while driving forward specific distance, stop then shoot, load shoot next ball
#ifndef DISABLE_SHOOTER
				// By Hugh Meyer - April 1, 2014
				
					switch(auto_state) {
開發者ID:RAR1741,項目名稱:RA14_RobotCode,代碼行數:67,代碼來源:RobotMain.cpp


注:本文中的Collection::ExtendArm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。