mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-25 06:51:40 +00:00
Update YAGSL to handle controls better
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Generated by javadoc (17) on Wed Apr 05 08:59:10 CDT 2023 -->
|
||||
<!-- Generated by javadoc (17) on Sat Apr 08 12:30:47 CDT 2023 -->
|
||||
<title>SwerveMath</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-04-05">
|
||||
<meta name="dc.created" content="2023-04-08">
|
||||
<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">
|
||||
@@ -129,75 +129,61 @@ loadScripts(document, 'script');</script>
|
||||
<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="#calculateAngleKV(double,double,double)" class="member-name-link">calculateAngleKV</a><wbr>(double optimalVoltage,
|
||||
double motorFreeSpeedRPM,
|
||||
double angleGearRatio)</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 angle kV which will be multiplied by the radians per second for the feedforward.</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="#calculateDegreesPerSteeringRotation(double,double)" class="member-name-link">calculateDegreesPerSteeringRotation</a><wbr>(double angleGearRatio,
|
||||
<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 angleGearRatio,
|
||||
double pulsePerRotation)</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 degrees per steering rotation for the integrated encoder.</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)" class="member-name-link">calculateMaxAcceleration</a><wbr>(double cof)</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 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 cof)</code></div>
|
||||
<div class="col-last even-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 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 stallTorqueNm,
|
||||
<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 stallTorqueNm,
|
||||
double gearRatio,
|
||||
double moduleCount,
|
||||
double wheelDiameter,
|
||||
double robotMass)</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 theoretical acceleration without 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="#calculateMaxAngularVelocity(double,double,double)" class="member-name-link">calculateMaxAngularVelocity</a><wbr>(double maxSpeed,
|
||||
<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 maxSpeed,
|
||||
double furthestModuleX,
|
||||
double furthestModuleY)</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 angular velocity.</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="#calculateMetersPerRotation(double,double,double)" class="member-name-link">calculateMetersPerRotation</a><wbr>(double wheelDiameter,
|
||||
<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 wheelDiameter,
|
||||
double driveGearRatio,
|
||||
double pulsePerRotation)</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 meters per rotation for the integrated encoder.</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>[] 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>[] modules,
|
||||
boolean front,
|
||||
boolean 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 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 commandedVelocity,
|
||||
edu.wpi.first.math.kinematics.ChassisSpeeds fieldVelocity,
|
||||
edu.wpi.first.math.geometry.Pose2d robotPose,
|
||||
double loopTime,
|
||||
double 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><<a href="Matter.html" title="class in swervelib.math">Matter</a>> matter,
|
||||
<a href="../parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a> config)</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">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<swervelib.math.Matter>, 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 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>
|
||||
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a></code></div>
|
||||
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#optimize(swervelib.math.SwerveModuleState2,edu.wpi.first.math.geometry.Rotation2d,double)" class="member-name-link">optimize</a><wbr>(<a href="SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a> desiredState,
|
||||
edu.wpi.first.math.geometry.Rotation2d currentAngle,
|
||||
double secondOrderOffsetDegrees)</code></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="#normalizeAngle(double)" class="member-name-link">normalizeAngle</a><wbr>(double angle)</code></div>
|
||||
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
|
||||
<div class="block">Optimize the angle of the <a href="SwerveModuleState2.html" title="class in swervelib.math"><code>SwerveModuleState2</code></a> to be the closest angle to the current angle.</div>
|
||||
<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 scopeReference,
|
||||
@@ -205,6 +191,11 @@ 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">Put an angle within the 360 deg scope of a reference.</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.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 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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -237,24 +228,6 @@ loadScripts(document, 'script');</script>
|
||||
<h2>Method Details</h2>
|
||||
<ul class="member-list">
|
||||
<li>
|
||||
<section class="detail" id="calculateAngleKV(double,double,double)">
|
||||
<h3>calculateAngleKV</h3>
|
||||
<div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">double</span> <span class="element-name">calculateAngleKV</span><wbr><span class="parameters">(double optimalVoltage,
|
||||
double motorFreeSpeedRPM,
|
||||
double angleGearRatio)</span></div>
|
||||
<div class="block">Calculate the angle kV which will be multiplied by the radians per second for the feedforward. Volt * seconds /
|
||||
degree == (maxVolts) / (maxSpeed)</div>
|
||||
<dl class="notes">
|
||||
<dt>Parameters:</dt>
|
||||
<dd><code>optimalVoltage</code> - Optimal voltage to use when calculating the angle kV.</dd>
|
||||
<dd><code>motorFreeSpeedRPM</code> - Motor free speed in Rotations per Minute.</dd>
|
||||
<dd><code>angleGearRatio</code> - Angle gear ratio, the amount of times the motor as to turn for the wheel rotation.</dd>
|
||||
<dt>Returns:</dt>
|
||||
<dd>angle kV for feedforward.</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</li>
|
||||
<li>
|
||||
<section class="detail" id="calculateMetersPerRotation(double,double,double)">
|
||||
<h3>calculateMetersPerRotation</h3>
|
||||
<div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">double</span> <span class="element-name">calculateMetersPerRotation</span><wbr><span class="parameters">(double wheelDiameter,
|
||||
@@ -391,6 +364,17 @@ loadScripts(document, 'script');</script>
|
||||
</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> <span class="return-type">edu.wpi.first.math.geometry.Twist2d</span> <span class="element-name">PoseLog</span><wbr><span class="parameters">(edu.wpi.first.math.geometry.Pose2d transform)</span></div>
|
||||
<div class="block">Logical inverse of the Pose exponential from 254. Taken from team 3181.</div>
|
||||
<dl class="notes">
|
||||
<dt>Parameters:</dt>
|
||||
<dd><code>transform</code> - Pose to perform the log on.</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</li>
|
||||
<li>
|
||||
<section class="detail" id="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)">
|
||||
<h3>limitVelocity</h3>
|
||||
<div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">edu.wpi.first.math.geometry.Translation2d</span> <span class="element-name">limitVelocity</span><wbr><span class="parameters">(edu.wpi.first.math.geometry.Translation2d commandedVelocity,
|
||||
@@ -436,25 +420,6 @@ loadScripts(document, 'script');</script>
|
||||
</section>
|
||||
</li>
|
||||
<li>
|
||||
<section class="detail" id="optimize(swervelib.math.SwerveModuleState2,edu.wpi.first.math.geometry.Rotation2d,double)">
|
||||
<h3>optimize</h3>
|
||||
<div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a></span> <span class="element-name">optimize</span><wbr><span class="parameters">(<a href="SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a> desiredState,
|
||||
edu.wpi.first.math.geometry.Rotation2d currentAngle,
|
||||
double secondOrderOffsetDegrees)</span></div>
|
||||
<div class="block">Optimize the angle of the <a href="SwerveModuleState2.html" title="class in swervelib.math"><code>SwerveModuleState2</code></a> to be the closest angle to the current angle. Taken from Team
|
||||
3181 at
|
||||
https://github.com/pittsfordrobotics/REVSwerve2023/blob/master/src/main/java/com/team3181/lib/swerve/SwerveOptimizer.java</div>
|
||||
<dl class="notes">
|
||||
<dt>Parameters:</dt>
|
||||
<dd><code>desiredState</code> - Desired <a href="SwerveModuleState2.html" title="class in swervelib.math"><code>SwerveModuleState2</code></a> to achieve.</dd>
|
||||
<dd><code>currentAngle</code> - Current angle as a <code>Rotation2d</code>.</dd>
|
||||
<dd><code>secondOrderOffsetDegrees</code> - Offset calculated using 2nd order kinematics.</dd>
|
||||
<dt>Returns:</dt>
|
||||
<dd>Optimized <a href="SwerveModuleState2.html" title="class in swervelib.math"><code>SwerveModuleState2</code></a></dd>
|
||||
</dl>
|
||||
</section>
|
||||
</li>
|
||||
<li>
|
||||
<section class="detail" id="placeInAppropriate0To360Scope(double,double)">
|
||||
<h3>placeInAppropriate0To360Scope</h3>
|
||||
<div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">double</span> <span class="element-name">placeInAppropriate0To360Scope</span><wbr><span class="parameters">(double scopeReference,
|
||||
|
||||
Reference in New Issue
Block a user