本文整理汇总了C++中EGamepad::GetEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ EGamepad::GetEvent方法的具体用法?C++ EGamepad::GetEvent怎么用?C++ EGamepad::GetEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EGamepad
的用法示例。
在下文中一共展示了EGamepad::GetEvent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleCollectorInputs
void HandleCollectorInputs ()
{
if (false == m_shooterMotorRunning)
{
if (kEventClosed == gamepad.GetEvent(BUTTON_COLLECTOR_FWD))
{
collectorMotor.Set(COLLECTOR_FWD);
m_collectorMotorRunning = true;
}
else if (kEventOpened == gamepad.GetEvent(BUTTON_COLLECTOR_FWD))
{
collectorMotor.Set(0.0);
m_collectorMotorRunning = false;
}
else if (kEventClosed == gamepad.GetEvent(BUTTON_COLLECTOR_REV))
{
collectorMotor.Set(COLLECTOR_REV);
m_collectorMotorRunning = true;
}
else if (kEventOpened == gamepad.GetEvent(BUTTON_COLLECTOR_REV))
{
collectorMotor.Set(0.0);
m_collectorMotorRunning = false;
}
}
}
示例2: HandleArm
// HandleArm
// * Manage solenoids for arm up-down
// ----> ASSUMES kForward on DoubleSolenoid is the down position.
// * Handle intake motors
void HandleArm()
{
if (gamepad.GetEvent(BUTTON_ARM) == kEventClosed && armDown)
{
arm.Set(DoubleSolenoid::kReverse);
armDown = false;
}
else if (gamepad.GetEvent(BUTTON_ARM) == kEventClosed)
{
arm.Set(DoubleSolenoid::kForward);
armDown = true;
}
if (gamepad.GetDPadEvent(BUTTON_INTAKE_COLLECT) == kEventClosed)
{
intake.Set(INTAKE_COLLECT);
}
else if (gamepad.GetDPadEvent(BUTTON_INTAKE_COLLECT) == kEventOpened)
{
intake.Set(0.0);
}
if(gamepad.GetDPadEvent(BUTTON_INTAKE_EJECT) == kEventClosed)
{
intake.Set(INTAKE_EJECT);
}
if (gamepad.GetDPadEvent(BUTTON_INTAKE_EJECT) == kEventOpened)
{
intake.Set(0.0);
}
}
示例3: HandleShooter
// HandleShooter
// * Manage winch motor state.
// * Toggles collection and eject mode (Gamepad button 4)
// ----> ASSUMES positive values = collecting
void HandleShooter()
{
if (gamepad.GetEvent(BUTTON_LOAD) == kEventClosed)
{
InitiateLoad();
}
if (loading)
{
CheckLoad();
}
if (gamepad.GetEvent(BUTTON_SHOOT) == kEventClosed)
{
LaunchCatapult();
}
}
示例4: HandleShooterInputs
void HandleShooterInputs()
{
if (shooterTimer.HasPeriodPassed(SPINUP_TIME))
{
shooterTimer.Stop();
shooterTimer.Reset();
indexerMotor.Set(INDEXER_FWD);
}
else if (!m_collectorMotorRunning && !m_shooterMotorRunning)
{
if (kEventClosed == gamepad.GetEvent(BUTTON_SHOOTER))
{
shooterMotor.Set(SHOOTER_FWD);
shooterTimer.Start();
m_shooterMotorRunning = true;
}
}
else
{
if (indexSwitch.GetEvent() == kEventOpened)
{
indexerMotor.Set(0.0);
shooterMotor.Set(0.0);
m_shooterMotorRunning = false;
}
}
}
示例5: Test
// Runs during test mode
// Test
// *
void Test()
{
shifters.Set(DoubleSolenoid::kForward);
leftDriveEncoder.Start();
leftDriveEncoder.Reset();
int start = leftDriveEncoder.Get();
while (IsTest()) {
if (rightStick.GetRawButton(7)) {
robotDrive.ArcadeDrive(rightStick.GetY(), -rightStick.GetX());
}
else {
robotDrive.ArcadeDrive(rightStick.GetY()/2, -rightStick.GetX()/2);
}
if (gamepad.GetEvent(4) == kEventClosed) {
start = leftDriveEncoder.Get();
}
dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "lde: %d", leftDriveEncoder.Get() - start);
dsLCD->UpdateLCD();
gamepad.Update();
}
}
示例6: HandleArmInputs
void HandleArmInputs(void)
{
if (gamepad.GetLeftY() < -0.1)
{
if (potentiometer.GetVoltage() < 4.5)
{
armMotor.Set(1.0);
}
else
{
armMotor.Set(0.0);
}
}
else if (gamepad.GetLeftY() > 0.1)
{
if (potentiometer.GetVoltage() > .5)
{
armMotor.Set(-1.0);
}
else
{
armMotor.Set(0.0);
}
}
else
{
armMotor.Set(0.0);
}
if (gamepad.GetEvent(BUTTON_CLAW_1_LOCKED) == kEventClosed)
{
greenClaw.Set(DoubleSolenoid::kForward);
}
else if (gamepad.GetEvent(BUTTON_CLAW_1_UNLOCKED) == kEventClosed)
{
greenClaw.Set(DoubleSolenoid::kReverse);
}
else if (gamepad.GetEvent(BUTTON_CLAW_2_LOCKED) == kEventClosed)
{
yellowClaw.Set(DoubleSolenoid::kForward);
}
else if (gamepad.GetEvent(BUTTON_CLAW_2_UNLOCKED) == kEventClosed)
{
yellowClaw.Set(DoubleSolenoid::kReverse);
}
}
示例7: HandleEject
// HandleEject
// * Handle eject piston.
void HandleEject()
{
if (gamepad.GetEvent(BUTTON_PASS) == kEventClosed)
{
ejectTimer.Start();
eject.Set(DoubleSolenoid::kForward);
}
if (ejectTimer.HasPeriodPassed(EJECT_WAIT))
{
ejectTimer.Stop();
ejectTimer.Reset();
eject.Set(DoubleSolenoid::kReverse);
}
}
示例8: HandleResetButton
void HandleResetButton(void)
{
if (gamepad.GetEvent(BUTTON_STOP_ALL) == kEventClosed)
{
collectorMotor.Set(0.0);
m_collectorMotorRunning = false;
shooterMotor.Set(0.0);
m_shooterMotorRunning = false;
indexerMotor.Set(0.0);
armMotor.Set(0.0);
jogTimer.Stop();
jogTimer.Reset();
m_jogTimerRunning = false;
}
}
示例9: HandleShooterInputs
void HandleShooterInputs()
{
if (!m_collectorMotorRunning && !m_shooterMotorRunning)
{
if (kEventClosed == gamepad.GetEvent(BUTTON_SHOOTER))
{
shooterMotor.Set(-0.5);
indexerMotor.Set(-0.5);
m_shooterMotorRunning = true;
}
}
else
{
if (indexSwitch.GetEvent() == kEventClosed)
{
indexerMotor.Set(0.0);
shooterMotor.Set(0.0);
m_shooterMotorRunning = false;
}
}
}
示例10: HandleArmInputs
void HandleArmInputs(void)
{
if (!m_jogTimerRunning)
{
if (gamepad.GetLeftY() < -0.1)
{
if (potentiometer.GetVoltage() < 4.5)
{
armMotor.Set(ARM_FWD);
}
else
{
armMotor.Set(0.0);
}
}
else if (gamepad.GetLeftY() > 0.1)
{
if (potentiometer.GetVoltage() > .5)
{
armMotor.Set(ARM_REV);
}
else
{
armMotor.Set(0.0);
}
}
else if (kEventClosed == gamepad.GetDPadEvent(Gamepad::kUp))
{
armMotor.Set(ARM_FWD);
jogTimer.Start();
jogTimer.Reset();
m_jogTimerRunning = true;
}
else if (kEventClosed == gamepad.GetDPadEvent(Gamepad::kDown))
{
armMotor.Set(ARM_REV);
jogTimer.Start();
jogTimer.Reset();
m_jogTimerRunning = true;
}
else
{
armMotor.Set(0.0);
}
}
else if (jogTimer.HasPeriodPassed(JOG_TIME))
{
armMotor.Set(0);
jogTimer.Stop();
jogTimer.Reset();
m_jogTimerRunning = false;
}
if (gamepad.GetEvent(BUTTON_CLAW_1_LOCKED) == kEventClosed)
{
greenClaw.Set(DoubleSolenoid::kForward);
}
else if (gamepad.GetEvent(BUTTON_CLAW_1_UNLOCKED) == kEventClosed)
{
greenClaw.Set(DoubleSolenoid::kReverse);
}
else if (gamepad.GetEvent(BUTTON_CLAW_2_LOCKED) == kEventClosed)
{
yellowClaw.Set(DoubleSolenoid::kForward);
}
else if (gamepad.GetEvent(BUTTON_CLAW_2_UNLOCKED) == kEventClosed)
{
yellowClaw.Set(DoubleSolenoid::kReverse);
}
}