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


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

本文整理汇总了C++中Joystick::GetRawAxis方法的典型用法代码示例。如果您正苦于以下问题:C++ Joystick::GetRawAxis方法的具体用法?C++ Joystick::GetRawAxis怎么用?C++ Joystick::GetRawAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Joystick的用法示例。


在下文中一共展示了Joystick::GetRawAxis方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TeleopPeriodic

	void TeleopPeriodic() {
		if(m_driver->GetRawButton(BUTTON_LB)) {
			// PYRAMID
			m_PIDController->SetSetpoint(PLATE_PYRAMID_THREE_POINT);
			m_PIDController->Enable();
		} else if(m_driver->GetRawButton(BUTTON_RB)) {
			// FEEDER
			m_PIDController->SetSetpoint(PLATE_FEEDER_THREE_POINT);
			m_PIDController->Enable();
		} else if(m_driver->GetRawAxis(TRIGGERS) > 0.5) {
			m_PIDController->SetSetpoint(PLATE_TEN_POINT_CLIMB);
			m_PIDController->Enable();
		} else {
			// MANUAL CONTROL
			m_PIDController->Disable();
			
			m_plate1->Set(-deadband(m_driver->GetRawAxis(LEFT_Y)));
			m_plate2->Set(-deadband(m_driver->GetRawAxis(LEFT_Y)));
		}
		
		// ----- PRINT -----
		SmartDashboard::PutNumber("Plate Position: ", m_plateSensor->GetVoltage());
		SmartDashboard::PutNumber("PID GET: ", m_plateSensor->PIDGet());
		
	} // TeleopPeriodic()
开发者ID:hal7df,项目名称:further-suggestions,代码行数:25,代码来源:Main.cpp

示例2: TeleopPeriodic

	void TeleopPeriodic()
	{
		myRobot.ArcadeDrive(-gPad.GetRawAxis(GP_RSTICK_YAXIS)*ROBOT_START_SPEED, -gPad.GetRawAxis(GP_RSTICK_XAXIS)*ROBOT_START_SPEED ); // drive with arcade style (use right stick)
		if(gPad.GetRawButton(GP_Y_BUTTON) == true && yButton == false)
		{
			if(driveSpeed + 0.25 < 1 && driveSpeed - 0.25 > 0)
			{
				yButton = true;
				driveSpeed = driveSpeed + 0.25;
			}
			else
			{
				yButton = false;
			}
		}

		if(gPad.GetRawButton(GP_A_BUTTON) == true && aButton == false)
		{
			if(driveSpeed + 0.25 < 1 && driveSpeed - 0.25 > 0)
			{
				aButton = true;
				driveSpeed = driveSpeed + 0.25;
			}
			else
			{
				aButton = false;
			}
		}

	}
开发者ID:CCathFIre,项目名称:Komodo-4293-2016-Code,代码行数:30,代码来源:Robot.cpp

示例3: Execute

void ArcadeDriveWithJoystick::Execute() {
	Joystick* stick = CommandBase::oi->GetJoystick();
	float moveValue = stick->GetRawAxis(1);
	float rotateValue = stick->GetRawAxis(4);

	CommandBase::drivetrain->Drive(moveValue, rotateValue);
	CommandBase::drivetrain->Log();
}
开发者ID:f-jiang,项目名称:frc-command-based-test,代码行数:8,代码来源:ArcadeDriveWithJoystick.cpp

示例4: OperatorControl

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		while (IsOperatorControl())
		{
			left.Set(cont.GetRawAxis(2));
			right.Set(cont.GetRawAxis(4));
		}
	}
开发者ID:Team537,项目名称:RobotCode,代码行数:11,代码来源:MyRobot.cpp

