Java 类edu.wpi.first.wpilibj.Talon 实例源码

项目:2017-emmet    文件:RobotMap.java   
public static void init() {
    driveTrainCIMRearLeft = new CANTalon(2); // rear left motor
    driveTrainCIMFrontLeft = new CANTalon(12); // 
    driveTrainCIMRearRight = new CANTalon(1);
    driveTrainCIMFrontRight = new CANTalon(11);
    driveTrainRobotDrive41 = new RobotDrive(driveTrainCIMRearLeft, driveTrainCIMFrontLeft, 
            driveTrainCIMRearRight, driveTrainCIMFrontRight);
    climberClimber = new CANTalon(3);
    c1 = new Talon(5);
    pDPPowerDistributionPanel1 = new PowerDistributionPanel(0);
    gyro = new ADXRS450_Gyro(Port.kOnboardCS0);
    c2 = new Talon(6);
    ultra = new AnalogInput(0);

    LiveWindow.addSensor("PDP", "PowerDistributionPanel 1", pDPPowerDistributionPanel1);
    LiveWindow.addSensor("Ultra", "Ultra", ultra);
   //  LiveWindow.addActuator("Intake", "Intake", intakeIntake);
    LiveWindow.addActuator("Climber", "Climber", climberClimber);
    LiveWindow.addActuator("RearLeft (2)", "Drivetrain", driveTrainCIMRearLeft);
    LiveWindow.addActuator("FrontLeft (12)", "Drivetrain", driveTrainCIMFrontLeft);
    LiveWindow.addActuator("RearRight (1)", "Drivetrain", driveTrainCIMRearRight);
    LiveWindow.addActuator("FrontRight (11)", "Drivetrain", driveTrainCIMFrontRight);
    LiveWindow.addActuator("Drive Train", "Gyro", gyro);
    // LiveWindow.addActuator("Shooter", "Shooter", shooter1);
}
项目:2016-Robot-Final    文件:Arm.java   
public Arm() {
super("arm", kP, kI, kD);

motor = new Talon(RobotMap.ArmMap.PWM_MOTOR);
motor.setInverted(RobotMap.ArmMap.INV_MOTOR);

encoder = new Encoder(RobotMap.ArmMap.DIO_ENCODER_A, RobotMap.ArmMap.DIO_ENCODER_B);
encoder.setDistancePerPulse(RobotMap.ArmMap.DISTANCE_PER_PULSE);
encoder.setReverseDirection(RobotMap.ArmMap.INV_ENCODER);

upperLimit = new DigitalInput(RobotMap.ArmMap.DIO_LIMIT_TOP);
bottomLimit = new DigitalInput(RobotMap.ArmMap.DIO_LIMIT_BOTTOM);

setAbsoluteTolerance(0.05);
getPIDController().setContinuous(false);
   }
项目:frc-2016    文件:Shooter.java   
public Shooter() {

        shooterLeftSide = new Talon(RobotMap.Pwm.LeftShooterMotor);
        shooterRightSide = new Talon(RobotMap.Pwm.RightShooterMotor);

        encoderLeft = new Encoder(RobotMap.Digital.ShooterLeftChannelA, RobotMap.Digital.ShooterLeftChannelB);
        encoderRight = new Encoder(RobotMap.Digital.ShooterRightChannelA, RobotMap.Digital.ShooterRightChannelB);

        encoderLeft.setPIDSourceType(PIDSourceType.kRate);
        encoderRight.setPIDSourceType(PIDSourceType.kRate);
        encoderLeft.setDistancePerPulse(distancePerPulse);
        encoderRight.setDistancePerPulse(distancePerPulse);

        // leftPID = new PIDSpeedController(encoderLeft, shooterLeftSide, "Shooter", "Left Wheel");
        // rightPID = new PIDSpeedController(encoderRight, shooterRightSide, "Shooter", "Right Wheel");

    }
项目:2016-Robot    文件:Arm.java   
public Arm() {
super("arm", kP, kI, kD);

motor = new Talon(RobotMap.ArmMap.PWM_MOTOR);
motor.setInverted(RobotMap.ArmMap.INV_MOTOR);

encoder = new Encoder(RobotMap.ArmMap.DIO_ENCODER_A, RobotMap.ArmMap.DIO_ENCODER_B);
encoder.setDistancePerPulse(RobotMap.ArmMap.DISTANCE_PER_PULSE);
encoder.setReverseDirection(RobotMap.ArmMap.INV_ENCODER);

upperLimit = new DigitalInput(RobotMap.ArmMap.DIO_LIMIT_TOP);
bottomLimit = new DigitalInput(RobotMap.ArmMap.DIO_LIMIT_BOTTOM);

setAbsoluteTolerance(0.05);
getPIDController().setContinuous(false);
   }
