本文整理汇总了C++中Talon类的典型用法代码示例。如果您正苦于以下问题:C++ Talon类的具体用法?C++ Talon怎么用?C++ Talon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Talon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: grabberChuteTaskFunc
inline void grabberChuteTaskFunc(uint32_t joystickPtr, uint32_t grabTalonPtr, uint32_t grabOuterLimitPtr, uint32_t grabInnerLimitPtr, uint32_t pdpPtr, uint32_t isGrabbingPtr...) {//uint is a pointer and not an integer
SmartDashboard::PutBoolean("Breakpoint 0", true);
Wait(.5);
Joystick *joystick = (Joystick *) joystickPtr;//initializes objects from pointers
Talon *grabTalon = (Talon *) grabTalonPtr;
Switch *grabInnerLimit = (Switch *) grabInnerLimitPtr;
Switch *grabOuterLimit = (Switch *) grabOuterLimitPtr;
PowerDistributionPanel *pdp = (PowerDistributionPanel *) pdpPtr;
bool *isGrabbing = (bool *) isGrabbingPtr;
Timer timer;
timer.Start();
SmartDashboard::PutBoolean("Breakpoint 1", true);
Wait(.5);
*isGrabbing = true;//tells robot.cpp that thread is running
SmartDashboard::PutBoolean("Breakpoint 2", true);
Wait(.5);
while (grabOuterLimit->Get() && joystick->GetRawButton(Constants::pickupCancelButton) == false) {//starts to spin motor to pass startup current
//grabTalon->Set(1);//move in
}
SmartDashboard::PutBoolean("Breakpoint 3", true);
Wait(.5);
timer.Reset();
while (timer.Get() < Constants::grabChuteTime && grabInnerLimit->Get() && joystick->GetRawButton(Constants::pickupCancelButton) == false) {//while it hasn't reached the current cutoff, hit a limit switch, or been cancelled
//grabTalon->Set(1);
SmartDashboard::PutNumber("Current",pdp->GetCurrent(Constants::grabPdpChannel));//displays current on SmartDashboard
Wait(.5);
}
SmartDashboard::PutBoolean("Breakpoint 4", true);
Wait(.5);
grabTalon->Set(0);//stop moving
timer.Stop();
*isGrabbing = false;//tells that thread is over
}
开发者ID:Numeri,项目名称:RecycleRush,代码行数:43,代码来源:Pickup.cpp
示例2: grabberPositionTaskFunc
inline void grabberPositionTaskFunc(uint32_t joystickPtr, uint32_t grabTalonPtr, uint32_t grabInnerLimitPtr, uint32_t pdpPtr, uint32_t backOutPtr, uint32_t grabPowerPtr, uint32_t isGrabbingPtr...) {//uint is a pointer and not an integer
Joystick *joystick = (Joystick *) joystickPtr;//initializes objects from pointers
Talon *grabTalon = (Talon *) grabTalonPtr;
Switch *grabInnerLimit = (Switch *) grabInnerLimitPtr;
PowerDistributionPanel *pdp = (PowerDistributionPanel *) pdpPtr;
bool *isGrabbing = (bool *) isGrabbingPtr;
bool *backOut = (bool *) backOutPtr;
double *grabPower = (double *) grabPowerPtr;
Timer timer;
timer.Start();
*isGrabbing = true;//tells robot.cpp that thread is running
while (grabInnerLimit->Get() && timer.Get() < Constants::grabDelay) {//starts to spin motor to pass startup current
grabTalon->Set(1);//move in
}
while (pdp->GetCurrent(Constants::grabPdpChannel) < *grabPower && grabInnerLimit->Get() && joystick->GetRawButton(Constants::pickupCancelButton) == false) {//while it hasn't reached the current cutoff, hit a limit switch, or been cancelled
grabTalon->Set(1);
SmartDashboard::PutNumber("Current",pdp->GetCurrent(Constants::grabPdpChannel));//displays current on SmartDashboard
}
if (*backOut) {
grabTalon->Set(0);//stop moving
timer.Reset();
while (timer.Get() < Constants::liftBackoutTime && joystick->GetRawButton(Constants::pickupCancelButton) == false) {
grabTalon->Set(-.75);
}
}
grabTalon->Set(0);//stop moving
timer.Stop();
*isGrabbing = false;//tells that thread is over
}
开发者ID:Numeri,项目名称:RecycleRush,代码行数:34,代码来源:Pickup.cpp
示例3: 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
示例4: stopDriving
void stopDriving()
{
leftFront.Set(0);
leftBack.Set(0);
rightFront.Set(0);
rightBack.Set(0);
}
开发者ID:secant,项目名称:robot2014,代码行数:7,代码来源:AutonomousCodeTest.cpp
示例5:
//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
示例6: 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
示例7: 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
示例8: 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
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: 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
示例15: 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
示例16: 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
示例17: 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
示例18: Reset
void Reset() {
m_talonCounter->Reset();
m_victorCounter->Reset();
m_jaguarCounter->Reset();
m_talon->Set(0.0f);
m_victor->Set(0.0f);
m_jaguar->Set(0.0f);
}
开发者ID:FRCTeam1967,项目名称:FRCTeam1967,代码行数:8,代码来源:CounterTest.cpp
示例19: IsAutonomous
void AutonomousType2() { //Pick tote and bin, move to auto zone
SmartDashboard::PutString("STATUS:", "STARTING AUTO 2");
chainLift.SetSpeed(0.5);
while (midPoint.Get() && maxUp.Get()) {
}
chainLift.SetSpeed(0);
robotDrive.MecanumDrive_Polar(0.3, 0, 0);
if (WaitF(1.6))
return;
robotDrive.MecanumDrive_Polar(0, 0, 0);
chainLift.SetSpeed(-0.2);
if (WaitF(0.8))
return;
chainLift.SetSpeed(0);
robotDrive.MecanumDrive_Polar(-0.3, 0, 0);
if (WaitF(1.6))
return;
robotDrive.MecanumDrive_Polar(0, 0, 0);
chainLift.SetSpeed(-0.3);
while (maxDown.Get()) {
}
chainLift.SetSpeed(0);
robotDrive.MecanumDrive_Polar(0.2, 0, 0);
if (WaitF(2))
return;
robotDrive.MecanumDrive_Polar(0, 0, 0);
chainLift.SetSpeed(0.4);
while (midPoint.Get() && maxUp.Get()) {
}
chainLift.SetSpeed(0);
//turn 90 deg
robotDrive.MecanumDrive_Polar(0, 0, -0.3);
if (WaitF(4))
return;
robotDrive.MecanumDrive_Polar(0.5, 0, 0);
if (WaitF(2.5))
return;
robotDrive.MecanumDrive_Polar(0, 0, 0);
chainLift.SetSpeed(-0.4);
while (maxDown.Get() && IsAutonomous()) {
}
chainLift.SetSpeed(0);
SmartDashboard::PutString("STATUS:", "AUTO 2 COMPLETE");
}
开发者ID:FIRSTRoboticsTeam4381,项目名称:Team4381RecRush15,代码行数:45,代码来源:Main.cpp
示例20: OperatorControl
/**
* Runs the motor from the output of a Joystick.
*/
void OperatorControl() {
while (IsOperatorControl() && IsEnabled()) {
// Set the motor controller's output.
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards).
m_motor.Set(m_stick.GetY());
Wait(kUpdatePeriod); // Wait 5ms for the next update.
}
}
开发者ID:Beachbot330,项目名称:eclipse_plugins,代码行数:12,代码来源:Robot.cpp
注:本文中的Talon类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论