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


C++ Solenoid::Set方法代码示例

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


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

示例1: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		
		GetWatchdog().SetEnabled(true);
		compressor->Start();
		
		GetWatchdog().SetExpiration(0.5);
		
		bool valve_state = false;
		
		while (IsOperatorControl())
		{
			motor->Set(stick->GetY());
			
			if (stick->GetRawButton(1) && !valve_state)
			{
				valve->Set(true);
				valve_state = true;
			}
			
			if (!stick->GetRawButton(1) && valve_state)
			{
				valve->Set(false);
				valve_state = false;
			}
			// Update driver station
			//dds->sendIOPortData(valve);

			GetWatchdog().Feed();
		}
	}
开发者ID:FRC2994,项目名称:FRC2994,代码行数:34,代码来源:MyRobot.cpp

示例2: TestBGrabber

	void TestBGrabber()
		{
			//ROLLERS	
			if (m_operator->GetRawAxis(TRIGGERS) > 0.4) {
				m_roller->Set(0.5);
			}
			else if (m_operator->GetRawAxis(TRIGGERS) < -0.4)
				m_roller->Set(0.5);
			else {
				m_roller->Set(0.0);
			}	

			//BALL CATCH (#Sweg)
			if (m_operator->GetRawButton(BUTTON_A)) {
				m_catch->Set(true); 
			}
			else if (m_operator->GetRawButton(BUTTON_B)) {
				m_catch->Set(false);
			}

			//bArm OPEN / CLOSE
			if (m_operator->GetRawButton(BUTTON_X)) {
				m_bArm->Set(true);
			}
			else if (m_operator->GetRawButton(BUTTON_Y)) {
				m_bArm->Set(false);
			}
		}
开发者ID:hal7df,项目名称:further-suggestions,代码行数:28,代码来源:BuiltinDefaultCode.cpp

示例3: ShiftLow

	void ShiftLow(void) 
	{
		// shiftRight->Get() : false is low gear, true is high gear
		if(shiftRight->Get()) {
			shiftRight->Set(false);
			shiftLeft->Set(false);
		}
	}
开发者ID:jkirlans5282,项目名称:2014_Robot_Code-1,代码行数:8,代码来源:BuiltinDefaultCode.cpp

示例4: RobotInit

	void RobotInit(void) {
		// Actions which would be performed once (and only once) upon initialization of the
		// robot would be put here.
		shiftLeft->Set(false); //low gear
		shiftRight->Set(false); //low gear
		passingPiston->Set(false); //retracted
		printf("RobotInit() completed.\n");
	}
开发者ID:jkirlans5282,项目名称:2014_Robot_Code-1,代码行数:8,代码来源:BuiltinDefaultCode.cpp

示例5: deployMini

	void RawControl::deployMini()
	{
		if(chkSwitch())
		{
			deploy->Set(true);
		}
		else
			deploy->Set(false);
	}
开发者ID:The-Charge,项目名称:2011_TubeBot,代码行数:9,代码来源:TubeBot.cpp

示例6: ShiftHigh

	void ShiftHigh(void) 
	{
		// shiftRight->Get() : false is low gear, true is high gear
		if(!(shiftRight->Get())) 
		{
			shiftRight->Set(true);
			shiftLeft->Set(true);
		}
	}
开发者ID:jkirlans5282,项目名称:2014_Robot_Code-1,代码行数:9,代码来源:BuiltinDefaultCode.cpp

示例7: OperatorControl

	void OperatorControl()
	{
		compressor.Start();
		while (IsOperatorControl())
		{
			if(stick.GetRawButton(6)) //press the upper right trigger
			{
				piston.Set(true);
			}
			else if(stick.GetRawButton(8)) //press the lower right trigger
			{
				piston.Set(false);
			}
		}
		compressor.Stop();
	}
开发者ID:mililanirobotics,项目名称:FRC2015,代码行数:16,代码来源:Robot.cpp

示例8: TeleopInit

	void TeleopInit() override {
		drive->SetExpiration(200000);
		drive->SetSafetyEnabled(false);
		liftdown->Set(false);

		intake_hold = false;
		lastLiftPos = 0;
		manual = true;
	}
开发者ID:RoboLoCo-5338,项目名称:BasicDrive,代码行数:9,代码来源:Robot.cpp

