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

项目:RobotCode2017    文件:FlywheelEncoderSubsystem.java   
@Override
protected void initDefaultCommand()
{
    setDefaultCommand(new ShooterCommand(1.2D));

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

    flywheelTalon.configNominalOutputVoltage(+0.0f, -0.0f);
    flywheelTalon.configPeakOutputVoltage(+12.0f, -12.0f);

    flywheelTalon.setProfile(0);
    flywheelTalon.setF(0.1199);
    flywheelTalon.setP(0.2842);
    flywheelTalon.setI(0);
    flywheelTalon.setD(0);
}
项目: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);
}
项目:Frc2016FirstStronghold    文件:Arm.java   
public Arm()
{
    armMotor = new FrcCANTalon(RobotInfo.CANID_ARM);

    //Invert motor direction: arm should go down on positive power value.
    armMotor.setInverted(false);

    //Invert encoder: encode value should increase while arm going down.
    armMotor.setPositionSensorInverted(false);

    armMotor.enableLimitSwitch(true, true);
    armMotor.ConfigRevLimitSwitchNormallyOpen(false);
    armMotor.ConfigFwdLimitSwitchNormallyOpen(false);

    //Swap the two limit switches: lower limit switch should stop arm going down.
    armMotor.setLimitSwitchesSwapped(false);

    armMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);

    pidCtrl = new TrcPidController(
            moduleName,
            RobotInfo.ARM_KP,
            RobotInfo.ARM_KI,
            RobotInfo.ARM_KD,
            RobotInfo.ARM_KF,
            RobotInfo.ARM_TOLERANCE,
            RobotInfo.ARM_SETTLING,
            this);
    pidCtrl.setAbsoluteSetPoint(true);

    pidMotor = new TrcPidMotor(moduleName, armMotor, pidCtrl);

    //Need to determine degrees per encoder count
    pidMotor.setPositionScale(RobotInfo.ARM_DEGREES_PER_COUNT);

    timer = new TrcTimer(moduleName);
}
项目:FRC-2016    文件:Drivetrain.java   
/**
 * Constructor
 */
private Drivetrain() {
    left = new CANTalon(LEFT);
    leftSlave = new CANTalon(LEFT_SLAVE);
    right = new CANTalon(RIGHT);
    rightSlave = new CANTalon(RIGHT_SLAVE);
    left.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    right.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    setTalonDefaults();
    //shifter.set(DoubleSolenoid.Value.kForward);
}
项目:RobotCode2017    文件:DriveTrainSubsystem.java   
private void setTalonSettings(CANTalon talon)
{
    talon.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    talon.configEncoderCodesPerRev(256);
    talon.reverseSensor(false);
    talon.configNominalOutputVoltage(0.0D, -0.0D);
    talon.configPeakOutputVoltage(12.0D, -12.0D);
}
项目: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
}
项目:Frc2016FirstStronghold    文件:Crane.java   
/**
 * Constructor: Create an instance of the object.
 */
public Crane()
{
    //
    // Winch has a motor and an encoder but no limit switches.
    // The encoder is used to synchronize with the crane motor.
    //
    winchMotor = new FrcCANTalon(RobotInfo.CANID_WINCH);
    winchMotor.setInverted(true);
    winchMotor.enableLimitSwitch(false, false);
    winchMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    winchMotor.reverseSensor(false);
    winchPidCtrl = new TrcPidController(
            moduleName,
            RobotInfo.WINCH_KP,
            RobotInfo.WINCH_KI,
            RobotInfo.WINCH_KD,
            RobotInfo.WINCH_KF,
            RobotInfo.WINCH_TOLERANCE,
            RobotInfo.WINCH_SETTLING,
            this);
    winchPidMotor = new TrcPidMotor(moduleName + ".winch", winchMotor, winchPidCtrl);
    winchPidMotor.setPositionScale(RobotInfo.WINCH_INCHES_PER_COUNT);

    //
    // Crane has a motor, an encoder, lower and upper limit switches.
    // It can do full PID control.
    //
    craneMotor = new FrcCANTalon(RobotInfo.CANID_CRANE);
    craneMotor.setInverted(true);
    craneMotor.enableLimitSwitch(true, true);
    craneMotor.ConfigRevLimitSwitchNormallyOpen(true);
    craneMotor.ConfigFwdLimitSwitchNormallyOpen(true);
    craneMotor.setLimitSwitchesSwapped(true);
    craneMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    craneMotor.reverseSensor(true);
    cranePidCtrl = new TrcPidController(
            moduleName,
            RobotInfo.CRANE_KP,
            RobotInfo.CRANE_KI,
            RobotInfo.CRANE_KD,
            RobotInfo.CRANE_KF,
            RobotInfo.CRANE_TOLERANCE,
            RobotInfo.CRANE_SETTLING,
            this);
    cranePidCtrl.setAbsoluteSetPoint(true);
    cranePidMotor = new TrcPidMotor(moduleName + ".crane", craneMotor, cranePidCtrl);
    cranePidMotor.setPositionScale(RobotInfo.CRANE_INCHES_PER_COUNT);

    //
    // Tilter has a motor, an encoder and a lower limit switch.
    // It can do full PID control.
    //
    tilterMotor = new FrcCANTalon(RobotInfo.CANID_TILTER);
    tilterMotor.setInverted(true);
    craneMotor.enableLimitSwitch(true, true);
    tilterMotor.ConfigRevLimitSwitchNormallyOpen(false);
    tilterMotor.ConfigFwdLimitSwitchNormallyOpen(false);
    tilterMotor.setLimitSwitchesSwapped(true);
    tilterMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    tilterMotor.reverseSensor(false);
    tilterPidCtrl = new TrcPidController(
            moduleName,
            RobotInfo.TILTER_KP,
            RobotInfo.TILTER_KI,
            RobotInfo.TILTER_KD,
            RobotInfo.TILTER_KF,
            RobotInfo.TILTER_TOLERANCE,
            RobotInfo.TILTER_SETTLING,
            this);
    tilterPidCtrl.setAbsoluteSetPoint(true);
    tilterPidCtrl.setOutputRange(
            RobotInfo.TILTER_DOWN_POWER_LIMIT, RobotInfo.TILTER_UP_POWER_LIMIT);
    tilterPidMotor = new TrcPidMotor(
            moduleName + ".tilter", tilterMotor, tilterPidCtrl);
    tilterPidMotor.setPositionScale(RobotInfo.TILTER_DEGREES_PER_COUNT);
}
项目: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);
}