项目:snobot-2017    文件:Robot.java   
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
@Override
public void robotInit() {

       driveLeftA = new CANTalon(2);
       driveLeftB = new CANTalon(1);
       driveRightA = new CANTalon(3);
       driveRightB = new CANTalon(4);

       climberMotorA = new Talon(1);
       climberMotorB = new Talon(2);

       drive = new RobotDrive(driveLeftA, driveLeftB, driveRightA, driveRightB);

       joystick = new Joystick(0);

       SmartDashboard.putNumber("SlowClimber", .5);
       SmartDashboard.putNumber("FastClimber", 1);
}
项目:Cogsworth    文件:DriveSubsystem.java   
public DriveSubsystem() {
    talonFrontLeft = new CANTalon(Ports.FRONT_LEFT_MOTOR);
    talonFrontRight = new CANTalon(Ports.FRONT_RIGHT_MOTOR);
    talonBackLeft = new Talon(Ports.BACK_LEFT_MOTOR);
    talonBackRight = new Talon(Ports.BACK_RIGHT_MOTOR);
    ultraSanic.setAutomaticMode(true);

    talonFrontLeft.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    talonFrontRight.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    talonFrontLeft.configEncoderCodesPerRev(PulsesPerRevolution);
    talonFrontRight.configEncoderCodesPerRev(PulsesPerRevolution);

    try {
        ahrs = new AHRS(Port.kMXP);
    } catch (Exception ex) {
        //System.out.println(ex);
    }
    // SPEED MODE CODE
    // setDriveControlMode(TalonControlMode.Speed);
    drivingStraight = false;
    driveLowerSpeed = false;
    reversed = true;
    enableForwardSoftLimit(false);
    enableReverseSoftLimit(false);
}
项目:frc-2015    文件:Lift.java   
public Lift(int motorChannel, int brakeChannelForward, int brakeChannelReverse, int encoderChannelA,
        int encoderChannelB, int boundaryLimitChannel, String subsystem) {
    motor = new Talon(motorChannel);
    brake = new DoubleSolenoid(RobotMap.solenoid.Pcm24, brakeChannelForward, brakeChannelReverse);
    encoder = new Encoder(encoderChannelA, encoderChannelB);
    boundaryLimit = new DigitalInput(boundaryLimitChannel);

    LiveWindow.addActuator(subsystem, "Motor", motor);
    LiveWindow.addActuator(subsystem, "Brake", brake);
    LiveWindow.addSensor(subsystem, "Encoder", encoder);
    LiveWindow.addSensor(subsystem, "Boundary Limit Switch", boundaryLimit);

    encoder.setPIDSourceType(PIDSourceType.kRate);
    pid = new PIDSpeedController(encoder, motor, subsystem, "Speed Control");
    subsystemName = subsystem;
}
项目:ParadigmShift-2014    文件:DriveTrain.java   
public DriveTrain(OperatorInputs _operatorInputs) {
    this.operatorInputs = _operatorInputs;
    this.leftTalons = new Talon(LEFT_PORT);
    this.rightTalons = new Talon(RIGHT_PORT);
    this.gearShiftLow = new Solenoid(SHIFT_MODULE, SHIFT_PORT_LOW);
    this.gearShiftHigh = new Solenoid(SHIFT_MODULE, SHIFT_PORT_HIGH);
    this.leftEncoder = new Encoder(3, 4);
    this.rightEncoder = new Encoder(5, 6);
    this.timer = new Timer();
    //Start all wheels off
    leftTalons.set(0);
    rightTalons.set(0);
    //Starts in low gear
    gearShiftLow.set(isHighGear);
    gearShiftHigh.set(!isHighGear);
    leftEncoder.setDistancePerPulse(-DISTANCE_PER_PULSE);
    rightEncoder.setDistancePerPulse(DISTANCE_PER_PULSE);

}
项目:Aerial-Assist    文件:Launcher.java   
/**
 * Constructs a new Launcher, with two Talons for winding, a release relay,
 * and a limit switch for winding regulation based on input from a
 * MaxbotixUltrasonic rangefinder.
 */
public Launcher() {
    super("Launcher");

    winderL = new Talon(RobotMap.WIND_LEFT_PORT);
    winderR = new Talon(RobotMap.WIND_RIGHT_PORT);

    releaseMotor = new Relay(RobotMap.RELAY_PORT);

    camera = new AxisCameraM1101();
    rangefinder = new MaxbotixUltrasonic(RobotMap.ULTRASONIC_RANGEFINDER);

    limitSwitch = new DigitalInput(RobotMap.LIMIT_SWITCH);
    counter = new Counter(limitSwitch);

    counterInit(counter);
}
项目:Nashoba-Robotics2014    文件:Drive.java   
public Talon getTalon(int which) {
    switch(which)
    {
        case HardwareDefines.FRONT_LEFT_TALON:
            return leftTalon1;
        case HardwareDefines.FRONT_RIGHT_TALON:
            return rightTalon1;
        case HardwareDefines.BACK_LEFT_TALON:
            return leftTalon2;
        case HardwareDefines.BACK_RIGHT_TALON:
            return rightTalon2;
    }

    throw new RuntimeException("Error: " + 
                                "trying to get a Talon that doesn't exist");
}
项目:2015-frc-robot    文件:RobotOutput.java   
/**
 * Instantiates a new robot output.
 */
