• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ IsAutonomous函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RobotMain

/**
 * Start a competition.
 * This code needs to track the order of the field starting to ensure that
 * everything happens in the right order. Repeatedly run the correct
 * method, either Autonomous or OperatorControl when the robot is
 * enabled. After running the correct method, wait for some state to
 * change, either the other mode starts or the robot is disabled. Then go
 * back and wait for the robot to be enabled again.
 */
void SimpleRobot::StartCompetition()
{
    RobotMain();
    if (!m_robotMainOverridden)
    {
        while (1)
        {
            while (IsDisabled())
                Wait(.01);      // wait for robot to be enabled

            if (IsAutonomous())
            {
                Autonomous();   // run the autonomous method
                while (IsAutonomous() && !IsDisabled())
                    Wait(.01);
            }
            else
            {
                OperatorControl();      // run the operator control method
                while (IsOperatorControl() && !IsDisabled())
                    Wait(.01);
            }
        }
    }
}
开发者ID:FRC980,项目名称:FRC-Team-980,代码行数:34,代码来源:SimpleRobot.cpp


示例2: RobotMain

/**
 * Start a competition.
 * This code needs to track the order of the field starting to ensure that everything happens
 * in the right order. Repeatedly run the correct method, either Autonomous or OperatorControl
 * when the robot is enabled. After running the correct method, wait for some state to change,
 * either the other mode starts or the robot is disabled. Then go back and wait for the robot
 * to be enabled again.
 */
void SimpleRobot::StartCompetition()
{
	RobotMain();
	if (!m_robotMainOverridden)
	{
		while (1)
		{
			if (IsDisabled())
			{
				Disabled();
				while (IsDisabled()) Wait(.01);
			}
			else if (IsAutonomous())
			{
				Autonomous();
				while (IsAutonomous() && IsEnabled()) Wait(.01);
			}
			else
			{
				OperatorControl();
				while (IsOperatorControl() && IsEnabled()) Wait(.01);
			}
		}
	}
}
开发者ID:Veryku,项目名称:Saints-Robotics-Programming,代码行数:33,代码来源:SimpleRobot.cpp


示例3: RobotMain

/**
 * Start a competition.
 * This code needs to track the order of the field starting to ensure that everything happens
 * in the right order. Repeatedly run the correct method, either Autonomous or OperatorControl
 * when the robot is enabled. After running the correct method, wait for some state to change,
 * either the other mode starts or the robot is disabled. Then go back and wait for the robot
 * to be enabled again.
 */
void SimpleRobot::StartCompetition()
{
    RobotMain();
    
    if (!m_robotMainOverridden)
    {
        // first and one-time initialization
        RobotInit();

        while (true)
        {
            if (IsDisabled())
            {
                m_ds->InDisabled(true);
                Disabled();
                m_ds->InDisabled(false);
                while (IsDisabled()) m_ds->WaitForData();
            }
            else if (IsAutonomous())
            {
                m_ds->InAutonomous(true);
                Autonomous();
                m_ds->InAutonomous(false);
                while (IsAutonomous() && IsEnabled()) m_ds->WaitForData();
            }
            else
            {
                m_ds->InOperatorControl(true);
                OperatorControl();
                m_ds->InOperatorControl(false);
                while (IsOperatorControl() && IsEnabled()) m_ds->WaitForData();
            }
        }
    }
}
开发者ID:anidev,项目名称:frc-simulator,代码行数:43,代码来源:SimpleRobot.cpp


示例4: RobotMain

/**
 * Start a competition.
 * This code needs to track the order of the field starting to ensure that everything happens
 * in the right order. Repeatedly run the correct method, either Autonomous or OperatorControl
 * when the robot is enabled. After running the correct method, wait for some state to change,
 * either the other mode starts or the robot is disabled. Then go back and wait for the robot
 * to be enabled again.
 */