示例5: TeleopPeriodic

	//void StartAutomaticCapture(std::shared_ptr<USBCamera>cam0);
	void TeleopPeriodic() {
//		ui.GetData(&wui);
//		m_tank.Drive(wui.LeftSpeed, wui.RightSpeed);
//
//		m_shooter.Rotate(wui.RotateSpeed*3); //70 degrees per second at full value
//		m_shooter.Lift(wui.LiftSpeed*1.193); //4 seconds for 180 degree revolution
//		if(wui.SpinUp) {
//			m_shooter.Spinup(1);
//		}
//		if(wui.Shoot) {
//			m_shooter.Shoot();
//		}
//		if(wui.Pickup) {
//			m_shooter.Pickup();
//		}
//
//		m_suspension.SetFrontLeft(wui.DropFL);
//		m_suspension.SetBackLeft(wui.DropBL);
//		m_suspension.SetFrontRight(wui.DropFR);
//		m_suspension.SetBackRight(wui.DropBR);

//		m_leddar.GetDetections();
//		m_shooter.Update();
		//float RTrigger = m_lStick->GetRawAxis(3);
		//float LTrigger = m_lStick->GetRawAxis(2);

		//if (m_PWMTalonLeftFrontTop == .5)
		//if (abs(RTrigger) < 0.2)
			//RTrigger = 0;
		//if (abs(LTrigger) < 0.2)
			//LTrigger = 0;
		float leftSpeed = m_lStick->GetRawAxis(1);
		float rightSpeed = m_lStick->GetRawAxis(5);
		if (abs(leftSpeed) < 0.2)
			leftSpeed = 0;
		if (abs(rightSpeed) < 0.2)
			rightSpeed = 0;
		//float LTrigger = m_lStick->GetRawAxis(3);
		//float RTrigger = m_lStick->GetRawAxis(2);
		SmartDashboard::PutNumber("Left Stick", leftSpeed);
		SmartDashboard::PutNumber("Right Stick", rightSpeed);
		//SmartDashboard::PutNumber("L Trigger", LTrigger);
		//SmartDashboard::PutNumber("R Trigger", RTrigger);
		SmartDashboard::PutNumber("Left Encoder", leftEncoder->Get());
		SmartDashboard::PutNumber("Right Encoder", rightEncoder->Get());
		drive->TankDrive(leftSpeed, rightSpeed, true);
		//drive->TankDrive(RTrigger, LTrigger, true);
		LEFTDRIVE1->Set(leftSpeed);
		LEFTDRIVE2->Set(leftSpeed);
		RIGHTDRIVE1->Set(rightSpeed);
		RIGHTDRIVE2->Set(rightSpeed);
		//m_PWMTalonLeftFrontTop->Set(RTrigger);
		//m_PWMTalonRightFrontTop->Set(RTrigger);
		//m_PWMTalonRightRearTop->Set(LTrigger);
		//m_PWMTalonLeftRearTop->Set(LTrigger);
	}
开发者ID:Robotics5316,项目名称:March29,代码行数:57,代码来源:Robot.cpp

示例6: TeleopContinuous

	void TeleopContinuous(void) {
		printf("Running in teleop continuous...\n");
		
		GetWatchdog().Feed();
		
		//Drive the robot
		drivetrain->ArcadeDrive(driverJoystick->GetRawAxis(2) * -1,driverJoystick->GetRawAxis(4) * -1);
		
		//Run the kicker
		kicker->Act();
	}
开发者ID:Tanner,项目名称:Team-1261---C--,代码行数:11,代码来源:Chimichanga.cpp

示例7: OperatorControl

	void OperatorControl(void) {
		while(!IsDisabled()) {
			GetWatchdog().Feed();
			float speed = stick.GetRawAxis(2);
			float strafe = -1*stick.GetRawAxis(1);
			float turn = -1*stick.GetRawAxis(3);
			Dlf->Set(speed + turn + strafe);
			Dlb->Set(speed + turn - strafe);
			Drf->Set(-speed + turn + strafe);
			Drb->Set(-speed + turn - strafe);
			Wait(.05);	
		}
	}
开发者ID:nerdherd,项目名称:FRC-2011,代码行数:13,代码来源:MyRobot.cpp

示例8: move

void Intake::move (const Joystick& joystick) {
    float left = joystick.GetRawAxis (OI::kIntakeTake);
    float right = joystick.GetRawAxis (OI::kIntakeGive);

    if (left > right)
        move (left);

    else if (right > left)
        move (right * -1);

    else
        move (0);
}
开发者ID:WinT-3794,项目名称:KZ-2016-CPP,代码行数:13,代码来源:intake.cpp

