edu.wpi.first.wpilibj.DigitalInput的实例源码

项目:thirdcoast    文件dioSet.java   
@NotNull
List<DigitalInput> getDigitalInputs() {
  if (inputs.size() == 0) {
    telemetryService.stop();
    for (int i = 0; i < 10; i++) {
      if (outputs.contains(i)) {
        inputs.add(null); // outputs can't be inputs
      } else {
        DigitalInput input = new DigitalInput(i);
        inputs.add(input);
        telemetryService.register(new DigitalInputItem(input));
      }
    }
    telemetryService.start();
    logger.info("initialized inputs and restarted TelemetryService");
  }
  return Collections.unmodifiableList(inputs);
}
项目: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);
   }
项目: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);
   }
项目:Stronghold2016-340    文件Harvester.java   
public Harvester() {        

    //Todo: sync left/right motors
    tiltRight = new CANTalon(RobotMap.HARVESTER_aimING_RIGHT);
    tiltLeft = new CANTalon(RobotMap.HARVESTER_aimING_LEFT);

    //tiltLeft.setVoltageRampRate(5); // this might be a good way to solve our ramp rate issue IE smooth out the jerkiness
    //tiltRight.setVoltageRampRate(5); // this might be a good way to solve our ramp rate issue IE smooth out the jerkiness

    limitLeft = new DigitalInput(RobotMap.HARVESTER_LEFT_BUMP_BottOM);
    limitRight = new DigitalInput(RobotMap.HARVESTER_RIGHT_BUMP_BottOM);
    limitLeftTop = new DigitalInput(RobotMap.HARVESTER_LEFT_BUMP_TOP);
    limitRightTop = new DigitalInput(RobotMap.HARVESTER_RIGHT_BUMP_TOP);

    leftpot = new ZeroablePotentiometer(RobotMap.LEFT_aim_POT,250);
    rightpot = new ZeroablePotentiometer(RobotMap.RIGHT_aim_POT,250);
    leftpot.setInverted(true);
}
项目:FRC-2014-robot-project    文件ShooterControl.java   
ShooterControl(Encoder encoder,SpeedController pullBackSpeedController,double speedControllerMaxRpm,DigitalInput limitSwitch,DoubleSolenoid gearControl,Servo latchServo,Relay angleControl)
{
    m_latchReleaseServo = latchServo;
    m_currentState = SHOOTER_CONTROL_STATE_WAIT;
    m_encoder = encoder;
    m_pullBackSpeedController = pullBackSpeedController;
    m_angleControl = angleControl;
    m_speedControllerMaxRpm = speedControllerMaxRpm;
    m_limitSwitch = limitSwitch;
    m_pullBackEncoderRpm = new EncoderRPM();
    m_pullBackEncoderRpm.Init(m_pullBackSpeedController,m_encoder,(-1)*m_speedControllerMaxRpm,m_speedControllerMaxRpm,0.05,100,m_limitSwitch);
    m_releaseFromMidptEncoderRpm = new EncoderRPM();
    m_releaseFromMidptEncoderRpm.Init(m_pullBackSpeedController,(-1)*m_speedControllerMaxRpm/4,3);
    m_gearControl = gearControl;
    m_latchReleased = false;
    m_gearReleased = false;
    m_isPulledBack = 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;
}
项目: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);
}
项目:2015-frc-robot    文件SensorInput.java   
/**
 * Instantiates the Sensor Input module to read all sensors connected to the roboRIO.
 */
