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

C++ IsOperatorControl函数代码示例

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

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



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

示例1: OperatorControl

	/**
	 * Runs the motor from the output of a Joystick.
	 */
	void OperatorControl() {
		while (IsOperatorControl() && IsEnabled()) {
			// Set the motor controller's output.
			// This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards).
			m_motor.Set(m_stick.GetY());

			Wait(kUpdatePeriod); // Wait 5ms for the next update.
		}
	}
开发者ID:Beachbot330,项目名称:eclipse_plugins,代码行数:12,代码来源:Robot.cpp


示例2: OperatorControl

	//
	// Main Tele Operator Mode function.  This function is called once, therefore a while loop that checks IsOperatorControl and IsEnabled is used 
	// to maintain control until the end of tele operator mode
	//
	void OperatorControl()
	{
		//myRobot.SetSafetyEnabled(true);
		
		timer->Start();
		Relay* reddlight = new Relay(4);
		//Timer* lighttimer = new Timer();
		//lighttimer->Start();
		while (IsOperatorControl() && IsEnabled())
		{
			reddlight->Set(reddlight->kForward);
			/*
			if (lighttimer->Get()<=0.5) {
				reddlight->Set(reddlight->kForward);
			}
			else if(lighttimer->Get()<1){
				reddlight->Set(reddlight->kOff);
			}
			else {
				lighttimer->Reset();
			}
			*/
			//
			// Get inputs
			//
			driverInput->GetInputs();
			drive->GetInputs();
			catapult->GetInputs();
			feeder->GetInputs();
			
			//
			// Pass values between components as necessary
			//
			//catapult->SetSafeToFire(feeder->GetAngle()<95); 
			
			//
			// Execute one step on each component
			//
			drive->ExecStep(); 
			catapult->ExecStep();
			feeder->ExecStep(); 
			
		    //
			// Set Outputs on all components
			//
			catapult->SetOutputs();
			feeder->SetOutputs();
			
			//
			// Wait for step timer to expire.  This allows us to control the amount of time each step takes. Afterwards, restart the 
			// timer for the next loop
			//
			while (timer->Get()<(PERIOD_IN_SECONDS));
			timer->Reset();

		}
	}
开发者ID:TitaniumTitans,项目名称:FRC-2014,代码行数:61,代码来源:MyRobot.cpp


示例3: printf

void WorkshopRobot::OperatorControl(void){
	printf("2250 start\n"); 					//Check in with the console.
	while (IsOperatorControl()){ 				//Called once at the beggining of the teleop mode.
		//printf("Feed!\n");
		driveSys->RunDriveSystem();
		LauncherMech->RunLauncher();
		Wait(0.005); 							//Minimum motor controller wait time. (also handy for ticks)
	}
}
开发者ID:Team2550,项目名称:cRIO-Code,代码行数:9,代码来源:WorkshopRobot.cpp


示例4: OperatorControl

	void OperatorControl(void)
	{
		while (IsOperatorControl())
		{
			driveTrain->Drive();
			pickupBall->Pickup();
			ballShooter->ShootBall();
		}
	}
开发者ID:FRC-263,项目名称:Gimli,代码行数:9,代码来源:Robot2014.cpp


示例5: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
			Wait(0.005);				// wait for a motor update time
		}
	}
开发者ID:Skunk-ProLaptop,项目名称:Skunkworks1983,代码行数:12,代码来源:MyRobot.cpp


示例6: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();
			myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
		}
	}
开发者ID:Team694,项目名称:frc,代码行数:12,代码来源:Michael1.cpp


示例7: while

void TestBed::OperatorControl(void)
{
	while (IsOperatorControl() && !IsDisabled())
	{
		DriveSys->RemoteDrive();
		SmartDashboard::PutNumber("LeftStick: ", DriveSys->LeftStickY);
		SmartDashboard::PutNumber("RightStick:", DriveSys->RightStickY);
		Wait(0.005);// wait for a motor update time
	}
}
开发者ID:Team2550,项目名称:cRIO-Code,代码行数:10,代码来源:TestBedSimple.cpp


示例8: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		float speed = 0;
		while (IsOperatorControl())
		{
			myRobot.TankDrive(leftstick, rightstick);
			//driveleft.Set(1);  //Why are we setting driveleft and driveright to 1 and -1?
			//driveright.Set(-1);  
		}
	}
开发者ID:AdriannasArsenic,项目名称:robot2013,代码行数:13,代码来源:MyRobot.cpp


示例9: TeleopInit

	void TeleopInit()
	{
		while(IsOperatorControl())
		{
			intake();
			shoot();
		
		}
		
	}