示例9: TeleopPeriodic

	virtual void TeleopPeriodic() {

		rightDrive->SetSpeed(-(Driver->GetRawAxis(2)));
		leftDrive->SetSpeed((Driver->GetRawAxis(5)));


		shooterFWD->SetSpeed(-(Operator->GetRawAxis(2)));
		shooterRear->SetSpeed(-(Operator->GetRawAxis(2)));


		//shoioter angle
		if(Operator->GetRawButton(5))
		{
			cout<<"Relay 1 forward"<<endl;
			shooterAngle->Set(Relay::kForward);
		}

		if(Operator->GetRawButton(6))
		{
			cout<<"Relay 1 Reverse"<<endl;
			shooterAngle->Set(Relay::kReverse);
		}


		//Fire button
		if(Operator->GetRawButton(1))
		{
			cout<<"Relay 1 forward"<<endl;
			shooterFire->Set(Relay::kForward);
		}

		if(Operator->GetRawButton(2))
		{
			cout<<"Relay 1 Reverse"<<endl;
			shooterFire->Set(Relay::kReverse);
		}

		if(CompressorSwitch->Get() == 0){
			CompressorRelay->Set(Relay::kForward);
		}else{
			CompressorRelay->Set(Relay::kOff);
		}

		//if(canPDP == 0){
		//	cout << "NULL" << endl;
		//}else{
			//canPDP->GetVoltage(Voltage) ;
			//cout << "0" << endl;
		//}

	}
开发者ID:Team2168,项目名称:alpha2015,代码行数:51,代码来源:Robot.cpp

示例10: getStickValues

	/* gets stick values into the x y and z values, these values are not returned by this but rather stored into the respective variables, the values are filtered*/
	void RawControl::getStickValues(float &x, float &y, float &z) {
		x=(fabs(stick->GetRawAxis(1))<.3 ? 0 : stick->GetRawAxis(1));
		y=(fabs(stick->GetRawAxis(2))<.3 ? 0 : stick->GetRawAxis(2));
		z=(fabs(stick->GetRawAxis(3))<.3 ? 0 : stick->GetRawAxis(3));
		x=x*x*x*x*x*x*x;
		y=y*y*y*y*y*y*y;
		z*=.9;
		z=z*z*z;
		//y*=.9;
		//stick->GetRawButton(2) ? z=0 : z=z;

		//theres a lot more filtering of axes after this....but with comments on top of comments i dont remember what actually worked.  Any other 
		//manipulation of joystick input for x-y-z axes goes here.
	}
开发者ID:The-Charge,项目名称:2011_TubeBot,代码行数:15,代码来源:TubeBot.cpp

示例11: Print

	void Print ()
		{
			if (PrintTime.Get() > PRINT_TIME)
			{
				lcd->Clear();
				lcd->Printf(DriverStationLCD::kUser_Line1, 1, "Left Speed = %5.4f", PrimaryController.GetRawAxis(LEFT_JOYSTICK));
				lcd->Printf(DriverStationLCD::kUser_Line2, 1, "Right Speed = %5.4f", PrimaryController.GetRawAxis(RIGHT_JOYSTICK));
				lcd->Printf(DriverStationLCD::kUser_Line3, 1, "Charge State = %d", (int)Shooter.chargestate);
				//lcd->Printf(DriverStationLCD::kUser_Line4, 1, "Collector speed= %d", Collector.CollectorSpeed());
				lcd->UpdateLCD();
				PrintTime.Reset();
				PrintTime.Start();
			}
		}
开发者ID:Team537,项目名称:RobotCode,代码行数:14,代码来源:MyRobot.cpp

示例12: OperatorControl

	/**
	 * Runs the motors with arcade steering.
	 */
	void OperatorControl()
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl() && IsEnabled())
		{
			leftIntake.Set(0.8);
			rightIntake.Set(0.8);

			leftLift.Set(operatorStick.GetRawAxis(1));
			rightLift.Set(operatorStick.GetRawAxis(1));

			myRobot.TankDrive(driverStick.GetRawAxis(5), driverStick.GetRawAxis(1), true); // drive with arcade style (use right stick)
			Wait(0.005);				// wait for a motor update time
		}
	}