private Sensorinput() { 
    limit_left = new DigitalInput(ChiliConstants.left_limit);
    limit_right = new DigitalInput(ChiliConstants.right_limit);
    accel = new BuiltInAccelerometer(Accelerometer.Range.k2G);
    gyro = new Gyro(ChiliConstants.gyro_channel);
    pdp = new PowerdistributionPanel();
    left_encoder = new Encoder(ChiliConstants.left_encoder_channelA,ChiliConstants.left_encoder_channelB,false);
    right_encoder = new Encoder(ChiliConstants.right_encoder_channelA,ChiliConstants.right_encoder_channelB,true);
    gyro_i2c = new GyroITG3200(I2C.Port.kOnboard);

    gyro_i2c.initialize();
    gyro_i2c.reset();
    gyro.initGyro();

    left_encoder.setdistancePerpulse(ChiliConstants.kdistancePerpulse);
    right_encoder.setdistancePerpulse(ChiliConstants.kdistancePerpulse);
}
项目: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();
}
项目:2012    文件Loader.java   
public Loader()
{
    Conveyor = new Victor(ReboundRumble.LOADER_CONVEYOR_PWM);
    loaderInSolenoid = new Solenoid(ReboundRumble.LOADER_IN_SOLENOID_CHANNEL);
    loaderOutSolenoid = new Solenoid(ReboundRumble.LOADER_OUT_SOLENOID_CHANNEL);
    loaderUpSolenoid = new Solenoid(ReboundRumble.LOADER_UP_SOLENOID_CHANNEL);
    loaderDownSolenoid = new Solenoid(ReboundRumble.LOADER_DOWN_SOLENOID_CHANNEL);
    loaderIn = new DigitalInput(ReboundRumble.LOAD_IN_GPIO_CHANNEL);
    loaderOut = new DigitalInput(ReboundRumble.LOAD_OUT_GPIO_CHANNEL);
    loaderUp = new DigitalInput(ReboundRumble.LOAD_UP_GPIO_CHANNEL);
    loaderDown = new DigitalInput(ReboundRumble.LOAD_DOWN_GPIO_CHANNEL);
    loaderDownSolenoid.set(false);
    loaderUpSolenoid.set(true);
    loaderOutSolenoid.set(false);
    loaderInSolenoid.set(true);
}
项目:Woodchuck-2013    文件Shooter.java   
public Shooter(Vision vision,JoystickControl controller)
{
    this.vision = vision;
    this.controller = controller;

    averageSpeed = new MovingAverage(ENCODER_AVERAGE_SAMPLES);

    Feeder = new Relay(FeedER_RELAY_CHANNEL);
    Feeder.setDirection(Relay.Direction.kForward);
    FeederSwitch = new DigitalInput(FeedER_DIGITAL_SIDECAR_SLOT,FeedER_DIGITAL_CHANNEL);

    encoderInput = new DigitalInput(ENCODER_DIGITAL_SIDECAR_SLOT,ENCODER_DIGITAL_CHANNEL);
    shooterEncoder = new Counter(encoderInput);
    shooterEncoder.setSemiPeriodMode(true);

    shooterMotor = new Motor(SHOOTER_JAGUAR_CHANNEL,SHOOTER_JAGUAR_INVERTED);

    cycleCounts = 0;
    rateCount = 0.0;
    prevTime = 0.0;
    currentSpeed = 0.0;
}
项目:GearBot    文件RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    leftSideLeftPaddle = new Spark(0);
    LiveWindow.addActuator("LeftSide","LeftPaddle",(Spark) leftSideLeftPaddle);

    leftSideLeftOut = new DigitalInput(0);
    LiveWindow.addSensor("LeftSide","LeftOut",leftSideLeftOut);

    leftSideLeftIn = new DigitalInput(2);
    LiveWindow.addSensor("LeftSide","LeftIn",leftSideLeftIn);

    rightSideRightPaddle = new Spark(1);
    LiveWindow.addActuator("RightSide","RightPaddle",(Spark) rightSideRightPaddle);

    rightSideRightOut = new DigitalInput(1);
    LiveWindow.addSensor("RightSide","RightOut",rightSideRightOut);

    rightSideRightIn = new DigitalInput(3);
    LiveWindow.addSensor("RightSide","RightIn",rightSideRightIn);

    gearGate = new Spark(2);
    LiveWindow.addActuator("Gear","Gate",(Spark) gearGate);

    gearGearIsIn = new DigitalInput(4);
    LiveWindow.addSensor("Gear","GearIsIn",gearGearIsIn);


// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:FlashLib    文件FRCpulseCounter.java   
public FRCpulseCounter(DigitalInput port,boolean pulseLength) {
    counter = new Counter();

    if(pulseLength){
        counter.setpulseLengthMode(0.01);
    }else{
        counter.setupsource(port);
        counter.setupdownCounterMode();
        counter.setSemiPeriodMode(false);
    }

    quadrature = false;
}
项目:FlashLib    文件FRCpulseCounter.java   
public FRCpulseCounter(DigitalInput upPort,DigitalInput downPort) {
    counter = new Counter();

    counter.setupsource(upPort);
    counter.setDownSource(downPort);
    counter.setupdownCounterMode();
    counter.setSemiPeriodMode(false);

    quadrature = true;
}
项目:thirdcoast    文件dioSet.java   
void removeInput(int channel) {
  if (inputs.size() == 0) {
    logger.debug("removeInput: inputs not initialized,returning");
    return;
  }
  DigitalInput input = inputs.get(channel);
  if (input == null) {
    logger.info("input channel {} is already removed",channel);
    return;
  }
  input.free();
  inputs.set(channel,null);
  logger.info("removed input {}",channel);
}
项目:thirdcoast    文件InspectDigitalInputsCommand.java   
@Override
public void perform() {
  PrintWriter writer = terminal.writer();
  writer.println(Messages.bold("\nDigital Input States"));
  for (int i = 0; i < 10; i++) {
    writer.print(Messages.bold(String.format("%2d  ",i)));
    DigitalInput input = dioSet.getDigitalInputs().get(i);
    if (input != null) {
      writer.println(input.get() ? "OFF" : Messages.boldGreen(" ON"));
    } else {
      writer.println("OUTPUT");
    }
  }
}
项目:2016-Robot-Final    文件Intake.java   
public Intake() {
motor = new Spark(RobotMap.IntakeMap.PWM_MOTOR);
motor.setInverted(RobotMap.IntakeMap.INV_MOTOR);

limit = new DigitalInput(RobotMap.IntakeMap.dio_LIMIT);
stop();
   }
项目: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);
    }
项目:2016-Robot    文件Intake.java   
public Intake() {
motor = new Spark(RobotMap.IntakeMap.PWM_MOTOR);
motor.setInverted(RobotMap.IntakeMap.INV_MOTOR);

limit = new DigitalInput(RobotMap.IntakeMap.dio_LIMIT);
stop();
   }
项目: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    文件HarvesterRollers.java   
public HarvesterRollers() {
        shooterWheelA = new CANTalon(RobotMap.HARVESTER_SHOOTER_WHEEL_A);//Construct shooter A as CANTalon,this should have encoder into it
        shooterWheelB = new CANTalon(RobotMap.HARVESTER_SHOOTER_WHEEL_B);//Construct shooter B as CANTalon
//      shooterWheelB.changeControlMode(CANTalon.TalonControlMode.Follower);//turn shooter motor B to a slave
//      shooterWheelB.set(shooterWheelA.get());//slave shooter motor B to shooter motor A

        harvesterBallControl = new CANTalon(RobotMap.HARVESTER_BALL_CONTROL);

        ballSensorLeft = new DigitalInput(RobotMap.BALL_SENSOR_LEFT);
        ballSensorRight = new DigitalInput(RobotMap.BALL_SENSOR_RIGHT);
        pdp = new PowerdistributionPanel();
    }