void SimpleRobot::StartCompetition()
{
	RobotMain();
	if ( !m_robotMainOverridden)
	{
		while (Simulator::ShouldContinue())
		{
			Simulator::NextStep(0.0);

			if (IsDisabled())
				continue;

			if (IsAutonomous())
			{
				Autonomous();					// run the autonomous method
				while (IsAutonomous() && !IsDisabled() && Simulator::ShouldContinue()) Wait(.01);
			}
			else
			{
				OperatorControl();				// run the operator control method
				while (IsOperatorControl() && !IsDisabled() && Simulator::ShouldContinue()) Wait(.01);
			}
		}
	}
}
开发者ID:multiplemonomials,项目名称:WPILibTestHarness,代码行数:33,代码来源:SimpleRobot.cpp


示例5: RobotMain

/**
 * Start a competition.
 * This code needs to track the order of the field starting to ensure that everything happens
 * in the right order. Repeatedly run the correct method, either Autonomous or OperatorControl
 * or Test when the robot is enabled. After running the correct method, wait for some state to
 * change, either the other mode starts or the robot is disabled. Then go back and wait for the
 * robot to be enabled again.
 */
void SampleRobot::StartCompetition()
{
	LiveWindow *lw = LiveWindow::GetInstance();

	SmartDashboard::init();
	NetworkTable::GetTable("LiveWindow")->GetSubTable("~STATUS~")->PutBoolean("LW Enabled", false);

	RobotMain();

	if (!m_robotMainOverridden)
	{
		// first and one-time initialization
		lw->SetEnabled(false);
		RobotInit();

		while (true)
		{
			if (IsDisabled())
			{
				m_ds.InDisabled(true);
				Disabled();
				m_ds.InDisabled(false);
				while (IsDisabled()) sleep(1); //m_ds.WaitForData();
			}
			else if (IsAutonomous())
			{
				m_ds.InAutonomous(true);
				Autonomous();
				m_ds.InAutonomous(false);
				while (IsAutonomous() && IsEnabled()) sleep(1); //m_ds.WaitForData();
			}
            else if (IsTest())
            {
              lw->SetEnabled(true);
              m_ds.InTest(true);
              Test();
              m_ds.InTest(false);
              while (IsTest() && IsEnabled()) sleep(1); //m_ds.WaitForData();
              lw->SetEnabled(false);
            }
			else
			{
				m_ds.InOperatorControl(true);
				OperatorControl();
				m_ds.InOperatorControl(false);
				while (IsOperatorControl() && IsEnabled()) sleep(1); //m_ds.WaitForData();
			}
		}
	}
}
开发者ID:adsnaider,项目名称:Robotics-Project,代码行数:58,代码来源:SampleRobot.cpp


示例6: AutonomousType10

	//Grab first two and turn to go right
	void AutonomousType10() {
		SmartDashboard::PutString("STATUS:", "STARTING AUTO 10");
		robotDrive.MecanumDrive_Cartesian(0, -0.2, 0);
		if (WaitF(1.2))
			return;
		robotDrive.MecanumDrive_Cartesian(0, 0, 0);
		chainLift.SetSpeed(0.5);
		while (IsAutonomous() && maxUp.Get() && midPoint.Get()) {
		}
		chainLift.SetSpeed(0);
		robotDrive.MecanumDrive_Cartesian(0, 0.4, 0);
		if (WaitF(1.6))
			return;

		robotDrive.MecanumDrive_Polar(0, 0, 0.3);
		if (WaitF(2.6))
			return;

		robotDrive.MecanumDrive_Cartesian(0, -0.4, 0);
		if (WaitF(1))
			return;

		robotDrive.MecanumDrive_Polar(0, 0, -0.3);
		if (WaitF(2.6))
			return;

		robotDrive.MecanumDrive_Cartesian(0, -0.4, 0);
		if (WaitF(1.6))
			return;
		robotDrive.MecanumDrive_Cartesian(0, 0, 0);
		SmartDashboard::PutString("STATUS:", "AUTO 10 COMPLETE");
	}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:33,代码来源:Main.cpp


