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


C++ DigitalInput::Get方法代码示例

本文整理汇总了C++中DigitalInput::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ DigitalInput::Get方法的具体用法?C++ DigitalInput::Get怎么用?C++ DigitalInput::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DigitalInput的用法示例。


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

示例1: dumb_climber_code

void RobotDemo::dumb_climber_code()
{
	//printf("Top:%i   Bottom:%i  " , top_claw_limit_switch->Get() , bottom_claw_limit_switch->Get());
	if (drive_stick_prim ->GetRawButton(climber_hold_up))
	{
		if (top_claw_limit_switch->Get() == 1)
		{
			climbing_motor->Set(0.0);
			//printf("STOPPED\n");
		}
		else
		{
			climbing_motor->Set(1);
			//printf("GOING UP\n");
		}
	} // not climber hold up

	else if (drive_stick_prim->GetRawButton(climber_hold_down))
	{
		if (bottom_claw_limit_switch->Get() == 0)
		{
			climbing_motor->Set(0.0);
			//printf("STOPED\n");
		}
		else
		{
			climbing_motor->Set(-1);
			//printf("GOING DOWN\n");
		}
	} // hold down button
	else
	{ // no js buttons pushed
		climbing_motor->Set(0.0);
	}
}
开发者ID:2643,项目名称:2013-Code,代码行数:35,代码来源:final-2013botcode_03-18-13.cpp

示例2: AutonomousInit

	//Choose which auto to use
	void AutonomousInit() {

		chainLift.SetSpeed(0);
		canGrabber.SetSpeed(0);
		robotDrive.MecanumDrive_Cartesian(0, 0, 0);
		SmartDashboard::PutString("STATUS:", "STARTING AUTO");
		robotDrive.SetSafetyEnabled(false);
		chainLift.SetSafetyEnabled(false);

		SmartDashboard::PutBoolean("Auto switch A: ", autoSwitch1.Get());
		SmartDashboard::PutBoolean("Auto switch B: ", autoSwitch2.Get());

		//Select auto type
		if (autoSwitch1.Get()) {
			if (autoSwitch2.Get())
				AutonomousType4();
			else
				//1 on 2 grab n back
				AutonomousType8();
		} else {
			if (autoSwitch2.Get())
				//1 off, 2 on: grab n turn
				AutonomousType10();
			else {
				SmartAutoPicker();
			}
			//Do Nothing
		}
	}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:30,代码来源:Main.cpp

示例3:

	void AutonomousType4() {
		SmartDashboard::PutString("STATUS:", "STARTING AUTO 4");

		//Lift, turn, drive
		chainLift.SetSpeed(0.5);
		while (midPoint.Get() && maxUp.Get()) {
		}
		chainLift.SetSpeed(0);
		robotDrive.MecanumDrive_Polar(0, 0, 0.3);

		if (WaitF(2.5))
			return;
		robotDrive.MecanumDrive_Polar(0.25, 0, 0);
		if (WaitF(5.6))
			return;
		robotDrive.MecanumDrive_Polar(0, 0, 0.3);
		if (WaitF(2))
			return;
		robotDrive.MecanumDrive_Polar(0, 0, 0);
		//chainLift.SetSpeed(-0.4);
		//while (maxDown.Get() && IsAutonomous()) {
		//}
		chainLift.SetSpeed(0);
		robotDrive.MecanumDrive_Polar(0, 0, 0);
		SmartDashboard::PutString("STATUS:", "AUTO 4 COMPLETE");
	}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:26,代码来源:Main.cpp

示例4: 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(void)
	{
		Victor armMotor(5);						// create arm motor instance
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();

			// determine if tank or arcade mode; default with no jumper is for tank drive
			if (ds->GetDigitalIn(ARCADE_MODE) == 0) {	
				myRobot->TankDrive(leftStick, rightStick);	 // drive with tank style
			} else{
				myRobot->ArcadeDrive(rightStick);	         // drive with arcade style (use right stick)
			}

			// Control the movement of the arm using the joystick
			// Use the "Y" value of the arm joystick to control the movement of the arm
			float armStickDirection = armStick->GetY();

			// if at a limit and telling the arm to move past the limit, don't drive the motor
			if ((armUpperLimit->Get() == 0) && (armStickDirection > 0.0)) {
				armStickDirection = 0;
			} else if ((armLowerLimit->Get() == 0) && (armStickDirection < 0.0)) {
				armStickDirection = 0;
			}

			// Set the motor value 
			armMotor.Set(armStickDirection);
		}
	}