项目:Stronghold2016-340    文件ClawArm.java   
public ClawArm() {
    System.out.println("Claw arm constructor method called");
    armMotor = new TalonSRX(RobotMap.ClawArmMotor);

    clawPiston = new Solenoid(RobotMap.ClawPiston);

    armAngleSensor = new AnalogPotentiometer(RobotMap.ClawArmAngleSensor,270);
    bottomSwitch = new DigitalInput(RobotMap.ClawBottomSwitch);
    topSwitch = new DigitalInput(RobotMap.ClawTopSwitch);
    System.out.println("Claw arm constructor method complete.");
}
项目:FRC-2014-robot-project    文件AutonomousModeHandler.java   
public AutonomousModeHandler(Encoder enc1,Encoder enc2,RobotDrivePID robotoDrive,AxisCamera cam,ConfigurableValues configurableValues,IntakeControl frontIntake,IntakeControl backIntake,ShooterControl shooterControl,DigitalInput frontIntakeArmAngleDetector)
{
    m_configurableValues = configurableValues;
    m_shooterControl = shooterControl;
    m_robotDrivePid = robotoDrive;
    m_frontIntake = frontIntake;
    m_backIntake = backIntake;
    m_frontIntakeArmAngleDetector = frontIntakeArmAngleDetector;
    m_driveEncoder1 = enc1;
    m_driveEncoder2 = enc2;
    m_encoderAverager = new EncoderAverager(m_driveEncoder1,m_driveEncoder2);

    m_autonomousImageDetector = new AutonomousImageDetector(cam,m_configurableValues);
    m_nextStateArray= new byte[256];
    m_motorBrake = new MotorBrake();

    SetCurrentState(AUTONOMOUS_HANDLER_STATE_WAIT);
    SetNextStateArray(AUTONOMOUS_MODE_1_BALL_SHOOTING);

    m_overrideCoefficients = false;

    m_pidController = null;

    m_disabled = true;
    m_shootingBall = false;
    m_driving = false;
    m_braking = false;
    m_detectingImage = false;
    m_currentStateIndex = 0;
    m_loadingBall = false;
    m_shooterPullingBack = false;
}
项目:FRC-2014-robot-project    文件EncoderRPM.java   
public void Init(SpeedController speedController,Encoder encoder,double rpm,double maxRpm,double error,double targetRotations,DigitalInput limitSwitch)
{

    m_speedController = speedController;
    m_encoder = encoder;
    m_targetRpm = rpm;
    m_maxRpm = maxRpm;
    m_errorPercent = error;
    m_lastValueSet = 0;
    m_targetRotations = targetRotations;
    m_switch = limitSwitch;
    m_encoder.reset();
    m_enabled = false;
    m_running = false;
}
项目:FRC-2016    文件Turret.java   
/**
 * Constructor
 */
private Turret() {
    winch = new CANTalon(TURRET);
    winch.changeControlMode(PERCENT_VBUS_MODE);
    winch.enableBrakeMode(BRAKE_MODE);
    lower = new DigitalInput(0);
    upper = new DigitalInput(1);
    // winch.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Relative);
}
项目:r2016    文件HookerSubsystem.java   
public HookerSubsystem(SpeedControllerSubsystemType type,final int speedControllerChannel,final DigitalInput _encoderAChannel,final DigitalInput _encoderBChannel,final int limitSwitchChannel) {
    super(type,speedControllerChannel);

    this._encoder = new Encoder(_encoderAChannel,_encoderBChannel);
    this._limitSwitch = new LimitSwitch(limitSwitchChannel);

    this.setDataKey(HookerSubsystemDataKey.POWER,0.0d);
}
项目:FRC2549-2016    文件ShooterSubsystem.java   
public ShooterSubsystem(){
    liftController=RobotMap.liftMotor.getController();
    wheelController=RobotMap.wheelMotor.getController();

    liftGyro = new AnalogGyro(RobotMap.liftGyroPort);
    liftGyro.reset();
    liftGyro.setSensitivity(0.007);

    limitSwitch = new DigitalInput(RobotMap.limitSwitch);
}
项目:Frc2017FirstSteamWorks    文件GearPickup.java   
/**
 * Initialize the GearPickup class.
 */
