Files
YAGSL/SwerveLib/frc/robot/subsystems/swervedrive/swerve/SwerveDrive.html

1379 lines
57 KiB
HTML
Raw Normal View History

2023-01-29 21:03:26 -06:00
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.13) on Sun Jan 29 15:36:03 CST 2023 -->
<title>SwerveDrive</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2023-01-29">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SwerveDrive";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":9,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">frc.robot.subsystems.swervedrive.swerve</a></div>
<h2 title="Class SwerveDrive" class="title">Class SwerveDrive</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>edu.wpi.first.wpilibj.MotorSafety</li>
<li>
<ul class="inheritance">
<li>edu.wpi.first.wpilibj.drive.RobotDriveBase</li>
<li>
<ul class="inheritance">
<li>frc.robot.subsystems.swervedrive.swerve.SwerveDrive</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code>edu.wpi.first.util.sendable.Sendable</code>, <code>java.lang.AutoCloseable</code></dd>
</dl>
<hr>
<pre>public class <span class="typeNameLabel">SwerveDrive</span>
extends edu.wpi.first.wpilibj.drive.RobotDriveBase
implements edu.wpi.first.util.sendable.Sendable, java.lang.AutoCloseable</pre>
<div class="block">SwerveDrive base which is meant to be platform agnostic. This implementation expect second order kinematics because
second order kinematics prevents the drift that builds up when using first order kinematics. As per this <a href="https://www.chiefdelphi.com/t/whitepaper-swerve-drive-skew-and-second-order-kinematics/416964">ChiefDelphi
post</a></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="SwerveDrive.SwerveModuleConfig.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveDrive.SwerveModuleConfig</a>&lt;<a href="SwerveDrive.SwerveModuleConfig.html" title="type parameter in SwerveDrive.SwerveModuleConfig">DriveMotorType</a> extends edu.wpi.first.wpilibj.motorcontrol.MotorController,&#8203;<a href="SwerveDrive.SwerveModuleConfig.html" title="type parameter in SwerveDrive.SwerveModuleConfig">SteeringMotorType</a> extends edu.wpi.first.wpilibj.motorcontrol.MotorController,&#8203;<a href="SwerveDrive.SwerveModuleConfig.html" title="type parameter in SwerveDrive.SwerveModuleConfig">AbsoluteEncoder</a> extends com.ctre.phoenix.sensors.CANCoder&gt;</span></code></th>
<td class="colLast">
<div class="block">Helper class for easier swerve module creation</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="nested.classes.inherited.from.class.edu.wpi.first.wpilibj.drive.RobotDriveBase">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from class&nbsp;edu.wpi.first.wpilibj.drive.RobotDriveBase</h3>
<code>edu.wpi.first.wpilibj.drive.RobotDriveBase.MotorType</code></li>
</ul>
</li>
</ul>
</section>
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#instances">instances</a></span></code></th>
<td class="colLast">
<div class="block">Count of SwerveModule instances created.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_angle">m_angle</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_backLeft">m_backLeft</a></span></code></th>
<td class="colLast">
<div class="block">Back left swerve drive</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_backRight">m_backRight</a></span></code></th>
<td class="colLast">
<div class="block">Back right swerve drive</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_driverMaxAngularVelocity">m_driverMaxAngularVelocity</a></span></code></th>
<td class="colLast">
<div class="block">Maximum speed in meters per second.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_driverMaxSpeedMPS">m_driverMaxSpeedMPS</a></span></code></th>
<td class="colLast">
<div class="block">Maximum speed in meters per second.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private edu.wpi.first.wpilibj.Timer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_driveTimer">m_driveTimer</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private edu.wpi.first.wpilibj.smartdashboard.Field2d</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_field">m_field</a></span></code></th>
<td class="colLast">
<div class="block">Field2d displayed on shuffleboard with current position.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_frontLeft">m_frontLeft</a></span></code></th>
<td class="colLast">
<div class="block">Front left swerve drive</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_frontRight">m_frontRight</a></span></code></th>
<td class="colLast">
<div class="block">Front right swerve drive</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_gyroInverted">m_gyroInverted</a></span></code></th>
<td class="colLast">
<div class="block">Invert the gyro reading.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_physicalMaxSpeedMPS">m_physicalMaxSpeedMPS</a></span></code></th>
<td class="colLast">
<div class="block">Maximum speed in meters per second.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private com.ctre.phoenix.sensors.WPI_Pigeon2</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_pigeonIMU">m_pigeonIMU</a></span></code></th>
<td class="colLast">
<div class="block">Pigeon 2.0 centered on the robot.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private edu.wpi.first.math.kinematics.ChassisSpeeds</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_prevChassisSpeed">m_prevChassisSpeed</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="kinematics/SwerveDriveKinematics2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveDriveKinematics2</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_swerveKinematics">m_swerveKinematics</a></span></code></th>
<td class="colLast">
<div class="block">Swerve drive kinematics.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private edu.wpi.first.math.estimator.SwerveDrivePoseEstimator</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_swervePoseEstimator">m_swervePoseEstimator</a></span></code></th>
<td class="colLast">
<div class="block">Swerve drive pose estimator for attempting to figure out our current position.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_timerPrev">m_timerPrev</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private edu.wpi.first.math.filter.SlewRateLimiter</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_turningLimiter">m_turningLimiter</a></span></code></th>
<td class="colLast">
<div class="block">The slew rate limiters to make control smooth.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private edu.wpi.first.math.filter.SlewRateLimiter</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_xLimiter">m_xLimiter</a></span></code></th>
<td class="colLast">
<div class="block">The slew rate limiters to make control smooth.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private edu.wpi.first.math.filter.SlewRateLimiter</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#m_yLimiter">m_yLimiter</a></span></code></th>
<td class="colLast">
<div class="block">The slew rate limiters to make control smooth.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="fields.inherited.from.class.edu.wpi.first.wpilibj.drive.RobotDriveBase">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;edu.wpi.first.wpilibj.drive.RobotDriveBase</h3>
<code>kDefaultDeadband, kDefaultMaxOutput, m_deadband, m_maxOutput</code></li>
</ul>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(frc.robot.subsystems.swervedrive.swerve.SwerveModule,frc.robot.subsystems.swervedrive.swerve.SwerveModule,frc.robot.subsystems.swervedrive.swerve.SwerveModule,frc.robot.subsystems.swervedrive.swerve.SwerveModule,com.ctre.phoenix.sensors.WPI_Pigeon2,double,double,double,double,double,boolean,edu.wpi.first.math.geometry.Pose2d)">SwerveDrive</a></span>&#8203;(<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;&nbsp;frontLeft,
<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;&nbsp;frontRight,
<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;&nbsp;backLeft,
<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;&nbsp;backRight,
com.ctre.phoenix.sensors.WPI_Pigeon2&nbsp;pigeon,
double&nbsp;driverMaxSpeedMetersPerSecond,
double&nbsp;driverMaxAngularVelocityRadiansPerSecond,
double&nbsp;driverMaxDriveAccelerationMetersPerSecond,
double&nbsp;driverMaxAngularAccelerationRadiansPerSecond,
double&nbsp;physicalMaxSpeedMPS,
boolean&nbsp;gyroInverted,
edu.wpi.first.math.geometry.Pose2d&nbsp;start)</code></th>
<td class="colLast">
<div class="block">Constructor for Swerve Drive assuming modules have been created and configured with PIDF and conversions.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#close()">close</a></span>()</code></th>
<td class="colLast">
<div class="block">Closes this resource, relinquishing any underlying resources.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#configurePigeonIMU()">configurePigeonIMU</a></span>()</code></th>
<td class="colLast">
<div class="block">Configure the PigeonIMU with factory default settings and a zeroed gyroscope.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static <a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createModules(double,double,double,double,double,double,double,double,boolean,boolean,frc.robot.subsystems.swervedrive.swerve.SwerveDrive.SwerveModuleConfig%5B%5D)">createModules</a></span>&#8203;(double&nbsp;driveGearRatio,
double&nbsp;steerGearRatio,
double&nbsp;wheelDiameterMeters,
double&nbsp;wheelBaseMeters,
double&nbsp;driveTrainWidthMeters,
double&nbsp;steeringMotorFreeSpeedRPM,
double&nbsp;maxSpeedMPS,
double&nbsp;maxDriveAcceleration,
boolean&nbsp;steeringMotorInverted,
boolean&nbsp;drivingMotorInverted,
<a href="SwerveDrive.SwerveModuleConfig.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveDrive.SwerveModuleConfig</a>&lt;?,&#8203;?,&#8203;?&gt;[]&nbsp;configs)</code></th>
<td class="colLast">
<div class="block">Create swerve drive modules</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#drive(double,double,double,boolean)">drive</a></span>&#8203;(double&nbsp;forward,
double&nbsp;strafe,
double&nbsp;turn,
boolean&nbsp;fieldRelative)</code></th>
<td class="colLast">
<div class="block">Drive swerve based off controller input.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDescription()">getDescription</a></span>()</code></th>
<td class="colLast">
<div class="block">Get the description of the robot drive base.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>edu.wpi.first.math.geometry.Pose2d</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPose()">getPose</a></span>()</code></th>
<td class="colLast">
<div class="block">Get the current Pose, used in autonomous.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>edu.wpi.first.math.kinematics.SwerveModulePosition[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPositions()">getPositions</a></span>()</code></th>
<td class="colLast">
<div class="block">Get current swerve module positions in order.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>edu.wpi.first.math.geometry.Rotation2d</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getRotation()">getRotation</a></span>()</code></th>
<td class="colLast">
<div class="block">Get the current robot rotation.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="kinematics/SwerveModuleState2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveModuleState2</a>[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStates()">getStates</a></span>()</code></th>
<td class="colLast">
<div class="block">Get current swerve module states in order.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initSendable(edu.wpi.first.util.sendable.SendableBuilder)">initSendable</a></span>&#8203;(edu.wpi.first.util.sendable.SendableBuilder&nbsp;builder)</code></th>
<td class="colLast">
<div class="block">Initializes this <code>Sendable</code> object.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#publish(frc.robot.subsystems.swervedrive.swerve.SwerveModule.Verbosity)">publish</a></span>&#8203;(<a href="SwerveModule.Verbosity.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.Verbosity</a>&nbsp;level)</code></th>
<td class="colLast">
<div class="block">Publish data from the Swerve Modules to the dashboard.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#resetEncoders()">resetEncoders</a></span>()</code></th>
<td class="colLast">
<div class="block">Resets the drive encoders to currently read a position of 0.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#resetOdometry(edu.wpi.first.math.geometry.Pose2d)">resetOdometry</a></span>&#8203;(edu.wpi.first.math.geometry.Pose2d&nbsp;pose)</code></th>
<td class="colLast">
<div class="block">Reset the odometry given the position and using current rotation from the PigeonIMU 2.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#set(double,double,double,boolean)">set</a></span>&#8203;(double&nbsp;forward,
double&nbsp;strafe,
double&nbsp;radianPerSecond,
boolean&nbsp;fieldRelative)</code></th>
<td class="colLast">
<div class="block">Swerve drive function</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setGyroInverted(boolean)">setGyroInverted</a></span>&#8203;(boolean&nbsp;isInverted)</code></th>
<td class="colLast">
<div class="block">Invert the gyroscope reading.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setModuleStates(frc.robot.subsystems.swervedrive.swerve.kinematics.SwerveModuleState2%5B%5D)">setModuleStates</a></span>&#8203;(<a href="kinematics/SwerveModuleState2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveModuleState2</a>[]&nbsp;states)</code></th>
<td class="colLast">
<div class="block">Set the swerve module states given an array of states.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setPIDF(double,double,double,double,double,frc.robot.subsystems.swervedrive.swerve.SwerveMotor.ModuleMotorType)">setPIDF</a></span>&#8203;(double&nbsp;p,
double&nbsp;i,
double&nbsp;d,
double&nbsp;f,
double&nbsp;integralZone,
<a href="SwerveMotor.ModuleMotorType.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveMotor.ModuleMotorType</a>&nbsp;moduleMotorType)</code></th>
<td class="colLast">
<div class="block">Set the PIDF coefficients for the closed loop PID onboard the motor controller.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setVoltageCompensation()">setVoltageCompensation</a></span>()</code></th>
<td class="colLast">
<div class="block">Enable voltage compensation to the current battery voltage on all modules.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setX()">setX</a></span>()</code></th>
<td class="colLast">
<div class="block">Sets the wheels into an X formation to prevent movement.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#stopMotor()">stopMotor</a></span>()</code></th>
<td class="colLast">
<div class="block">Stop all running and turning motors.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#subscribe()">subscribe</a></span>()</code></th>
<td class="colLast">
<div class="block">Update swerve module parameters based on data in the dashboard.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#synchronizeEncoders()">synchronizeEncoders</a></span>()</code></th>
<td class="colLast">
<div class="block">Synchronize internal steering encoders with the absolute encoder.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>edu.wpi.first.math.estimator.SwerveDrivePoseEstimator</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#update()">update</a></span>()</code></th>
<td class="colLast">
<div class="block">Update the swerve drive odometry.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#zeroGyro()">zeroGyro</a></span>()</code></th>
<td class="colLast">
<div class="block">Set the current rotation of the gyroscope (pigeonIMU 2) to 0.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#zeroModules()">zeroModules</a></span>()</code></th>
<td class="colLast">
<div class="block">Sets the speed to 0 and angle to 0 for all the swerve drive modules.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.edu.wpi.first.wpilibj.drive.RobotDriveBase">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;edu.wpi.first.wpilibj.drive.RobotDriveBase</h3>
<code>feedWatchdog, normalize, setDeadband, setMaxOutput</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.edu.wpi.first.wpilibj.MotorSafety">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;edu.wpi.first.wpilibj.MotorSafety</h3>
<code>check, checkMotors, feed, getExpiration, isAlive, isSafetyEnabled, setExpiration, setSafetyEnabled</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="instances">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>instances</h4>
<pre>private static&nbsp;int instances</pre>
<div class="block">Count of SwerveModule instances created.</div>
</li>
</ul>
<a id="m_frontLeft">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_frontLeft</h4>
<pre>public final&nbsp;<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt; m_frontLeft</pre>
<div class="block">Front left swerve drive</div>
</li>
</ul>
<a id="m_backLeft">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_backLeft</h4>
<pre>public final&nbsp;<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt; m_backLeft</pre>
<div class="block">Back left swerve drive</div>
</li>
</ul>
<a id="m_frontRight">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_frontRight</h4>
<pre>public final&nbsp;<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt; m_frontRight</pre>
<div class="block">Front right swerve drive</div>
</li>
</ul>
<a id="m_backRight">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_backRight</h4>
<pre>public final&nbsp;<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt; m_backRight</pre>
<div class="block">Back right swerve drive</div>
</li>
</ul>
<a id="m_driverMaxSpeedMPS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_driverMaxSpeedMPS</h4>
<pre>public final&nbsp;double m_driverMaxSpeedMPS</pre>
<div class="block">Maximum speed in meters per second.</div>
</li>
</ul>
<a id="m_driverMaxAngularVelocity">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_driverMaxAngularVelocity</h4>
<pre>public final&nbsp;double m_driverMaxAngularVelocity</pre>
<div class="block">Maximum speed in meters per second.</div>
</li>
</ul>
<a id="m_physicalMaxSpeedMPS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_physicalMaxSpeedMPS</h4>
<pre>public final&nbsp;double m_physicalMaxSpeedMPS</pre>
<div class="block">Maximum speed in meters per second.</div>
</li>
</ul>
<a id="m_swerveKinematics">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_swerveKinematics</h4>
<pre>private final&nbsp;<a href="kinematics/SwerveDriveKinematics2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveDriveKinematics2</a> m_swerveKinematics</pre>
<div class="block">Swerve drive kinematics.</div>
</li>
</ul>
<a id="m_swervePoseEstimator">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_swervePoseEstimator</h4>
<pre>private final&nbsp;edu.wpi.first.math.estimator.SwerveDrivePoseEstimator m_swervePoseEstimator</pre>
<div class="block">Swerve drive pose estimator for attempting to figure out our current position.</div>
</li>
</ul>
<a id="m_pigeonIMU">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_pigeonIMU</h4>
<pre>private final&nbsp;com.ctre.phoenix.sensors.WPI_Pigeon2 m_pigeonIMU</pre>
<div class="block">Pigeon 2.0 centered on the robot.</div>
</li>
</ul>
<a id="m_field">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_field</h4>
<pre>private final&nbsp;edu.wpi.first.wpilibj.smartdashboard.Field2d m_field</pre>
<div class="block">Field2d displayed on shuffleboard with current position.</div>
</li>
</ul>
<a id="m_xLimiter">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_xLimiter</h4>
<pre>private final&nbsp;edu.wpi.first.math.filter.SlewRateLimiter m_xLimiter</pre>
<div class="block">The slew rate limiters to make control smooth.</div>
</li>
</ul>
<a id="m_yLimiter">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_yLimiter</h4>
<pre>private final&nbsp;edu.wpi.first.math.filter.SlewRateLimiter m_yLimiter</pre>
<div class="block">The slew rate limiters to make control smooth.</div>
</li>
</ul>
<a id="m_turningLimiter">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_turningLimiter</h4>
<pre>private final&nbsp;edu.wpi.first.math.filter.SlewRateLimiter m_turningLimiter</pre>
<div class="block">The slew rate limiters to make control smooth.</div>
</li>
</ul>
<a id="m_driveTimer">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_driveTimer</h4>
<pre>private final&nbsp;edu.wpi.first.wpilibj.Timer m_driveTimer</pre>
</li>
</ul>
<a id="m_gyroInverted">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_gyroInverted</h4>
<pre>private&nbsp;boolean m_gyroInverted</pre>
<div class="block">Invert the gyro reading.</div>
</li>
</ul>
<a id="m_angle">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_angle</h4>
<pre>private&nbsp;double m_angle</pre>
</li>
</ul>
<a id="m_prevChassisSpeed">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_prevChassisSpeed</h4>
<pre>private&nbsp;edu.wpi.first.math.kinematics.ChassisSpeeds m_prevChassisSpeed</pre>
</li>
</ul>
<a id="m_timerPrev">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>m_timerPrev</h4>
<pre>private&nbsp;double m_timerPrev</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;(frc.robot.subsystems.swervedrive.swerve.SwerveModule,frc.robot.subsystems.swervedrive.swerve.SwerveModule,frc.robot.subsystems.swervedrive.swerve.SwerveModule,frc.robot.subsystems.swervedrive.swerve.SwerveModule,com.ctre.phoenix.sensors.WPI_Pigeon2,double,double,double,double,double,boolean,edu.wpi.first.math.geometry.Pose2d)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SwerveDrive</h4>
<pre>public&nbsp;SwerveDrive&#8203;(<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;&nbsp;frontLeft,
<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;&nbsp;frontRight,
<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;&nbsp;backLeft,
<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;&nbsp;backRight,
com.ctre.phoenix.sensors.WPI_Pigeon2&nbsp;pigeon,
double&nbsp;driverMaxSpeedMetersPerSecond,
double&nbsp;driverMaxAngularVelocityRadiansPerSecond,
double&nbsp;driverMaxDriveAccelerationMetersPerSecond,
double&nbsp;driverMaxAngularAccelerationRadiansPerSecond,
double&nbsp;physicalMaxSpeedMPS,
boolean&nbsp;gyroInverted,
edu.wpi.first.math.geometry.Pose2d&nbsp;start)</pre>
<div class="block">Constructor for Swerve Drive assuming modules have been created and configured with PIDF and conversions.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>frontLeft</code> - Front left swerve module configured.</dd>
<dd><code>backLeft</code> - Back left swerve module.</dd>
<dd><code>frontRight</code> - Front right swerve module.</dd>
<dd><code>backRight</code> - Back right swerve module</dd>
<dd><code>pigeon</code> - Pigeon IMU.</dd>
<dd><code>driverMaxSpeedMetersPerSecond</code> - Maximum speed for all modules to follow when in teleop.</dd>
<dd><code>driverMaxAngularVelocityRadiansPerSecond</code> - Maximum angular velocity for turning when using the drive
function.</dd>
<dd><code>driverMaxDriveAccelerationMetersPerSecond</code> - Maximum acceleration in meters per second for the drive motors
when in teleop for the slew rate limiter.</dd>
<dd><code>driverMaxAngularAccelerationRadiansPerSecond</code> - Maximum angular acceleration in meters per second for the
steering motors when in teleop for the slew rate limiters.</dd>
<dd><code>physicalMaxSpeedMPS</code> - Maximum speed a module can go physically, used to desaturate
wheel speeds.</dd>
<dd><code>gyroInverted</code> - Invert the gyroscope for the robot.</dd>
<dd><code>start</code> - The starting pose on the field.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="setVoltageCompensation()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setVoltageCompensation</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setVoltageCompensation()</pre>
<div class="block">Enable voltage compensation to the current battery voltage on all modules.</div>
</li>
</ul>
<a id="createModules(double,double,double,double,double,double,double,double,boolean,boolean,frc.robot.subsystems.swervedrive.swerve.SwerveDrive.SwerveModuleConfig[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createModules</h4>
<pre class="methodSignature">public static&nbsp;<a href="SwerveModule.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveModule</a>&lt;?,&#8203;?,&#8203;?&gt;[]&nbsp;createModules&#8203;(double&nbsp;driveGearRatio,
double&nbsp;steerGearRatio,
double&nbsp;wheelDiameterMeters,
double&nbsp;wheelBaseMeters,
double&nbsp;driveTrainWidthMeters,
double&nbsp;steeringMotorFreeSpeedRPM,
double&nbsp;maxSpeedMPS,
double&nbsp;maxDriveAcceleration,
boolean&nbsp;steeringMotorInverted,
boolean&nbsp;drivingMotorInverted,
<a href="SwerveDrive.SwerveModuleConfig.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveDrive.SwerveModuleConfig</a>&lt;?,&#8203;?,&#8203;?&gt;[]&nbsp;configs)</pre>
<div class="block">Create swerve drive modules</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>driveGearRatio</code> - Drive gear ratio in form of (rotation:1 AKA rotations/1) to get the encoder ticks
per rotation.</dd>
<dd><code>steerGearRatio</code> - Steering motor gear ratio (usually 12.8:1 for MK4 in form of rotations:1 or
rotations/1), only applied if using Neo's.</dd>
<dd><code>wheelDiameterMeters</code> - The wheel diameter of the swerve drive module in meters.</dd>
<dd><code>wheelBaseMeters</code> - The Distance between front and back wheels of the robot in meters.</dd>
<dd><code>driveTrainWidthMeters</code> - The Distance between centers of right and left wheels in meters.</dd>
<dd><code>steeringMotorFreeSpeedRPM</code> - The RPM free speed of the steering motor.</dd>
<dd><code>maxSpeedMPS</code> - The maximum drive speed in meters per second.</dd>
<dd><code>maxDriveAcceleration</code> - The maximum drive acceleration in meters^2 per second.</dd>
<dd><code>steeringMotorInverted</code> - The steering motor is inverted.</dd>
<dd><code>drivingMotorInverted</code> - The driving motor is inverted.</dd>
<dd><code>configs</code> - The swerve module configuration classes for the swerve drive given.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Array of swerve modules in the order of front left, front right, back left, back right.</dd>
</dl>
</li>
</ul>
<a id="zeroModules()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>zeroModules</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;zeroModules()</pre>
<div class="block">Sets the speed to 0 and angle to 0 for all the swerve drive modules.</div>
</li>
</ul>
<a id="configurePigeonIMU()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>configurePigeonIMU</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;configurePigeonIMU()</pre>
<div class="block">Configure the PigeonIMU with factory default settings and a zeroed gyroscope.</div>
</li>
</ul>
<a id="update()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre class="methodSignature">public&nbsp;edu.wpi.first.math.estimator.SwerveDrivePoseEstimator&nbsp;update()</pre>
<div class="block">Update the swerve drive odometry.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Swerve drive odometry.</dd>
</dl>
</li>
</ul>
<a id="drive(double,double,double,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>drive</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;drive&#8203;(double&nbsp;forward,
double&nbsp;strafe,
double&nbsp;turn,
boolean&nbsp;fieldRelative)</pre>
<div class="block">Drive swerve based off controller input.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>forward</code> - The speed (-1 to 1) in which the Y axis should go.</dd>
<dd><code>strafe</code> - The speed (-1 to 1) in which the X axis should go.</dd>
<dd><code>turn</code> - The speed (-1 to 1) in which the robot should turn.</dd>
<dd><code>fieldRelative</code> - Whether or not to use field relative controls.</dd>
</dl>
</li>
</ul>
<a id="set(double,double,double,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;set&#8203;(double&nbsp;forward,
double&nbsp;strafe,
double&nbsp;radianPerSecond,
boolean&nbsp;fieldRelative)</pre>
<div class="block">Swerve drive function</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>forward</code> - forward meters per second, strafe facing left from alliance wall</dd>
<dd><code>strafe</code> - strafe meters per second, forward away from alliance wall</dd>
<dd><code>radianPerSecond</code> - radians per second</dd>
<dd><code>fieldRelative</code> - field relative</dd>
</dl>
</li>
</ul>
<a id="setModuleStates(frc.robot.subsystems.swervedrive.swerve.kinematics.SwerveModuleState2[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setModuleStates</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setModuleStates&#8203;(<a href="kinematics/SwerveModuleState2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveModuleState2</a>[]&nbsp;states)</pre>
<div class="block">Set the swerve module states given an array of states. Normalize the wheel speeds to abide by maximum supplied</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>states</code> - Module states in a specified order. [front left, front right, back left, back right]</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.RuntimeException</code> - If the CANCoder is inaccessible or not configured.</dd>
</dl>
</li>
</ul>
<a id="setX()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setX</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setX()</pre>
<div class="block">Sets the wheels into an X formation to prevent movement.</div>
</li>
</ul>
<a id="setGyroInverted(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setGyroInverted</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setGyroInverted&#8203;(boolean&nbsp;isInverted)</pre>
<div class="block">Invert the gyroscope reading.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>isInverted</code> - Inversion of the gryoscope, true is inverted.</dd>
</dl>
</li>
</ul>
<a id="getRotation()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRotation</h4>
<pre class="methodSignature">public&nbsp;edu.wpi.first.math.geometry.Rotation2d&nbsp;getRotation()</pre>
<div class="block">Get the current robot rotation.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>Rotation2d</code> of the robot.</dd>
</dl>
</li>
</ul>
<a id="getPose()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPose</h4>
<pre class="methodSignature">public&nbsp;edu.wpi.first.math.geometry.Pose2d&nbsp;getPose()</pre>
<div class="block">Get the current Pose, used in autonomous.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Current pose based off odometry.</dd>
</dl>
</li>
</ul>
<a id="getPositions()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPositions</h4>
<pre class="methodSignature">public&nbsp;edu.wpi.first.math.kinematics.SwerveModulePosition[]&nbsp;getPositions()</pre>
<div class="block">Get current swerve module positions in order.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Swerve module positions array.</dd>
</dl>
</li>
</ul>
<a id="getStates()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStates</h4>
<pre class="methodSignature">public&nbsp;<a href="kinematics/SwerveModuleState2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveModuleState2</a>[]&nbsp;getStates()</pre>
<div class="block">Get current swerve module states in order.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Swerve module states array.</dd>
</dl>
</li>
</ul>
<a id="resetOdometry(edu.wpi.first.math.geometry.Pose2d)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resetOdometry</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;resetOdometry&#8203;(edu.wpi.first.math.geometry.Pose2d&nbsp;pose)</pre>
<div class="block">Reset the odometry given the position and using current rotation from the PigeonIMU 2.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>pose</code> - Current position on the field.</dd>
</dl>
</li>
</ul>
<a id="resetEncoders()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resetEncoders</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;resetEncoders()</pre>
<div class="block">Resets the drive encoders to currently read a position of 0.</div>
</li>
</ul>
<a id="zeroGyro()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>zeroGyro</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;zeroGyro()</pre>
<div class="block">Set the current rotation of the gyroscope (pigeonIMU 2) to 0.</div>
</li>
</ul>
<a id="stopMotor()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stopMotor</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;stopMotor()</pre>
<div class="block">Stop all running and turning motors.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>stopMotor</code>&nbsp;in class&nbsp;<code>edu.wpi.first.wpilibj.drive.RobotDriveBase</code></dd>
</dl>
</li>
</ul>
<a id="subscribe()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>subscribe</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;subscribe()</pre>
<div class="block">Update swerve module parameters based on data in the dashboard.</div>
</li>
</ul>
<a id="publish(frc.robot.subsystems.swervedrive.swerve.SwerveModule.Verbosity)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>publish</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;publish&#8203;(<a href="SwerveModule.Verbosity.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.Verbosity</a>&nbsp;level)</pre>
<div class="block">Publish data from the Swerve Modules to the dashboard.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>level</code> - Verbosity level in terms of CAN utilization.</dd>
</dl>
</li>
</ul>
<a id="setPIDF(double,double,double,double,double,frc.robot.subsystems.swervedrive.swerve.SwerveMotor.ModuleMotorType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPIDF</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setPIDF&#8203;(double&nbsp;p,
double&nbsp;i,
double&nbsp;d,
double&nbsp;f,
double&nbsp;integralZone,
<a href="SwerveMotor.ModuleMotorType.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveMotor.ModuleMotorType</a>&nbsp;moduleMotorType)</pre>
<div class="block">Set the PIDF coefficients for the closed loop PID onboard the motor controller. Tuning the PID
<p>
<b>P</b> = .5 and increase it by .1 until oscillations occur, then decrease by .05 then .005 until oscillations
stop and angle is perfect or near perfect.
</p>
<p>
<b>I</b> = 0 tune this if your PID never quite reaches the target, after tuning <b>D</b>. Increase this by
<b>P</b>*.01 each time and adjust accordingly.
</p>
<p>
<b>D</b> = 0 tune this if the PID accelerates too fast, it will smooth the motion. Increase this by <b>P</b>*10
and adjust accordingly.
</p>
<p>
<b>F</b> = 0 tune this if the PID is being used for velocity, the <b>F</b> is multiplied by the target and added
to the voltage output. Increase this by 0.01 until the PIDF reaches the desired state in a fast enough manner.
</p>
Documentation for this is best described by CTRE <a href="https://docs.ctre-phoenix.com/en/stable/ch16_ClosedLoop.html#position-closed-loop-control-mode">here</a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>p</code> - Proportional gain for closed loop. This is multiplied by closed loop error in sensor units.</dd>
<dd><code>i</code> - Integral gain for closed loop. This is multiplied by closed loop error in sensor units every
PID Loop.</dd>
<dd><code>d</code> - Derivative gain for closed loop. This is multiplied by derivative error (sensor units per
PID loop).</dd>
<dd><code>f</code> - Feed Fwd gain for Closed loop.</dd>
<dd><code>integralZone</code> - Integral Zone can be used to auto clear the integral accumulator if the sensor pos is too
far from the target. This prevents unstable oscillation if the kI is too large. Value is in
sensor units.</dd>
<dd><code>moduleMotorType</code> - Swerve drive motor type.</dd>
</dl>
</li>
</ul>
<a id="synchronizeEncoders()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>synchronizeEncoders</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;synchronizeEncoders()</pre>
<div class="block">Synchronize internal steering encoders with the absolute encoder.</div>
</li>
</ul>
<a id="getDescription()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDescription</h4>
<pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getDescription()</pre>
<div class="block">Get the description of the robot drive base.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>getDescription</code>&nbsp;in class&nbsp;<code>edu.wpi.first.wpilibj.drive.RobotDriveBase</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>string of the RobotDriveBase</dd>
</dl>
</li>
</ul>
<a id="initSendable(edu.wpi.first.util.sendable.SendableBuilder)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initSendable</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;initSendable&#8203;(edu.wpi.first.util.sendable.SendableBuilder&nbsp;builder)</pre>
<div class="block">Initializes this <code>Sendable</code> object.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>initSendable</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.util.sendable.Sendable</code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>builder</code> - sendable builder</dd>
</dl>
</li>
</ul>
<a id="close()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>close</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;close()
throws java.lang.Exception</pre>
<div class="block">Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects
managed by the <code>try</code>-with-resources statement.
<p>While this interface method is declared to throw <code>
Exception</code>, implementers are <em>strongly</em> encouraged to declare concrete implementations of the <code>close</code>
method to throw more specific exceptions, or to throw no exception at all if the close operation cannot fail.
<p> Cases where the close operation may fail require careful
attention by implementers. It is strongly advised to relinquish the underlying resources and to internally
<em>mark</em> the resource as closed, prior to throwing the exception. The <code>close</code> method is unlikely to be
invoked more than once and so this ensures that the resources are released in a timely manner. Furthermore it
reduces problems that could arise when the resource wraps, or is wrapped, by another resource.
<p><em>Implementers of this interface are also strongly advised
to not have the <code>close</code> method throw <code>InterruptedException</code>.</em>
<p>
This exception interacts with a thread's interrupted status, and runtime misbehavior is likely to occur if an
<code>InterruptedException</code> is suppressed.
<p>
More generally, if it would cause problems for an exception to be suppressed, the <code>AutoCloseable.close</code>
method should not throw it.
<p>Note that unlike the <code>close</code>
method of <code>Closeable</code>, this <code>close</code> method is <em>not</em> required to be idempotent. In other words,
calling this <code>close</code> method more than once may have some visible side effect, unlike <code>Closeable.close</code>
which is required to have no effect if called more than once.
<p>
However, implementers of this interface are strongly encouraged to make their <code>close</code> methods idempotent.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if this resource cannot be closed</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>