开发者ID:Alexander-Brown,项目名称:frc2876,代码行数:33,代码来源:PrototypeRobot.cpp

示例5: DisabledPeriodic

/******************************************************************************
 * Function:     DisabledPeriodic
 *
 * Description:  Run the functions that are expected during the period when the
 *               robot is disabled.
 ******************************************************************************/
void DisabledPeriodic()
{
  Scheduler::GetInstance()->Run();

  Light1.Set(1);
  Light2.Set(1);


  while(IsDisabled())
  {
    UpdateActuatorCmnds(0,0,false,false,false,false,false,false,false,0,0,0,0,0);

    ReadAutonSwitch();

    UpdateSmartDashboad(Sw1.Get(),
                        Sw2.Get(),
                        Sw3.Get(),
                        Sw4.Get(),
                        BlSw.Get(),
                        (double)AutonState,
                        (double)0,
                        ballarm.GetDistance(),
                        gyroOne.GetAngle(),
                        accel.GetX(),
                        accel.GetY(),
                        accel.GetZ(),
                        (double)0,
                        (double)0);
  wait(kUpdatePeriod);
  }
}
开发者ID:ConnerWallace,项目名称:5561-Raider-Robotics,代码行数:37,代码来源:Robot.cpp

示例6: 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

示例7: shootCatapult

	void shootCatapult()
	{
		if (logitech.GetRawButton(2) && buttonOne.Get()==0 && buttonTwo.Get()==0)
		{
			dogSolenoid.Set(DoubleSolenoid::kReverse);
			Wait(0.5);
			ratchetSolenoid.Set(DoubleSolenoid::kReverse);
			Wait(1);
		}
	}
开发者ID:secant,项目名称:robot2014,代码行数:10,代码来源:AutonomousCodeTest.cpp

示例8: DriverLCD

void RobotDemo::DriverLCD()
{
	if (cycle_counter >= 50)
	{
		dsLCD->Printf(DriverStationLCD::kUser_Line1, 1, "RPS Back:%f  ",
				RPS_back);
		dsLCD->Printf(DriverStationLCD::kUser_Line2, 1, "RPS Front:%f  ",
				RPS_front);
		dsLCD->Printf(DriverStationLCD::kUser_Line3, 1, "RPS DRPS:%f  ",
				desired_RPS_control);
#if 0
		if (shooter_fire_piston_A->Get())
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line4, 1,"Fire   ");
		}
		else
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line4, 1,"Retracting...   ");
		}
#endif
		//dsLCD->Printf(DriverStationLCD::kUser_Line4, 1,"TopLS:%i   BotLS:%i   ", top_claw_limit_switch->Get(),
		//	bottom_claw_limit_switch ->Get());
		if (top_claw_limit_switch->Get())
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line4, 1, "!TOP");
		}
		else if (!bottom_claw_limit_switch->Get())
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line4, 1, "!BOTTOM");
		}
		else
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line4, 1, "Neither");
		}
		if (shooter_angle_1->Get())
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line5, 1, "Up   ");
		}
		else
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line5, 1, "Down   ");
		}
		if (arcadedrive)
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line6, 1, "Arcade   ");
		}
		else
		{
			dsLCD->Printf(DriverStationLCD::kUser_Line6, 1, "Tank   ");
		}
		dsLCD->UpdateLCD();
		//cycle_counter = 0;
	}
	//cycle_counter++;
}
开发者ID:2643,项目名称:2013-Code,代码行数:55,代码来源:final-2013botcode_03-18-13.cpp

