Updated to 2024

This commit is contained in:
thenetworkgrinch
2024-01-15 14:37:13 -06:00
parent 3fd8493ccb
commit a71d7a0b4e
185 changed files with 6910 additions and 10987 deletions

View File

@@ -1,18 +1,17 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Dec 12 10:48:21 CST 2023 -->
<title>SwerveMath</title>
<!-- Generated by javadoc (17) -->
<title>SwerveMath (YAGSL-Example API)</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-12-12">
<meta name="description" content="declaration: package: swervelib.math, class: SwerveMath">
<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.5.1.min.js"></script>
<script type="text/javascript" src="../../script-dir/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
@@ -36,7 +35,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-files/index-1.html">Index</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html#class">Help</a></li>
</ul>
</div>
@@ -120,87 +119,79 @@ loadScripts(document, 'script');</script>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Algebraically apply a deadband using a piece wise function.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>private static double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d,java.util.List,double,swervelib.parser.SwerveDriveConfiguration)" class="member-name-link">calcMaxAccel</a><wbr>(edu.wpi.first.math.geometry.Rotation2d&nbsp;angle,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Matter.html" title="class in swervelib.math">Matter</a>&gt;&nbsp;matter,
double&nbsp;robotMass,
<a href="../parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a>&nbsp;config)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Calculates the maximum acceleration allowed in a direction without tipping the robot.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateDegreesPerSteeringRotation(double,double)" class="member-name-link">calculateDegreesPerSteeringRotation</a><wbr>(double&nbsp;angleGearRatio,
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateDegreesPerSteeringRotation(double,double)" class="member-name-link">calculateDegreesPerSteeringRotation</a><wbr>(double&nbsp;angleGearRatio,
double&nbsp;pulsePerRotation)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Calculate the degrees per steering rotation for the integrated encoder.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateMaxAcceleration(double)" class="member-name-link">calculateMaxAcceleration</a><wbr>(double&nbsp;cof)</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 double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateMaxAcceleration(double)" class="member-name-link">calculateMaxAcceleration</a><wbr>(double&nbsp;cof)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Calculate the practical maximum acceleration of the robot using the wheel coefficient of friction.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateMaxAcceleration(double,double,double,double,double)" class="member-name-link">calculateMaxAcceleration</a><wbr>(double&nbsp;stallTorqueNm,
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateMaxAcceleration(double,double,double,double,double)" class="member-name-link">calculateMaxAcceleration</a><wbr>(double&nbsp;stallTorqueNm,
double&nbsp;gearRatio,
double&nbsp;moduleCount,
double&nbsp;wheelDiameter,
double&nbsp;robotMass)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Calculate the maximum theoretical acceleration without friction.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateMaxAngularVelocity(double,double,double)" class="member-name-link">calculateMaxAngularVelocity</a><wbr>(double&nbsp;maxSpeed,
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateMaxAngularVelocity(double,double,double)" class="member-name-link">calculateMaxAngularVelocity</a><wbr>(double&nbsp;maxSpeed,
double&nbsp;furthestModuleX,
double&nbsp;furthestModuleY)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Calculate the maximum angular velocity.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateMetersPerRotation(double,double,double)" class="member-name-link">calculateMetersPerRotation</a><wbr>(double&nbsp;wheelDiameter,
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#calculateMetersPerRotation(double,double,double)" class="member-name-link">calculateMetersPerRotation</a><wbr>(double&nbsp;wheelDiameter,
double&nbsp;driveGearRatio,
double&nbsp;pulsePerRotation)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Calculate the meters per rotation for the integrated encoder.</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.controller.SimpleMotorFeedforward</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#createDriveFeedforward(double,double,double)" class="member-name-link">createDriveFeedforward</a><wbr>(double&nbsp;optimalVoltage,
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static edu.wpi.first.math.controller.SimpleMotorFeedforward</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#createDriveFeedforward(double,double,double)" class="member-name-link">createDriveFeedforward</a><wbr>(double&nbsp;optimalVoltage,
double&nbsp;maxSpeed,
double&nbsp;wheelGripCoefficientOfFriction)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Create the drive feedforward for swerve modules.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="../parser/SwerveModuleConfiguration.html" title="class in swervelib.parser">SwerveModuleConfiguration</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#getSwerveModule(swervelib.SwerveModule%5B%5D,boolean,boolean)" class="member-name-link">getSwerveModule</a><wbr>(<a href="../SwerveModule.html" title="class in swervelib">SwerveModule</a>[]&nbsp;modules,
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <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-tab1 method-summary-table-tab4"><code><a href="#getSwerveModule(swervelib.SwerveModule%5B%5D,boolean,boolean)" class="member-name-link">getSwerveModule</a><wbr>(<a href="../SwerveModule.html" title="class in swervelib">SwerveModule</a>[]&nbsp;modules,
boolean&nbsp;front,
boolean&nbsp;left)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Get the fruthest module from center based on the module locations.</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="#limitVelocity(edu.wpi.first.math.geometry.Translation2d,edu.wpi.first.math.kinematics.ChassisSpeeds,edu.wpi.first.math.geometry.Pose2d,double,double,java.util.List,swervelib.parser.SwerveDriveConfiguration)" class="member-name-link">limitVelocity</a><wbr>(edu.wpi.first.math.geometry.Translation2d&nbsp;commandedVelocity,
<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="#limitVelocity(edu.wpi.first.math.geometry.Translation2d,edu.wpi.first.math.kinematics.ChassisSpeeds,edu.wpi.first.math.geometry.Pose2d,double,double,java.util.List,swervelib.parser.SwerveDriveConfiguration)" class="member-name-link">limitVelocity</a><wbr>(edu.wpi.first.math.geometry.Translation2d&nbsp;commandedVelocity,
edu.wpi.first.math.kinematics.ChassisSpeeds&nbsp;fieldVelocity,
edu.wpi.first.math.geometry.Pose2d&nbsp;robotPose,
double&nbsp;loopTime,
double&nbsp;robotMass,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Matter.html" title="class in swervelib.math">Matter</a>&gt;&nbsp;matter,
<a href="../parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a>&nbsp;config)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Limits a commanded velocity to prevent exceeding the maximum acceleration given by <a href="#calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d,java.util.List,double,swervelib.parser.SwerveDriveConfiguration)"><code>calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d, java.util.List&lt;swervelib.math.Matter&gt;, double, swervelib.parser.SwerveDriveConfiguration)</code></a>.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#normalizeAngle(double)" class="member-name-link">normalizeAngle</a><wbr>(double&nbsp;angle)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Normalize an angle to be within 0 to 360.</div>
<div class="block">Limits a commanded velocity to prevent exceeding the maximum acceleration given by <code>calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d, java.util.List&lt;swervelib.math.Matter&gt;, double, swervelib.parser.SwerveDriveConfiguration)</code>.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#placeInAppropriate0To360Scope(double,double)" class="member-name-link">placeInAppropriate0To360Scope</a><wbr>(double&nbsp;scopeReference,
double&nbsp;newAngle)</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#normalizeAngle(double)" class="member-name-link">normalizeAngle</a><wbr>(double&nbsp;angle)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Normalize an angle to be within 0 to 360.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#placeInAppropriate0To360Scope(double,double)" class="member-name-link">placeInAppropriate0To360Scope</a><wbr>(double&nbsp;scopeReference,
double&nbsp;newAngle)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Put an angle within the 360 deg scope of a reference.</div>
</div>
<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.Twist2d</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#PoseLog(edu.wpi.first.math.geometry.Pose2d)" class="member-name-link">PoseLog</a><wbr>(edu.wpi.first.math.geometry.Pose2d&nbsp;transform)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<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.Twist2d</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#PoseLog(edu.wpi.first.math.geometry.Pose2d)" class="member-name-link">PoseLog</a><wbr>(edu.wpi.first.math.geometry.Pose2d&nbsp;transform)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Logical inverse of the Pose exponential from 254.</div>
</div>
</div>
@@ -368,27 +359,6 @@ loadScripts(document, 'script');</script>
</section>
</li>
<li>
<section class="detail" id="calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d,java.util.List,double,swervelib.parser.SwerveDriveConfiguration)">
<h3>calcMaxAccel</h3>
<div class="member-signature"><span class="modifiers">private static</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">calcMaxAccel</span><wbr><span class="parameters">(edu.wpi.first.math.geometry.Rotation2d&nbsp;angle,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Matter.html" title="class in swervelib.math">Matter</a>&gt;&nbsp;matter,
double&nbsp;robotMass,
<a href="../parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a>&nbsp;config)</span></div>
<div class="block">Calculates the maximum acceleration allowed in a direction without tipping the robot. Reads arm position from
NetworkTables and is passed the direction in question.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>angle</code> - The direction in which to calculate max acceleration, as a Rotation2d. Note that this is
robot-relative.</dd>
<dd><code>matter</code> - Matter that the robot is composed of in kg. (Includes chassis)</dd>
<dd><code>robotMass</code> - The weight of the robot in kg. (Including manipulators, etc).</dd>
<dd><code>config</code> - The swerve drive configuration.</dd>
<dt>Returns:</dt>
<dd>Maximum acceleration allowed in the robot direction.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="PoseLog(edu.wpi.first.math.geometry.Pose2d)">
<h3>PoseLog</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">edu.wpi.first.math.geometry.Twist2d</span>&nbsp;<span class="element-name">PoseLog</span><wbr><span class="parameters">(edu.wpi.first.math.geometry.Pose2d&nbsp;transform)</span></div>
@@ -411,7 +381,7 @@ loadScripts(document, 'script');</script>
double&nbsp;robotMass,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Matter.html" title="class in swervelib.math">Matter</a>&gt;&nbsp;matter,
<a href="../parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a>&nbsp;config)</span></div>
<div class="block">Limits a commanded velocity to prevent exceeding the maximum acceleration given by <a href="#calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d,java.util.List,double,swervelib.parser.SwerveDriveConfiguration)"><code>calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d, java.util.List&lt;swervelib.math.Matter&gt;, double, swervelib.parser.SwerveDriveConfiguration)</code></a>.
<div class="block">Limits a commanded velocity to prevent exceeding the maximum acceleration given by <code>calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d, java.util.List&lt;swervelib.math.Matter&gt;, double, swervelib.parser.SwerveDriveConfiguration)</code>.
Note that this takes and returns field-relative velocities.</div>
<dl class="notes">
<dt>Parameters:</dt>