private RobotOutput() {     

    this.forces = ChiliFunctions.fillArrayWithZeros(this.forces);

    front_left = new Talon(ChiliConstants.front_left_motor);
    rear_left = new Talon(ChiliConstants.rear_left_motor);
    front_right = new Talon(ChiliConstants.front_right_motor);
    rear_right = new Talon(ChiliConstants.rear_right_motor);
    left_lifter = new Jaguar(ChiliConstants.left_lifter_motor);
    right_lifter = new Jaguar(ChiliConstants.right_lifter_motor);

    //Sensor object for some cheating.
    //Objecto de sensor. "Trampa" para obtener ciertos valores.
    sensor = SensorInput.getInstance();

    /*front_left.setSafetyEnabled(true);
    rear_left.setSafetyEnabled(true);
    front_right.setSafetyEnabled(true);
    rear_right.setSafetyEnabled(true);
    left_lifter.setSafetyEnabled(true);
    right_lifter.setSafetyEnabled(true);*/
}
项目:2014_Main_Robot    文件:Winch.java   
/**
 * A private constructor to prevent multiple instances from being created.
 */
private Winch(){
    winchMotor = new Talon(RobotMap.winchMotor.getInt());
    winchInputSwitch = new DigitalInput(RobotMap.winchLimitSwitch.getInt());
    winchSolenoid = new MomentaryDoubleSolenoid(
            RobotMap.winchExtPort.getInt(),RobotMap.winchRetPort.getInt());
    winchBallSensor = new AnalogChannel(RobotMap.winchBallSensorPort.getInt());
    intakeBallSensor = new AnalogChannel(RobotMap.intakeBallSensorPort.getInt());
    ballPresent = new Debouncer(RobotMap.ballPresentTime.getDouble());
    ballNotPresent = new Debouncer(RobotMap.ballPresentTime.getDouble());
    ballSettled = new Debouncer(RobotMap.ballSettleTime.getDouble());
    ballPresentOnWinch = new Debouncer(RobotMap.ballPresentOnWinchTime.getDouble());

    winchPotentiometer =
            new AnalogChannel(RobotMap.potentiometerPort.getInt());
    winchEncoder = new AverageEncoder(
            RobotMap.winchEncoderA.getInt(),
            RobotMap.winchEncoderB.getInt(),
            RobotMap.winchEncoderPulsePerRot,
            RobotMap.winchEncoderDistPerTick,
            RobotMap.winchEncoderReverse,
            RobotMap.winchEncodingType, RobotMap.winchSpeedReturnType,
            RobotMap.winchPosReturnType, RobotMap.winchAvgEncoderVal);
    winchEncoder.start();
}
项目:NR-2014-CMD    文件:Drive.java   
private Drive()
{
    drive = new RobotDrive(new Talon(1),new Talon(2),new Talon(3),new Talon(4));
    drive.setSafetyEnabled(false);


    e1 = new Encoder(RobotMap.ENCODER_1_A, RobotMap.ENCODER_1_B, false, CounterBase.EncodingType.k4X);
    e2 = new Encoder(RobotMap.ENCODER_2_A, RobotMap.ENCODER_2_B, false, CounterBase.EncodingType.k4X);

    //A calculated constant to convert from encoder ticks to feet on 4 inch diameter wheels
    e1.setDistancePerPulse(0.0349065850388889/12);
    e2.setDistancePerPulse(0.0349065850388889/12);
    startEncoders();

    drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true);      
    drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);

    sonic = new Ultrasonic(RobotMap.ULTRASONIC_A, RobotMap.ULTRASONIC_B);
    sonic.setAutomaticMode(true);
    sonic.setEnabled(true);


    shifter = new DoubleSolenoid(RobotMap.SHIFTER_ENGAGE, RobotMap.SHIFTER_DISENGAGE);
}
项目:EventBasedWiredCats    文件:SystemDrive.java   
public SystemDrive() {
    super();

    leftTalon = new Talon(2); // Both bots: 2
    rightTalon = new Talon(1); //Both bots: 1
    leftDesiredEncoderDistance = 0;
    rightDesiredEncoderDistance = 0;

    driveDeadband = WiredCats2415.textReader.getValue("driveDeadband");
    driveGain = WiredCats2415.textReader.getValue("driveGain");

    lastLeftError = 0;
    lastRightError = 0;

    kp = WiredCats2415.textReader.getValue("propConstantDrive");
    ki = WiredCats2415.textReader.getValue("integralConstantDrive");
    kd = WiredCats2415.textReader.getValue("derivativeConstantDrive");

    System.out.println("[WiredCats] Initialized System Drive");
}
项目:FlashLib    文件:ExampleSubsystem.java   
public ExampleSubsystem() {
    /*
     * Here we should prepare our system for use. We will create 
     * our speed controller.
     */

    //create our speed controller. we will use port 0.
    speedController = new Talon(0);
}
项目:VikingRobot    文件:Shooter.java   
public Shooter() {
    motor = new CANTalon(LEAD_SHOOTER_PORT);
    motor.setInverted(true);
    CANTalon follower = new CANTalon(FOLLOWER_SHOOTER_PORT);
    agitatorMotor = new Talon(AGITATOR_PORT);
    motor.setFeedbackDevice(CANTalon.FeedbackDevice.QuadEncoder);
    motor.changeControlMode(CANTalon.TalonControlMode.Speed);
    follower.changeControlMode(CANTalon.TalonControlMode.Follower);
    follower.set(LEAD_SHOOTER_PORT);
    motor.setF(0);
    motor.setP(.88);
    motor.setI(0);
    motor.setD(0);
}
项目:Sprocket    文件:Motor.java   
public Motor(SpeedController motor) {
    if(motor == null) {
        throw new IllegalArgumentException("SpeedController argument was null when instantiating Motor object");
    }


    this.motor = motor;
    if(motor instanceof CANTalon) {
        motorType = MotorType.CANTALON;
    } else if(motor instanceof Talon) {
        motorType = MotorType.TALON;
    } else {
        motorType = MotorType.UNKNOWN;
    }



    switch(motorType) {
        case CANTALON:
            CANTalon cMotor = (CANTalon) motor;
            cMotor.changeControlMode(CANTalon.TalonControlMode.PercentVbus);
            cMotor.enableBrakeMode(true);
        break;
        default:
        break;
    }

}
项目:FRC-Robotics-2016-Team-2262    文件:TapeMeasure.java   
public TapeMeasure(int frictionWheelChannel, int frontClimberChannel, int rearClimberChannel) {

        frictionWheel = new Talon(frictionWheelChannel);
        frontClimber = new Talon(frontClimberChannel);
        rearClimber = new Talon(rearClimberChannel);

        frictionWheel.setInverted(true);
        frontClimber.setInverted(true);
        rearClimber.setInverted(true);

    }