开发者ID:Mbaig7,项目名称:2013_Medic,代码行数:10,代码来源:Medic.cpp


示例10: OperatorControl

	/**
	 * Runs the motors with arcade steering.
	 */
	void OperatorControl()
	{
		while (IsOperatorControl() && IsEnabled())
		{

			myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
			//camera.GetImage(Image); 	//get the most recent image from the camera
			Wait(0.005);				// wait for a motor update time
		}
	}
开发者ID:dat-tehcie-stew,项目名称:2172,代码行数:13,代码来源:Robot.cpp


示例11: OperatorControl

void OperatorControl(void)
{
	SetWatchdogEnabled(true);
	while (IsOperatorControl())
	{
		WatchdogFeed();
		ArcadeDrive(JOYSTICK_PORT);
		Wait(0.005);
	}
}
开发者ID:2202Programming,项目名称:OldCode,代码行数:10,代码来源:CSimpleTemplate.cpp


示例12: OperatorControl

		/**
		 * Runs the motors under driver control with either tank or arcade steering selected
		 * by a jumper in DS Digin 0. Also an arm will operate based on a joystick Y-axis. 
		 */
		void OperatorControl()
		{
			control->initialize();
			while (IsOperatorControl())
			{
				control->run();
				dsLCD->UpdateLCD();
				Wait(0.005);
			}
		}
开发者ID:2202Programming,项目名称:OldCode,代码行数:14,代码来源:DriverStationLCDTextExample.cpp


示例13: OperatorControl

	// Code to be run during the remaining 2:20 of the match (after Autonomous())
	//
	// OperatorControl
	//	* Calls all the above methods
	void OperatorControl()
	{
		// SAFETY AND SANITY - SET ALL TO ZERO
		intake.Set(0.0);
		rightWinch.Set(0.0);
		leftWinch.Set(0.0);

		arm.Set(DoubleSolenoid::kReverse);

		/* TODO: Investigate. At least year's (GTR East) competition, we reached the conclusion that disabling this was 
		 * the only way we could get out robot code to work (reliably). Should this be set to false?
		 */ 
		robotDrive.SetSafetyEnabled(false);

		Timer clock;
		int sanity = 0;
		int bigSanity = 0;

		loading = false;
		loaded = winchSwitch.Get();

		RegisterButtons();
		gamepad.Update();
		leftStick.Update();

		compressor.Start();

		while (IsOperatorControl() && IsEnabled())
		{
			clock.Start();

			HandleDriverInputs();
			HandleShooter();
			HandleArm();
			//			HandleEject();

			while (!clock.HasPeriodPassed(LOOP_PERIOD)); // add an IsEnabled???
			clock.Reset();
			sanity++;
			if (sanity >= 100)
			{
				bigSanity++;
				sanity = 0;
				dsLCD->PrintfLine(DriverStationLCD::kUser_Line4, "%d", bigSanity);
			}
			gamepad.Update();
			leftStick.Update();
			dsLCD->UpdateLCD();
		}

		// SAFETY AND SANITY - SET ALL TO ZERO
		intake.Set(0.0);
		rightWinch.Set(0.0);
		leftWinch.Set(0.0);
	}
开发者ID:D3ZOMBKEELA,项目名称:Robot-2014,代码行数:59,代码来源:FRC2994_2014.cpp


示例14: OperatorControl

    /**
     * Drive based upon joystick inputs, and automatically control
     * motors if the robot begins tipping.
     */
    void OperatorControl()
    {
        robotDrive.SetSafetyEnabled(false);
        while (IsOperatorControl() && IsEnabled()) {

            double xAxisRate = stick.GetX();
            double yAxisRate = stick.GetY();
            double pitchAngleDegrees = ahrs->GetPitch();
            double rollAngleDegrees = ahrs->GetRoll();

            if ( !autoBalanceXMode &&
                 (fabs(pitchAngleDegrees) >=
                  fabs(kOffBalanceThresholdDegrees))) {
                autoBalanceXMode = true;
            }
            else if ( autoBalanceXMode &&
                      (fabs(pitchAngleDegrees) <=
                       fabs(kOnBalanceThresholdDegrees))) {
                autoBalanceXMode = false;
            }
            if ( !autoBalanceYMode &&
                 (fabs(pitchAngleDegrees) >=
                  fabs(kOffBalanceThresholdDegrees))) {
                autoBalanceYMode = true;
            }
            else if ( autoBalanceYMode &&
                      (fabs(pitchAngleDegrees) <=
                       fabs(kOnBalanceThresholdDegrees))) {
                autoBalanceYMode = false;
            }

            // Control drive system automatically,
            // driving in reverse direction of pitch/roll angle,
            // with a magnitude based upon the angle

            if ( autoBalanceXMode ) {
                double pitchAngleRadians = pitchAngleDegrees * (M_PI / 180.0);
                xAxisRate = sin(pitchAngleRadians) * -1;
            }
            if ( autoBalanceYMode ) {
                double rollAngleRadians = rollAngleDegrees * (M_PI / 180.0);
                yAxisRate = sin(rollAngleRadians) * -1;
            }

            try {
                // Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation.
                robotDrive.MecanumDrive_Cartesian(xAxisRate, yAxisRate,stick.GetZ());
            } catch (std::exception ex ) {
                std::string err_string = "Drive system error:  ";
                err_string += ex.what();
                DriverStation::ReportError(err_string.c_str());
            }
            Wait(0.005); // wait 5ms to avoid hogging CPU cycles
        }
    }