示例9: TestInit

    /**
     * Initialization code for test mode should go here.
     * 
     * Use this method for initialization code which will be called each time
     * the robot enters test mode.
     */
    void TestInit()
    {
printf(">>> TestInit\n");
#ifdef HAVE_COMPRESSOR
	compressor->Start();
#endif
#ifdef HAVE_ARM
	arm->Set(DoubleSolenoid::kOff);
#endif
#ifdef HAVE_INJECTOR
	injectorL->Set(DoubleSolenoid::kOff);
	injectorR->Set(DoubleSolenoid::kOff);
#endif
#ifdef HAVE_EJECTOR
	ejector->Set(false);
#endif
#ifdef HAVE_LEGS
	legs->Set(false);
#endif

#ifdef HAVE_TOP_WHEEL
#ifdef HAVE_TOP_CAN1
	jagVbus(topWheel1, 0.0);
#endif
#ifdef HAVE_TOP_PWM1
	topWheel1->Set(0.0);
#endif
#ifdef HAVE_TOP_CAN2
	jagVbus(topWheel2, 0.0);
#endif
#endif
#ifdef HAVE_BOTTOM_WHEEL
#ifdef HAVE_BOTTOM_CAN1
	jagVbus(bottomWheel1, 0.0);
#endif
#ifdef HAVE_BOTTOM_PWM1
	bottomWheel1->Set(0.0);
#endif
#ifdef HAVE_BOTTOM_CAN2
	jagVbus(bottomWheel2, 0.0);
#endif
#endif
printf("<<< TestInit\n");
    }
开发者ID:errorcodexero,项目名称:k9,代码行数:50,代码来源:k9.cpp

示例10: AutonomousInit

	// Start auto mode
	void AutonomousInit() override {
		autoSelected = *((int*) chooser.GetSelected()); // autonomous mode chosen in dashboard
		currentState = 1;
		ahrs->ZeroYaw();
		ahrs->GetFusedHeading();
		autoLength = SmartDashboard::GetNumber(AUTO_LENGTH, AUTO_LENGTH_DEFAULT);
		autoSpeed = SmartDashboard::GetNumber(AUTO_SPEED, AUTO_SPEED_DEFAULT);
		autoIntakeSpeed = SmartDashboard::GetNumber(AUTO_INTAKE_SPEED, AUTO_INTAKE_SPEED_DEFAULT);
		liftdown->Set(false);
	}
开发者ID:RoboLoCo-5338,项目名称:BasicDrive,代码行数:11,代码来源:Robot.cpp

示例11: Shoot

	void Shoot (bool teleop)
	{
		// code to differentiate teleop from autonomous
		/*if (teleop == true)
			shootyesorno = controller.GetRawButton(BTN_SHOOT);
		else if (teleop == false)
			shootyesorno = true;*/
		if (AcceptableToFire() == true && firefrisbee.Get() == true)
		{
			firefrisbee.Set(false); // SHOOT THE DARN FRISBEE
			shottime.Stop();
			shottime.Reset();
			shottime.Start();
		}
		if (shootyesorno == true && firefrisbee.Get() == false && AcceptableToFire() == true && ShootMode == eShoot)
		{
			firefrisbee.Set(true); // Primes that there frisbee
			shottime.Stop();
			shottime.Reset();
			shottime.Start();
		}
	}
开发者ID:Team537,项目名称:RobotCode,代码行数:22,代码来源:MyRobot.cpp

示例12: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		log->Info("TELEOP START");
		
//		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			double distance = dist.GetVoltage() / (5.0 / 512.0);
			SmartDashboard::Log(distance, "Rangefinder distance");
			SmartDashboard::Log(dist.GetVoltage(), "Rangefinder voltage");
			
			Sol1.Set(stick1.GetRawButton(1));
			Sol2.Set(stick1.GetRawButton(2));
			Sol3.Set(stick1.GetRawButton(3));
			Sol4.Set(stick1.GetRawButton(4));
			Sol5.Set(stick1.GetRawButton(5));
			
			if (stick1.GetRawButton(6)) {
				if (!lastButton) log->Shot(stick1.GetZ(), stick2.GetZ());
				lastButton = true;
			} else {
				lastButton = false;
			}
			
			SmartDashboard::Log(((stick1.GetZ() + 1) / 2) * 2500, "Distance");
			SmartDashboard::Log(((stick2.GetZ() + 1) / 2) * 5.0, "Compression");
			SmartDashboard::Log(LookUp(stick1.GetZ() * 2500, /* stick2.GetZ() * 5.0 */ dist.GetVoltage()), "Shooter Speed");
			
//			myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
//			lJagA.Set(stick1.GetY());
//			lJagB.Set(stick1.GetY());
//			rJagA.Set(stick2.GetY());
//			rJagB.Set(stick2.GetY());
			Wait(0.010);				// wait for a motor update time
		}
	}
开发者ID:CRRobotics,项目名称:Robots,代码行数:39,代码来源:MyRobot.cpp

