本文整理汇总了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;
}
示例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();
});
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}