public GearPickup()
{
    claw = new FrcPneumatic(
        "GearPickupClaw",RobotInfo.CANID_PCM1,RobotInfo.soL_GEARPICKUP_CLAW_EXTEND,RobotInfo.soL_GEARPICKUP_CLAW_RETRACT);
    arm = new FrcPneumatic(
        "GearPickupArm",RobotInfo.soL_GEARPICKUP_ARM_EXTEND,RobotInfo.soL_GEARPICKUP_ARM_RETRACT);
    gearSensor = new DigitalInput(RobotInfo.DIN_GEAR_SENSOR);
}
项目:Recyclerush2015    文件WinchControl.java   
public WinchControl(SpeedController motor,double upSpeed,double downSpeed,DigitalInput upSwitch,DigitalInput downSwitch) {
    this.winchMotor = motor;
    this.upValue = upSpeed;
    this.downValue = downSpeed;
    this.upSwitch = upSwitch;
    this.downSwitch = downSwitch;
}
项目:Recyclerush2015    文件WinchControl.java   
public DigitalInput setSwitch(Direction dir,DigitalInput newSwitch) {
    DigitalInput prev;

    if (dir == Direction.UPWARDS) {
        prev = this.upSwitch;
        this.upSwitch = newSwitch;
    } else {
        prev = this.downSwitch;
        this.downSwitch = newSwitch;
    }

    return prev;
}
项目:Stronghold-2016    文件FlyWheels.java   
public FlyWheels() {
    left = new CANTalon(RobotMap.LEFT_SHOOTER_MOTOR);
    right = new CANTalon(RobotMap.RIGHT_SHOOTER_MOTOR);
    left.enableBrakeMode(true);
    right.enableBrakeMode(true);

    right.changeControlMode(CANTalon.TalonControlMode.Follower);
    right.reverSEOutput(true);

    pusher = new DoubleSolenoid(RobotMap.PUSHER_OUT_PORT,RobotMap.PUSHER_IN_PORT);

    wheelSwitch = new DigitalInput(RobotMap.FLYWHEEL_ENCODER_SWITCH);
    counter = new Counter(wheelSwitch);
}
项目:Robot2015    文件copyOfToteElevatorSubsystem.java   
public copyOfToteElevatorSubsystem() {
    // Add the safety elements to the elevator talon
    // Since negative power drives the motor up,the negative limit switch is the elevator upper limit switch
    elevatorMotor.setNegativeLimitSwitch(new DigitalInput(RobotMap.TOTE_ELEVATOR_UPPER_LIMIT_SWITCH));
    elevatorMotor.setPositiveLimitSwitch(floorSensor);
    elevatorMotor.setoverCurrentFuse(RobotMap.TOTE_ELEVATOR_POWER_disTRIBUTION_PORT,SafeTalon.CURRENT_NO_LIMIT,0);
}
项目:Robot2015    文件SafeTalon.java   
/**
 * Set the negative limit switch for this Talon.  
 * <p>
 * This limit switch will stop the motor (set the talon to zero) if the limit switch
 * is engaged and the motor set value is negative (<0).  Any calls to {@link #pidWrite(double)}
 * or {@link #set(double)} that contain a negative value will be overridden to zero.  Positive
 * motor speeds will still be accepted.
 * 
 * @param negativeLimitSwitch - a digital input used for this limit switch.
 * @param defaultState - the default state for this limit switch. The value opposite of the default
 * state is used to determine if the switch is engaged.  
 */
public void setNegativeLimitSwitch(DigitalInput negativeLimitSwitch,boolean defaultState) {
    this.negativeLimitSwitch             = negativeLimitSwitch;
    this.negativeLimitSwitchDefaultState = defaultState;

    // If the default state is true,the counter should detect falling edges
    this.negativeLimitSwitchCounter = new Counter(this.negativeLimitSwitch);
    if (defaultState == false) {
        this.negativeLimitSwitchCounter.setupsourceEdge(true,false);
    } else {
        this.negativeLimitSwitchCounter.setupsourceEdge(false,true);
    }
    this.negativeLimitSwitchCounter.reset();
}
项目:Robot2015    文件SafeTalon.java   
/**
 * Set the positive limit switch for this Talon.  
 * <p>
 * This limit switch will stop the motor (set the talon to zero) if the limit switch
 * is engaged and the motor set value is positive (>0).  Any calls to {@link #pidWrite(double)}
 * or {@link #set(double)} that contain a positive value will be overridden to zero.  Negative
 * motor speeds will still be accepted.
 * 
 * @param positiveLimitSwitch - a digital input used for this limit switch.
 * @param defaultState - the default state for this limit switch. The value opposite of the default
 * state is used to determine if the switch is engaged.  
 */