示例9: loadCatapult

	void loadCatapult()
	{
		if (buttonOne.Get()==1 && buttonTwo.Get()==1 && dogSolenoid.Get()==DoubleSolenoid::kReverse)
		{
			dogSolenoid.Set(DoubleSolenoid::kForward);
			Wait(0.5);
			ratchetSolenoid.Set(DoubleSolenoid::kForward);
			Wait(0.5);
			catapultMotor.Set(1);
		}
	}
开发者ID:secant,项目名称:robot2014,代码行数:11,代码来源:AutonomousCodeTest.cpp

示例10: IsEnabled

	//Grab first yellow, back up to auto zone, DON'T DROP
	void AutonomousType12() {
		SmartDashboard::PutString("STATUS:", "STARTING AUTO 12");
		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);
		SmartDashboard::PutString("STATUS:", "AUTO 12 COMPLETE");
	}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:13,代码来源:Main.cpp

示例11: autonomousCatapultRelease

	void autonomousCatapultRelease()
	{
		if ((leftLimitSwitch.Get()== 0 || rightLimitSwitch.Get()== 0) && winchMotor.Get() == 0)
		{
			stopDriving(); // Stops the drive so the robot doesn't flip on itself or something
			winchMotor.Set(0); // Redundant line for extra safety that can be removed after testing (The winch should already be off)
			dogSolenoid.Set(DoubleSolenoid::kReverse); // Brings the pneumatic piston backward to disengage the dog gear
			Wait(0.2); // Giving the pistons time to disengage properly
			ratchetSolenoid.Set(DoubleSolenoid::kReverse); // Brings the pneumatic piston backward to disengage the ratchet
			Wait(5); // Waits 5 seconds after shooting before starting to load the catapult
		}
	}
开发者ID:secant,项目名称:robot2014,代码行数:12,代码来源:easyAutonomousTesting.cpp

示例12: Test

	void Test() 
	{
		DriverStationLCD *screen = DriverStationLCD::GetInstance();
		while (IsTest())
		{
			if ((buttonOne.Get()) == 1)
			{
				screen -> PrintfLine(DriverStationLCD::kUser_Line1,"Button1_Not Pressed!");
			}
			else
			{
				screen -> PrintfLine(DriverStationLCD::kUser_Line1,"Button1_Pressed!");
			}
			if ((buttonTwo.Get()) == 1)
			{
				screen -> PrintfLine(DriverStationLCD::kUser_Line2,"Button2_Not Pressed!");
			}
			else
			{
				screen -> PrintfLine(DriverStationLCD::kUser_Line2,"Button2_Pressed!");
			}
			if ((togglebuttonOne.Get()) == 0)
			{
				screen -> PrintfLine(DriverStationLCD::kUser_Line3,"Left Is_On!");
			}
			else
			{
				screen -> PrintfLine(DriverStationLCD::kUser_Line3,"Left Is_Off!");
			}
			if ((togglebuttonTwo.Get()) == 0)
			{
				screen -> PrintfLine(DriverStationLCD::kUser_Line4,"Right Is_On!");
			}
			else
			{
				screen -> PrintfLine(DriverStationLCD::kUser_Line4,"Right Is_Off!");
			}
			if (buttonOne.Get() == 0)
			{
				emergencyCompressor.Set(Relay::kOff);
			}
			
#if 0
		screen -> PrintfLine(DriverStationLCD::kUser_Line1,"ButtonOneIs_%d", buttonOne.Get());
		screen -> PrintfLine(DriverStationLCD::kUser_Line2,"toggle_%d", buttonTwo.Get());
		screen -> PrintfLine(DriverStationLCD::kUser_Line3,"Button_%d", togglebuttonOne.Get());
		screen -> PrintfLine(DriverStationLCD::kUser_Line4,"toggle_%d", togglebuttonTwo.Get());
#endif
		Wait(0.005);
		screen -> UpdateLCD();
		}
	}
开发者ID:secant,项目名称:robot2014,代码行数:52,代码来源:AutonomousCodeTest.cpp

