Java 类edu.wpi.first.wpilibj.CANTalon.TalonControlMode 实例源码

项目:Cybercavs2016Code    文件:PickupArm.java   
public void setPickupWheelsMode(int mode) {
    if (mode == 0) {
        pickupWheels.changeControlMode(TalonControlMode.Current);
    }
    if (mode == 1) {
        pickupWheels.changeControlMode(TalonControlMode.Disabled);
    }
    if (mode == 2) {
        pickupWheels.changeControlMode(TalonControlMode.Follower);
    }
    if (mode == 3) {
        pickupWheels.changeControlMode(TalonControlMode.MotionProfile);
    }
    if (mode == 4) {
        pickupWheels.changeControlMode(TalonControlMode.PercentVbus);
    }
    if (mode == 5) {
        pickupWheels.changeControlMode(TalonControlMode.Position);
    }
    if (mode == 6) {
        pickupWheels.changeControlMode(TalonControlMode.Speed);
    }
    if (mode == 7) {
        pickupWheels.changeControlMode(TalonControlMode.Voltage);
    }
}
项目:Cybercavs2016Code    文件:PickupArm.java   
public void setElbowMode(int mode) {
    if (mode == 0) {
        pickupElbowMotor.changeControlMode(TalonControlMode.Current);
    }
    if (mode == 1) {
        pickupElbowMotor.changeControlMode(TalonControlMode.Disabled);
    }
    if (mode == 2) {
        pickupElbowMotor.changeControlMode(TalonControlMode.Follower);
    }
    if (mode == 3) {
        pickupElbowMotor.changeControlMode(TalonControlMode.MotionProfile);
    }
    if (mode == 4) {
        pickupElbowMotor.changeControlMode(TalonControlMode.PercentVbus);
    }
    if (mode == 5) {
        pickupElbowMotor.changeControlMode(TalonControlMode.Position);
    }
    if (mode == 6) {
        pickupElbowMotor.changeControlMode(TalonControlMode.Speed);
    }
    if (mode == 7) {
        pickupElbowMotor.changeControlMode(TalonControlMode.Voltage);
    }
}
项目:Cybercavs2016Code    文件:PickupArm.java   
public void setWristMode(int mode) {
    if (mode == 0) {
        pickupWristMotor.changeControlMode(TalonControlMode.Current);
    }
    if (mode == 1) {
        pickupWristMotor.changeControlMode(TalonControlMode.Disabled);
    }
    if (mode == 2) {
        pickupWristMotor.changeControlMode(TalonControlMode.Follower);
    }
    if (mode == 3) {
        pickupWristMotor.changeControlMode(TalonControlMode.MotionProfile);
    }
    if (mode == 4) {
        pickupWristMotor.changeControlMode(TalonControlMode.PercentVbus);
    }
    if (mode == 5) {
        pickupWristMotor.changeControlMode(TalonControlMode.Position);
    }
    if (mode == 6) {
        pickupWristMotor.changeControlMode(TalonControlMode.Speed);
    }
    if (mode == 7) {
        pickupWristMotor.changeControlMode(TalonControlMode.Voltage);
    }
}
项目:Cybercavs2016Code    文件:ManipulatorArmOld.java   
public void setManipulatorElbowMode(int mode) {
    if (mode == 0) {
        manipulatorElbow.changeControlMode(TalonControlMode.Current);
    }
    if (mode == 1) {
        manipulatorElbow.changeControlMode(TalonControlMode.Disabled);
    }
    if (mode == 2) {
        manipulatorElbow.changeControlMode(TalonControlMode.Follower);
    }
    if (mode == 3) {
        manipulatorElbow.changeControlMode(TalonControlMode.MotionProfile);
    }
    if (mode == 4) {
        manipulatorElbow.changeControlMode(TalonControlMode.PercentVbus);
    }
    if (mode == 5) {
        manipulatorElbow.changeControlMode(TalonControlMode.Position);
    }
    if (mode == 6) {
        manipulatorElbow.changeControlMode(TalonControlMode.Speed);
    }
    if (mode == 7) {
        manipulatorElbow.changeControlMode(TalonControlMode.Voltage);
    }
}
项目:Cybercavs2016Code    文件:ManipulatorArmOld.java   
public void setManipulatorWristMode(int mode) {
    if (mode == 0) {
        manipulatorWrist.changeControlMode(TalonControlMode.Current);
    }
    if (mode == 1) {
        manipulatorWrist.changeControlMode(TalonControlMode.Disabled);
    }
    if (mode == 2) {
        manipulatorWrist.changeControlMode(TalonControlMode.Follower);
    }
    if (mode == 3) {
        manipulatorWrist.changeControlMode(TalonControlMode.MotionProfile);
    }
    if (mode == 4) {
        manipulatorWrist.changeControlMode(TalonControlMode.PercentVbus);
    }
    if (mode == 5) {
        manipulatorWrist.changeControlMode(TalonControlMode.Position);
    }
    if (mode == 6) {
        manipulatorWrist.changeControlMode(TalonControlMode.Speed);
    }
    if (mode == 7) {
        manipulatorWrist.changeControlMode(TalonControlMode.Voltage);
    }
}
项目:RobotCode2017    文件:ShooterSubsystem.java   
@Override
protected void initDefaultCommand()
{
    this.setDefaultCommand(new ShooterCommand(1));

    flywheelTalon.changeControlMode(TalonControlMode.Speed);

    flywheelTalon.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    flywheelTalon.configEncoderCodesPerRev(256);
    flywheelTalon.reverseSensor(false);

    flywheelTalon.configNominalOutputVoltage(0.0D, -0.0D);
    flywheelTalon.configPeakOutputVoltage(12.0D, -12.0D);

    flywheelTalon.setProfile(0);
    flywheelTalon.setF(0.21765900);
    flywheelTalon.setP(1.71312500);
    flywheelTalon.setI(0.0);
    flywheelTalon.setD(0.0);
}
项目:Cybercavs2016Code    文件:PickupArm.java   
public void holdPosition() {
    setElbowPosition(elbowHoldPosition);
    if (Math.abs(pickupElbowMotor.getError()) < 1000) { //moves the elbow first once within an error then moves wrist
        pickupWristMotor.changeControlMode(TalonControlMode.Position);
        setWristPosition(wristHoldPosition);
    }
    else { //stops the wrist if elbow not inposition yet
        pickupWristMotor.changeControlMode(TalonControlMode.Voltage);
        pickupWristMotor.set(0);
    }
    setPickupWheels(0);
    //System.out.println("Elbow Error :" + pickupElbowMotor.getError());
}
项目:Cybercavs2016Code    文件:PickupArm.java   
public void lowBarPosition() {
//      switch(lowBarState) {
//      
//      case 0:
//          pickup();
//          if (pickupElbowMotor.getError() < 500)  {
//              lowBarState++;
//          }
//          break;
//      case 1:
//          setElbowPosition(Robot.lowBarElbowPosition());
//          setPickupWheels(0);
//          break;
//      }
        setElbowPosition(elbowLowBarPosition);
        if (pickupElbowMotor.getError() < 5000 && count > 10 || elbowInLowPos) { // moves the elbow first, once its in position wrist can be moved
            count = 0;
            pickupWristMotor.changeControlMode(TalonControlMode.Position);
            pickupWristMotor.set(wristLowBarPosition);
            elbowInLowPos = true;
            setPickupWheels(0);
        }
        else {
            setPickupWheels(-6);
            pickupWristMotor.changeControlMode(TalonControlMode.Voltage);
            pickupWristMotor.set(0);
        }
        count++;
    }