项目:FRC-Robotics-2016-Team-2262    文件:Arm.java   
public Arm(int elbowChannel, int armRollerChannel, int topChannel) {

        elbow = new Talon(elbowChannel);
        roller = new Talon(armRollerChannel);

        limitSwitchTop = new DigitalInput(topChannel);
        //limitSwitchBottom = new DigitalInput(bottomChannel);
    }
项目:RobotBuilderTest    文件:RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveTrainLeftMotor = new Talon(0);
    LiveWindow.addActuator("DriveTrain", "LeftMotor", (Talon) driveTrainLeftMotor);

    driveTrainRightMotor = new Talon(1);
    LiveWindow.addActuator("DriveTrain", "RightMotor", (Talon) driveTrainRightMotor);

    driveTrainRobotDrive = new RobotDrive(driveTrainLeftMotor, driveTrainRightMotor);

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

    intakeintakeMotor = new Talon(2);
    LiveWindow.addActuator("Intake", "intakeMotor", (Talon) intakeintakeMotor);

    pneumaticSystemCompressor = new Compressor(0);


    pneumaticSystemDoubleSolenoidPusher = new DoubleSolenoid(0, 0, 1);
    LiveWindow.addActuator("Pneumatic System", "DoubleSolenoidPusher", pneumaticSystemDoubleSolenoidPusher);

    sensorBaseUltraSonicMaxbotix = new AnalogInput(0);
    LiveWindow.addSensor("SensorBase", "UltraSonicMaxbotix", sensorBaseUltraSonicMaxbotix);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:snobot-2017    文件:Snobot.java   
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotInit()
{
    // PWM's
    mTestMotor1 = new Talon(0);
    mTestMotor2 = new Jaguar(1);
    mServo = new Servo(2);

    // Digital IO
    mDigitalOutput = new DigitalOutput(0);
    mRightEncoder = new Encoder(4, 5);
    mLeftEncoder = new Encoder(1, 2);
    mUltrasonic = new Ultrasonic(7, 6);

    // Analog IO
    mAnalogGryo = new AnalogGyro(0);
    mPotentiometer = new AnalogPotentiometer(1);

    // Solenoid
    mSolenoid = new Solenoid(0);

    // Relay
    mRelay = new Relay(0);

    // Joysticks
    mJoystick1 = new Joystick(0);
    mJoystick2 = new XboxController(1);

    // SPI
    mSpiGryo = new ADXRS450_Gyro();

    // Utilities
    mTimer = new Timer();
    mPDP = new PowerDistributionPanel();

    Preferences.getInstance().putDouble("Motor One Speed", .5);
}
项目:snobot-2017    文件:Snobot2012.java   
/**
 * This function is run when the robot is first started up and should be used for any initialization code.
 */
