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


C++ Talon类代码示例

本文整理汇总了C++中Talon的典型用法代码示例。如果您正苦于以下问题:C++ Talon类的具体用法?C++ Talon怎么用?C++ Talon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TestBGrabber

	void TestBGrabber()
		{
			//ROLLERS	
			if (m_operator->GetRawAxis(TRIGGERS) > 0.4) {
				m_roller->Set(0.5);
			}
			else if (m_operator->GetRawAxis(TRIGGERS) < -0.4)
				m_roller->Set(0.5);
			else {
				m_roller->Set(0.0);
			}	

			//BALL CATCH (#Sweg)
			if (m_operator->GetRawButton(BUTTON_A)) {
				m_catch->Set(true); 
			}
			else if (m_operator->GetRawButton(BUTTON_B)) {
				m_catch->Set(false);
			}

			//bArm OPEN / CLOSE
			if (m_operator->GetRawButton(BUTTON_X)) {
				m_bArm->Set(true);
			}
			else if (m_operator->GetRawButton(BUTTON_Y)) {
				m_bArm->Set(false);
			}
		}
开发者ID:hal7df,项目名称:further-suggestions,代码行数:28,代码来源:BuiltinDefaultCode.cpp

示例2: stopDriving

	void stopDriving()
	{
		leftFront.Set(0);
		leftBack.Set(0);
		rightFront.Set(0);
		rightBack.Set(0);
	}
开发者ID:secant,项目名称:robot2014,代码行数:7,代码来源:AutonomousCodeTest.cpp

示例3:

	//Grab first two and turn to go right
	void AutonomousType10() {
		SmartDashboard::PutString("STATUS:", "STARTING AUTO 10");
		robotDrive.MecanumDrive_Cartesian(0, -0.2, 0);
		if (WaitF(1.2))
			return;
		robotDrive.MecanumDrive_Cartesian(0, 0, 0);
		chainLift.SetSpeed(0.5);
		while (IsAutonomous() && maxUp.Get() && midPoint.Get()) {
		}
		chainLift.SetSpeed(0);
		robotDrive.MecanumDrive_Cartesian(0, 0.4, 0);
		if (WaitF(1.6))
			return;

		robotDrive.MecanumDrive_Polar(0, 0, 0.3);
		if (WaitF(2.6))
			return;

		robotDrive.MecanumDrive_Cartesian(0, -0.4, 0);
		if (WaitF(1))
			return;

		robotDrive.MecanumDrive_Polar(0, 0, -0.3);
		if (WaitF(2.6))
			return;

		robotDrive.MecanumDrive_Cartesian(0, -0.4, 0);
		if (WaitF(1.6))
			return;
		robotDrive.MecanumDrive_Cartesian(0, 0, 0);
		SmartDashboard::PutString("STATUS:", "AUTO 10 COMPLETE");
	}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:33,代码来源:Main.cpp

示例4: AutonomousInit

	//Choose which auto to use
	void AutonomousInit() {

		chainLift.SetSpeed(0);
		canGrabber.SetSpeed(0);
		robotDrive.MecanumDrive_Cartesian(0, 0, 0);
		SmartDashboard::PutString("STATUS:", "STARTING AUTO");
		robotDrive.SetSafetyEnabled(false);
		chainLift.SetSafetyEnabled(false);

		SmartDashboard::PutBoolean("Auto switch A: ", autoSwitch1.Get());
		SmartDashboard::PutBoolean("Auto switch B: ", autoSwitch2.Get());

		//Select auto type
		if (autoSwitch1.Get()) {
			if (autoSwitch2.Get())
				AutonomousType4();
			else
				//1 on 2 grab n back
				AutonomousType8();
		} else {
			if (autoSwitch2.Get())
				//1 off, 2 on: grab n turn
				AutonomousType10();
			else {
				SmartAutoPicker();
			}
			//Do Nothing
		}
	}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:30,代码来源:Main.cpp

示例5: TeleopPeriodic

	void TeleopPeriodic()
	{

		rightDrive = rightStick->GetY();
		leftDrive  = leftStick->GetY();
		rightDrive = .6*rightDrive;
		leftDrive  = .6*leftDrive;
		robotDrive->TankDrive(rightDrive, leftDrive);
		ax = accel-> GetX();
		ay = accel-> GetY();
		az = accel-> GetZ();
		SmartDashboard::PutData("Auto Modes", chooser);
		SmartDashboard::PutNumber("ax",ax);
		SmartDashboard::PutNumber("ay",ay);
		SmartDashboard::PutNumber("az",az);
		bool triggerRight = rightStick->GetRawButton(1);
		bool triggerLeft = leftStick->GetRawButton(1);
		SmartDashboard::PutBoolean("trigger", triggerRight);
		SmartDashboard::PutBoolean("trigger", triggerLeft);
		if(triggerRight || triggerLeft){
			pickup->Set(.3);
		}
		else{
			pickup->Set(0);
		}
	}
开发者ID:docphoton,项目名称:CB4,代码行数:26,代码来源:Robot.cpp

示例6: driveBackward

	void driveBackward() //Creates a function to drive backward (sets it)
	{
		leftFront.Set(-0.75);
		leftBack.Set(-0.75);
		rightFront.Set(-0.75);
		rightBack.Set(-0.75);
	}
开发者ID:secant,项目名称:robot2014,代码行数:7,代码来源:AutonomousCodeTest.cpp

