Updated swerve module optimizations and moved math to SwerveMath.

This commit is contained in:
thenetworkgrinch
2023-03-29 07:24:24 -05:00
parent 8d83836a8a
commit d160c01364
121 changed files with 813 additions and 597 deletions

View File

@@ -1,11 +1,11 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Mar 28 10:14:05 CDT 2023 -->
<!-- Generated by javadoc (17) on Wed Mar 29 07:20:20 CDT 2023 -->
<title>SwerveDrive</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-03-28">
<meta name="dc.created" content="2023-03-29">
<meta name="description" content="declaration: package: swervelib, class: SwerveDrive">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
@@ -327,6 +327,23 @@ loadScripts(document, 'script');</script>
<div class="block">Set the expected gyroscope angle using a <code>Rotation3d</code> object.</div>
</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="#setMaximumSpeed(double)" class="member-name-link">setMaximumSpeed</a><wbr>(double&nbsp;maximumSpeed)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the maximum speed of the drive motors, modified <a href="parser/SwerveControllerConfiguration.html#maxSpeed"><code>SwerveControllerConfiguration.maxSpeed</code></a> and
<a href="parser/SwerveDriveConfiguration.html#maxSpeed"><code>SwerveDriveConfiguration.maxSpeed</code></a> which is used for the
<a href="#setRawModuleStates(swervelib.math.SwerveModuleState2%5B%5D,boolean)"><code>setRawModuleStates(SwerveModuleState2[], boolean)</code></a> function and
<a href="SwerveController.html#getTargetSpeeds(double,double,double,double,double)"><code>SwerveController.getTargetSpeeds(double, double, double, double, double)</code></a> functions.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setMaximumSpeed(double,boolean)" class="member-name-link">setMaximumSpeed</a><wbr>(double&nbsp;maximumSpeed,
boolean&nbsp;updateModuleFeedforward)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the maximum speed of the drive motors, modified <a href="parser/SwerveControllerConfiguration.html#maxSpeed"><code>SwerveControllerConfiguration.maxSpeed</code></a> and
<a href="parser/SwerveDriveConfiguration.html#maxSpeed"><code>SwerveDriveConfiguration.maxSpeed</code></a> which is used for the
<a href="#setRawModuleStates(swervelib.math.SwerveModuleState2%5B%5D,boolean)"><code>setRawModuleStates(SwerveModuleState2[], boolean)</code></a> function and
<a href="SwerveController.html#getTargetSpeeds(double,double,double,double,double)"><code>SwerveController.getTargetSpeeds(double, double, double, double, double)</code></a> functions.</div>
</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="#setModuleStates(swervelib.math.SwerveModuleState2%5B%5D,boolean)" class="member-name-link">setModuleStates</a><wbr>(<a href="math/SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a>[]&nbsp;desiredStates,
boolean&nbsp;isOpenLoop)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
@@ -744,6 +761,41 @@ loadScripts(document, 'script');</script>
</section>
</li>
<li>
<section class="detail" id="setMaximumSpeed(double,boolean)">
<h3>setMaximumSpeed</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setMaximumSpeed</span><wbr><span class="parameters">(double&nbsp;maximumSpeed,
boolean&nbsp;updateModuleFeedforward)</span></div>
<div class="block">Set the maximum speed of the drive motors, modified <a href="parser/SwerveControllerConfiguration.html#maxSpeed"><code>SwerveControllerConfiguration.maxSpeed</code></a> and
<a href="parser/SwerveDriveConfiguration.html#maxSpeed"><code>SwerveDriveConfiguration.maxSpeed</code></a> which is used for the
<a href="#setRawModuleStates(swervelib.math.SwerveModuleState2%5B%5D,boolean)"><code>setRawModuleStates(SwerveModuleState2[], boolean)</code></a> function and
<a href="SwerveController.html#getTargetSpeeds(double,double,double,double,double)"><code>SwerveController.getTargetSpeeds(double, double, double, double, double)</code></a> functions. This function overrides
what was placed in the JSON and could damage your motor/robot if set too high or unachievable rates.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>maximumSpeed</code> - Maximum speed for the drive motors in meters / second.</dd>
<dd><code>updateModuleFeedforward</code> - Update the swerve module feedforward to account for the new maximum speed. This
should be true unless you have replaced the drive motor feedforward with
<a href="#replaceSwerveModuleFeedforward(edu.wpi.first.math.controller.SimpleMotorFeedforward)"><code>replaceSwerveModuleFeedforward(SimpleMotorFeedforward)</code></a></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setMaximumSpeed(double)">
<h3>setMaximumSpeed</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setMaximumSpeed</span><wbr><span class="parameters">(double&nbsp;maximumSpeed)</span></div>
<div class="block">Set the maximum speed of the drive motors, modified <a href="parser/SwerveControllerConfiguration.html#maxSpeed"><code>SwerveControllerConfiguration.maxSpeed</code></a> and
<a href="parser/SwerveDriveConfiguration.html#maxSpeed"><code>SwerveDriveConfiguration.maxSpeed</code></a> which is used for the
<a href="#setRawModuleStates(swervelib.math.SwerveModuleState2%5B%5D,boolean)"><code>setRawModuleStates(SwerveModuleState2[], boolean)</code></a> function and
<a href="SwerveController.html#getTargetSpeeds(double,double,double,double,double)"><code>SwerveController.getTargetSpeeds(double, double, double, double, double)</code></a> functions. This function overrides
what was placed in the JSON and could damage your motor/robot if set too high or unachievable rates. Overwrites the
<a href="SwerveModule.html#feedforward"><code>SwerveModule.feedforward</code></a>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>maximumSpeed</code> - Maximum speed for the drive motors in meters / second.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="lockPose()">
<h3>lockPose</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">lockPose</span>()</div>