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


Java Counter.setSemiPeriodMode方法代码示例

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


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

示例1: Shooter

import edu.wpi.first.wpilibj.Counter; //导入方法依赖的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

示例2: USensor

import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public USensor() {
    leftPulse = new DigitalOutput(RobotMap.LEFT_PULSE);
    left = new Counter(RobotMap.LEFT_ECHO);
    left.setMaxPeriod(1);
    left.setSemiPeriodMode(true);
    left.reset();

    rightPulse = new DigitalOutput(RobotMap.RIGHT_PULSE);
    right = new Counter(RobotMap.RIGHT_ECHO);
    right.setMaxPeriod(1);
    right.setSemiPeriodMode(true);
    right.reset();

    threadInit(() -> {
        leftPulse.pulse(RobotMap.US_PULSE);
        rightPulse.pulse(RobotMap.US_PULSE);

        do {
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } while (left.get() < 2 || right.get() < 2);

        leftDistant = left.getPeriod() * 0.5 * RobotMap.SPEED_OF_SOUND;
        rightDistant = right.getPeriod() * 0.5 * RobotMap.SPEED_OF_SOUND;

        SmartDashboard.putNumber("left dis", leftDistant);
        SmartDashboard.putNumber("right dis", rightDistant);

        left.reset();
        right.reset();
    });
}
 
开发者ID:FRCteam6414,项目名称:FRC6414program,代码行数:36,代码来源:USensor.java

示例3: FRCPulseCounter

import edu.wpi.first.wpilibj.Counter; //导入方法依赖的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

示例4: TurtleHallSensor

import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public TurtleHallSensor(int port, boolean countHighs) {
	c = new Counter();
	c.setUpSource(port);
	c.setUpDownCounterMode();
	c.setSemiPeriodMode(countHighs);
	c.setMaxPeriod(1);
	c.setDistancePerPulse(1);
	c.setSamplesToAverage(6);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:10,代码来源:TurtleHallSensor.java

示例5: initialize

import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
/**
 * Initializes important objects for the 
 */
private void initialize() {
	counter    = new Counter(input);
	counter.setSemiPeriodMode(false);
	rateCalc   = new RateCalculator(counter);
	rateThread = new Thread(rateCalc);
}
 
开发者ID:Team-2502,项目名称:RobotCode2013,代码行数:10,代码来源:PhotoelectricSensor.java

示例6: Auger

import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public Auger(int augerRelay, int augerRotationSwitch, int augerTopSwitch) {
    super("Auger");
    auger = new Relay(augerRelay);
    augerRotateSwitch = new DigitalInput(augerRotationSwitch);
    augerTopLimitSwitch = new DigitalInput(augerTopSwitch);
    counter = new Counter(augerRotateSwitch);
    counter.setSemiPeriodMode(false);
    direction = AugerDirection.AUGER_STOP;
    counter.start();
}
 
开发者ID:TheGreenMachine,项目名称:Zed-Java,代码行数:11,代码来源:Auger.java


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