本文整理汇总了C++中Joystick::GetAxis方法的典型用法代码示例。如果您正苦于以下问题:C++ Joystick::GetAxis方法的具体用法?C++ Joystick::GetAxis怎么用?C++ Joystick::GetAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joystick
的用法示例。
在下文中一共展示了Joystick::GetAxis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TeleopPeriodic
void TeleopPeriodic()
{
Drive->arcadeDrive(Drivestick->GetAxis((Joystick::AxisType)constants->Get("DriveAxisY")),
Drivestick->GetAxis((Joystick::AxisType)constants->Get("DriveAxisX")),
Drivestick->GetRawButton(constants->Get("HighShiftButton")),
Drivestick->GetRawButton(constants->Get("LowShiftButton")));
if(ShootIntake->shooter->shooterIndex->Get()==false){
ShootIntake->RollerMotor->Set(Operatorstick->GetAxis((Joystick::AxisType)constants->Get("RollerMotorY")) * constants->Get("rollerMotorGain"), 0);
}
else{
ShootIntake->RollerMotor->Set(0);
}
ShootIntake->Update(Operatorstick->GetRawButton(constants->Get("intakeButton")),
Operatorstick->GetRawButton(constants->Get("armedButton")),
Operatorstick->GetRawButton(constants->Get("shooterButton")), Operatorstick->GetRawButton(constants->Get("DownRollerButton")), Operatorstick->GetRawButton(constants->Get("UpRollerButton")), Operatorstick->GetAxis((Joystick::AxisType)constants->Get("RollerAControl")));
//ShootIntake->Rollerarm->Set(Operatorstick->GetAxis((Joystick::AxisType)constants->Get("RollerAControl")));
if(ShootIntake->Rollerarm->RollerControl->GetPinStateQuadIdx()==0){
ShootIntake->Rollerarm->RollerControl->SetPosition(0);
}
char *Rollerencoder = new char[255];
sprintf(Rollerencoder, "rollerEncoder: %lf\n", ShootIntake->Rollerarm->GetPosition());
DriverStation::GetInstance().ReportError(Rollerencoder);
}
示例2: Execute
// Called repeatedly when this Command is scheduled to run
void DriveWithJoystick::Execute() {
Joystick *leftStick = Robot::oi->getLeftStick();
Joystick *rightStick = Robot::oi->getRightStick();
float leftaxis = leftStick->GetAxis(Joystick::kYAxis);
float rightaxis = rightStick->GetAxis(Joystick::kYAxis);
if((leftaxis < DEADBAND) && (leftaxis > -DEADBAND))
leftaxis = 0;
if((rightaxis < DEADBAND) && (rightaxis > -DEADBAND))
rightaxis = 0;
// Code for the slow mode if either button "2" on the driver sticks is pressed.
leftButton2 = Robot::oi->getLeftStick()->GetRawButton(2);
rightButton2 = Robot::oi->getRightStick()->GetRawButton(2);
if((leftButton2 == true) || (rightButton2 == true))
{
leftaxis *= SLOW_PERCENTAGE;
rightaxis *= SLOW_PERCENTAGE;
}
Robot::driveTrain->tankDrive(leftaxis, rightaxis);
}
示例3: GetAxis
/**
* For the current joystick, return the axis determined by the argument.
*
* This is for cases where the joystick axis is returned programatically, otherwise one of the
* previous functions would be preferable (for example GetX()).
*
* @param port The USB port for this joystick.
* @param axis The axis to read.
* @return The value of the axis.
*/
float GetAxis(UINT32 port, AxisType axis)
{
Joystick *stick = getJoystick(port);
if (stick == NULL)
return 0;
return stick->GetAxis((Joystick::AxisType) axis);
}
示例4: OperatorControl
/**
* Run the closed loop position controller on the Jag.
*/
void OperatorControl()
{
printf("In OperatorControl\n");
GetWatchdog().SetEnabled(true);
while (IsOperatorControl() && !IsDisabled())
{
GetWatchdog().Feed();
// Set the desired setpoint
speedJag.Set(stick.GetAxis(axis) * 150.0);
UpdateDashboardStatus();
Wait(0.05);
}
}