wpilib18/java/current/javadoc/edu/wpi/first/wpilibj/Encoder.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Sat Oct 28 05:22:53 EDT 2017 -->
<title>Encoder (Documentation - Release API)</title>
<meta name="date" content="2017-10-28">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Encoder (Documentation - Release API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":42,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/wpi/first/wpilibj/DriverStation.Alliance.html" title="enum in edu.wpi.first.wpilibj"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../edu/wpi/first/wpilibj/Encoder.IndexingType.html" title="enum in edu.wpi.first.wpilibj"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/wpi/first/wpilibj/Encoder.html" target="_top">Frames</a></li>
<li><a href="Encoder.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.wpi.first.wpilibj</div>
<h2 title="Class Encoder" class="title">Class Encoder</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">edu.wpi.first.wpilibj.SensorBase</a></li>
<li>
<ul class="inheritance">
<li>edu.wpi.first.wpilibj.Encoder</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a>, <a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a>, <a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a>, <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj">Sendable</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">Encoder</span>
extends <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">SensorBase</a>
implements <a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a>, <a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a>, <a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a></pre>
<div class="block">Class to read quadrature encoders.
<p>Quadrature encoders are devices that count shaft rotation and can sense direction. The output
of the Encoder class is an integer that can count either up or down, and can go negative for
reverse direction counting. When creating Encoders, a direction can be supplied that inverts the
sense of the output to make code more readable if the encoder is 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 for direction sensing.
<p>All encoders will immediately start counting - reset() them if you need them to be zeroed
before use.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.IndexingType.html" title="enum in edu.wpi.first.wpilibj">Encoder.IndexingType</a></span></code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="nested.classes.inherited.from.class.edu.wpi.first.wpilibj.CounterBase">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.<a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></h3>
<code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.EncodingType.html" title="enum in edu.wpi.first.wpilibj">CounterBase.EncodingType</a></code></li>
</ul>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#m_aSource">m_aSource</a></span></code>
<div class="block">The a source.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#m_bSource">m_bSource</a></span></code>
<div class="block">The b source.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#m_indexSource">m_indexSource</a></span></code>
<div class="block">The index source.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.edu.wpi.first.wpilibj.SensorBase">
<!-- -->
</a>
<h3>Fields inherited from class edu.wpi.first.wpilibj.<a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">SensorBase</a></h3>
<code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kAnalogInputChannels">kAnalogInputChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kAnalogOutputChannels">kAnalogOutputChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kDigitalChannels">kDigitalChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kPCMModules">kPCMModules</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kPDPChannels">kPDPChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kPDPModules">kPDPModules</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kPwmChannels">kPwmChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kRelayChannels">kRelayChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kSolenoidChannels">kSolenoidChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kSystemClockTicksPerMicrosecond">kSystemClockTicksPerMicrosecond</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-">Encoder</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-boolean-">Encoder</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB,
boolean reverseDirection)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-boolean-edu.wpi.first.wpilibj.CounterBase.EncodingType-">Encoder</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB,
boolean reverseDirection,
<a href="../../../../edu/wpi/first/wpilibj/CounterBase.EncodingType.html" title="enum in edu.wpi.first.wpilibj">CounterBase.EncodingType</a> encodingType)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-">Encoder</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> indexSource)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-boolean-">Encoder</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> indexSource,
boolean reverseDirection)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-int-int-">Encoder</a></span>(int channelA,
int channelB)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-int-int-boolean-">Encoder</a></span>(int channelA,
int channelB,
boolean reverseDirection)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-int-int-boolean-edu.wpi.first.wpilibj.CounterBase.EncodingType-">Encoder</a></span>(int channelA,
int channelB,
boolean reverseDirection,
<a href="../../../../edu/wpi/first/wpilibj/CounterBase.EncodingType.html" title="enum in edu.wpi.first.wpilibj">CounterBase.EncodingType</a> encodingType)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-int-int-int-">Encoder</a></span>(int channelA,
int channelB,
int indexChannel)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#Encoder-int-int-int-boolean-">Encoder</a></span>(int channelA,
int channelB,
int indexChannel,
boolean reverseDirection)</code>
<div class="block">Encoder constructor.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#free--">free</a></span>()</code>
<div class="block">Free the resources used by this object.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#get--">get</a></span>()</code>
<div class="block">Gets the current count.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getDirection--">getDirection</a></span>()</code>
<div class="block">The last direction the encoder value changed.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getDistance--">getDistance</a></span>()</code>
<div class="block">Get the distance the robot has driven since the last reset as scaled by the value from <a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setDistancePerPulse-double-"><code>setDistancePerPulse(double)</code></a>.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getEncodingScale--">getEncodingScale</a></span>()</code>
<div class="block">Used to divide raw edge counts down to spec'd counts.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getFPGAIndex--">getFPGAIndex</a></span>()</code>
<div class="block">Get the FPGA index of the encoder.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getPeriod--">getPeriod</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>
<div class="block"><span class="deprecationComment">Use getRate() in favor of this method.</span></div>
</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../../../edu/wpi/first/wpilibj/PIDSourceType.html" title="enum in edu.wpi.first.wpilibj">PIDSourceType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getPIDSourceType--">getPIDSourceType</a></span>()</code>
<div class="block">Get which parameter of the device you are using as a process control variable.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getRate--">getRate</a></span>()</code>
<div class="block">Get the current rate of the encoder.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getRaw--">getRaw</a></span>()</code>
<div class="block">Gets the raw value from the encoder.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getSamplesToAverage--">getSamplesToAverage</a></span>()</code>
<div class="block">Get the Samples to Average which specifies the number of samples of the timer to average when
calculating the period.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getSmartDashboardType--">getSmartDashboardType</a></span>()</code>
<div class="block">Live Window code, only does anything if live window is activated.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#getStopped--">getStopped</a></span>()</code>
<div class="block">Determine if the encoder is stopped.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#initTable-edu.wpi.first.networktables.NetworkTable-">initTable</a></span>(<a href="../../../../edu/wpi/first/networktables/NetworkTable.html" title="class in edu.wpi.first.networktables">NetworkTable</a> subtable)</code>
<div class="block">Initializes a table for this <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj"><code>Sendable</code></a> object.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#pidGet--">pidGet</a></span>()</code>
<div class="block">Implement the PIDSource interface.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#reset--">reset</a></span>()</code>
<div class="block">Reset the Encoder distance to zero.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setDistancePerPulse-double-">setDistancePerPulse</a></span>(double distancePerPulse)</code>
<div class="block">Set the distance per pulse for this encoder.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setIndexSource-edu.wpi.first.wpilibj.DigitalSource-">setIndexSource</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source)</code>
<div class="block">Set the index source for the encoder.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setIndexSource-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.Encoder.IndexingType-">setIndexSource</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source,
<a href="../../../../edu/wpi/first/wpilibj/Encoder.IndexingType.html" title="enum in edu.wpi.first.wpilibj">Encoder.IndexingType</a> type)</code>
<div class="block">Set the index source for the encoder.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setIndexSource-int-">setIndexSource</a></span>(int channel)</code>
<div class="block">Set the index source for the encoder.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setIndexSource-int-edu.wpi.first.wpilibj.Encoder.IndexingType-">setIndexSource</a></span>(int channel,
<a href="../../../../edu/wpi/first/wpilibj/Encoder.IndexingType.html" title="enum in edu.wpi.first.wpilibj">Encoder.IndexingType</a> type)</code>
<div class="block">Set the index source for the encoder.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setMaxPeriod-double-">setMaxPeriod</a></span>(double maxPeriod)</code>
<div class="block">Sets the maximum period for stopped detection.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setMinRate-double-">setMinRate</a></span>(double minRate)</code>
<div class="block">Set the minimum rate of the device before the hardware reports it stopped.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setPIDSourceType-edu.wpi.first.wpilibj.PIDSourceType-">setPIDSourceType</a></span>(<a href="../../../../edu/wpi/first/wpilibj/PIDSourceType.html" title="enum in edu.wpi.first.wpilibj">PIDSourceType</a> pidSource)</code>
<div class="block">Set which parameter of the encoder you are using as a process control variable.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setReverseDirection-boolean-">setReverseDirection</a></span>(boolean reverseDirection)</code>
<div class="block">Set the direction sensing for this encoder.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setSamplesToAverage-int-">setSamplesToAverage</a></span>(int samplesToAverage)</code>
<div class="block">Set the Samples to Average which specifies the number of samples of the timer to average when
calculating the period.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#startLiveWindowMode--">startLiveWindowMode</a></span>()</code>
<div class="block">Start having this sendable object automatically respond to value changes reflect the value on
the table.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#stopLiveWindowMode--">stopLiveWindowMode</a></span>()</code>
<div class="block">Stop having this sendable object automatically respond to value changes.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Encoder.html#updateTable--">updateTable</a></span>()</code>
<div class="block">Update the table for this sendable object with the latest values.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.edu.wpi.first.wpilibj.SensorBase">
<!-- -->
</a>
<h3>Methods inherited from class edu.wpi.first.wpilibj.<a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">SensorBase</a></h3>
<code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkAnalogInputChannel-int-">checkAnalogInputChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkAnalogOutputChannel-int-">checkAnalogOutputChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkDigitalChannel-int-">checkDigitalChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkPDPChannel-int-">checkPDPChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkPDPModule-int-">checkPDPModule</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkPWMChannel-int-">checkPWMChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkRelayChannel-int-">checkRelayChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkSolenoidChannel-int-">checkSolenoidChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkSolenoidModule-int-">checkSolenoidModule</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#getDefaultSolenoidModule--">getDefaultSolenoidModule</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#setDefaultSolenoidModule-int-">setDefaultSolenoidModule</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="m_aSource">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_aSource</h4>
<pre>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> m_aSource</pre>
<div class="block">The a source.</div>
</li>
</ul>
<a name="m_bSource">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_bSource</h4>
<pre>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> m_bSource</pre>
<div class="block">The b source.</div>
</li>
</ul>
<a name="m_indexSource">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>m_indexSource</h4>
<pre>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> m_indexSource</pre>
<div class="block">The index source.</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="Encoder-int-int-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(int channelA,
int channelB,
boolean reverseDirection)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a and b channels.
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channelA</code> - The a channel DIO channel. 0-9 are on-board, 10-25 are on the MXP port</dd>
<dd><code>channelB</code> - The b channel DIO channel. 0-9 are on-board, 10-25 are on the MXP port</dd>
<dd><code>reverseDirection</code> - represents the orientation of the encoder and inverts the output values
if necessary so forward represents positive values.</dd>
</dl>
</li>
</ul>
<a name="Encoder-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(int channelA,
int channelB)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a and b channels.
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channelA</code> - The a channel digital input channel.</dd>
<dd><code>channelB</code> - The b channel digital input channel.</dd>
</dl>
</li>
</ul>
<a name="Encoder-int-int-boolean-edu.wpi.first.wpilibj.CounterBase.EncodingType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(int channelA,
int channelB,
boolean reverseDirection,
<a href="../../../../edu/wpi/first/wpilibj/CounterBase.EncodingType.html" title="enum in edu.wpi.first.wpilibj">CounterBase.EncodingType</a> encodingType)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a and b channels.
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channelA</code> - The a channel digital input channel.</dd>
<dd><code>channelB</code> - The b channel digital input channel.</dd>
<dd><code>reverseDirection</code> - represents the orientation of the encoder and inverts the output values
if necessary so forward represents positive values.</dd>
<dd><code>encodingType</code> - either k1X, k2X, or k4X to indicate 1X, 2X or 4X decoding. If 4X is
selected, then an encoder FPGA object is used and the returned counts
will be 4x the encoder spec'd value since all rising and falling edges
are counted. If 1X or 2X are selected then a m_counter object will be
used and the returned value will either exactly match the spec'd count
or be double (2x) the spec'd count.</dd>
</dl>
</li>
</ul>
<a name="Encoder-int-int-int-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(int channelA,
int channelB,
int indexChannel,
boolean reverseDirection)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a and b channels. Using an index pulse forces 4x
encoding
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channelA</code> - The a channel digital input channel.</dd>
<dd><code>channelB</code> - The b channel digital input channel.</dd>
<dd><code>indexChannel</code> - The index channel digital input channel.</dd>
<dd><code>reverseDirection</code> - represents the orientation of the encoder and inverts the output values
if necessary so forward represents positive values.</dd>
</dl>
</li>
</ul>
<a name="Encoder-int-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(int channelA,
int channelB,
int indexChannel)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a and b channels. Using an index pulse forces 4x
encoding
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channelA</code> - The a channel digital input channel.</dd>
<dd><code>channelB</code> - The b channel digital input channel.</dd>
<dd><code>indexChannel</code> - The index channel digital input channel.</dd>
</dl>
</li>
</ul>
<a name="Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB,
boolean reverseDirection)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a and b channels as digital inputs. This is used
in the case where the digital inputs are shared. The Encoder class will not allocate the
digital inputs and assume that they already are counted.
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sourceA</code> - The source that should be used for the a channel.</dd>
<dd><code>sourceB</code> - the source that should be used for the b channel.</dd>
<dd><code>reverseDirection</code> - represents the orientation of the encoder and inverts the output values
if necessary so forward represents positive values.</dd>
</dl>
</li>
</ul>
<a name="Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a and b channels as digital inputs. This is used
in the case where the digital inputs are shared. The Encoder class will not allocate the
digital inputs and assume that they already are counted.
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sourceA</code> - The source that should be used for the a channel.</dd>
<dd><code>sourceB</code> - the source that should be used for the b channel.</dd>
</dl>
</li>
</ul>
<a name="Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-boolean-edu.wpi.first.wpilibj.CounterBase.EncodingType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB,
boolean reverseDirection,
<a href="../../../../edu/wpi/first/wpilibj/CounterBase.EncodingType.html" title="enum in edu.wpi.first.wpilibj">CounterBase.EncodingType</a> encodingType)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a and b channels as digital inputs. This is used
in the case where the digital inputs are shared. The Encoder class will not allocate the
digital inputs and assume that they already are counted.
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sourceA</code> - The source that should be used for the a channel.</dd>
<dd><code>sourceB</code> - the source that should be used for the b channel.</dd>
<dd><code>reverseDirection</code> - represents the orientation of the encoder and inverts the output values
if necessary so forward represents positive values.</dd>
<dd><code>encodingType</code> - either k1X, k2X, or k4X to indicate 1X, 2X or 4X decoding. If 4X is
selected, then an encoder FPGA object is used and the returned counts
will be 4x the encoder spec'd value since all rising and falling edges
are counted. If 1X or 2X are selected then a m_counter object will be
used and the returned value will either exactly match the spec'd count
or be double (2x) the spec'd count.</dd>
</dl>
</li>
</ul>
<a name="Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> indexSource,
boolean reverseDirection)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a, b and index channels as digital inputs. This
is used in the case where the digital inputs are shared. The Encoder class will not allocate
the digital inputs and assume that they already are counted.
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sourceA</code> - The source that should be used for the a channel.</dd>
<dd><code>sourceB</code> - the source that should be used for the b channel.</dd>
<dd><code>indexSource</code> - the source that should be used for the index channel.</dd>
<dd><code>reverseDirection</code> - represents the orientation of the encoder and inverts the output values
if necessary so forward represents positive values.</dd>
</dl>
</li>
</ul>
<a name="Encoder-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Encoder</h4>
<pre>public Encoder(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceA,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> sourceB,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> indexSource)</pre>
<div class="block">Encoder constructor. Construct a Encoder given a, b and index channels as digital inputs. This
is used in the case where the digital inputs are shared. The Encoder class will not allocate
the digital inputs and assume that they already are counted.
<p>The encoder will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sourceA</code> - The source that should be used for the a channel.</dd>
<dd><code>sourceB</code> - the source that should be used for the b channel.</dd>
<dd><code>indexSource</code> - the source that should be used for the index channel.</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getFPGAIndex--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFPGAIndex</h4>
<pre>public int getFPGAIndex()</pre>
<div class="block">Get the FPGA index of the encoder.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The Encoder's FPGA index.</dd>
</dl>
</li>
</ul>
<a name="getEncodingScale--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEncodingScale</h4>
<pre>public int getEncodingScale()</pre>
<div class="block">Used to divide raw edge counts down to spec'd counts.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The encoding scale factor 1x, 2x, or 4x, per the requested encoding type.</dd>
</dl>
</li>
</ul>
<a name="free--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>free</h4>
<pre>public void free()</pre>
<div class="block">Free the resources used by this object.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#free--">free</a></code> in class <code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">SensorBase</a></code></dd>
</dl>
</li>
</ul>
<a name="getRaw--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRaw</h4>
<pre>public int getRaw()</pre>
<div class="block">Gets the raw value from the encoder. The raw value is the actual count unscaled by the 1x, 2x,
or 4x scale factor.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Current raw count from the encoder</dd>
</dl>
</li>
</ul>
<a name="get--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public int get()</pre>
<div class="block">Gets the current count. Returns the current count on the Encoder. This method compensates for
the decoding type.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#get--">get</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Current count from the Encoder adjusted for the 1x, 2x, or 4x scale factor.</dd>
</dl>
</li>
</ul>
<a name="reset--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reset</h4>
<pre>public void reset()</pre>
<div class="block">Reset the Encoder distance to zero. Resets the current count to zero on the encoder.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#reset--">reset</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
</dl>
</li>
</ul>
<a name="getPeriod--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPeriod</h4>
<pre>@Deprecated
public double getPeriod()</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Use getRate() in favor of this method.</span></div>
<div class="block">Returns the period of the most recent pulse. Returns the period of the most recent Encoder
pulse in seconds. This method compensates for the decoding type.
<p><b>Warning:</b> This returns unscaled periods. Use getRate() for rates that are scaled using
the value from setDistancePerPulse().</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#getPeriod--">getPeriod</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Period in seconds of the most recent pulse.</dd>
</dl>
</li>
</ul>
<a name="setMaxPeriod-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMaxPeriod</h4>
<pre>public void setMaxPeriod(double maxPeriod)</pre>
<div class="block">Sets the maximum period for stopped detection. Sets the value that represents the maximum
period of the Encoder before it will assume that the attached device is stopped. This timeout
allows users to determine if the wheels or other shaft has stopped rotating. This method
compensates for the decoding type.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#setMaxPeriod-double-">setMaxPeriod</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>maxPeriod</code> - The maximum time between rising and falling edges before the FPGA will report
the device stopped. This is expressed in seconds.</dd>
</dl>
</li>
</ul>
<a name="getStopped--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStopped</h4>
<pre>public boolean getStopped()</pre>
<div class="block">Determine if the encoder is stopped. Using the MaxPeriod value, a boolean is returned that is
true if the encoder is considered stopped and false if it is still moving. A stopped encoder is
one where the most recent pulse width exceeds the MaxPeriod.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#getStopped--">getStopped</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>True if the encoder is considered stopped.</dd>
</dl>
</li>
</ul>
<a name="getDirection--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDirection</h4>
<pre>public boolean getDirection()</pre>
<div class="block">The last direction the encoder value changed.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#getDirection--">getDirection</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The last direction the encoder value changed.</dd>
</dl>
</li>
</ul>
<a name="getDistance--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDistance</h4>
<pre>public double getDistance()</pre>
<div class="block">Get the distance the robot has driven since the last reset as scaled by the value from <a href="../../../../edu/wpi/first/wpilibj/Encoder.html#setDistancePerPulse-double-"><code>setDistancePerPulse(double)</code></a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The distance driven since the last reset</dd>
</dl>
</li>
</ul>
<a name="getRate--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRate</h4>
<pre>public double getRate()</pre>
<div class="block">Get the current rate of the encoder. Units are distance per second as scaled by the value from
setDistancePerPulse().</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The current rate of the encoder.</dd>
</dl>
</li>
</ul>
<a name="setMinRate-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMinRate</h4>
<pre>public void setMinRate(double minRate)</pre>
<div class="block">Set the minimum rate of the device before the hardware reports it stopped.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>minRate</code> - The minimum rate. The units are in distance per second as scaled by the value
from setDistancePerPulse().</dd>
</dl>
</li>
</ul>
<a name="setDistancePerPulse-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDistancePerPulse</h4>
<pre>public void setDistancePerPulse(double distancePerPulse)</pre>
<div class="block">Set the distance per pulse for this encoder. This sets the multiplier used to determine the
distance driven based on the count value from the encoder. Do not include the decoding type in
this scale. The library already compensates for the decoding type. Set this value based on the
encoder's rated Pulses per Revolution and factor in gearing reductions following the encoder
shaft. This distance can be in any units you like, linear or angular.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>distancePerPulse</code> - The scale factor that will be used to convert pulses to useful units.</dd>
</dl>
</li>
</ul>
<a name="setReverseDirection-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setReverseDirection</h4>
<pre>public void setReverseDirection(boolean reverseDirection)</pre>
<div class="block">Set the direction sensing for this encoder. This sets the direction sensing on the encoder so
that it could count in the correct software direction regardless of the mounting.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>reverseDirection</code> - true if the encoder direction should be reversed</dd>
</dl>
</li>
</ul>
<a name="setSamplesToAverage-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSamplesToAverage</h4>
<pre>public void setSamplesToAverage(int samplesToAverage)</pre>
<div class="block">Set the Samples to Average which specifies the number of samples of the timer to average when
calculating the period. Perform averaging to account for mechanical imperfections or as
oversampling to increase resolution.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>samplesToAverage</code> - The number of samples to average from 1 to 127.</dd>
</dl>
</li>
</ul>
<a name="getSamplesToAverage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSamplesToAverage</h4>
<pre>public int getSamplesToAverage()</pre>
<div class="block">Get the Samples to Average which specifies the number of samples of the timer to average when
calculating the period. Perform averaging to account for mechanical imperfections or as
oversampling to increase resolution.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>SamplesToAverage The number of samples being averaged (from 1 to 127)</dd>
</dl>
</li>
</ul>
<a name="setPIDSourceType-edu.wpi.first.wpilibj.PIDSourceType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPIDSourceType</h4>
<pre>public void setPIDSourceType(<a href="../../../../edu/wpi/first/wpilibj/PIDSourceType.html" title="enum in edu.wpi.first.wpilibj">PIDSourceType</a> pidSource)</pre>
<div class="block">Set which parameter of the encoder you are using as a process control variable. The encoder
class supports the rate and distance parameters.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#setPIDSourceType-edu.wpi.first.wpilibj.PIDSourceType-">setPIDSourceType</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>pidSource</code> - An enum to select the parameter.</dd>
</dl>
</li>
</ul>
<a name="getPIDSourceType--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPIDSourceType</h4>
<pre>public <a href="../../../../edu/wpi/first/wpilibj/PIDSourceType.html" title="enum in edu.wpi.first.wpilibj">PIDSourceType</a> getPIDSourceType()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#getPIDSourceType--">PIDSource</a></code></span></div>
<div class="block">Get which parameter of the device you are using as a process control variable.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#getPIDSourceType--">getPIDSourceType</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the currently selected PID source parameter</dd>
</dl>
</li>
</ul>
<a name="pidGet--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pidGet</h4>
<pre>public double pidGet()</pre>
<div class="block">Implement the PIDSource interface.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#pidGet--">pidGet</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The current value of the selected source parameter.</dd>
</dl>
</li>
</ul>
<a name="setIndexSource-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setIndexSource</h4>
<pre>public void setIndexSource(int channel)</pre>
<div class="block">Set the index source for the encoder. When this source is activated, the encoder count
automatically resets.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channel</code> - A DIO channel to set as the encoder index</dd>
</dl>
</li>
</ul>
<a name="setIndexSource-edu.wpi.first.wpilibj.DigitalSource-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setIndexSource</h4>
<pre>public void setIndexSource(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source)</pre>
<div class="block">Set the index source for the encoder. When this source is activated, the encoder count
automatically resets.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>source</code> - A digital source to set as the encoder index</dd>
</dl>
</li>
</ul>
<a name="setIndexSource-int-edu.wpi.first.wpilibj.Encoder.IndexingType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setIndexSource</h4>
<pre>public void setIndexSource(int channel,
<a href="../../../../edu/wpi/first/wpilibj/Encoder.IndexingType.html" title="enum in edu.wpi.first.wpilibj">Encoder.IndexingType</a> type)</pre>
<div class="block">Set the index source for the encoder. When this source rises, the encoder count automatically
resets.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channel</code> - A DIO channel to set as the encoder index</dd>
<dd><code>type</code> - The state that will cause the encoder to reset</dd>
</dl>
</li>
</ul>
<a name="setIndexSource-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.Encoder.IndexingType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setIndexSource</h4>
<pre>public void setIndexSource(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source,
<a href="../../../../edu/wpi/first/wpilibj/Encoder.IndexingType.html" title="enum in edu.wpi.first.wpilibj">Encoder.IndexingType</a> type)</pre>
<div class="block">Set the index source for the encoder. When this source rises, the encoder count automatically
resets.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>source</code> - A digital source to set as the encoder index</dd>
<dd><code>type</code> - The state that will cause the encoder to reset</dd>
</dl>
</li>
</ul>
<a name="getSmartDashboardType--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSmartDashboardType</h4>
<pre>public java.lang.String getSmartDashboardType()</pre>
<div class="block">Live Window code, only does anything if live window is activated.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html#getSmartDashboardType--">getSmartDashboardType</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj">Sendable</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The type of this <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj"><code>Sendable</code></a>.</dd>
</dl>
</li>
</ul>
<a name="initTable-edu.wpi.first.networktables.NetworkTable-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initTable</h4>
<pre>public void initTable(<a href="../../../../edu/wpi/first/networktables/NetworkTable.html" title="class in edu.wpi.first.networktables">NetworkTable</a> subtable)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html#initTable-edu.wpi.first.networktables.NetworkTable-">Sendable</a></code></span></div>
<div class="block">Initializes a table for this <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj"><code>Sendable</code></a> object.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html#initTable-edu.wpi.first.networktables.NetworkTable-">initTable</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj">Sendable</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>subtable</code> - The table to put the values in.</dd>
</dl>
</li>
</ul>
<a name="updateTable--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>updateTable</h4>
<pre>public void updateTable()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#updateTable--">LiveWindowSendable</a></code></span></div>
<div class="block">Update the table for this sendable object with the latest values.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#updateTable--">updateTable</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a></code></dd>
</dl>
</li>
</ul>
<a name="startLiveWindowMode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>startLiveWindowMode</h4>
<pre>public void startLiveWindowMode()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#startLiveWindowMode--">LiveWindowSendable</a></code></span></div>
<div class="block">Start having this sendable object automatically respond to value changes reflect the value on
the table.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#startLiveWindowMode--">startLiveWindowMode</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a></code></dd>
</dl>
</li>
</ul>
<a name="stopLiveWindowMode--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>stopLiveWindowMode</h4>
<pre>public void stopLiveWindowMode()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#stopLiveWindowMode--">LiveWindowSendable</a></code></span></div>
<div class="block">Stop having this sendable object automatically respond to value changes.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#stopLiveWindowMode--">stopLiveWindowMode</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/wpi/first/wpilibj/DriverStation.Alliance.html" title="enum in edu.wpi.first.wpilibj"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../edu/wpi/first/wpilibj/Encoder.IndexingType.html" title="enum in edu.wpi.first.wpilibj"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/wpi/first/wpilibj/Encoder.html" target="_top">Frames</a></li>
<li><a href="Encoder.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>