开发者ID:HighRollersCode,项目名称:HR16,代码行数:59,代码来源:Robot.cpp


示例15: OperatorControl

	/**
	 *  Tells the robot to drive to a set distance (in inches) from an object using
	 *  proportional control.
	 */
	void OperatorControl() {

		double currentDistance; //distance measured from the ultrasonic sensor values
		double currentSpeed; //speed to set the drive train motors

		while (IsOperatorControl() && IsEnabled()) {
			currentDistance = ultrasonic->GetValue() * valueToInches; //sensor returns a value from 0-4095 that is scaled to inches
			currentSpeed = (holdDistance - currentDistance) * pGain; //convert distance error to a motor speed
			myRobot->Drive(currentSpeed, 0); //drive robot
		}
	}
开发者ID:Talos4757,项目名称:allwpilib,代码行数:15,代码来源:Robot.cpp


示例16: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void) {

		while (IsOperatorControl()) {
			dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Voltage: %f",
					signal.GetVoltage());
			dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "CVoltage: %f",
					signalControlVoltage.GetVoltage());
			dsLCD->UpdateLCD();
			Wait(0.005); // wait for a motor update time
		}
	}
开发者ID:2202Programming,项目名称:OldCode,代码行数:14,代码来源:Sonar.cpp


示例17: while

void MainRobot::OperatorControl() {
    mWatchdog->SetEnabled(true);

    while (IsOperatorControl()) {
        mJoystickController->Run();
        GetWatchdog().Feed();
        Wait(cMotorWait);
    }

    return;
}
开发者ID:cosmicomic,项目名称:Bandit_2013,代码行数:11,代码来源:robot.cpp


示例18: printf

void Michael1::OperatorControl(void)
{
	printf("\n\n\tStart Teleop:\n\n");
	GetWatchdog().SetEnabled(false);
	ariels_light->Set(0);
	
	while (IsOperatorControl())
	{
		dt->TankDrive(left_stick, right_stick);
	}
}
开发者ID:Team694,项目名称:frc,代码行数:11,代码来源:Michael1.cpp


示例19: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			myRobot.ArcadeDrive(stick.getAxisLeftY(), stick.getAxisLeftX()); // drive with arcade style (use left stick)
			dsLCD->Printf(DriverStationLCD::kUser_Line2, 1, "Move: %f4", stick.getAxisLeftY());
			dsLCD->Printf(DriverStationLCD::kUser_Line3, 1, "Rotate: %f4", stick.getAxisLeftX());
			dsLCD->UpdateLCD();
			Wait(0.005);				// wait for a motor update time
		}
	}
开发者ID:2202Programming,项目名称:OldCode,代码行数:15,代码来源:MyRobot.cpp


示例20: OperatorControl

	void OperatorControl()
	{
		tank.StartDrive();
		kick.StartKicker();
		while (IsOperatorControl())
		{
			comp.checkCompressor();
			tank.Drive(PrimaryController.GetRawAxis(LEFT_JOYSTICK), PrimaryController.GetRawAxis(RIGHT_JOYSTICK), (int)PrimaryController.GetRawButton(BUTTON_HIGH_DRIVE_SHIFT), (int)PrimaryController.GetRawButton(BUTTON_LOW_DRIVE_SHIFT));
			kick.StateMachine(PrimaryController.GetRawButton(BUTTON_KICK));
			collect.runCollector(PrimaryController.GetRawButton(BUTTON_ROLLER_ON));
		}
	}
开发者ID:Team537,项目名称:RobotCode,代码行数:12,代码来源:MyRobot.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ IsPC函数代码示例发布时间:2022-05-30
下一篇:
C++ IsOper函数代码示例发布时间: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