@Override
public void robotInit()
{
    // UI
    mShooterJoystick = new Joystick(PortMap.sOPERATOR_JOYSTICK_PORT);
    mDriveJoystick = new Joystick(PortMap.sDRIVER_JOYSTICK_PORT);
    mDriverController = new DriverJoystick(mDriveJoystick);
    mOperatorController = new OperatorJoystick(mShooterJoystick);

    //Shooter
    mShooterMotor = new Talon(PortMap.sSHOOTER_MOTOR);
    mShooterSolenoid = new Solenoid(PortMap.sSHOOTER_PISTON);
    mShooter = new SnobotShooter(mShooterMotor, mShooterSolenoid, mOperatorController);

    //Drive Train
    mLeftMotor = new Talon(PortMap.sLEFT_DRIVE_MOTOR);
    mRightMotor = new Talon(PortMap.sRIGHT_DRIVE_MOTOR);
    mDriveTrain = new SnobotDriveTrain(mLeftMotor, mRightMotor, mDriverController);

    // Intake
    mUpperIntakeMotor = new Talon(PortMap.sUPPER_INTAKE_MOTOR);
    mLowerIntakeMotor = new Talon(PortMap.sLOWER_INTAKE_MOTOR);
    mIntake = new SnobotIntake(mLowerIntakeMotor, mUpperIntakeMotor, mOperatorController);

    addModule(mDriveTrain);
    addModule(mShooter);
    addModule(mIntake);

    initializeLogHeaders();

    // Now all the preferences should be loaded, make sure they are all
    // saved
    PropertyManager.saveIfUpdated();
}
项目:Stronghold2016-340    文件:Climber.java   
/**
     * Instantiate latch and sensor
     */
    public Climber() {
        armLatch = new Servo(RobotMap.CLIMBER_LATCH);
        dart = new Talon(4);
//      atBottom = new DigitalInput(RobotMap.ClimberBottomSensor);
        dartLimit = new DigitalInput(RobotMap.CLIMBER_DART_LIMIT);
        winchBanner = new DigitalInput(RobotMap.CLIMBER_BANNER);
    }
项目:Stronghold2016-340    文件:Drive.java   
/**
 * Code for driving robot
 */
public Drive() {
    leftDrive = new Talon(RobotMap.LEFT_DRIVE_TALON);
    rightDrive = new Talon(RobotMap.RIGHT_DRIVE_TALON);
    PTOMotor = new Servo(RobotMap.DRIVE_PTO);
    gyro = new AnalogGyro(0);
}
项目:FRC2549-2016    文件:MotorDescriptor.java   
public SpeedController getController(){
    if (allocated) return null;
    this.allocated = true;
    switch (this.speedControllerType){
        case kJaguar:
            return new Jaguar(this.PWMChannel);
        case kTalon:
            return new Talon(this.PWMChannel);
        default:
            return null;
    }
}
项目:RecycleRush2015    文件:Robot.java   
public Robot() {
    super("Sailors", 0x612);
    this.sdTable = NetworkTable.getTable("SmartDashboard");

    Talon winchMotor = new Talon(Channels.WINCH_MOTOR);

    Console.debug("Creating and Initializing Controls/Motor Scheme/Senses...");
    this.control = new DualJoystickControl(JOYSTICK_LEFT, JOYSTICK_RIGHT);
    this.control.setMagnitudeThreshold(MAG_STICK_DEADBAND);
    this.control.setTwistThreshold(TWIST_STICK_DEADBAND);
    this.motors = MotorScheme.Builder.newFourMotorDrive(FL_DMOTOR, RL_DMOTOR, FR_DMOTOR, RR_DMOTOR).setInverted(false, true).setDriveManager(DriveManager.MECANUM_POLAR).addMotor(winchMotor).build();
    this.motors.getRobotDrive().setMaxOutput(DRIVE_SCALE_FACTOR);
    this.senses = BasicSense.makeBuiltInSense(Range.k4G);
    this.pneumatics = new PneumaticControl();
    this.winch = new WinchControl(winchMotor, this.upWinchValue, this.downWinchValue);

    Console.debug("Initializing Button Actions...");
    this.control.putButtonAction(ID_SWAP_JOYSTICKS, "Swap Joysticks", this.control::swapJoysticks, Hand.BOTH);
    this.control.putButtonAction(ID_DISABLE_TWIST, "Toggle Left Twist", () -> this.control.toggleDisableTwistAxis(Hand.LEFT), Hand.LEFT);
    this.control.putButtonAction(ID_DISABLE_TWIST, "Toggle Right Twist", () -> this.control.toggleDisableTwistAxis(Hand.RIGHT), Hand.RIGHT);

    Console.debug("Starting Camera Capture...");
    this.camera = new USBCamera();
    this.camera.setSize(CameraSize.MEDIUM);
    CameraStream.INSTANCE.startAutomaticCapture(this.camera);
    Console.debug(String.format("Resolution: %dx%d | Quality: %s | FPS: %s", this.camera.getSize().WIDTH, this.camera.getSize().HEIGHT, this.camera.getQuality().name(), this.camera.getFPS().kFPS));
}
项目:BNO055_FRC    文件:Drivetrain.java   
/**
 * Private constructor. Singleton pattern, so it can only be
 *   initialized once!
 */