示例13: UpdateState

		bool UpdateState(
				float powerLevel,    //typically 1.0 for forward -1.0 for backward
				double targetPosition,
				HookSwitch hookSwitch=NoHookSwitch)
		{
		    
			if (powerLevel < 0.0 && !lowerLimitSwitch->Get()){
				if (motorController) {
					motorController->Disable();
				}
				motor->Set(0.0);
            	encoder->Reset();
				encoder->Start();
				return true;
			}
			double position = encoder->GetDistance();
			if (motorController) {
				if (!motorController->IsEnabled())
					motorController->Enable();
				motorController->SetSetpoint(targetPosition);
			} else {
            	if (position < targetPosition-ClimberCloseTolerance) {
            		motor->Set(1.0);
            	} else if (position > targetPosition+ClimberCloseTolerance){
            		motor->Set(-1.0);            		
            	}
			}

			if ( (hookSwitch == UpperHookSwitch && !upperHookSwitch->Get())||
				 (hookSwitch == LowerHookSwitch && !lowerHookSwitch->Get())||
				 (hookSwitch == NoHookSwitch &&
							targetPosition -ClimberCloseTolerance <= position && position <= targetPosition + ClimberCloseTolerance ) ) {
				if (motorController) {
					motorController->Disable();
				}
				motor->Set(0.0);
				encoder->Start();
				return true;
			} else if (hookSwitch != NoHookSwitch &&
					( (powerLevel > 0 && position > targetPosition) ||
						(powerLevel < 0 && position < targetPosition) ) ) {
				robot->AbortClimb("Grab did not occur when expected");
				return false;
			} // else if (hookSwitch != NoHookSwitch && Check motor power draw)
			// abort here if looking for switch and started drawing a lot of power 
			return false;
		}
开发者ID:phoenixfrc,项目名称:Phoenix2013,代码行数:47,代码来源:Robot.cpp

示例14: GetDigitalInput

/*
 * Get the value from a digital input channel.
 * Retrieve the value of a single digital input channel from the FPGA.
 *
 * @param slot The slot the digital input module is plugged into
 * @param channel The particular channel this digital input is using
 */
UINT32 GetDigitalInput(UINT32 slot, UINT32 channel)
{
    DigitalInput *digIn = AllocateDigitalInput(slot, channel);
    if (digIn)
        return digIn->Get();
    else
        return 0;
}
开发者ID:FRC980,项目名称:FRC-Team-980,代码行数:15,代码来源:CDigitalInput.cpp

示例15: TeleopPeriodic

	void TeleopPeriodic(void)
		{
			Scheduler::GetInstance()->Run();

			myDrive_all->TankDrive(drivestick_left->GetY(), drivestick_right->GetY());

			ABCheck = Xbox_Button_A->Get(); // Gets the value of the A button on the xbox
			BBCheck = Xbox_Button_B->Get(); // Gets the value of the B button on the xbox
			if (ABCheck == 1) // If A button is pressed
			{
				FirstSolenoid->Set(DoubleSolenoid::kForward); // Make piston extend
			}
			if (BBCheck == 1) // If B button is pressed
			{
				FirstSolenoid->Set(DoubleSolenoid::kReverse); // Make piston retract
			}
			if ((ABCheck == 0) && (BBCheck == 0)) // If A and B buttons are not pressed
			{
				FirstSolenoid->Set(DoubleSolenoid::kOff); // Make piston stay where it is
			}

			XBCheck = Xbox_Button_X->Get(); // Gets value of the X button on the xbox
			YBCheck = Xbox_Button_Y->Get(); // Get value of the Y button on the xbox

			if (XBCheck == 1)//If X button is pressed
			{
				if (limitSwitch->Get() == 0) // If limitswitch is pressed
				{
					intake_Motor->Set(0); // Stop test motor
				}
				if (limitSwitch->Get() == 1) // If limitswitch is not pressed
				{
					intake_Motor->Set(1); // Test motor goes forward at 0.5 speed
				}
			}

			if (YBCheck == 1) // If Y button is pressed
			{
				intake_Motor->Set(-1); // Test motor goes backward at -0.5 speed
			}

			if ((XBCheck == 0) && (YBCheck == 0)) // If X and Y buttons are not pressed
			{
				intake_Motor->Set(0); // Test motor stops
			}
		}
开发者ID:Crowbotics5934,项目名称:2016-Stronghold-Robot,代码行数:46,代码来源:Robot.cpp


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