本文整理汇总了Java中edu.wpi.first.wpilibj.Counter.start方法的典型用法代码示例。如果您正苦于以下问题:Java Counter.start方法的具体用法?Java Counter.start怎么用?Java Counter.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.Counter
的用法示例。
在下文中一共展示了Counter.start方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbsoluteAnalogEncoder
import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public AbsoluteAnalogEncoder(int channel, double minVoltage, double maxVoltage, double offsetDegrees, int analogSampleRate, double analogTriggerThresholdDifference) { //TODO: Implement direction
super(channel);
_channel = channel;
if (minVoltage >= maxVoltage) throw new IllegalArgumentException("Minimum voltage must be less than maximum voltage");
if (offsetDegrees < 0 || offsetDegrees > 360) throw new IllegalArgumentException("Offset must be between 0 and 360 degrees");
// Initialize analog trigger //
_analogTrigger = new AnalogTrigger(channel);
_analogTrigger.setFiltered(true);
_analogTrigger.setLimitsVoltage(minVoltage + analogTriggerThresholdDifference, maxVoltage - analogTriggerThresholdDifference);
AnalogTriggerOutput _analogTriggerFalling = new AnalogTriggerOutput(_analogTrigger, AnalogTriggerOutput.Type.kFallingPulse);
AnalogTriggerOutput _analogTriggerRising = new AnalogTriggerOutput(_analogTrigger, AnalogTriggerOutput.Type.kRisingPulse);
// Set analog module sampling rate //
AnalogModule module = (AnalogModule) Module.getModule(ModulePresence.ModuleType.kAnalog, DEFAULT_ANALOG_MODULE);
module.setSampleRate(analogSampleRate);
// Initialize turn counter //
_turnCounter = new Counter();
_turnCounter.setUpDownCounterMode();
_turnCounter.setUpSource(_analogTriggerRising);
_turnCounter.setDownSource(_analogTriggerFalling);
_turnCounter.start();
_minVoltage = minVoltage;
_maxVoltage = maxVoltage;
_offsetDegrees = offsetDegrees;
}
示例2: ShootArm
import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public ShootArm() {
arm = new Talon(Ports.SHOOTER_LAUNCHER);
arm.set(0);
launcherEncoder = new Encoder(Ports.SHOOTER_ENCODER_1, Ports.SHOOTER_ENCODER_2, false, 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;
}
示例3: AnalogChannelVolt
import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public AnalogChannelVolt(int moduleNumber, int channel) {
super(moduleNumber, channel);
this.getModule().setSampleRate(1000);
m_trig = new AnalogTrigger(moduleNumber, channel);
m_trig.setFiltered(true);
m_trig.setLimitsVoltage(1.35, 3.65);
m_count = new Counter();
m_count.setUpDownCounterMode();
m_count.setUpSource(m_trig, AnalogTriggerOutput.Type.kFallingPulse);
m_count.setDownSource(m_trig, AnalogTriggerOutput.Type.kRisingPulse);
m_count.start();
}
示例4: 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();
}
示例5: Shooter
import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
private Shooter(int motorChannel, int loader, int tilter, int encoder) {
motor = new Victor(motorChannel);
loaderPiston = new Solenoid(loader);
tilterPiston = new Solenoid(tilter);
cntr = new Counter(encoder);
//cntr.setSemiPeriodMode(true);
cntr.start();
new Thread(this).start();
}
示例6: EncoderShooter
import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public EncoderShooter() {
backMotor = new Victor(RobotMap.BACK_SHOOTER_MOTOR);
frontMotor = new Victor(RobotMap.FRONT_SHOOTER_MOTOR);
counter = new Counter(RobotMap.SHOOTER_ENCODER);
counter.setUpDownCounterMode();
counter.start();
setpoint = RobotMap.DEFAULT_SETPOINT;
backMotor.set(RobotMap.BACK_SHOOTING_SPEED);
}
示例7: ClimbingSystem
import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public ClimbingSystem(RobotTemplate robo)
{
try
{
up = new Solenoid(Wiring.CLIMB_SOLENOID_UP);
down = new Solenoid(Wiring.CLIMB_SOLENOID_DOWN);
forward = new Solenoid(Wiring.CLIMBING_SOLENOID_FORWARD);
back = new Solenoid(Wiring.CLIMBING_SOLENOID_BACKWARD);
home = new DigitalInput(Wiring.CYLINDER_HOME);
part = new DigitalInput(Wiring.CYLINDER_PART);
max = new DigitalInput(Wiring.CYLINDER_MAX);
winch = new CANJaguar(Wiring.WINCH_MOTOR);
countPart = new Counter(part);
countPart.setUpSourceEdge(true, false);
countPart.reset();
countPart.start();
winch.configMaxOutputVoltage(6.0);
forward.set(true);
back.set(false);
this.robo = robo;
time.start();
typicalCurrent = 0;
}
catch (CANTimeoutException ex)
{
ex.printStackTrace();
}
}
示例8: HallEffectSpeedSensor
import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
public HallEffectSpeedSensor(int port) {
_hallEffect = new DigitalInput(port);
_counter = new Counter(_hallEffect);
_counter.start();
}
示例9: counterInit
import edu.wpi.first.wpilibj.Counter; //导入方法依赖的package包/类
/**
* Initializes the counter object.
*
* @param counter The counter reference.
*/
private void counterInit(Counter counter) {
counter.start();
counter.reset();
}