开发者ID:frc461,项目名称:tote-bot,代码行数:18,代码来源:Robot.cpp

示例13: DriveControl

	void DriveControl() { //Drives la wheels of the robot
		flightX = flightStick->GetRawAxis(0); //Pull joystick side motion for later use
		flightY = flightStick->GetRawAxis(1); //Pull joystick forward motion for later use (forward is -, backwards is +)
		flightZ = flightStick->GetRawAxis(4); //Pull joystick twist motion for later use
		flightThrottle = ((((shootStick->GetThrottle() - 1)*-1)/2) * .8 + .2); //Pull throttle to modify drive variables
																		//Throttle value is between .2 and 1.0

		if (fabs(flightX) < deadZone) { //Deaden x
			flightX = 0;
		}
		if (fabs(flightY) < deadZone) { //Deaden y
			flightY = 0;
		}
		if (fabs(flightZ) < deadZone) { //Deaden z
			flightZ = 0;
		}

		if (flightStick->GetRawButton(strafeButtonChannel)){ //Set drive to strafe mode
			driveMode = 0;
		}
		if (flightStick->GetRawButton(arcadeButtonChannel)){ //Set drive to arcade mode
			driveMode = 1;
		}
		if (flightStick->GetRawButton(fieldButtonChannel)){ //Set drive to field-centric mode
			driveMode = 2;
		}
		if (shootStick->GetRawButton(gyroResetChannel)){ //Reset gyro with the trigger
			yawGyro->Reset();
		}
		flightX = flightX * flightThrottle;
		flightY = flightY * flightThrottle;
		flightZ = flightZ * flightThrottle;

		if(driveMode == 1){
			robotDrive->MecanumDrive_Cartesian(flightZ, flightY, flightX, 0);
			SmartDashboard::PutString("DriveMode", "Arcade");
		}
		else if(driveMode == 2){
			robotDrive->MecanumDrive_Cartesian(flightX, flightY, flightZ, yawGyro->GetAngle());
			SmartDashboard::PutString("DriveMode", "Field");
		}
		else{
			robotDrive->MecanumDrive_Cartesian(flightX, flightY, flightZ, 0);
			SmartDashboard::PutString("DriveMode", "Strafe");
		}

		SmartDashboard::PutNumber("GyroAngle", yawGyro->GetAngle());
	}
开发者ID:FYRE5480,项目名称:FYRE-Programming-2015-2016,代码行数:48,代码来源:Robot.cpp

示例14: GetRawAxis

/**
 * Get the value of the axis.
 *
 * @param port The USB port for this joystick.
 * @param axis The axis to read [1-6].
 * @return The value of the axis.
 */
float GetRawAxis(UINT32 port, UINT32 axis)
{
    Joystick *stick = getJoystick(port);
    if (stick == NULL)
        return 0;
    return stick->GetRawAxis(axis);
}
开发者ID:FRC980,项目名称:FRC-Team-980,代码行数:14,代码来源:CJoystick.cpp

示例15: OperatorControl

    void OperatorControl(void)
    {
        OperatorControlInit();
        compressor.Start();
        testActuator.Start();

        while (IsOperatorControl())
        {
            ProgramIsAlive();
            //No need to do waits because ProgramIsAlive function does a wait. //Wait(0.005);

            bool isButtonPressed = stick.GetRawButton(3);
            SmartDashboard::PutNumber("Actuator Button Status",isButtonPressed);
            if (isButtonPressed)
            {
                testActuator.Go();
            }


            float leftYaxis = stick.GetY();
            float rightYaxis = stick.GetRawAxis(5);	//RawAxis(5);
            TankDrive(leftYaxis,rightYaxis); 	// drive with arcade style (use right stick)for joystick 1
            SmartDashboard::PutNumber("Left Axis",leftYaxis);
            SmartDashboard::PutNumber("Right Axis",rightYaxis);
        }
    }
开发者ID:spanut01,项目名称:FRCTeam1967,代码行数:26,代码来源:JankyActuatorTest.cpp


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