示例7: Drive

	void Drive (float speed, int dist)
	{
		leftDriveEncoder.Reset();
		leftDriveEncoder.Start();
		
		int reading = 0;
		dist = abs(dist);
		
		// The encoder.Reset() method seems not to set Get() values back to zero,
		// so we use a variable to capture the initial value.
		dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "initial=%d\n", leftDriveEncoder.Get());
		dsLCD->UpdateLCD();

		// Start moving the robot
		robotDrive.Drive(speed, 0.0);
		
		while ((IsAutonomous()) && (reading <= dist))
		{
			reading = abs(leftDriveEncoder.Get());				
			dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "reading=%d\n", reading);
			dsLCD->UpdateLCD();
		}

		robotDrive.Drive(0.0, 0.0);
		
		leftDriveEncoder.Stop();
	}	
开发者ID:D3ZOMBKEELA,项目名称:Robot-2014,代码行数:27,代码来源:FRC2994_2014.cpp


示例8: AutonomousStateMachine

	void AutonomousStateMachine() {
		pneumaticsControl->initialize();
		shooterControl->initializeAuto();
		driveControl.initializeAuto();
		enum AutoState {
			AutoDrive, AutoSetup, AutoShoot
		};
		AutoState autoState;
		autoState = AutoDrive;

		bool feederState = false;
		bool hasFired = false;
		Timer feeder;

		while (IsAutonomous() && IsEnabled()) {
			GetWatchdog().Feed();
			switch (autoState) {//Start of Case Machine
			case AutoDrive://Drives the robot to set Destination 
				bool atDestination = driveControl.autoPIDDrive2();
				if (atDestination) {//If at Destination, Transition to Shooting Setup
					autoState = AutoSetup;
				}
				break;
			case AutoSetup://Starts the ballgrabber motors to place the ball and extends ballgrabber
				if (!pneumaticsControl->ballGrabberIsExtended()) {//extends ballgrabber if not already extended
					pneumaticsControl->ballGrabberExtend();
				}

				if (!feederState) {//Started the feeder timer once
					feederState = true;
					feeder.Start();
					autoState = AutoShoot;
				}

				break;
			case AutoShoot://Shoots the ball
				if (feeder.Get() < 2.0) {//Runs ballgrabber for 2.0 Seconds at most
					shooterControl->feed(true);
				} else if (feeder.Get() >= 2.0) {//Transition to Shooting
					shooterControl->feed(false);
					feeder.Stop();
				}
				
				if (pneumaticsControl->ballGrabberIsExtended() && !hasFired) {
					shooterControl->autoShoot();
					dsLCD->PrintfLine(DriverStationLCD::kUser_Line1,
							"The robot is(should be) shooting");
					if (shooterControl->doneAutoFire()) {//Returns true only after shoot is done firing
						hasFired = true;
					}
				} else if (hasFired) {//runs only after shoot is done
					dsLCD->PrintfLine(DriverStationLCD::kUser_Line1,
							"AutoMode Finished");
				}
				break;
			}
			dsLCD->UpdateLCD();

		}
	}
开发者ID:2202Programming,项目名称:OldCode,代码行数:60,代码来源:Hohenheim.cpp


示例9: output

	void output (void)
	{
		REDRUM;
		if (IsAutonomous())
			driverOut->PrintfLine(DriverStationLCD::kUser_Line1, "blaarag");
		else if (IsOperatorControl())
		{	
			REDRUM;
		}
		outputCounter++;
					
					if (outputCounter % 30 == 0){
						REDRUM;
					driverOut->PrintfLine(DriverStationLCD::kUser_Line2, "Top Shooter RPM: %f",(float)LTop.GetSpeed());
					driverOut->PrintfLine(DriverStationLCD::kUser_Line3, "Bot Shooter RPM: %f",(float)LBot.GetSpeed());
			//		driverOut->PrintfLine(DriverStationLCD::kUser_Line6, "Pilot Z-Axis: %f",pilot.GetZ());
					
					}
					
					if (outputCounter % 60 == 0){
						REDRUM;
					driverOut->PrintfLine(DriverStationLCD::kUser_Line4, "Top CANJag Temp: %f Celcius",LTop.GetTemperature()*(9/5) + 32);
					driverOut->PrintfLine(DriverStationLCD::kUser_Line5, "Bot CANJag Temp: %f Celcius",LBot.GetTemperature()*(9/5) + 32);
				    outputCounter = 1;
					}
		driverOut->UpdateLCD();
	}//nom nom nom