private Drivetrain() {
    left = new Talon(RobotMap.leftMotor);
    right = new Talon(RobotMap.rightMotor);

    imu = BNO055.getInstance(BNO055.opmode_t.OPERATION_MODE_IMUPLUS,
BNO055.vector_type_t.VECTOR_EULER);
}
项目:turtleshell    文件:DriveTrain.java   
public DriveTrain() {
    super();
    front_left_motor = new Talon(1);
    back_left_motor = new Talon(2);
    front_right_motor = new Talon(3);
    back_right_motor = new Talon(4);
    drive = new RobotDrive(front_left_motor, back_left_motor,
                           front_right_motor, back_right_motor);
    left_encoder = new Encoder(1, 2);
    right_encoder = new Encoder(3, 4);

    // Encoders may measure differently in the real world and in
    // simulation. In this example the robot moves 0.042 barleycorns
    // per tick in the real world, but the simulated encoders
    // simulate 360 tick encoders. This if statement allows for the
    // real robot to handle this difference in devices.
    if (Robot.isReal()) {
        left_encoder.setDistancePerPulse(0.042);
        right_encoder.setDistancePerPulse(0.042);
    } else {
        // Circumference in ft = 4in/12(in/ft)*PI
        left_encoder.setDistancePerPulse((4.0/12.0*Math.PI) / 360.0);
        right_encoder.setDistancePerPulse((4.0/12.0*Math.PI) / 360.0);
    }

    rangefinder = new AnalogInput(6);
    gyro = new AnalogGyro(1);

    // Let's show everything on the LiveWindow
    LiveWindow.addActuator("Drive Train", "Front_Left Motor", (Talon) front_left_motor);
    LiveWindow.addActuator("Drive Train", "Back Left Motor", (Talon) back_left_motor);
    LiveWindow.addActuator("Drive Train", "Front Right Motor", (Talon) front_right_motor);
    LiveWindow.addActuator("Drive Train", "Back Right Motor", (Talon) back_right_motor);
    LiveWindow.addSensor("Drive Train", "Left Encoder", left_encoder);
    LiveWindow.addSensor("Drive Train", "Right Encoder", right_encoder);
    LiveWindow.addSensor("Drive Train", "Rangefinder", rangefinder);
    LiveWindow.addSensor("Drive Train", "Gyro", gyro);
}
项目:FRC2015Code    文件:RobotMap.java   
public static void init() {
    leftDriveMotor = new Talon(leftDriveMotorPin);
    LiveWindow.addActuator("driveTrain", "Left Motor",
            (Talon) leftDriveMotor);

    rightDriveMotor = new Talon(rightDriveMotorPin);
    LiveWindow.addActuator("driveTrain", "Right Motor",
            (Talon) rightDriveMotor);

    shifterSolenoid = new DoubleSolenoid(shifterSolenoidUpPin, shifterSolenoidDownPin);
    LiveWindow.addActuator("driveTrain", "Gearbox Shifter",
            (DoubleSolenoid) shifterSolenoid);

    winchMotor = new Talon(winchMotorPin);
    LiveWindow.addActuator("chainLifter", "Elevator Motor",
            (Talon) winchMotor);

    robotDrive = new RobotDrive(leftDriveMotor, rightDriveMotor);

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

    robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
    robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);

    grabberSolenoid = new DoubleSolenoid(grabberSolenoidOpenPin, grabberSolenoidClosePin);
    LiveWindow.addActuator("grabberArm", "Grabber Solenoid",
            (DoubleSolenoid) grabberSolenoid);

    compressor = new Compressor();
    LiveWindow.addActuator("grabberArm", "compressor",
            (Compressor) compressor);

}
项目:ParadigmShift-2014    文件:Rafiki_Atlas.java   
public void autonomousInit() {

        compressor.start();
        colwellContraption1.set(true);
        colwellContraption2.set(false);

        //shoot.shootTimer.start();
        PickerPID.VOLTAGE_CORRECTION = prefs.getDouble("Pick_VC", PickerPID.VOLTAGE_CORRECTION);
        shoot.getPID().VOLTAGE_CORRECTION = prefs.getDouble("Shoot_VC", shoot.getPID().VOLTAGE_CORRECTION);
        drive.resetEncoders();
        Talon wheelSpin = pick.returnSpinner();
        wheelSpin.set(1.0);
        timer.start();
        autoShoot = true;
    }