项目:Cybercavs2016Code    文件:ManipulatorArm.java   
public void setManipulatorElbowMode(int mode) {
    manipulatorElbow.setStatusFrameRateMs(StatusFrameRate.QuadEncoder, 10);

// StatusFrameRateGeneral = 0, StatusFrameRateFeedback = 1, StatusFrameRateQuadEncoder = 2, StatusFrameRateAnalogTempVbat = 3, 
//  StatusFrameRatePulseWidthMeas = 4 
    if (mode == 0) {
        manipulatorElbow.changeControlMode(TalonControlMode.Current);
    }
    if (mode == 1) {
        manipulatorElbow.changeControlMode(TalonControlMode.Disabled);
    }
    if (mode == 2) {
        manipulatorElbow.changeControlMode(TalonControlMode.Follower);
    }
    if (mode == 3) {
        manipulatorElbow.changeControlMode(TalonControlMode.MotionProfile);
    }
    if (mode == 4) {
        manipulatorElbow.changeControlMode(TalonControlMode.PercentVbus);
    }
    if (mode == 5) {
        manipulatorElbow.changeControlMode(TalonControlMode.Position);
    }
    if (mode == 6) {
        manipulatorElbow.changeControlMode(TalonControlMode.Speed);
    }
    if (mode == 7) {
        manipulatorElbow.changeControlMode(TalonControlMode.Voltage);
    }
}
项目:Cybercavs2016Code    文件:ManipulatorArm.java   
public void setManipulatorWristMode(int mode) {
    manipulatorWrist.setStatusFrameRateMs(StatusFrameRate.QuadEncoder, 10);
    if (mode == 0) {
        manipulatorWrist.changeControlMode(TalonControlMode.Current);
    }
    if (mode == 1) {
        manipulatorWrist.changeControlMode(TalonControlMode.Disabled);
    }
    if (mode == 2) {
        manipulatorWrist.changeControlMode(TalonControlMode.Follower);
    }
    if (mode == 3) {
        manipulatorWrist.changeControlMode(TalonControlMode.MotionProfile);
    }
    if (mode == 4) {
        manipulatorWrist.changeControlMode(TalonControlMode.PercentVbus);
    }
    if (mode == 5) {
        manipulatorWrist.changeControlMode(TalonControlMode.Position);
    }
    if (mode == 6) {
        manipulatorWrist.changeControlMode(TalonControlMode.Speed);
    }
    if (mode == 7) {
        manipulatorWrist.changeControlMode(TalonControlMode.Voltage);
    }
}
项目:Cybercavs2016Code    文件:ManipulatorArmOld.java   
public void portcullis() {
    switch(portcullisState) {

    case 0:
        setManipulatorElbow(elbowPortcullisPosition);
        setManipulatorWrist(wristPortcullisPosition);
        if(Math.abs(manipulatorElbow.getError()) < 100 && count > 10) {
            portcullisState++;
            manipulatorWrist.changeControlMode(TalonControlMode.Voltage);
            manipulatorElbow.changeControlMode(TalonControlMode.Voltage);
            manipulatorWrist.set(0);
            manipulatorElbow.set(0);
            count = 0;
        }
        count++;
    break;
    case 1:
        if(count > 10) {
            if (Math.abs(wristPortcullisPosition - currentWristPosition) > 300) {
                Robot.robotDrive.resetEncoders();
                count = 0;
                portcullisState++;
            }
            previousWristPosition = currentWristPosition;
        }
        count++;
        currentWristPosition = manipulatorWrist.getPosition();
    break;
    case 2:
        wristPosition = manipulatorWrist.getPosition();
        elbowPosition = manipulatorElbow.getPosition();
        leftEncoder = Robot.robotDrive.getLeftEncoder();
        rightEncoder = Robot.robotDrive.getRightEncoder();
        System.out.println(wristPosition + ", " + elbowPosition + ", " + leftEncoder + ", " + rightEncoder);
    }
}
项目:2016-Stronghold    文件:IntakeLauncher.java   
public void moveToSetPoint() {
    //keepSetPointInRange();
    //calibratePotentiometer();
    aimMotor.changeControlMode(TalonControlMode.Position); // redundant, but
    //System.out.println("Moving to set point" + setPoint);
    //System.out.println("Currently at " + aimMotor.getPosition());
    aimMotor.set(setPoint);
}
项目:FRC2016    文件:OpenLoopArm.java   
@Override
public void stop() {

    RobotMap.arm1.disableControl();
    RobotMap.brakeAndVoltage(RobotMap.arm1);
    RobotMap.arm1.setFeedbackDevice(CANTalon.FeedbackDevice.CtreMagEncoder_Absolute);
    RobotMap.arm1.reverseSensor(true);
    RobotMap.arm1.setF(Constants.armF);
    RobotMap.arm1.setPID(Constants.armP, Constants.armI, Constants.armD);
    RobotMap.arm1.changeControlMode(CANTalon.TalonControlMode.Position);
    RobotMap.arm1.set(RobotMap.arm1.getPosition());
    RobotMap.arm1.enableControl();
}
项目:FRC-2016    文件:Drivetrain.java   
/**
 * Sets the Talon SRX's control mode
 * 
 * @param mode - Sets the control mode (Uses default control modes)
 */
