Completed artf2662: removed Start()/Stop() in Encoders and Counters.

Change-Id: I11954bb5f66e54461455637d79013c1071f5d00f
This commit is contained in:
Colby Skeggs
2014-07-29 09:58:15 -07:00
committed by Thomas Clark
parent c0af235050
commit 0bb13d86ea
23 changed files with 164 additions and 225 deletions

View File

@@ -11,6 +11,9 @@ package edu.wpi.first.wpilibj;
* Interface for counting the number of ticks on a digital input channel.
* Encoders, Gear tooth sensors, and counters should all subclass this so it can be used to
* build more advanced classes for control and driving.
*
* All counters will immediately start counting - reset() them if you need them
* to be zeroed before use.
*/
public interface CounterBase {
@@ -44,11 +47,6 @@ public interface CounterBase {
}
}
/**
* Start the counter
*/
public void start();
/**
* Get the count
* @return the count
@@ -60,11 +58,6 @@ public interface CounterBase {
*/
void reset();
/**
* Stop counting
*/
void stop();
/**
* Get the time between the last two edges counted
* @return the time beteween the last two ticks in seconds

View File

@@ -21,6 +21,9 @@ import edu.wpi.first.wpilibj.util.BoundaryException;
* mounted such that forward movement generates negative values. Quadrature
* encoders have two digital outputs, an A Channel and a B Channel that are out
* of phase with each other to allow the FPGA to do direction sensing.
*
* All encoders will immediately start counting - reset() them if you need them
* to be zeroed before use.
*/
public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveWindowSendable {
private int m_index;
@@ -37,6 +40,8 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW
* Common initialization code for Encoders. This code allocates resources
* for Encoders and is common to all constructors.
*
* The encoder will start counting immediately.
*
* @param reverseDirection
* If true, counts down instead of up (this is all relative)
* @param encodingType
@@ -65,11 +70,14 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW
impl = new SimEncoder("simulator/dio/"+aChannel+"/"+bChannel);
setDistancePerPulse(1);
impl.start();
}
/**
* Encoder constructor. Construct a Encoder given a and b channels.
*
* The encoder will start counting immediately.
*
* @param aChannel
* The a channel digital input channel.
* @param bChannel
@@ -90,6 +98,8 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW
/**
* Encoder constructor. Construct a Encoder given a and b channels.
*
* The encoder will start counting immediately.
*
* @param aChannel
* The a channel digital input channel.
* @param bChannel
@@ -102,6 +112,8 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW
/**
* Encoder constructor. Construct a Encoder given a and b channels.
*
* The encoder will start counting immediately.
*
* @param aChannel
* The a channel digital input channel.
* @param bChannel
@@ -132,21 +144,6 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW
public void free() {}
/**
* Start the Encoder.
* Starts counting pulses on the Encoder device.
*/
public void start() {
impl.start();
}
/**
* Stops counting pulses on the Encoder device. The value is not changed.
*/
public void stop() {
impl.stop();
}
/**
* Reset the Encoder distance to zero.
* Resets the current count to zero on the encoder.