示例7: driveForward

	void driveForward() //Creates a function to drive forward (sets it)
	{
		leftFront.Set(0.75);
		leftBack.Set(0.75);
		rightFront.Set(0.75);
		rightBack.Set(0.75);
	}
开发者ID:secant,项目名称:robot2014,代码行数:7,代码来源:AutonomousCodeTest.cpp

示例8: stopDriving

	/**** Yo yo yo the right side motors are inverted, so a positive left motor (probably) moves forward and a positive right motor (probably) moves backward ****/
	void stopDriving() // Stops drive motors
	{
		leftFront.Set(0);
		leftBack.Set(0);
		rightFront.Set(0);
		rightBack.Set(0);
	}
开发者ID:secant,项目名称:robot2014,代码行数:8,代码来源:easyAutonomousTesting.cpp

示例9: driveForward

	void driveForward() //Drives forward
	{
		leftFront.Set(justIncaseMyPolarityDunGoofed*(1 - (autonomousSlowDriveSpeedMultiplier))); // Probably needs to be positive
		leftBack.Set(justIncaseMyPolarityDunGoofed*(1 - (autonomousSlowDriveSpeedMultiplier))); // Probably needs to be positive
		rightFront.Set(justIncaseMyPolarityDunGoofed*(-1 + (autonomousSlowDriveSpeedMultiplier))); // Probably needs to be negative
		rightBack.Set(justIncaseMyPolarityDunGoofed*(-1 + (autonomousSlowDriveSpeedMultiplier))); // Probably needs to be negative
	}
开发者ID:secant,项目名称:robot2014,代码行数:7,代码来源:easyAutonomousTesting.cpp

示例10: TestRamMotion

	void TestRamMotion()
	{
		if (m_driver->GetRawButton(BUTTON_LB))
			m_ramMotor->Set(.8);
		else if (m_driver->GetRawButton(BUTTON_RB))
			m_ramMotor->Set(-.2);
		else
			m_ramMotor->Set(0);
	}
开发者ID:hal7df,项目名称:further-suggestions,代码行数:9,代码来源:BuiltinDefaultCode.cpp

示例11: autonomousCatapultRelease

	void autonomousCatapultRelease()
	{
		if ((leftLimitSwitch.Get()== 0 || rightLimitSwitch.Get()== 0) && winchMotor.Get() == 0)
		{
			stopDriving(); // Stops the drive so the robot doesn't flip on itself or something
			winchMotor.Set(0); // Redundant line for extra safety that can be removed after testing (The winch should already be off)
			dogSolenoid.Set(DoubleSolenoid::kReverse); // Brings the pneumatic piston backward to disengage the dog gear
			Wait(0.2); // Giving the pistons time to disengage properly
			ratchetSolenoid.Set(DoubleSolenoid::kReverse); // Brings the pneumatic piston backward to disengage the ratchet
			Wait(5); // Waits 5 seconds after shooting before starting to load the catapult
		}
	}
开发者ID:secant,项目名称:robot2014,代码行数:12,代码来源:easyAutonomousTesting.cpp

示例12: IsEnabled

	//Grab first yellow, back up to auto zone, DON'T DROP
	void AutonomousType12() {
		SmartDashboard::PutString("STATUS:", "STARTING AUTO 12");
		chainLift.SetSpeed(0.5);
		while (IsAutonomous() && IsEnabled() && maxUp.Get() && midPoint.Get()) {
		}
		chainLift.SetSpeed(0);
		robotDrive.MecanumDrive_Cartesian(0, 0.4, 0);
		if (WaitF(3))
			return;
		robotDrive.MecanumDrive_Cartesian(0, 0, 0);
		SmartDashboard::PutString("STATUS:", "AUTO 12 COMPLETE");
	}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:13,代码来源:Main.cpp

示例13: 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

示例14: spinnerRight

void RobotDemo::spinnerRight(float speed) {
	float sec = 0.0;
	float currentMotorPower = 0.0;
	
	if(speed<0.05 && speed>-0.05){
		stopSpinnersRight();
	}
	else if(speed>0){
		while(currentMotorPower<speed){
			spinnerR1->Set(currentMotorPower);
			spinnerR2->Set(currentMotorPower);
			sec += 0.1;
			currentMotorPower = ramp(sec);
		}
		spinnerR1->Set(speed); //may need to
		spinnerR2->Set(speed); //reverse these
	}
	else{
		while(currentMotorPower<abs(speed)){
			spinnerR1->Set(-currentMotorPower);
			spinnerR2->Set(-currentMotorPower);
			sec += 0.3;
			currentMotorPower = ramp(sec);
		}
		spinnerR1->Set(speed); //may need to
		spinnerR2->Set(speed); //reverse these
	}
	
}
开发者ID:Iron-Panthers,项目名称:Iron-Panthers,代码行数:29,代码来源:robotTemplate.cpp

示例15: OperatorControl

	/**
	 * Runs the motors with arcade steering.
	 */
	void OperatorControl()
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl() && IsEnabled())
		{
			myRobot.ArcadeDrive(joystick); // drive with arcade style (use right stick)

			if(joystick.GetRawButton(1)) {
				crochets.Set(-0.6);
			}
			else if(joystick.GetRawButton(2)) {
				crochets.Set(0.6);
			}

			Wait(0.005);				// wait for a motor update time
		}
	}
开发者ID:etiennebeaulac,项目名称:AtlasSample,代码行数:20,代码来源:Robot.cpp


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