Fixed issue with angle optimization

This commit is contained in:
thenetworkgrinch
2023-08-29 19:59:07 -05:00
parent 38c7bdba7d
commit 12f6e0ed38
138 changed files with 8913 additions and 1020 deletions

View File

@@ -1,17 +1,18 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>SwerveModule (YAGSL-Lib API)</title>
<!-- Generated by javadoc (17) on Tue Aug 29 19:54:45 CDT 2023 -->
<title>SwerveModule</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-08-29">
<meta name="description" content="declaration: package: swervelib, class: SwerveModule">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../script.js"></script>
<script type="text/javascript" src="../script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
@@ -35,7 +36,7 @@ loadScripts(document, 'script');</script>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../index-all.html">Index</a></li>
<li><a href="../index-files/index-1.html">Index</a></li>
<li><a href="../help-doc.html#class">Help</a></li>
</ul>
</div>
@@ -90,11 +91,31 @@ 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/SwerveModuleConfiguration.html" title="class in swervelib.parser">SwerveModuleConfiguration</a></code></div>
<div class="col-second even-row-color"><code><a href="#configuration" class="member-name-link">configuration</a></code></div>
<div class="col-first even-row-color"><code>private final <a href="encoders/SwerveAbsoluteEncoder.html" title="class in swervelib.encoders">SwerveAbsoluteEncoder</a></code></div>
<div class="col-second even-row-color"><code><a href="#absoluteEncoder" class="member-name-link">absoluteEncoder</a></code></div>
<div class="col-last even-row-color">
<div class="block">Absolute encoder for swerve drive.</div>
</div>
<div class="col-first odd-row-color"><code>private final <a href="motors/SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></div>
<div class="col-second odd-row-color"><code><a href="#angleMotor" class="member-name-link">angleMotor</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Swerve Motors.</div>
</div>
<div class="col-first even-row-color"><code>private final double</code></div>
<div class="col-second even-row-color"><code><a href="#angleOffset" class="member-name-link">angleOffset</a></code></div>
<div class="col-last even-row-color">
<div class="block">Angle offset from the absolute encoder.</div>
</div>
<div class="col-first odd-row-color"><code>final <a href="parser/SwerveModuleConfiguration.html" title="class in swervelib.parser">SwerveModuleConfiguration</a></code></div>
<div class="col-second odd-row-color"><code><a href="#configuration" class="member-name-link">configuration</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Swerve module configuration options.</div>
</div>
<div class="col-first even-row-color"><code>private final <a href="motors/SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></div>
<div class="col-second even-row-color"><code><a href="#driveMotor" class="member-name-link">driveMotor</a></code></div>
<div class="col-last even-row-color">
<div class="block">Swerve Motors.</div>
</div>
<div class="col-first odd-row-color"><code>edu.wpi.first.math.controller.SimpleMotorFeedforward</code></div>
<div class="col-second odd-row-color"><code><a href="#feedforward" class="member-name-link">feedforward</a></code></div>
<div class="col-last odd-row-color">
@@ -113,8 +134,18 @@ loadScripts(document, 'script');</script>
<div class="col-first even-row-color"><code>boolean</code></div>
<div class="col-second even-row-color"><code><a href="#moduleStateOptimization" class="member-name-link">moduleStateOptimization</a></code></div>
<div class="col-last even-row-color">
<div class="block">Enable <a href="math/SwerveModuleState2.html" title="class in swervelib.math"><code>SwerveModuleState2</code></a> optimizations so the angle is reversed and speed is reversed
to ensure the module never turns more than 90deg.</div>
<div class="block">Enable <a href="math/SwerveModuleState2.html" title="class in swervelib.math"><code>SwerveModuleState2</code></a> optimizations so the angle is reversed and speed is reversed to ensure the module
never turns more than 90deg.</div>
</div>
<div class="col-first odd-row-color"><code>private <a href="simulation/SwerveModuleSimulation.html" title="class in swervelib.simulation">SwerveModuleSimulation</a></code></div>
<div class="col-second odd-row-color"><code><a href="#simModule" class="member-name-link">simModule</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Simulated swerve module.</div>
</div>
<div class="col-first even-row-color"><code>private boolean</code></div>
<div class="col-second even-row-color"><code><a href="#synchronizeEncoderQueued" class="member-name-link">synchronizeEncoderQueued</a></code></div>
<div class="col-last even-row-color">
<div class="block">Encoder synchronization queued.</div>
</div>
</div>
</section>
@@ -159,8 +190,7 @@ loadScripts(document, 'script');</script>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="parser/SwerveModuleConfiguration.html" title="class in swervelib.parser">SwerveModuleConfiguration</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getConfiguration()" class="member-name-link">getConfiguration</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Fetch the <a href="parser/SwerveModuleConfiguration.html" title="class in swervelib.parser"><code>SwerveModuleConfiguration</code></a> for the <a href="SwerveModule.html" title="class in swervelib"><code>SwerveModule</code></a> with the parsed
configurations.</div>
<div class="block">Fetch the <a href="parser/SwerveModuleConfiguration.html" title="class in swervelib.parser"><code>SwerveModuleConfiguration</code></a> for the <a href="SwerveModule.html" title="class in swervelib"><code>SwerveModule</code></a> with the parsed configurations.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="motors/SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getDriveMotor()" class="member-name-link">getDriveMotor</a>()</code></div>
@@ -229,11 +259,38 @@ loadScripts(document, 'script');</script>
</section>
</li>
<li>
<section class="detail" id="angleOffset">
<h3>angleOffset</h3>
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">angleOffset</span></div>
<div class="block">Angle offset from the absolute encoder.</div>
</section>
</li>
<li>
<section class="detail" id="angleMotor">
<h3>angleMotor</h3>
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="motors/SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></span>&nbsp;<span class="element-name">angleMotor</span></div>
<div class="block">Swerve Motors.</div>
</section>
</li>
<li>
<section class="detail" id="driveMotor">
<h3>driveMotor</h3>
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="motors/SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></span>&nbsp;<span class="element-name">driveMotor</span></div>
<div class="block">Swerve Motors.</div>
</section>
</li>
<li>
<section class="detail" id="absoluteEncoder">
<h3>absoluteEncoder</h3>
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="encoders/SwerveAbsoluteEncoder.html" title="class in swervelib.encoders">SwerveAbsoluteEncoder</a></span>&nbsp;<span class="element-name">absoluteEncoder</span></div>
<div class="block">Absolute encoder for swerve drive.</div>
</section>
</li>
<li>
<section class="detail" id="moduleNumber">
<h3>moduleNumber</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">moduleNumber</span></div>
<div class="block">Module number for kinematics, usually 0 to 3. front left -> front right -> back left -> back
right.</div>
<div class="block">Module number for kinematics, usually 0 to 3. front left -> front right -> back left -> back right.</div>
</section>
</li>
<li>
@@ -254,8 +311,22 @@ loadScripts(document, 'script');</script>
<section class="detail" id="moduleStateOptimization">
<h3>moduleStateOptimization</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">moduleStateOptimization</span></div>
<div class="block">Enable <a href="math/SwerveModuleState2.html" title="class in swervelib.math"><code>SwerveModuleState2</code></a> optimizations so the angle is reversed and speed is reversed
to ensure the module never turns more than 90deg.</div>
<div class="block">Enable <a href="math/SwerveModuleState2.html" title="class in swervelib.math"><code>SwerveModuleState2</code></a> optimizations so the angle is reversed and speed is reversed to ensure the module
never turns more than 90deg.</div>
</section>
</li>
<li>
<section class="detail" id="simModule">
<h3>simModule</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="simulation/SwerveModuleSimulation.html" title="class in swervelib.simulation">SwerveModuleSimulation</a></span>&nbsp;<span class="element-name">simModule</span></div>
<div class="block">Simulated swerve module.</div>
</section>
</li>
<li>
<section class="detail" id="synchronizeEncoderQueued">
<h3>synchronizeEncoderQueued</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">synchronizeEncoderQueued</span></div>
<div class="block">Encoder synchronization queued.</div>
</section>
</li>
</ul>
@@ -300,15 +371,14 @@ loadScripts(document, 'script');</script>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setDesiredState</span><wbr><span class="parameters">(<a href="math/SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a>&nbsp;desiredState,
boolean&nbsp;isOpenLoop,
boolean&nbsp;force)</span></div>
<div class="block">Set the desired state of the swerve module. <br>
<b>WARNING: If you are not using one of the functions from <a href="SwerveDrive.html" title="class in swervelib"><code>SwerveDrive</code></a> you may screw up
<a href="SwerveDrive.html#kinematics"><code>SwerveDrive.kinematics</code></a></b></div>
<div class="block">Set the desired state of the swerve module. <br/><b>WARNING: If you are not using one of the functions from
<a href="SwerveDrive.html" title="class in swervelib"><code>SwerveDrive</code></a> you may screw up <a href="SwerveDrive.html#kinematics"><code>SwerveDrive.kinematics</code></a></b></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>desiredState</code> - Desired swerve module state.</dd>
<dd><code>isOpenLoop</code> - Whether to use open loop (direct percent) or direct velocity control.</dd>
<dd><code>force</code> - Disables optimizations that prevent movement in the angle motor and forces the
desired state onto the swerve module.</dd>
<dd><code>force</code> - Disables optimizations that prevent movement in the angle motor and forces the desired state
onto the swerve module.</dd>
</dl>
</section>
</li>
@@ -404,8 +474,7 @@ loadScripts(document, 'script');</script>
<section class="detail" id="getConfiguration()">
<h3>getConfiguration</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="parser/SwerveModuleConfiguration.html" title="class in swervelib.parser">SwerveModuleConfiguration</a></span>&nbsp;<span class="element-name">getConfiguration</span>()</div>
<div class="block">Fetch the <a href="parser/SwerveModuleConfiguration.html" title="class in swervelib.parser"><code>SwerveModuleConfiguration</code></a> for the <a href="SwerveModule.html" title="class in swervelib"><code>SwerveModule</code></a> with the parsed
configurations.</div>
<div class="block">Fetch the <a href="parser/SwerveModuleConfiguration.html" title="class in swervelib.parser"><code>SwerveModuleConfiguration</code></a> for the <a href="SwerveModule.html" title="class in swervelib"><code>SwerveModule</code></a> with the parsed configurations.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd><a href="parser/SwerveModuleConfiguration.html" title="class in swervelib.parser"><code>SwerveModuleConfiguration</code></a> for the <a href="SwerveModule.html" title="class in swervelib"><code>SwerveModule</code></a>.</dd>