public void setPositiveLimitSwitch(DigitalInput positiveLimitSwitch,boolean defaultState) {
    this.positiveLimitSwitch             = positiveLimitSwitch;
    this.positiveLimitSwitchDefaultState = defaultState;

    // If the default state is true,the counter should detect falling edges
    this.positiveLimitSwitchCounter = new Counter(this.positiveLimitSwitch);
    if (defaultState == false) {
        this.positiveLimitSwitchCounter.setupsourceEdge(true,false);
    } else {
        this.positiveLimitSwitchCounter.setupsourceEdge(false,true);
    }
    this.positiveLimitSwitchCounter.reset();
}
项目:turtleshell    文件Robot.java   
public Robot() {
    stick = new Joystick(0);
    try {
        /* Construct Digital I/O Objects */
        pwm_out_9 = new Victor(        getChannelFromPin( PinType.PWM,9 ));
        pwm_out_8 = new Jaguar(        getChannelFromPin( PinType.PWM,8 ));
        dig_in_7  = new DigitalInput(  getChannelFromPin( PinType.DigitalIO,7 ));
        dig_in_6  = new DigitalInput(  getChannelFromPin( PinType.DigitalIO,6 ));
        dig_out_5 = new DigitalOutput( getChannelFromPin( PinType.DigitalIO,5 ));
        dig_out_4 = new DigitalOutput( getChannelFromPin( PinType.DigitalIO,4 ));
        enc_3and2 = new Encoder(       getChannelFromPin( PinType.DigitalIO,3 ),getChannelFromPin( PinType.DigitalIO,2 ));
        enc_1and0 = new Encoder(       getChannelFromPin( PinType.DigitalIO,1 ),0 ));

        /* Construct Analog I/O Objects */
        /* NOTE:  Due to a board layout issue on the navX MXP board revision */
        /* 3.3,there is noticeable crosstalk between AN IN pins 3,2 and 1. */
        /* For that reason,use of pin 3 and pin 2 is NOT RECOMMENDED.       */
        an_in_1   = new AnalogInput(   getChannelFromPin( PinType.AnalogIn,1 ));
        an_trig_0 = new AnalogTrigger( getChannelFromPin( PinType.AnalogIn,0 ));
        an_trig_0_counter = new Counter( an_trig_0 );

        an_out_1  = new Analogoutput(  getChannelFromPin( PinType.Analogout,1 ));
        an_out_0  = new Analogoutput(  getChannelFromPin( PinType.Analogout,0 ));

        /* Configure I/O Objects */
        pwm_out_9.setSafetyEnabled(false); /* disable Motor Safety for Demo */
        pwm_out_8.setSafetyEnabled(false); /* disable Motor Safety for Demo */

        /* Configure Analog Trigger */
        an_trig_0.setAveraged(true);
        an_trig_0.setLimitsVoltage(MIN_AN_TRIGGER_VOLTAGE,MAX_AN_TRIGGER_VOLTAGE);
    } catch (RuntimeException ex ) {
        DriverStation.reportError( "Error instantiating MXP pin on navX MXP:  " 
                                    + ex.getMessage(),true);
    }
}
项目:turtleshell    文件Claw.java   
public Claw() {
      super();
      motor = new Victor(7);
      contact = new DigitalInput(5);

// Let's show everything on the LiveWindow
      LiveWindow.addActuator("Claw",(Victor) motor);
      LiveWindow.addActuator("Claw","Limit Switch",contact);
  }
项目:2015RobotCode    文件ArmElevator.java   
@Override
public void initialize() {

    m_victor = new Victor(RobotMap.LIFT_MOTOR);
    m_victor.enableDeadbandElimination(true);
    m_victor.setExpiration(Victor.DEFAULT_SAFETY_EXPIRATION);

    m_encoder = new Encoder(RobotMap.ENCODER_dio_PORTA,RobotMap.ENCODER_dio_PORTB,true);
    m_encoder.setSamplesToAverage(10);

    m_maxLimit = new DigitalInput(RobotMap.LIMIT_dio_PORT1);
    max_counter = new Counter(m_maxLimit);

}
项目:Swerve    文件CompressorControl.java   
CompressorControl(int chanCompressor,int modComp,int modPS,int chanPS) {
    compressor = new Relay(modComp,chanCompressor,Relay.Direction.kForward);
    pressureSwitch = new DigitalInput(modPS,chanPS);

    // Start background task
    Thread t = new Thread(this);
    t.start();
}
项目:4500-2014    文件Winch.java   
Winch(JoyStickCustom inStick){
    winchRelease=new Pneumatics(1,2);
    winch= new Victor(5);

    states[0]="WINDING";
    states[1]="RELEASING";
    states[2]="HOLDING";
    setState(HOLDING1);//same as holding used to be

    limitSwitch= new DigitalInput(4);

    secondStick = inStick;
    winchE= new Encoder(3,2);
    winchE.start();
}

相关文章

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