Skip to content

Commit

Permalink
updated control algorithms to work better with NetworkTables
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam-Belliveau committed Apr 3, 2021
1 parent 9030c8d commit 7b69970
Show file tree
Hide file tree
Showing 21 changed files with 378 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
35 changes: 33 additions & 2 deletions docs/com/stuypulse/stuylib/control/BangBangController.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
catch(err) {
}
//-->
var data = {"i0":10};
var data = {"i0":10,"i1":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
Expand Down Expand Up @@ -134,6 +134,10 @@ <h2 title="Class BangBangController" class="title">Class BangBangController</h2>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code>edu.wpi.first.wpilibj.Sendable</code></dd>
</dl>
<hr>
<pre>public class <span class="typeNameLabel">BangBangController</span>
extends <a href="Controller.html" title="class in com.stuypulse.stuylib.control">Controller</a></pre>
Expand Down Expand Up @@ -208,6 +212,11 @@ <h3>Method Summary</h3>
<div class="block">Update the controller with the error just measured</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder)">initSendable</a></span>&#8203;(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder&nbsp;builder)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.com.stuypulse.stuylib.control.Controller">
Expand All @@ -223,6 +232,13 @@ <h3>Methods inherited from class&nbsp;com.stuypulse.stuylib.control.<a href="Con
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.edu.wpi.first.wpilibj.Sendable">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;edu.wpi.first.wpilibj.Sendable</h3>
<code>addChild, getName, getSubsystem, setName, setName, setName, setName, setSubsystem</code></li>
</ul>
</li>
</ul>
</section>
Expand Down Expand Up @@ -294,7 +310,7 @@ <h3>Method Detail</h3>
<a id="calculate(double)">
<!-- -->
</a>
<ul class="blockListLast">
<ul class="blockList">
<li class="blockList">
<h4>calculate</h4>
<pre class="methodSignature">public&nbsp;double&nbsp;calculate&#8203;(double&nbsp;error)</pre>
Expand All @@ -311,6 +327,21 @@ <h4>calculate</h4>
</dl>
</li>
</ul>
<a id="initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>initSendable</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;initSendable&#8203;(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder&nbsp;builder)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>initSendable</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.Sendable</code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="Controller.html#initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder)">initSendable</a></code>&nbsp;in class&nbsp;<code><a href="Controller.html" title="class in com.stuypulse.stuylib.control">Controller</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
Expand Down
50 changes: 40 additions & 10 deletions docs/com/stuypulse/stuylib/control/Controller.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
catch(err) {
}
//-->
var data = {"i0":6,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10};
var data = {"i0":6,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
Expand Down Expand Up @@ -130,12 +130,17 @@ <h2 title="Class Controller" class="title">Class Controller</h2>
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code>edu.wpi.first.wpilibj.Sendable</code></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="BangBangController.html" title="class in com.stuypulse.stuylib.control">BangBangController</a></code>, <code><a href="PIDCalculator.html" title="class in com.stuypulse.stuylib.control">PIDCalculator</a></code>, <code><a href="PIDController.html" title="class in com.stuypulse.stuylib.control">PIDController</a></code>, <code><a href="TBHController.html" title="class in com.stuypulse.stuylib.control">TBHController</a></code></dd>
</dl>
<hr>
<pre>public abstract class <span class="typeNameLabel">Controller</span>
extends java.lang.Object</pre>
extends java.lang.Object
implements edu.wpi.first.wpilibj.Sendable</pre>
<div class="block">The controller class is an abstract class that is used to create different controllers. All a
class will need to do is implement calculate(double error), and then the user would use the
update() functions, which work as a sort of wrapper for the controllers. No matter what
Expand Down Expand Up @@ -233,57 +238,62 @@ <h3>Method Summary</h3>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder)">initSendable</a></span>&#8203;(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder&nbsp;builder)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isDone(double)">isDone</a></span>&#8203;(double&nbsp;maxError)</code></th>
<td class="colLast">
<div class="block">Get whether or not the Controller has arrived at the target.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<tr id="i8" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isDone(double,double)">isDone</a></span>&#8203;(double&nbsp;maxError,
double&nbsp;maxVelocity)</code></th>
<td class="colLast">
<div class="block">Get whether or not the Controller has arrived at the target.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<tr id="i9" class="rowColor">
<td class="colFirst"><code><a href="Controller.html" title="class in com.stuypulse.stuylib.control">Controller</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setErrorFilter(com.stuypulse.stuylib.streams.filters.IFilter)">setErrorFilter</a></span>&#8203;(<a href="../streams/filters/IFilter.html" title="interface in com.stuypulse.stuylib.streams.filters">IFilter</a>&nbsp;filter)</code></th>
<td class="colLast">
<div class="block">Lets you specify a filter that will be applied to all measurements that are given to the
controller.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<tr id="i10" class="altColor">
<td class="colFirst"><code><a href="Controller.html" title="class in com.stuypulse.stuylib.control">Controller</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setOutputFilter(com.stuypulse.stuylib.streams.filters.IFilter)">setOutputFilter</a></span>&#8203;(<a href="../streams/filters/IFilter.html" title="interface in com.stuypulse.stuylib.streams.filters">IFilter</a>&nbsp;filter)</code></th>
<td class="colLast">
<div class="block">Lets you specify a filter that will be applied to all of the outputs of the controller.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<tr id="i11" class="rowColor">
<td class="colFirst"><code><a href="Controller.html" title="class in com.stuypulse.stuylib.control">Controller</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setVelocityFilter(com.stuypulse.stuylib.streams.filters.IFilter)">setVelocityFilter</a></span>&#8203;(<a href="../streams/filters/IFilter.html" title="interface in com.stuypulse.stuylib.streams.filters">IFilter</a>&nbsp;filter)</code></th>
<td class="colLast">
<div class="block">Lets you specify a filter that will be applied to the velocity measurements.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<tr id="i12" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
<td class="colLast">
<div class="block">Default to string funciton</div>
</td>
</tr>
<tr id="i12" class="altColor">
<tr id="i13" class="rowColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(double)">update</a></span>&#8203;(double&nbsp;error)</code></th>
<td class="colLast">
<div class="block">Update the controller with the error from the destination that you want to reach</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<tr id="i14" class="altColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update(double,double)">update</a></span>&#8203;(double&nbsp;setpoint,
double&nbsp;measurement)</code></th>
Expand All @@ -300,6 +310,13 @@ <h3>Method Summary</h3>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.edu.wpi.first.wpilibj.Sendable">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;edu.wpi.first.wpilibj.Sendable</h3>
<code>addChild, getName, getSubsystem, setName, setName, setName, setName, setSubsystem</code></li>
</ul>
</li>
</ul>
</section>
Expand Down Expand Up @@ -576,7 +593,7 @@ <h4>calculate</h4>
<a id="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre class="methodSignature">public&nbsp;java.lang.String&nbsp;toString()</pre>
Expand All @@ -587,6 +604,19 @@ <h4>toString</h4>
</dl>
</li>
</ul>
<a id="initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>initSendable</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;initSendable&#8203;(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder&nbsp;builder)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>initSendable</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.Sendable</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
Expand Down
37 changes: 34 additions & 3 deletions docs/com/stuypulse/stuylib/control/PIDCalculator.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10};
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
Expand Down Expand Up @@ -134,6 +134,10 @@ <h2 title="Class PIDCalculator" class="title">Class PIDCalculator</h2>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code>edu.wpi.first.wpilibj.Sendable</code></dd>
</dl>
<hr>
<pre>public class <span class="typeNameLabel">PIDCalculator</span>
extends <a href="Controller.html" title="class in com.stuypulse.stuylib.control">Controller</a></pre>
Expand Down Expand Up @@ -224,11 +228,16 @@ <h3>Method Summary</h3>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder)">initSendable</a></span>&#8203;(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder&nbsp;builder)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="PIDCalculator.html" title="class in com.stuypulse.stuylib.control">PIDCalculator</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setControlSpeed(java.lang.Number)">setControlSpeed</a></span>&#8203;(java.lang.Number&nbsp;speed)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i8" class="altColor">
<tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
<td class="colLast">
Expand All @@ -250,6 +259,13 @@ <h3>Methods inherited from class&nbsp;com.stuypulse.stuylib.control.<a href="Con
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.edu.wpi.first.wpilibj.Sendable">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;edu.wpi.first.wpilibj.Sendable</h3>
<code>addChild, getName, getSubsystem, setName, setName, setName, setName, setSubsystem</code></li>
</ul>
</li>
</ul>
</section>
Expand Down Expand Up @@ -406,7 +422,7 @@ <h4>getPController</h4>
<a id="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre class="methodSignature">public&nbsp;java.lang.String&nbsp;toString()</pre>
Expand All @@ -420,6 +436,21 @@ <h4>toString</h4>
</dl>
</li>
</ul>
<a id="initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>initSendable</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;initSendable&#8203;(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder&nbsp;builder)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>initSendable</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.Sendable</code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="Controller.html#initSendable(edu.wpi.first.wpilibj.smartdashboard.SendableBuilder)">initSendable</a></code>&nbsp;in class&nbsp;<code><a href="Controller.html" title="class in com.stuypulse.stuylib.control">Controller</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
Expand Down
Loading

0 comments on commit 7b69970

Please sign in to comment.