开发者ID:HelenCheng,项目名称:DoctorOctagonapus,代码行数:27,代码来源:MyRobot.cpp


示例10: printf

void Michael1::Autonomous(void)
{
	printf("\n\n\tStart Autonomous:\n\n");
	GetWatchdog().SetEnabled(false);
	ariels_light->Set(1);
		
	while (IsAutonomous())
	{
		Wait(0.1); //important
		dt->SmoothTankDrive(left_stick, right_stick);
		//dt->UpdateSlip();
		//dt->UpdateSlip(); //calling slipControl(true) should spawn a task which does this.
		
		//printf("Encoder: %f, ", dt->encoder_left->GetDistance());
		//printf("Gyro: %f, ", dt->gyro->GetAngle());
		//printf("Accel: %f", dt->accel->GetAcceleration());
		//printf("\n\n");s
		
		/*Wait(.1);
		if(cam->FindTargets()){
			ariels_light->Set(1);
		} else {
			ariels_light->Set(0);
		}
		*/
	}

}
开发者ID:Team694,项目名称:frc,代码行数:28,代码来源:Michael1.cpp


示例11: AutonomousType11

	//Grab first yellow, back up to auto zone, drop
	void AutonomousType11() {
		SmartDashboard::PutString("STATUS:", "STARTING AUTO 11");
		chainLift.SetSpeed(0.5);
		while (IsAutonomous() && IsEnabled() && maxUp.Get() && midPoint.Get()) {
		}
		chainLift.SetSpeed(0);
		robotDrive.MecanumDrive_Cartesian(0, 0.4, 0);
		if (WaitF(3))
			return;
		robotDrive.MecanumDrive_Cartesian(0, 0, 0);
		chainLift.SetSpeed(-0.5);
		while (IsAutonomous() && IsEnabled() && maxDown.Get()) {
		}
		chainLift.SetSpeed(0);
		SmartDashboard::PutString("STATUS:", "AUTO 11 COMPLETE");
	}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:17,代码来源:Main.cpp


示例12: while

/* RunScript is blocking (pauses thread until script is complete)
 * Takes a pointer to a Command in a Command array (Script).
 * Iterates over said array until reaches "END" command.
 */
void Michael1::RunScript(Command* scpt){
	bool finished = false;
	
	while (IsAutonomous())
		{
			switch(scpt->cmd){
			case TURN:
				dt->Turn(scpt->param1,14.5 - time->Get());
				break;
			case JSTK:
				dt->SetMotors(scpt->param1, scpt->param2);
				Wait(14.5 - time->Get());
				break;
			case WAIT:
				dt->SetMotors(0,0);
				Wait(scpt->param1);
				break;
			case FWD:
				dt->GoDistance(scpt->param1,14.5 - time->Get());
				break;
			default:
				dt->SetMotors(0,0);
				finished = true;
			}
			if (finished){
				break;
			}
			scpt++;
		}
}
开发者ID:Team694,项目名称:frc,代码行数:34,代码来源:Michael1.cpp


示例13: Autonomous

	void Autonomous()
	{
		while(IsAutonomous())
		{
			//do stuff
		}
	}
开发者ID:mililanirobotics,项目名称:FRC2015,代码行数:7,代码来源:Robot.cpp


示例14: Run

void DriveController :: Run()
{
	if ( IsAutonomous() )
		Autonomous();
	
	else if ( IsOperatorControl() )
		OperatorControl();
}
开发者ID:Himorask,项目名称:Nashoba-Robotics,代码行数:8,代码来源:DriveController.cpp


示例15: Autonomous

	void Autonomous() {
		if (DriverStation::GetInstance()->IsFMSAttached()) log->InMatch();
		
		log->Info("AUTONOMOUS START");
		
		while (IsAutonomous()) {
			Wait(0.10);
		}
	}
开发者ID:CRRobotics,项目名称:Robots,代码行数:9,代码来源:MyRobot.cpp