项目:ParadigmShift-2014    文件:Rafiki_Atlas.java   
/**
 * This function is called periodically (every 20-25 ms) during autonomous
 */
public void autonomousPeriodic() {
    Talon wheelSpin = pick.returnSpinner();
    double batteryVoltage = DriverStation.getInstance().getBatteryVoltage();
    wheelSpin.set(0);
    boolean autoShoot1 = drive.driveStraight(9.40, 6.5, 11.0 / DriverStation.getInstance().getBatteryVoltage()/*, shoot*/);
    //7.2
    boolean hotZone = NetworkTable.getTable("camera").getBoolean("hotZone", false);
    System.out.println(hotZone);
    if (timer.get() < 10.0 && !autoShoot1) {//do ///i need to change this?
        //drive.driveStraight(9.40, 6.5, 11.0 / DriverStation.getInstance().getBatteryVoltage()/*, shoot*/); //7.2

        if (hotZone) {
            //hotZoneActive = NetworkTable.getTable("camera").getBoolean("hotZone");
            //visionDistance = NetworkTable.getTable("camera").getNumber("distance");
            //drive.driveStraight(9.40, 6.5, 11.0 / DriverStation.getInstance().getBatteryVoltage(), shoot); //7.2
            SmartDashboard.putNumber("Some Voltage", pickerPID.getVoltage());
            SmartDashboard.putNumber("Kp", PickerPID.Kp);
            SmartDashboard.putNumber("Ki", PickerPID.Ki);
            SmartDashboard.putNumber("Kd", PickerPID.Kd);
            shoot.quickShoot(1.0, (11.0 / batteryVoltage) > 0.95 ? 0.95 : (11.0 / batteryVoltage), 0.01, autoShoot);
            System.out.println("Hot Zone");
            autoShoot = false;
        } else {
            if (timer.get() > 2.0) {
                //drive.driveStraight(9.40, 6.5, 11.0 / DriverStation.getInstance().getBatteryVoltage()/*,shoot*/);//7.2
                shoot.quickShoot(1.0, (11.0 / batteryVoltage) > 0.95 ? 0.95 : (11.0 / batteryVoltage), 0.01, autoShoot);
                autoShoot = false;
                //System.out.println("Case 2");
            }
            //System.out.println("Case 3");
        }
    } else if (timer.get() >= 10) {
        timer.stop();
        System.out.println("Auto Done");
    }
}
项目:4500-2014    文件:RobotTemplate.java   
public void robotInit(){
    driveStick= new JoyStickCustom(1, DEADZONE);
    secondStick=new JoyStickCustom(2, DEADZONE);

    frontLeft= new Talon(1);
    rearLeft= new Talon(2);
    frontRight= new Talon(3);
    rearRight= new Talon(4);

    timer=new Timer();
    timer.start();

    armM = new Victor(7);
    rollers =new Victor(6);

    mainDrive=new RobotDrive(frontLeft,rearLeft,frontRight,rearRight);

    mainDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
    mainDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);

    armP = new AnalogPotentiometer(1);
    distance= new AnalogChannel(2);
    ultra=new Ultrasonic(6,7);
    ultra.setAutomaticMode(true);

    compress=new Compressor(5,1);

    handJoint=new Pneumatics(3,4);

    //ultra = new Ultrasonic(6,5);
    //ultra.setAutomaticMode(true);

    winch = new Winch(secondStick);

}
项目:2014-Aerial-Assist    文件:WindLauncher.java   
protected void execute() {
    if (((Talon) Robot.launcher.getWindingMotor()).isSafetyEnabled()) {
       // System.out.println("Winding SetSafetyEnabled is true");
    }
    else {
       // System.out.println("Winding SetSafetyEnabled is false");
    }
    if (!shouldQuit) {
        Robot.launcher.startWindingMotor(1.0);
    }
    Robot.harvester.stopWheels();
}
项目:ProjectShifter    文件:Drivetrain.java   
public Drivetrain(){
    leftFront = new Talon(Constants.leftFront);
    leftMiddle = new Talon(Constants.leftMiddle);
    leftBack = new Talon(Constants.leftBack);
    rightFront = new Talon(Constants.rightFront);
    rightMiddle = new Talon(Constants.rightMiddle);
    rightBack = new Talon(Constants.rightBack);
    relay = new Relay(Constants.shifter);
    compressor = new Compressor(Constants.pressureGauge, Constants.compressor);
    compressor.start();
}
项目:RobotCode2014    文件:DriveSubsystem.java   
public DriveSubsystem() {
        frontLeft = new Talon(RobotMap.DRIVE_FRONT_LEFT);
        frontRight = new Talon(RobotMap.DRIVE_FRONT_RIGHT);
        backLeft = new Talon(RobotMap.DRIVE_BACK_LEFT);
        backRight = new Talon(RobotMap.DRIVE_BACK_RIGHT);
//      driveTrain = new RobotDrive(frontLeft, backLeft, frontRight, backRight);
        trainSwitcher = new Solenoid(RobotMap.DRIVE_TRAIN_SWITCHER);
//      driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, REVERSE_FRONT_LEFT);
//      driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontRight, REVERSE_FRONT_RIGHT);
//      driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearLeft, REVERSE_BACK_LEFT);
//      driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearRight, REVERSE_BACK_RIGHT);
//      driveTrain.setSafetyEnabled(false);
//      driveTrain.setExpiration(2000);
        switchToMecanum();
    }