private void setCtrlMode(TalonControlMode mode) {
    left.changeControlMode(mode);
    leftSlave.changeControlMode(SLAVE_MODE);
    leftSlave.set(left.getDeviceID());
    // (arc sin(8020))/1 #killyourself
    right.changeControlMode(mode);
    rightSlave.changeControlMode(SLAVE_MODE);
    rightSlave.set(right.getDeviceID());
}
项目:Stronghold-2016    文件:DrivetrainPID.java   
public void teleoperatedDrive() {
    SmartDashboard.putBoolean("Teleop drive called?", true);
    frontLeft.changeControlMode(TalonControlMode.PercentVbus);
    frontRight.changeControlMode(TalonControlMode.PercentVbus);
    rearLeft.changeControlMode(TalonControlMode.PercentVbus);
    rearRight.changeControlMode(TalonControlMode.PercentVbus);

    if(OI.getInstance().getArcadeMode()){
        arcadeDrive();
    } else tankDrive();
}
项目:Stronghold-2016    文件:DrivetrainPID.java   
public void set(double leftValue, double rightValue) {
    if(Robot.test_platform){
        frontRight.set(-leftValue); 
        frontLeft.set(rightValue);
    } else{
        frontRight.set(leftValue); 
        frontLeft.set(-rightValue);
    }
    rearRight.changeControlMode(TalonControlMode.Follower);
    rearRight.set(RobotMap.FRONT_RIGHT_MOTOR);

    rearLeft.changeControlMode(TalonControlMode.Follower);
    rearLeft.set(RobotMap.FRONT_LEFT_MOTOR);
}
项目:Stronghold-2016    文件:Yaw.java   
public Yaw(){
    yaw = new CANTalon(RobotMap.TARGETING_YAW_MOTOR);
    yaw.enableControl();
    yawZero = yaw.getEncPosition();

    yaw.changeControlMode(TalonControlMode.Position);
    yaw.setPID(RobotMap.YAW_P, RobotMap.YAW_I, RobotMap.YAW_D);
}
项目:Stronghold-2016    文件:Drivetrain.java   
public void teleoperatedDrive() {
    frontLeft.changeControlMode(TalonControlMode.PercentVbus);
    frontRight.changeControlMode(TalonControlMode.PercentVbus);
    rearLeft.changeControlMode(TalonControlMode.PercentVbus);
    rearRight.changeControlMode(TalonControlMode.PercentVbus);

    tankDrive();
}
项目:Stronghold-2016    文件:Drivetrain.java   
public void setPosition(int encoderPosition) {
    frontLeft.changeControlMode(TalonControlMode.Position);
    frontRight.changeControlMode(TalonControlMode.Position);
    rearLeft.changeControlMode(TalonControlMode.Position);
    rearRight.changeControlMode(TalonControlMode.Position);

    frontLeft.set(encoderPosition);
    frontRight.set(encoderPosition);
    rearLeft.set(encoderPosition);
    rearRight.set(encoderPosition);
}
项目:Stronghold-2016    文件:Drivetrain.java   
public void set(double value) {

    frontRight.set(value);
    frontLeft.set(value);

    SmartDashboard.putNumber("Front right", frontRight.get());
    rearRight.changeControlMode(TalonControlMode.Follower);
    rearRight.set(RobotMap.FRONT_RIGHT_MOTOR);

    SmartDashboard.putNumber("Front left", frontLeft.get());
    rearLeft.changeControlMode(TalonControlMode.Follower);
    rearLeft.set(RobotMap.FRONT_LEFT_MOTOR);
}
项目:Cybercavs2016Code    文件:PickupArm.java   
public void pickup() {
        switch(pickupState) {
        case 0: //moves Arm to higher position and waits for wrist to be in position
//          setWristPosition(wristPickupPosition);
//          if (pickupElbowMotor.getEncPosition() > 10000) {  //
//              setWristPosition(wristPickupPosition);
//              if (pickupWristMotor.getEncPosition() > 5229) { //detects if wrist is in position so that the elbow may continue moving
//                  setElbowPosition(elbowPickupPosition);
//                  setPickupWheels(Robot.pickupWheelsPower());
//              }
//          }
//          else {
//              setElbowPosition(elbowPickupPosition - 25000);//moves arm to specific location until the wrist is in position so we don't go over 15 in
//          }
            setElbowPosition(elbowPickupPosition);
            if (pickupElbowMotor.getError() < 10000) {
                pickupWristMotor.changeControlMode(TalonControlMode.Position);
                setWristPosition(wristPickupPosition);
                if (Robot.oi.getOperatorGamepad().getRawButton(9)) {
                    setPickupWheels(-Robot.pickupWheelsPower() / 1.3);
                } else {
                    setPickupWheels(Robot.pickupWheelsPower());
                }
                if (!backBallSensor.get()) { //starts incrementing count once the back sensor sees the ball
                    count++;            
                }
                else {
                    count = 0;
                }
                if (count > 15 || Robot.oi.driverGamepad.getRawButton(12)) { // after 15 counts (~1/4 of a second) it assumes the ball is centered and proceeds to pick up the ball
                    pickupState++;
                    count = 0;
                }
                if (!ballSensor.get()) {
                    pickupState=2;
                }
            }
            else {
                pickupWristMotor.changeControlMode(TalonControlMode.Voltage);
                pickupWristMotor.set(0);
            }


        break;
        case 1://moves the wrist out and the elbow down to lift the ball over the bumper
            //System.out.println("IN CASE 1!!!!");
            if (Robot.oi.getOperatorGamepad().getRawButton(9)) {
                setPickupWheels(-Robot.pickupWheelsPower()/1.3);
            } else {
                setPickupWheels(Robot.pickupWheelsPower());
            }
            setWristPosition(wristPickupPosition + 1000); 
            setElbowPosition(elbowPickupPosition + 2000);
            if (!ballSensor.get()) {
                pickupState++;
            }
        break;
        case 2: //Once elbow is high enough it will wait for the ball the settle in the catapult
            setElbowPosition(elbowHoldPosition + 5000); //moves arm to this position to allow the ball to have time to settle in the robot
            count++;
            if (count > 25) {
                setPickupWheels(0);
                setArmMode("Hold");
                count = 0;
            }
            if (count > 10) {
                setPickupWheels(0);
            }
        break;
        }
    }