示例13: TeleopPeriodic

	void TeleopPeriodic(void)
	{
		bool flag = true; //flag object initial declaration to ensure passing Piston toggle works properly

		float leftStick  = gamePad->GetRawAxis(4);
		float rightStick = gamePad->GetRawAxis(2);
		bool rightBumper = gamePad->GetRawButton(6);
		bool leftBumper  = gamePad->GetRawButton(5);
		bool buttonA     = gamePad->GetRawButton(2);

		if(fabs(leftStick) >= 0.05 || fabs(rightStick >= 0.05)) 
			{
				m_robotDrive->TankDrive(leftStick, rightStick);
			}
		else if(rightBumper || leftBumper) 
			{
				if(rightBumper && !leftBumper) 
				{
					ShiftHigh();
				}
				else if(leftBumper && !rightBumper) 
				{
					ShiftLow();
			    }
			}
		else if(buttonA && flag)
			{
				flag = false;
				passingPiston->Set(true);
			}
		 else
		 	{
				if(!buttonA)
				{
					flag = false;
					MotorControlLeft(0.0);
					MotorControlRight(0.0);
				}
				else
				{
					MotorControlLeft(0.0);
					MotorControlRight(0.0);
				}
			}
	} 
开发者ID:jkirlans5282,项目名称:2014_Robot_Code-1,代码行数:45,代码来源:BuiltinDefaultCode.cpp

示例14: RobotInit

	void RobotInit() override {
		lw = LiveWindow::GetInstance();
		drive->SetExpiration(20000);
		drive->SetSafetyEnabled(false);
		//Gyroscope stuff
		try {
			/* Communicate w/navX-MXP via the MXP SPI Bus.                                       */
			/* Alternatively:  I2C::Port::kMXP, SerialPort::Port::kMXP or SerialPort::Port::kUSB */
			/* See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface/ for details.   */
			ahrs = new AHRS(SPI::Port::kMXP);
		} catch (std::exception ex) {
			std::string err_string = "Error instantiating navX-MXP:  ";
			err_string += ex.what();
			//DriverStation::ReportError(err_string.c_str());
		}

		if (ahrs) {
			LiveWindow::GetInstance()->AddSensor("IMU", "Gyro", ahrs);
			ahrs->ZeroYaw();

			// Kp	  Ki	 Kd		Kf    PIDSource PIDoutput
			turnController = new PIDController(0.015f, 0.003f, 0.100f, 0.00f,
					ahrs, this);
			turnController->SetInputRange(-180.0f, 180.0f);
			turnController->SetOutputRange(-1.0, 1.0);
			turnController->SetAbsoluteTolerance(2); //tolerance in degrees
			turnController->SetContinuous(true);
		}
		chooser.AddDefault("No Auto", new int(0));
		chooser.AddObject("GyroTest Auto", new int(1));
		chooser.AddObject("Spy Auto", new int(2));
		chooser.AddObject("Low Bar Auto", new int(3));
		chooser.AddObject("Straight Spy Auto", new int(4));
		chooser.AddObject("Adjustable Straight Auto", new int(5));
		SmartDashboard::PutNumber(AUTO_LENGTH, AUTO_LENGTH_DEFAULT);
		SmartDashboard::PutNumber(AUTO_SPEED, AUTO_SPEED_DEFAULT);
		SmartDashboard::PutNumber(AUTO_INTAKE_SPEED, AUTO_INTAKE_SPEED_DEFAULT);
		SmartDashboard::PutData("Auto Modes", &chooser);
		liftdown->Set(false);
		comp->Start();
	}
开发者ID:RoboLoCo-5338,项目名称:BasicDrive,代码行数:41,代码来源:Robot.cpp

示例15: TeleopInit

    /**
     * Initialization code for teleop mode should go here.
     * 
     * Use this method for initialization code which will be called each time
     * the robot enters teleop mode.
     */
    void TeleopInit()
    {
printf(">>> TeleopInit\n");
#ifdef HAVE_COMPRESSOR
	compressor->Start();
#endif
#ifdef HAVE_ARM
	arm->Set(DoubleSolenoid::kForward);
#endif
#ifdef HAVE_INJECTOR
	injectorL->Set(DoubleSolenoid::kReverse);
	injectorR->Set(DoubleSolenoid::kReverse);
#endif
#ifdef HAVE_EJECTOR
	ejector->Set(false);
#endif
#ifdef HAVE_LEGS
	// legs->Set(true);
#endif

	// StartWheels();
printf("<<< TeleopInit\n");
    }
开发者ID:errorcodexero,项目名称:k9,代码行数:29,代码来源:k9.cpp


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