示例16: Autonomous

	void Autonomous(void)
	{
		GetWatchdog().SetEnabled(false);
		
		if (recorder.StartPlayback())
		{
			while (IsAutonomous() && recorder.Playback());
		}
	}
开发者ID:frc2423,项目名称:2008-2012,代码行数:9,代码来源:MyRobot.cpp


示例17: Autonomous

	void Autonomous ()
	{
		DriveTrain.StartDriveTrain();
		Shooter.StartShooterAuto();
		AutonomousState = 1;
		while(IsAutonomous())
		{
			if (AutonomousSwitch.Get() == 0)
			{
				if (AutonomousState == 1)
				{
					DriveTrain.RunDriveTrain(1, 1, 0, 0);
					if ((DriveTrain.LeftEncTotal >= 2400) || (DriveTrain.RightEncTotal >= 2400))
					{
						AutonomousState = 2;
					}
				}
				else if ((AutonomousState == 2) && (HotGoal == true))
				{
					Shooter.RunShooter(0, 1, 0);
				}
			}
			else if (AutonomousSwitch.Get() == 1)
			{
				if (AutonomousState == 1)
				{
					DriveTrain.RunDriveTrain(1, 1, 0, 0);
					if ((DriveTrain.LeftEncTotal >= 2400) || (DriveTrain.RightEncTotal >= 2400))
					{
						AutonomousState = 2;
					}
				}
				else if ((AutonomousState == 2) && (WhichHotGoal != 0))
				{
					DriveTrain.RunDriveTrain(WhichHotGoal, -WhichHotGoal, 0, 0);
					if (((WhichHotGoal == 1) && ((DriveTrain.LeftEncTotal >= 2800) || (DriveTrain.RightEncTotal <= 2000))) || ((WhichHotGoal == -1) && ((DriveTrain.LeftEncTotal <= 2000) || (DriveTrain.RightEncTotal >= 2800))))
					{
						AutonomousState = 3;
					}
				}
				else if (AutonomousState == 3)
				{
					Shooter.RunShooter(0, 1, 0);
					AutonomousState = 4;
				}
				else if (AutonomousState == 4)
				{
					DriveTrain.RunDriveTrain(-WhichHotGoal, WhichHotGoal, 0, 0);
					if (((WhichHotGoal == 1) && ((DriveTrain.LeftEncTotal <= 2400) || (DriveTrain.RightEncTotal >= 2400))) || ((WhichHotGoal == -1) && ((DriveTrain.LeftEncTotal >= 2400) || (DriveTrain.RightEncTotal <= 2400))))
					{
						AutonomousState = 5;
					}
				}
			}
		}
	}
开发者ID:Team537,项目名称:RobotCode,代码行数:56,代码来源:MyRobot.cpp


示例18: printf

void Robot::Autonomous(void)
{
  printf("Auto Mode!");

  while(IsAutonomous() && IsEnabled())
  {
    Wait(.1);
    printf("autonomous\r\n");
  }
}
开发者ID:gtozzi0,项目名称:FirstRobotics,代码行数:10,代码来源:Robot.cpp


示例19: Autonomous

	void Autonomous(){
		Option *num = (Option *) chooser->GetSelected();
		myRobot->ResetDisplacement();
		Modes->SetMode(num->Get());
		Modes->Run();
		while(IsAutonomous() && IsEnabled()){
			Wait(0.05);
			Scheduler::GetInstance()->Run();
		}
	}
开发者ID:SigmaCat-Robotics,项目名称:SigmaCodeCPP,代码行数:10,代码来源:Robot.cpp


示例20: while

void Robot::AutonFeed() {
    while (IsEnabled() && IsAutonomous()) {
        DS_PrintOut();

        // make ball conveyors run in reverse for all of Autonomous
        lift.Set(Relay::kReverse);

        Wait(0.1);
    }
}
开发者ID:Team3512,项目名称:Robot-2012,代码行数:10,代码来源:AutonFeed.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IsBadCodePtr函数代码示例发布时间:2022-05-30
下一篇:
C++ IsAutoVacuumWorkerProcess函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap