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


C++ Joystick::GetAxis方法代码示例

本文整理汇总了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);

	}
开发者ID:FRC-1164-Project-NEO,项目名称:2016SeasonRobot,代码行数:30,代码来源:Robot.cpp

示例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);
	
}
开发者ID:AGHSEagleRobotics,项目名称:frc1388-2013,代码行数:32,代码来源:DriveWithJoystick.cpp

示例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);
}
开发者ID:FRC980,项目名称:FRC-Team-980,代码行数:17,代码来源:CJoystick.cpp

示例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);
		}
	}
开发者ID:FRC980,项目名称:FRC-Team-980,代码行数:16,代码来源:MyRobot.cpp


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