本文整理汇总了C++中Gamepad::GetStart方法的典型用法代码示例。如果您正苦于以下问题:C++ Gamepad::GetStart方法的具体用法?C++ Gamepad::GetStart怎么用?C++ Gamepad::GetStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gamepad
的用法示例。
在下文中一共展示了Gamepad::GetStart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TeleopPeriodic
void TeleopPeriodic() {
//Target * target = GetLatestTarget();
//Begin DRIVER input section
if(driverGamepad->GetDPad()==Gamepad::kUp)
lc->setMode(1);
else if(driverGamepad->GetDPad()==Gamepad::kDown)
lc->setMode(6);
else
lc->setMode(0);
if(driverGamepad->GetDPad() == Gamepad::kRight)
{
cameraLight->Set(Relay::kOff);
}
else if(driverGamepad->GetDPad() == Gamepad::kLeft)
{
cameraLight->Set(Relay::kOn);
}
if(driverGamepad->GetB())
{
cout << "Resetting the gyro! :D" << endl;
//driveGyro->Reset();
magicBox->resetGyro();
}
bool modifySpeed = driverGamepad->GetRightBumper();
bool halfSpeed = driverGamepad->GetLeftBumper();
/*
try {
std::string temp = SmartDashboard::GetString("TargetInfo");
cout << "temp: " << endl;
} catch (exception ex) {
cout << "bah! " << ex.what() << endl;
}*/
//Target t = GetLatestTarget();
/*
if (t.IsValid()) {
cout << "Valid target (" << (t.IsCenter() ? "center" : "side") << "):" << t.Distance() << " ft, " << t.X() << "," << t.Y() << endl;
} else {
//cout << "No valid target." << endl;
} */
if(driverGamepad->GetBack())
{
cout << "Now driving in relation to the robot" << endl;
myDrive->setGyroDrive(false);
}
if(driverGamepad->GetStart())
{
cout << "Now driving in relation to the field (gyro)" << endl;
myDrive->setGyroDrive(true);
}
// If the driver is holding the X button
/*
if (driverGamepad->GetX()) {
// Stop using the joysticks to drive the robot, and let this function do it
PointAtTarget(t);
} else { */
// We aren't auto-targeting. Reset the sequence.
target_state = RA13Robot::READY;
// Drive based on joysticks.
myDrive->Drive(driverGamepad->GetLeftX(), driverGamepad->GetLeftY(),
driverGamepad->GetRightX(), magicBox->getGyroAngle(), modifySpeed,halfSpeed);
//}
//End DRIVER input section
Gamepad::DPadDirection dir = operatorGamepad->GetDPad();
if (dir != lastdir) {
switch(dir) {
case Gamepad::kUp:
manualAngle += 1;
break;
case Gamepad::kDown:
manualAngle -= 1;
break;
case Gamepad::kRight:
manualAngle += 0.25;
break;
case Gamepad::kLeft:
manualAngle -= 0.25;
break;
default:
break;
}
}
//cout << "Current target angle: " << manualAngle << endl;
//Begin OPERATOR input section
if(operatorGamepad->GetBack())
{
myShooter->ResetShooterProcess(); // Re-homes the shooter
}
//.........这里部分代码省略.........