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)",driveTrainCIMFrontLeft);
    LiveWindow.addActuator("RearRight (1)",driveTrainCIMRearRight);
    LiveWindow.addActuator("FrontRight (11)",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,"Left Wheel");
        // rightPID = new PIDSpeedController(encoderRight,shooterRightSide,"Right Wheel");

    }
项目:2016-Robot    文件Arm.java   
public Arm() {
super("arm",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,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,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);
}
项目: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,shoot*/); //7.2

        if (hotZone) {
            //hotZoneActive = NetworkTable.getTable("camera").getBoolean("hotZone");
            //visiondistance = NetworkTable.getTable("camera").getNumber("distance");
            //drive.driveStraight(9.40,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,shoot*/);//7.2
                shoot.quickShoot(1.0,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,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,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,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();
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...