本文整理汇总了C++中Solenoid类的典型用法代码示例。如果您正苦于以下问题:C++ Solenoid类的具体用法?C++ Solenoid怎么用?C++ Solenoid使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Solenoid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSolenoid
/**
* Read the current value of the solenoid.
*
* @param channel The channel in the Solenoid module
* @return The current value of the solenoid.
*/
bool GetSolenoid(UINT32 channel)
{
Solenoid *s = allocateSolenoid(channel);
if (s == NULL)
return false;
return s->Get();
}
示例2: 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");
}
示例3: 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");
}
示例4: solenoid_diag_handler
static nr::diag::handler_t
solenoid_diag_handler( const Solenoid& solenoid )
{ return solenoid.Get() ? "True" : "False"; }
示例5: 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);
}
}
示例6: 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();
}
}
示例7: ShiftLow
void ShiftLow(void)
{
// shiftRight->Get() : false is low gear, true is high gear
if(shiftRight->Get()) {
shiftRight->Set(false);
shiftLeft->Set(false);
}
}
示例8: 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");
}
示例9: deployMini
void RawControl::deployMini()
{
if(chkSwitch())
{
deploy->Set(true);
}
else
deploy->Set(false);
}
示例10: ShiftHigh
void ShiftHigh(void)
{
// shiftRight->Get() : false is low gear, true is high gear
if(!(shiftRight->Get()))
{
shiftRight->Set(true);
shiftLeft->Set(true);
}
}
示例11: 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++;
}
示例12: 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();
}
示例13: TeleopInit
void TeleopInit() override {
drive->SetExpiration(200000);
drive->SetSafetyEnabled(false);
liftdown->Set(false);
intake_hold = false;
lastLiftPos = 0;
manual = true;
}
示例14: 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);
}
示例15: 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();
}
}