当前位置: 首页>>代码示例>>Java>>正文


Java DigitalInput类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.DigitalInput的典型用法代码示例。如果您正苦于以下问题:Java DigitalInput类的具体用法?Java DigitalInput怎么用?Java DigitalInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DigitalInput类属于edu.wpi.first.wpilibj包,在下文中一共展示了DigitalInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDigitalInputs

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
@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);
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:19,代码来源:DioSet.java

示例2: Arm

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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);
   }
 
开发者ID:Team236,项目名称:2016-Robot-Final,代码行数:17,代码来源:Arm.java

示例3: Harvester

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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);
}
 
开发者ID:CraftSpider,项目名称:Stronghold2016-340,代码行数:19,代码来源:Harvester.java

示例4: ShooterControl

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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, m_encoder,(-1)*m_speedControllerMaxRpm/4,m_speedControllerMaxRpm,0.05, 3);
    m_gearControl = gearControl;
    m_latchReleased = false;
    m_gearReleased = false;
    m_isPulledBack = false;
}
 
开发者ID:Dinoyan,项目名称:FRC-2014-robot-project,代码行数:21,代码来源:ShooterControl.java

示例5: Lift

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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;
}
 
开发者ID:chopshop-166,项目名称:frc-2015,代码行数:17,代码来源:Lift.java

示例6: Launcher

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:bethpage-robotics,项目名称:Aerial-Assist,代码行数:22,代码来源:Launcher.java

示例7: SensorInput

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:Chilean-Heart,项目名称:2015-frc-robot,代码行数:21,代码来源:SensorInput.java

示例8: Winch

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:Team2168,项目名称:2014_Main_Robot,代码行数:28,代码来源:Winch.java

示例9: Loader

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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);
}
 
开发者ID:FIRST-FRC-Team-2028,项目名称:2012,代码行数:17,代码来源:Loader.java

示例10: Shooter

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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;
}
 
开发者ID:SaintsRobotics,项目名称:Woodchuck-2013,代码行数:23,代码来源:Shooter.java

示例11: init

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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
}
 
开发者ID:ElectricGeorge,项目名称:GearBot,代码行数:30,代码来源:RobotMap.java

示例12: FRCPulseCounter

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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;
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:14,代码来源:FRCPulseCounter.java

示例13: removeInput

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
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);
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:15,代码来源:DioSet.java

示例14: perform

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
@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");
    }
  }
}
 
开发者ID:strykeforce,项目名称:thirdcoast,代码行数:15,代码来源:InspectDigitalInputsCommand.java

示例15: Intake

import edu.wpi.first.wpilibj.DigitalInput; //导入依赖的package包/类
public Intake() {
motor = new Spark(RobotMap.IntakeMap.PWM_MOTOR);
motor.setInverted(RobotMap.IntakeMap.INV_MOTOR);

limit = new DigitalInput(RobotMap.IntakeMap.DIO_LIMIT);
stop();
   }
 
开发者ID:Team236,项目名称:2016-Robot-Final,代码行数:8,代码来源:Intake.java


注:本文中的edu.wpi.first.wpilibj.DigitalInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。