Updated YAGSL

This commit is contained in:
thenetworkgrinch
2023-02-22 20:50:16 -06:00
parent 8bfa4a8824
commit dd7d432e90
111 changed files with 497 additions and 276 deletions

View File

@@ -1,11 +1,11 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Feb 21 22:36:27 CST 2023 -->
<!-- Generated by javadoc (17) on Wed Feb 22 20:48:44 CST 2023 -->
<title>SwerveController</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2023-02-21">
<meta name="dc.created" content="2023-02-22">
<meta name="description" content="declaration: package: swervelib, class: SwerveController">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
@@ -91,22 +91,37 @@ loadScripts(document, 'script');</script>
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>final <a href="parser/SwerveControllerConfiguration.html" title="class in swervelib.parser">SwerveControllerConfiguration</a></code></div>
<div class="col-second even-row-color"><code><a href="#config" class="member-name-link">config</a></code></div>
<div class="col-first even-row-color"><code>edu.wpi.first.math.filter.SlewRateLimiter</code></div>
<div class="col-second even-row-color"><code><a href="#angleLimiter" class="member-name-link">angleLimiter</a></code></div>
<div class="col-last even-row-color">
<div class="block"><code>SlewRateLimiter</code> for angular movement in radians/second.</div>
</div>
<div class="col-first odd-row-color"><code>final <a href="parser/SwerveControllerConfiguration.html" title="class in swervelib.parser">SwerveControllerConfiguration</a></code></div>
<div class="col-second odd-row-color"><code><a href="#config" class="member-name-link">config</a></code></div>
<div class="col-last odd-row-color">
<div class="block"><a href="parser/SwerveControllerConfiguration.html" title="class in swervelib.parser"><code>SwerveControllerConfiguration</code></a> object storing data to generate the <code>PIDController</code> for controlling the
robot heading, and deadband for heading joystick.</div>
</div>
<div class="col-first odd-row-color"><code>double</code></div>
<div class="col-second odd-row-color"><code><a href="#lastAngle" class="member-name-link">lastAngle</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Last angle to robot was set to.</div>
</div>
<div class="col-first even-row-color"><code>private final edu.wpi.first.math.controller.PIDController</code></div>
<div class="col-second even-row-color"><code><a href="#thetaController" class="member-name-link">thetaController</a></code></div>
<div class="col-first even-row-color"><code>double</code></div>
<div class="col-second even-row-color"><code><a href="#lastAngleScalar" class="member-name-link">lastAngleScalar</a></code></div>
<div class="col-last even-row-color">
<div class="block">Last angle as a scalar [-1,1] the robot was set to.</div>
</div>
<div class="col-first odd-row-color"><code>private final edu.wpi.first.math.controller.PIDController</code></div>
<div class="col-second odd-row-color"><code><a href="#thetaController" class="member-name-link">thetaController</a></code></div>
<div class="col-last odd-row-color">
<div class="block">PID Controller for the robot heading.</div>
</div>
<div class="col-first even-row-color"><code>edu.wpi.first.math.filter.SlewRateLimiter</code></div>
<div class="col-second even-row-color"><code><a href="#xLimiter" class="member-name-link">xLimiter</a></code></div>
<div class="col-last even-row-color">
<div class="block"><code>SlewRateLimiter</code> for movement in the X direction in meters/second.</div>
</div>
<div class="col-first odd-row-color"><code>edu.wpi.first.math.filter.SlewRateLimiter</code></div>
<div class="col-second odd-row-color"><code><a href="#yLimiter" class="member-name-link">yLimiter</a></code></div>
<div class="col-last odd-row-color">
<div class="block"><code>SlewRateLimiter</code> for movement in the Y direction in meters/second.</div>
</div>
</div>
</section>
</li>
@@ -137,32 +152,54 @@ loadScripts(document, 'script');</script>
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addSlewRateLimiters(edu.wpi.first.math.filter.SlewRateLimiter,edu.wpi.first.math.filter.SlewRateLimiter,edu.wpi.first.math.filter.SlewRateLimiter)" class="member-name-link">addSlewRateLimiters</a><wbr>(edu.wpi.first.math.filter.SlewRateLimiter&nbsp;x,
edu.wpi.first.math.filter.SlewRateLimiter&nbsp;y,
edu.wpi.first.math.filter.SlewRateLimiter&nbsp;angle)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Add slew rate limiters to all controls.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>edu.wpi.first.math.kinematics.ChassisSpeeds</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getRawTargetSpeeds(double,double,double)" class="member-name-link">getRawTargetSpeeds</a><wbr>(double&nbsp;xSpeed,
double&nbsp;ySpeed,
double&nbsp;omega)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the <code>ChassisSpeeds</code> based of raw speeds desired in meters/second and heading in radians.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>edu.wpi.first.math.kinematics.ChassisSpeeds</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getTargetSpeeds(double,double,double,double)" class="member-name-link">getTargetSpeeds</a><wbr>(double&nbsp;xInput,
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getRawTargetSpeeds(double,double,double,double)" class="member-name-link">getRawTargetSpeeds</a><wbr>(double&nbsp;xSpeed,
double&nbsp;ySpeed,
double&nbsp;targetHeadingAngleRadians,
double&nbsp;currentHeadingAngleRadians)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the <code>ChassisSpeeds</code> based of raw speeds desired in meters/second and heading in radians.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>edu.wpi.first.math.kinematics.ChassisSpeeds</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getTargetSpeeds(double,double,double,double)" class="member-name-link">getTargetSpeeds</a><wbr>(double&nbsp;xInput,
double&nbsp;yInput,
double&nbsp;angle,
double&nbsp;currentHeadingAngleRadians)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the chassis speeds based on controller input of 1 joystick and a angle.</div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the chassis speeds based on controller input of 1 joystick and an angle.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>edu.wpi.first.math.kinematics.ChassisSpeeds</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getTargetSpeeds(double,double,double,double,double)" class="member-name-link">getTargetSpeeds</a><wbr>(double&nbsp;xInput,
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>edu.wpi.first.math.kinematics.ChassisSpeeds</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getTargetSpeeds(double,double,double,double,double)" class="member-name-link">getTargetSpeeds</a><wbr>(double&nbsp;xInput,
double&nbsp;yInput,
double&nbsp;headingX,
double&nbsp;headingY,
double&nbsp;currentHeadingAngleRadians)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the chassis speeds based on controller input of 2 joysticks.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static edu.wpi.first.math.geometry.Translation2d</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#getTranslation2d(edu.wpi.first.math.kinematics.ChassisSpeeds)" class="member-name-link">getTranslation2d</a><wbr>(edu.wpi.first.math.kinematics.ChassisSpeeds&nbsp;speeds)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static edu.wpi.first.math.geometry.Translation2d</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#getTranslation2d(edu.wpi.first.math.kinematics.ChassisSpeeds)" class="member-name-link">getTranslation2d</a><wbr>(edu.wpi.first.math.kinematics.ChassisSpeeds&nbsp;speeds)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Helper function to get the <code>Translation2d</code> of the chassis speeds given the <code>ChassisSpeeds</code>.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#withinHypotDeadband(double,double)" class="member-name-link">withinHypotDeadband</a><wbr>(double&nbsp;x,
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#withinHypotDeadband(double,double)" class="member-name-link">withinHypotDeadband</a><wbr>(double&nbsp;x,
double&nbsp;y)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Calculate the hypot deadband and check if the joystick is within it.</div>
</div>
</div>
@@ -198,10 +235,31 @@ loadScripts(document, 'script');</script>
</section>
</li>
<li>
<section class="detail" id="lastAngle">
<h3>lastAngle</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">lastAngle</span></div>
<div class="block">Last angle to robot was set to.</div>
<section class="detail" id="lastAngleScalar">
<h3>lastAngleScalar</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">lastAngleScalar</span></div>
<div class="block">Last angle as a scalar [-1,1] the robot was set to.</div>
</section>
</li>
<li>
<section class="detail" id="xLimiter">
<h3>xLimiter</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">edu.wpi.first.math.filter.SlewRateLimiter</span>&nbsp;<span class="element-name">xLimiter</span></div>
<div class="block"><code>SlewRateLimiter</code> for movement in the X direction in meters/second.</div>
</section>
</li>
<li>
<section class="detail" id="yLimiter">
<h3>yLimiter</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">edu.wpi.first.math.filter.SlewRateLimiter</span>&nbsp;<span class="element-name">yLimiter</span></div>
<div class="block"><code>SlewRateLimiter</code> for movement in the Y direction in meters/second.</div>
</section>
</li>
<li>
<section class="detail" id="angleLimiter">
<h3>angleLimiter</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">edu.wpi.first.math.filter.SlewRateLimiter</span>&nbsp;<span class="element-name">angleLimiter</span></div>
<div class="block"><code>SlewRateLimiter</code> for angular movement in radians/second.</div>
</section>
</li>
</ul>
@@ -246,6 +304,22 @@ loadScripts(document, 'script');</script>
</section>
</li>
<li>
<section class="detail" id="addSlewRateLimiters(edu.wpi.first.math.filter.SlewRateLimiter,edu.wpi.first.math.filter.SlewRateLimiter,edu.wpi.first.math.filter.SlewRateLimiter)">
<h3>addSlewRateLimiters</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">addSlewRateLimiters</span><wbr><span class="parameters">(edu.wpi.first.math.filter.SlewRateLimiter&nbsp;x,
edu.wpi.first.math.filter.SlewRateLimiter&nbsp;y,
edu.wpi.first.math.filter.SlewRateLimiter&nbsp;angle)</span></div>
<div class="block">Add slew rate limiters to all controls. This prevents the robot from ramping up too much. To disable a
<code>SlewRateLimiter</code> set the desired one to null.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>x</code> - The <code>SlewRateLimiter</code> for the X velocity in meters/second.</dd>
<dd><code>y</code> - The <code>SlewRateLimiter</code> for the Y velocity in meters/second.</dd>
<dd><code>angle</code> - The <code>SlewRateLimiter</code> for the angular velocity in radians/second.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="withinHypotDeadband(double,double)">
<h3>withinHypotDeadband</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">withinHypotDeadband</span><wbr><span class="parameters">(double&nbsp;x,
@@ -268,7 +342,8 @@ loadScripts(document, 'script');</script>
double&nbsp;yInput,
double&nbsp;angle,
double&nbsp;currentHeadingAngleRadians)</span></div>
<div class="block">Get the chassis speeds based on controller input of 1 joystick and a angle.</div>
<div class="block">Get the chassis speeds based on controller input of 1 joystick and an angle. Cubes the x and y input for smoother
motion.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>xInput</code> - X joystick input for the robot to move in the X direction.</dd>
@@ -302,6 +377,42 @@ loadScripts(document, 'script');</script>
</dl>
</section>
</li>
<li>
<section class="detail" id="getRawTargetSpeeds(double,double,double)">
<h3>getRawTargetSpeeds</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">edu.wpi.first.math.kinematics.ChassisSpeeds</span>&nbsp;<span class="element-name">getRawTargetSpeeds</span><wbr><span class="parameters">(double&nbsp;xSpeed,
double&nbsp;ySpeed,
double&nbsp;omega)</span></div>
<div class="block">Get the <code>ChassisSpeeds</code> based of raw speeds desired in meters/second and heading in radians.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>xSpeed</code> - X speed in meters per second.</dd>
<dd><code>ySpeed</code> - Y speed in meters per second.</dd>
<dd><code>omega</code> - Angular velocity in radians/second.</dd>
<dt>Returns:</dt>
<dd><code>ChassisSpeeds</code> the robot should move to.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getRawTargetSpeeds(double,double,double,double)">
<h3>getRawTargetSpeeds</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">edu.wpi.first.math.kinematics.ChassisSpeeds</span>&nbsp;<span class="element-name">getRawTargetSpeeds</span><wbr><span class="parameters">(double&nbsp;xSpeed,
double&nbsp;ySpeed,
double&nbsp;targetHeadingAngleRadians,
double&nbsp;currentHeadingAngleRadians)</span></div>
<div class="block">Get the <code>ChassisSpeeds</code> based of raw speeds desired in meters/second and heading in radians.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>xSpeed</code> - X speed in meters per second.</dd>
<dd><code>ySpeed</code> - Y speed in meters per second.</dd>
<dd><code>targetHeadingAngleRadians</code> - Target heading in radians.</dd>
<dd><code>currentHeadingAngleRadians</code> - Current heading in radians.</dd>
<dt>Returns:</dt>
<dd><code>ChassisSpeeds</code> the robot should move to.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>