项目:frc-2014    文件:IntakeArm.java   
/**
 * Constructor takes references two talons and pot used by intake
 * system.
 * @param rollerMotors
 * @param armMotors
 * @param pot
 */
public IntakeArm(Talon rollerMotors, Talon armMotors, AnalogPotentiometer pot) {
    this.armMotors      = armMotors;
    this.rollerMotors   = rollerMotors;
    this.pot            = pot;

    currentSetpoint     = UP_POSITION;
    armPID              = new PIDController(kP, kI, kD, pot, armMotors);

    armPID.setAbsoluteTolerance(ABSOLUTE_TOLERANCE);
    armPID.setOutputRange(-1.0, 1.0);
}
项目:2014-robot-code    文件:ShootArm.java   
public ShootArm() {
    arm = new Talon(Ports.SHOOTER_LAUNCHER);
    arm.set(0);
    launcherEncoder = new Encoder(Ports.SHOOTER_ENCODER_1, Ports.SHOOTER_ENCODER_2, false, Encoder.EncodingType.k4X);
    launcherEncoder.start();
    launcherEncoder.setDistancePerPulse(0.96);
    launcherEncoder.setMinRate(1);

    armHome = new DigitalInput(Ports.SHOOTER_HOME);
    armCounter = new Counter(armHome);
    armCounter.start();
    state = 0;
}
项目:2014MainCode    文件:Dumper.java   
public Dumper()
{
            dumperMotor = new Talon(MOTOR);

            topLimitSwitch = new DigitalInput(LIMIT_SWITCH_TOP);
            bottomLimitSwitch = new DigitalInput (LIMIT_SWITCH_BOTTOM);
}
项目:2014MainCode    文件:ForkLift.java   
public ForkLift() {
    forkMotor = new Talon(MOTOR); 

    upperLimitSwitch = new DigitalInput(UPPER_LIMIT_SWITCH);
    lowerLimitSwitch = new DigitalInput(LOWER_LIMIT_SWITCH);
    ballLimitSwitchOne = new DigitalInput(BALL_HIT_LIMIT_SWITCH_1);
    ballLimitSwitchTwo = new DigitalInput(BALL_HIT_LIMIT_SWITCH_2);
    mode = MANUAL;
}
项目:frc_2014_aerialassist    文件:FRC2014Java.java   
FRC2014Java(){

    //Motor Controllers
    leftDrive = new Talon(TALON_PORT_L);
    rightDrive = new Talon(TALON_PORT_R);

    //Joystick
    xbox = new Joystick(1);

    //Winch
    winch = new Talon(2);

    //Intake
    intake = new Talon(8);

    //Cam
    cam = new Talon(3);

    //Catapult Limit Switch
    catapultLimit = new DigitalInput(1);

    //Cam Limit Switch
    camLimit = new DigitalInput(2);

    //Intake Limit Switch
    intakeLimit = new DigitalInput(3);

    //Cameras
    cameraFront = AxisCamera.getInstance("10.10.2.11");
    cameraBack = AxisCamera.getInstance("10.10.2.12");

    //Watchdog
    dog = Watchdog.getInstance();
}