项目:Cybercavs2016Code    文件:PickupArm.java   
public void readyToShoot() {
    setPickupWheels(0);
    pickupWristMotor.changeControlMode(TalonControlMode.Voltage);
    pickupWristMotor.set(0);
    setElbowPosition(elbowShootPosition);
}
项目:MechStorm2016    文件:RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveleftDrive = new CANTalon(3);
    LiveWindow.addActuator("Drive", "leftDrive", driveleftDrive);

    driverightDrive = new CANTalon(4);
    LiveWindow.addActuator("Drive", "rightDrive", driverightDrive);

    driveRobotDrive21 = new RobotDrive(driveleftDrive, driverightDrive);

    driveRobotDrive21.setSafetyEnabled(true);
    driveRobotDrive21.setExpiration(0.1);
    driveRobotDrive21.setSensitivity(0.5);
    driveRobotDrive21.setMaxOutput(1.0);

    armsingleArm = new CANTalon(9);

    armsingleArm.changeControlMode(TalonControlMode.PercentVbus);
    armsingleArm.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    /*
    armsingleArm.setPID(.7, 0.000001, 0);
    //armsingleArm.setPosition(0);
    armsingleArm.set(RobotMap.armsingleArm.get()); 
    */

    LiveWindow.addActuator("Arm", "singleArm", armsingleArm);
    LiveWindow.addSensor("Arm", "singleArm", armsingleArm);

    intakeMotor = new CANTalon(8);
    //LiveWindow.addActuator("Intake", "intakeMotor", intakeMotor);

    shooterrightShooter = new CANTalon(6);
    //LiveWindow.addActuator("Shooter", "rightShooter", shooterrightShooter);

    shooterleftShooter = new CANTalon(7);
    //LiveWindow.addActuator("Shooter", "leftShooter", shooterleftShooter);

    shootershootPlunger = new CANTalon(11);
    //LiveWindow.addActuator("Shooter", "shootPlunger", shootershootPlunger);

    aimscissorLift = new CANTalon(10);
    //LiveWindow.addActuator("Aim", "scissorLift", aimscissorLift);


// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:FRC2016    文件:OpenLoopArm.java   
@Override
public void init() {
    RobotMap.arm1.disableControl();
    RobotMap.arm1.changeControlMode(TalonControlMode.PercentVbus);
    RobotMap.arm1.enableControl();
}
项目:2016-Robot-Code    文件:RobotMap.java   
public RobotMap () {
    navX.zeroYaw();
    shootingWheelMotor.setFeedbackDevice(CANTalon.FeedbackDevice.CtreMagEncoder_Relative);
    shootingWheelMotor.configEncoderCodesPerRev(1);
    shootingWheelMotor.changeControlMode(TalonControlMode.PercentVbus);     
}
项目:RobotCode2017    文件:FlywheelEncoderSubsystem.java   
public void flywheelDrive()
{
    flywheelTalon.changeControlMode(TalonControlMode.Speed);

    // Determines if the flywheel is already active.
    // If active, turn off flywheel at button press.
    // Else, turn on flywheel at button press.
    if(OI.JOYSTICK_FUNCTION.getRawButton(5))
    {

        if(isActiveFlywheel)
        {
            flywheelTalon.set(0);
            isActiveFlywheel = false;
        }
        else
        {
            flywheelTalon.set(targetSpeed);
            isActiveFlywheel = true;
        }
    }

    if(OI.JOYSTICK_FUNCTION.getRawButton(12))
    {
        targetSpeed = targetSpeed - 10;

    }

    if(OI.JOYSTICK_FUNCTION.getRawButton(11))
    {
        targetSpeed = targetSpeed + 10;

    }

    if(OI.JOYSTICK_FUNCTION.getTrigger())
    {
        feederTalon1.set(1);
        feederTalon2.set(-1);
    }
    else
    {
        feederTalon1.set(0);
        feederTalon2.set(0);
    }
}
项目:Stronghold-2016    文件:YawPID.java   
public void autoInit(){
    yaw.changeControlMode(TalonControlMode.Position);
yaw.setPID(RobotMap.YAW_P, RobotMap.YAW_I, RobotMap.YAW_D);
enable();
  }
项目:Stronghold-2016    文件:YawPID.java   
public void autoEnd(){
    disable();
    yaw.changeControlMode(TalonControlMode.PercentVbus);
}
项目:Stronghold-2016    文件:DrivetrainPID.java   
private void setLeft(double value){
    frontLeft.set(value);
    rearLeft.changeControlMode(TalonControlMode.Follower);
    rearLeft.set(RobotMap.FRONT_LEFT_MOTOR);
}
项目:Stronghold-2016    文件:DrivetrainPID.java   
private void setRight(double value){
    frontRight.set(value);
    rearRight.changeControlMode(TalonControlMode.Follower);
    rearRight.set(RobotMap.FRONT_RIGHT_MOTOR);
}
项目:Stronghold-2016    文件:Pitch.java   
public void autoInit(){
    pitch.changeControlMode(TalonControlMode.Position);
    pitch.setPID(RobotMap.PITCH_P, RobotMap.PITCH_I, RobotMap.PITCH_D);
    pitch.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    pitch.reverseOutput(true);
}
项目:Stronghold-2016    文件:Pitch.java   
public void teleopInit(){
    pitch.changeControlMode(TalonControlMode.PercentVbus);
}