Files
YAGSL/SwerveLib/frc/robot/subsystems/swervedrive/swerve/SwerveModule.html
thenetworkgrinch 95baa4db9d First commit
2023-01-29 21:03:26 -06:00

1444 lines
61 KiB
HTML

<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.13) on Sun Jan 29 15:36:03 CST 2023 -->
<title>SwerveModule</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="SwerveModule";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"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,"i25":10,"i26":10,"i27":9,"i28":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 SwerveModule" class="title">Class SwerveModule&lt;DriveMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController,&#8203;AngleMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController,&#8203;AbsoluteEncoderType&gt;</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>frc.robot.subsystems.swervedrive.swerve.SwerveModule&lt;DriveMotorType,&#8203;AngleMotorType,&#8203;AbsoluteEncoderType&gt;</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>DriveMotorType</code> - Main motor type that drives the wheel.</dd>
<dd><code>AngleMotorType</code> - Motor that controls the angle of the wheel.</dd>
<dd><code>AbsoluteEncoderType</code> - Absolute encoder for the swerve drive module.</dd>
</dl>
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code>edu.wpi.first.util.sendable.Sendable</code>, <code>edu.wpi.first.wpilibj.motorcontrol.MotorController</code>, <code>java.lang.AutoCloseable</code></dd>
</dl>
<hr>
<pre>public class <span class="typeNameLabel">SwerveModule&lt;DriveMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController,&#8203;AngleMotorType extends edu.wpi.first.wpilibj.motorcontrol.MotorController,&#8203;AbsoluteEncoderType&gt;</span>
extends java.lang.Object
implements edu.wpi.first.wpilibj.motorcontrol.MotorController, edu.wpi.first.util.sendable.Sendable, java.lang.AutoCloseable</pre>
<div class="block">Swerve module for representing a single swerve module of the robot.</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="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a></span></code></th>
<td class="colLast">
<div class="block">Swerve Module location on the robot.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="SwerveModule.Verbosity.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.Verbosity</a></span></code></th>
<td class="colLast">
<div class="block">Verbosity levels for data publishing,</div>
</td>
</tr>
</table>
</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 <a href="SwerveEncoder.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveEncoder</a>&lt;?&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#absoluteEncoder">absoluteEncoder</a></span></code></th>
<td class="colLast">
<div class="block">Absolute encoder for the swerve module.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#angleOffset">angleOffset</a></span></code></th>
<td class="colLast">
<div class="block">Angle offset of the CANCoder at initialization.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private edu.wpi.first.math.controller.SimpleMotorFeedforward</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#driveFeedforward">driveFeedforward</a></span></code></th>
<td class="colLast">
<div class="block">Drive feedforward for PID when driving by velocity.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="SwerveMotor.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveMotor</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#driveMotor">driveMotor</a></span></code></th>
<td class="colLast">
<div class="block">Motor Controllers for drive motor of the swerve module.</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="#drivePower">drivePower</a></span></code></th>
<td class="colLast">
<div class="block">Power to drive motor from -1 to 1.</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="#driveTrainWidth">driveTrainWidth</a></span></code></th>
<td class="colLast">
<div class="block">The Distance between centers of right and left wheels in meters.</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="#invertedDrive">invertedDrive</a></span></code></th>
<td class="colLast">
<div class="block">Inverted drive motor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#invertedTurn">invertedTurn</a></span></code></th>
<td class="colLast">
<div class="block">Inverted turning motor.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#maxDriveSpeedMPS">maxDriveSpeedMPS</a></span></code></th>
<td class="colLast">
<div class="block">Maximum speed in meters per second, used to eliminate unnecessary movement of the module.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#moduleTab">moduleTab</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private java.util.HashMap&lt;java.lang.String,&#8203;edu.wpi.first.wpilibj.shuffleboard.SimpleWidget&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#NT4Entries">NT4Entries</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#steeringKV">steeringKV</a></span></code></th>
<td class="colLast">
<div class="block">kV for steering feedforward.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#swerveLocation">swerveLocation</a></span></code></th>
<td class="colLast">
<div class="block">Enum representing the swerve module's location on the robot, assuming square.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>edu.wpi.first.math.geometry.Translation2d</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#swerveModuleLocation">swerveModuleLocation</a></span></code></th>
<td class="colLast">
<div class="block">Swerve Module location object relative to the center of the robot.</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="#targetAngle">targetAngle</a></span></code></th>
<td class="colLast">
<div class="block">Store the last angle for optimization.</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="#targetAngularVelocityRPS">targetAngularVelocityRPS</a></span></code></th>
<td class="colLast">
<div class="block">Angular velocity in radians per second.</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="#targetVelocity">targetVelocity</a></span></code></th>
<td class="colLast">
<div class="block">Target velocity for the swerve module.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="SwerveMotor.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveMotor</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#turningMotor">turningMotor</a></span></code></th>
<td class="colLast">
<div class="block">Motor Controller for the turning motor of the swerve drive module.</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="#wheelBase">wheelBase</a></span></code></th>
<td class="colLast">
<div class="block">The Distance between front and back wheels of the robot in meters.</div>
</td>
</tr>
</table>
</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(DriveMotorType,AngleMotorType,AbsoluteEncoderType,frc.robot.subsystems.swervedrive.swerve.SwerveModule.SwerveModuleLocation,double,double,double,double,double,double,double,double,double,double,double,boolean,boolean)">SwerveModule</a></span>&#8203;(<a href="SwerveModule.html" title="type parameter in SwerveModule">DriveMotorType</a>&nbsp;mainMotor,
<a href="SwerveModule.html" title="type parameter in SwerveModule">AngleMotorType</a>&nbsp;angleMotor,
<a href="SwerveModule.html" title="type parameter in SwerveModule">AbsoluteEncoderType</a>&nbsp;encoder,
<a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a>&nbsp;swervePosition,
double&nbsp;driveGearRatio,
double&nbsp;steerGearRatio,
double&nbsp;steeringOffsetDegrees,
double&nbsp;wheelDiameterMeters,
double&nbsp;wheelBaseMeters,
double&nbsp;driveTrainWidthMeters,
double&nbsp;steeringMotorFreeSpeedRPM,
double&nbsp;maxSpeedMPS,
double&nbsp;maxDriveAcceleration,
double&nbsp;drivingPowerLimit,
double&nbsp;steeringPowerLimit,
boolean&nbsp;steeringInverted,
boolean&nbsp;drivingInverted)</code></th>
<td class="colLast">
<div class="block">Swerve module constructor.</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>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#activeCAN()">activeCAN</a></span>()</code></th>
<td class="colLast">
<div class="block">Check that the link is good on the swerve module and CAN bus is able to retrieve data.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>private edu.wpi.first.wpilibj.shuffleboard.SimpleWidget</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addEntry(java.lang.String,java.lang.Object)">addEntry</a></span>&#8203;(java.lang.String&nbsp;name,
java.lang.Object&nbsp;defaultValue)</code></th>
<td class="colLast">
<div class="block">Create a widget and add the entry to the hashmap of entries for network tables.</div>
</td>
</tr>
<tr id="i2" 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="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#disable()">disable</a></span>()</code></th>
<td class="colLast">
<div class="block">Disable the motor controller.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#get()">get</a></span>()</code></th>
<td class="colLast">
<div class="block">Common interface for getting the current set speed of a motor controller.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getInverted()">getInverted</a></span>()</code></th>
<td class="colLast">
<div class="block">Common interface for returning if a motor controller is in the inverted state or not.</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="#getPosition()">getPosition</a></span>()</code></th>
<td class="colLast">
<div class="block">Get the swerve module position based off the sensors.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<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="#getState()">getState</a></span>()</code></th>
<td class="colLast">
<div class="block">Get the module state.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>private edu.wpi.first.math.geometry.Translation2d</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSwerveModulePosition(frc.robot.subsystems.swervedrive.swerve.SwerveModule.SwerveModuleLocation)">getSwerveModulePosition</a></span>&#8203;(<a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a>&nbsp;swerveLocation)</code></th>
<td class="colLast">
<div class="block">Get the swerve module position in <code>Translation2d</code> from the enum passed.</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 to the smart dashboard relating to this swerve module.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#remoteIntegratedEncoder()">remoteIntegratedEncoder</a></span>()</code></th>
<td class="colLast">
<div class="block">Checks if the absolute encoder is able to be read directly by the motor controller instead of using the
synchronizeEncoder() function periodically.</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="#resetEncoders()">resetEncoders</a></span>()</code></th>
<td class="colLast">
<div class="block">Reset the REV encoders onboard the SparkMax's to 0, and set's the drive motor to position to 0 and synchronizes the
internal steering encoders with the absolute encoder.</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)">set</a></span>&#8203;(double&nbsp;speed)</code></th>
<td class="colLast">
<div class="block">Common interface for setting the speed of a motor controller.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>private void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setAngle(double)">setAngle</a></span>&#8203;(double&nbsp;angle)</code></th>
<td class="colLast">
<div class="block">Set the angle of the swerve module without feedforward.</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="#setAngle(double,double)">setAngle</a></span>&#8203;(double&nbsp;angle,
double&nbsp;feedforward)</code></th>
<td class="colLast">
<div class="block">Set the angle of the swerve module.</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="#setAngleOffset(double)">setAngleOffset</a></span>&#8203;(double&nbsp;offset)</code></th>
<td class="colLast">
<div class="block">Configure the magnetic offset in the CANCoder.</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="#setCurrentLimit(int,frc.robot.subsystems.swervedrive.swerve.SwerveMotor.ModuleMotorType)">setCurrentLimit</a></span>&#8203;(int&nbsp;currentLimit,
<a href="SwerveMotor.ModuleMotorType.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveMotor.ModuleMotorType</a>&nbsp;type)</code></th>
<td class="colLast">
<div class="block">Set the current limit for the swerve drive motor, remember this may cause jumping if used in conjunction with
voltage compensation.</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="#setInverted(boolean)">setInverted</a></span>&#8203;(boolean&nbsp;isInverted)</code></th>
<td class="colLast">
<div class="block">Common interface for inverting direction of a motor controller.</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="#setInvertedAbsoluteEncoder(boolean)">setInvertedAbsoluteEncoder</a></span>&#8203;(boolean&nbsp;isInverted)</code></th>
<td class="colLast">
<div class="block">Invert the absolute encoder.</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="#setInvertedTurn(boolean)">setInvertedTurn</a></span>&#8203;(boolean&nbsp;isInverted)</code></th>
<td class="colLast">
<div class="block">Set the steering motor to be inverted.</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="#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="i22" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setState(frc.robot.subsystems.swervedrive.swerve.kinematics.SwerveModuleState2)">setState</a></span>&#8203;(<a href="kinematics/SwerveModuleState2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveModuleState2</a>&nbsp;state)</code></th>
<td class="colLast">
<div class="block">Set the module speed and angle based off the module state.</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="#setVelocity(double)">setVelocity</a></span>&#8203;(double&nbsp;velocity)</code></th>
<td class="colLast">
<div class="block">Set the drive motor velocity in MPS.</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="#setVoltageCompensation(double)">setVoltageCompensation</a></span>&#8203;(double&nbsp;nominalVoltage)</code></th>
<td class="colLast">
<div class="block">Set the voltage compensation for the swerve module motor.</div>
</td>
</tr>
<tr id="i25" 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">Stops motor movement.</div>
</td>
</tr>
<tr id="i26" 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">Subscribe from data within smart dashboard to make changes to the swerve module.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SwerveModuleLocationToString(frc.robot.subsystems.swervedrive.swerve.SwerveModule.SwerveModuleLocation)">SwerveModuleLocationToString</a></span>&#8203;(<a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a>&nbsp;swerveLocation)</code></th>
<td class="colLast">
<div class="block">Convert <a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve"><code>SwerveModule.SwerveModuleLocation</code></a> to <code>String</code> representation.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#synchronizeSteeringEncoder()">synchronizeSteeringEncoder</a></span>()</code></th>
<td class="colLast">
<div class="block">Synchronizes the internal encoder for the steering motor with the value from the absolute encoder.</div>
</td>
</tr>
</table>
<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>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.edu.wpi.first.wpilibj.motorcontrol.MotorController">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;edu.wpi.first.wpilibj.motorcontrol.MotorController</h3>
<code>setVoltage</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="swerveModuleLocation">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>swerveModuleLocation</h4>
<pre>public final&nbsp;edu.wpi.first.math.geometry.Translation2d swerveModuleLocation</pre>
<div class="block">Swerve Module location object relative to the center of the robot.</div>
</li>
</ul>
<a id="driveMotor">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>driveMotor</h4>
<pre>public final&nbsp;<a href="SwerveMotor.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveMotor</a> driveMotor</pre>
<div class="block">Motor Controllers for drive motor of the swerve module.</div>
</li>
</ul>
<a id="turningMotor">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>turningMotor</h4>
<pre>public final&nbsp;<a href="SwerveMotor.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveMotor</a> turningMotor</pre>
<div class="block">Motor Controller for the turning motor of the swerve drive module.</div>
</li>
</ul>
<a id="swerveLocation">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>swerveLocation</h4>
<pre>private final&nbsp;<a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a> swerveLocation</pre>
<div class="block">Enum representing the swerve module's location on the robot, assuming square.</div>
</li>
</ul>
<a id="absoluteEncoder">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>absoluteEncoder</h4>
<pre>private final&nbsp;<a href="SwerveEncoder.html" title="class in frc.robot.subsystems.swervedrive.swerve">SwerveEncoder</a>&lt;?&gt; absoluteEncoder</pre>
<div class="block">Absolute encoder for the swerve module.</div>
</li>
</ul>
<a id="driveTrainWidth">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>driveTrainWidth</h4>
<pre>private final&nbsp;double driveTrainWidth</pre>
<div class="block">The Distance between centers of right and left wheels in meters.</div>
</li>
</ul>
<a id="wheelBase">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>wheelBase</h4>
<pre>private final&nbsp;double wheelBase</pre>
<div class="block">The Distance between front and back wheels of the robot in meters.</div>
</li>
</ul>
<a id="driveFeedforward">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>driveFeedforward</h4>
<pre>private final&nbsp;edu.wpi.first.math.controller.SimpleMotorFeedforward driveFeedforward</pre>
<div class="block">Drive feedforward for PID when driving by velocity.</div>
</li>
</ul>
<a id="steeringKV">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>steeringKV</h4>
<pre>private final&nbsp;double steeringKV</pre>
<div class="block">kV for steering feedforward.</div>
</li>
</ul>
<a id="moduleTab">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>moduleTab</h4>
<pre>private final&nbsp;edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab moduleTab</pre>
</li>
</ul>
<a id="NT4Entries">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>NT4Entries</h4>
<pre>private final&nbsp;java.util.HashMap&lt;java.lang.String,&#8203;edu.wpi.first.wpilibj.shuffleboard.SimpleWidget&gt; NT4Entries</pre>
</li>
</ul>
<a id="angleOffset">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>angleOffset</h4>
<pre>public&nbsp;double angleOffset</pre>
<div class="block">Angle offset of the CANCoder at initialization.</div>
</li>
</ul>
<a id="maxDriveSpeedMPS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>maxDriveSpeedMPS</h4>
<pre>public&nbsp;double maxDriveSpeedMPS</pre>
<div class="block">Maximum speed in meters per second, used to eliminate unnecessary movement of the module.</div>
</li>
</ul>
<a id="invertedDrive">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invertedDrive</h4>
<pre>private&nbsp;boolean invertedDrive</pre>
<div class="block">Inverted drive motor.</div>
</li>
</ul>
<a id="invertedTurn">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invertedTurn</h4>
<pre>private&nbsp;boolean invertedTurn</pre>
<div class="block">Inverted turning motor.</div>
</li>
</ul>
<a id="drivePower">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>drivePower</h4>
<pre>private&nbsp;double drivePower</pre>
<div class="block">Power to drive motor from -1 to 1.</div>
</li>
</ul>
<a id="targetAngle">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>targetAngle</h4>
<pre>private&nbsp;double targetAngle</pre>
<div class="block">Store the last angle for optimization.</div>
</li>
</ul>
<a id="targetAngularVelocityRPS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>targetAngularVelocityRPS</h4>
<pre>private&nbsp;double targetAngularVelocityRPS</pre>
<div class="block">Angular velocity in radians per second.</div>
</li>
</ul>
<a id="targetVelocity">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>targetVelocity</h4>
<pre>private&nbsp;double targetVelocity</pre>
<div class="block">Target velocity for the swerve module.</div>
</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;(edu.wpi.first.wpilibj.motorcontrol.MotorController,edu.wpi.first.wpilibj.motorcontrol.MotorController,java.lang.Object,frc.robot.subsystems.swervedrive.swerve.SwerveModule.SwerveModuleLocation,double,double,double,double,double,double,double,double,double,double,double,boolean,boolean)">
<!-- -->
</a><a id="&lt;init&gt;(DriveMotorType,AngleMotorType,AbsoluteEncoderType,frc.robot.subsystems.swervedrive.swerve.SwerveModule.SwerveModuleLocation,double,double,double,double,double,double,double,double,double,double,double,boolean,boolean)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SwerveModule</h4>
<pre>public&nbsp;SwerveModule&#8203;(<a href="SwerveModule.html" title="type parameter in SwerveModule">DriveMotorType</a>&nbsp;mainMotor,
<a href="SwerveModule.html" title="type parameter in SwerveModule">AngleMotorType</a>&nbsp;angleMotor,
<a href="SwerveModule.html" title="type parameter in SwerveModule">AbsoluteEncoderType</a>&nbsp;encoder,
<a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a>&nbsp;swervePosition,
double&nbsp;driveGearRatio,
double&nbsp;steerGearRatio,
double&nbsp;steeringOffsetDegrees,
double&nbsp;wheelDiameterMeters,
double&nbsp;wheelBaseMeters,
double&nbsp;driveTrainWidthMeters,
double&nbsp;steeringMotorFreeSpeedRPM,
double&nbsp;maxSpeedMPS,
double&nbsp;maxDriveAcceleration,
double&nbsp;drivingPowerLimit,
double&nbsp;steeringPowerLimit,
boolean&nbsp;steeringInverted,
boolean&nbsp;drivingInverted)</pre>
<div class="block">Swerve module constructor. Both motors <b>MUST</b> be a <code>MotorController</code> class. It is recommended to create
a command to reset the encoders when triggered and</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>mainMotor</code> - Main drive motor. Must be a <code>MotorController</code> type.</dd>
<dd><code>angleMotor</code> - Angle motor for controlling the angle of the swerve module.</dd>
<dd><code>encoder</code> - Absolute encoder for the swerve module.</dd>
<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>swervePosition</code> - Swerve Module position on the robot.</dd>
<dd><code>steeringOffsetDegrees</code> - The current offset of the absolute encoder from 0 in degrees.</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>drivingPowerLimit</code> - The power limit for the closed loop PID of the driver motor.</dd>
<dd><code>steeringPowerLimit</code> - The power limit for the closed loop PID of the steering motor.</dd>
<dd><code>steeringInverted</code> - The steering motor is inverted.</dd>
<dd><code>drivingInverted</code> - The driving motor is inverted.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.RuntimeException</code> - if an assertion fails or invalid swerve module location is given.</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="SwerveModuleLocationToString(frc.robot.subsystems.swervedrive.swerve.SwerveModule.SwerveModuleLocation)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SwerveModuleLocationToString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;SwerveModuleLocationToString&#8203;(<a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a>&nbsp;swerveLocation)</pre>
<div class="block">Convert <a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve"><code>SwerveModule.SwerveModuleLocation</code></a> to <code>String</code> representation.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>swerveLocation</code> - Swerve position to convert.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>String</code> name of the <a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve"><code>SwerveModule.SwerveModuleLocation</code></a> enum.</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">Reset the REV encoders onboard the SparkMax's to 0, and set's the drive motor to position to 0 and synchronizes the
internal steering encoders with the absolute encoder.</div>
</li>
</ul>
<a id="synchronizeSteeringEncoder()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>synchronizeSteeringEncoder</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;synchronizeSteeringEncoder()</pre>
<div class="block">Synchronizes the internal encoder for the steering motor with the value from the absolute encoder.</div>
</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="setAngleOffset(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAngleOffset</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setAngleOffset&#8203;(double&nbsp;offset)</pre>
<div class="block">Configure the magnetic offset in the CANCoder.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>offset</code> - Magnetic offset in degrees.</dd>
</dl>
</li>
</ul>
<a id="activeCAN()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>activeCAN</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;activeCAN()</pre>
<div class="block">Check that the link is good on the swerve module and CAN bus is able to retrieve data.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true on all devices are accessible over CAN.</dd>
</dl>
</li>
</ul>
<a id="remoteIntegratedEncoder()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remoteIntegratedEncoder</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;remoteIntegratedEncoder()</pre>
<div class="block">Checks if the absolute encoder is able to be read directly by the motor controller instead of using the
synchronizeEncoder() function periodically.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>If the absolute sensor in the steering motor is directly accessed by the motor controller.</dd>
</dl>
</li>
</ul>
<a id="setAngle(double,double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAngle</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setAngle&#8203;(double&nbsp;angle,
double&nbsp;feedforward)</pre>
<div class="block">Set the angle of the swerve module.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>angle</code> - Angle in degrees.</dd>
<dd><code>feedforward</code> - The feedforward for the PID.</dd>
</dl>
</li>
</ul>
<a id="setAngle(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAngle</h4>
<pre class="methodSignature">private&nbsp;void&nbsp;setAngle&#8203;(double&nbsp;angle)</pre>
<div class="block">Set the angle of the swerve module without feedforward.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>angle</code> - Angle in degrees.</dd>
</dl>
</li>
</ul>
<a id="setVelocity(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setVelocity</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setVelocity&#8203;(double&nbsp;velocity)</pre>
<div class="block">Set the drive motor velocity in MPS.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>velocity</code> - Velocity in MPS.</dd>
</dl>
</li>
</ul>
<a id="getState()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getState</h4>
<pre class="methodSignature">public&nbsp;<a href="kinematics/SwerveModuleState2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveModuleState2</a>&nbsp;getState()</pre>
<div class="block">Get the module state.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>SwerveModuleState with the encoder inputs.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.RuntimeException</code> - Exception if CANCoder doesnt exist</dd>
</dl>
</li>
</ul>
<a id="setState(frc.robot.subsystems.swervedrive.swerve.kinematics.SwerveModuleState2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setState</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setState&#8203;(<a href="kinematics/SwerveModuleState2.html" title="class in frc.robot.subsystems.swervedrive.swerve.kinematics">SwerveModuleState2</a>&nbsp;state)</pre>
<div class="block">Set the module speed and angle based off the module state.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>state</code> - Module state.</dd>
</dl>
</li>
</ul>
<a id="getPosition()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPosition</h4>
<pre class="methodSignature">public&nbsp;edu.wpi.first.math.kinematics.SwerveModulePosition&nbsp;getPosition()</pre>
<div class="block">Get the swerve module position based off the sensors.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Swerve Module position, with the angle as what the angle is supposed to be, not what it actually is.</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">Subscribe from data within smart dashboard to make changes to the swerve module.</div>
</li>
</ul>
<a id="addEntry(java.lang.String,java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addEntry</h4>
<pre class="methodSignature">private&nbsp;edu.wpi.first.wpilibj.shuffleboard.SimpleWidget&nbsp;addEntry&#8203;(java.lang.String&nbsp;name,
java.lang.Object&nbsp;defaultValue)</pre>
<div class="block">Create a widget and add the entry to the hashmap of entries for network tables.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - Key to display on shuffleboard.</dd>
<dd><code>defaultValue</code> - Default value.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Widget that can be modified.</dd>
</dl>
</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 to the smart dashboard relating to this swerve module.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>level</code> - Verbosity level, affects the CAN utilization, on HIGH it will enable the update button.</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="blockList">
<li class="blockList">
<h4>close</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;close()</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>
</dl>
</li>
</ul>
<a id="disable()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>disable</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;disable()</pre>
<div class="block">Disable the motor controller.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>disable</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.motorcontrol.MotorController</code></dd>
</dl>
</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">Stops motor movement. Motor can be moved again by calling set without having to re-enable the motor.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>stopMotor</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.motorcontrol.MotorController</code></dd>
</dl>
</li>
</ul>
<a id="set(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;set&#8203;(double&nbsp;speed)</pre>
<div class="block">Common interface for setting the speed of a motor controller.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>set</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.motorcontrol.MotorController</code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>speed</code> - The speed to set. Value should be between -1.0 and 1.0.</dd>
</dl>
</li>
</ul>
<a id="get()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre class="methodSignature">public&nbsp;double&nbsp;get()</pre>
<div class="block">Common interface for getting the current set speed of a motor controller.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>get</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.motorcontrol.MotorController</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The current set speed. Value is between -1.0 and 1.0.</dd>
</dl>
</li>
</ul>
<a id="getSwerveModulePosition(frc.robot.subsystems.swervedrive.swerve.SwerveModule.SwerveModuleLocation)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSwerveModulePosition</h4>
<pre class="methodSignature">private&nbsp;edu.wpi.first.math.geometry.Translation2d&nbsp;getSwerveModulePosition&#8203;(<a href="SwerveModule.SwerveModuleLocation.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveModule.SwerveModuleLocation</a>&nbsp;swerveLocation)</pre>
<div class="block">Get the swerve module position in <code>Translation2d</code> from the enum passed.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>swerveLocation</code> - Swerve module location enum.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Location as <code>Translation2d</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.RuntimeException</code> - If Enum value is not defined.</dd>
</dl>
</li>
</ul>
<a id="setVoltageCompensation(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setVoltageCompensation</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setVoltageCompensation&#8203;(double&nbsp;nominalVoltage)</pre>
<div class="block">Set the voltage compensation for the swerve module motor.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>nominalVoltage</code> - Nominal voltage for operation to output to.</dd>
</dl>
</li>
</ul>
<a id="setCurrentLimit(int,frc.robot.subsystems.swervedrive.swerve.SwerveMotor.ModuleMotorType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCurrentLimit</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setCurrentLimit&#8203;(int&nbsp;currentLimit,
<a href="SwerveMotor.ModuleMotorType.html" title="enum in frc.robot.subsystems.swervedrive.swerve">SwerveMotor.ModuleMotorType</a>&nbsp;type)</pre>
<div class="block">Set the current limit for the swerve drive motor, remember this may cause jumping if used in conjunction with
voltage compensation. This is useful to protect the motor from current spikes.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>currentLimit</code> - Current limit in AMPS at free speed.</dd>
<dd><code>type</code> - Swerve Drive Motor type to configure.</dd>
</dl>
</li>
</ul>
<a id="setInvertedTurn(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setInvertedTurn</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setInvertedTurn&#8203;(boolean&nbsp;isInverted)</pre>
<div class="block">Set the steering motor to be inverted.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>isInverted</code> - The state of inversion, true is inverted.</dd>
</dl>
</li>
</ul>
<a id="setInvertedAbsoluteEncoder(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setInvertedAbsoluteEncoder</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setInvertedAbsoluteEncoder&#8203;(boolean&nbsp;isInverted)</pre>
<div class="block">Invert the absolute encoder.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>isInverted</code> - The state of inversion, true is inverted.</dd>
</dl>
</li>
</ul>
<a id="getInverted()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInverted</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;getInverted()</pre>
<div class="block">Common interface for returning if a motor controller is in the inverted state or not.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>getInverted</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.motorcontrol.MotorController</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>isInverted The state of the inversion true is inverted.</dd>
</dl>
</li>
</ul>
<a id="setInverted(boolean)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setInverted</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setInverted&#8203;(boolean&nbsp;isInverted)</pre>
<div class="block">Common interface for inverting direction of a motor controller.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>setInverted</code>&nbsp;in interface&nbsp;<code>edu.wpi.first.wpilibj.motorcontrol.MotorController</code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>isInverted</code> - The state of inversion, true is inverted.</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>