Files
YAGSL/docs/swervelib/motors/SparkMaxBrushedMotorSwerve.html
2023-02-24 22:10:33 -06:00

656 lines
42 KiB
HTML

<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Fri Feb 24 22:08:26 CST 2023 -->
<title>SparkMaxBrushedMotorSwerve</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2023-02-24">
<meta name="description" content="declaration: package: swervelib.motors, class: SparkMaxBrushedMotorSwerve">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
<script type="text/javascript" src="../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&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="sub-nav-list">
<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>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">swervelib.motors</a></div>
<h1 title="Class SparkMaxBrushedMotorSwerve" class="title">Class SparkMaxBrushedMotorSwerve</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance"><a href="SwerveMotor.html" title="class in swervelib.motors">swervelib.motors.SwerveMotor</a>
<div class="inheritance">swervelib.motors.SparkMaxBrushedMotorSwerve</div>
</div>
</div>
<section class="class-description" id="class-description">
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">SparkMaxBrushedMotorSwerve</span>
<span class="extends-implements">extends <a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></span></div>
<div class="block">Brushed motor control with SparkMax.</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>com.revrobotics.AbsoluteEncoder</code></div>
<div class="col-second even-row-color"><code><a href="#absoluteEncoder" class="member-name-link">absoluteEncoder</a></code></div>
<div class="col-last even-row-color">
<div class="block">Absolute encoder attached to the SparkMax (if exists)</div>
</div>
<div class="col-first odd-row-color"><code>com.revrobotics.RelativeEncoder</code></div>
<div class="col-second odd-row-color"><code><a href="#encoder" class="member-name-link">encoder</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Integrated encoder.</div>
</div>
<div class="col-first even-row-color"><code>private boolean</code></div>
<div class="col-second even-row-color"><code><a href="#factoryDefaultOccurred" class="member-name-link">factoryDefaultOccurred</a></code></div>
<div class="col-last even-row-color">
<div class="block">Factory default already occurred.</div>
</div>
<div class="col-first odd-row-color"><code>com.revrobotics.CANSparkMax</code></div>
<div class="col-second odd-row-color"><code><a href="#motor" class="member-name-link">motor</a></code></div>
<div class="col-last odd-row-color">
<div class="block">SparkMAX Instance.</div>
</div>
<div class="col-first even-row-color"><code>com.revrobotics.SparkMaxPIDController</code></div>
<div class="col-second even-row-color"><code><a href="#pid" class="member-name-link">pid</a></code></div>
<div class="col-last even-row-color">
<div class="block">Closed-loop PID controller.</div>
</div>
</div>
<div class="inherited-list">
<h3 id="fields-inherited-from-class-swervelib.motors.SwerveMotor">Fields inherited from class&nbsp;swervelib.motors.<a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></h3>
<code><a href="SwerveMotor.html#isDriveMotor">isDriveMotor</a></code></div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(int,boolean,com.revrobotics.SparkMaxRelativeEncoder.Type,int,boolean)" class="member-name-link">SparkMaxBrushedMotorSwerve</a><wbr>(int&nbsp;id,
boolean&nbsp;isDriveMotor,
com.revrobotics.SparkMaxRelativeEncoder.Type&nbsp;encoderType,
int&nbsp;countsPerRevolution,
boolean&nbsp;useDataPortQuadEncoder)</code></div>
<div class="col-last even-row-color">
<div class="block">Initialize the <a href="SwerveMotor.html" title="class in swervelib.motors"><code>SwerveMotor</code></a> as a <code>CANSparkMax</code> connected to a Brushless Motor.</div>
</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(com.revrobotics.CANSparkMax,boolean,com.revrobotics.SparkMaxRelativeEncoder.Type,int,boolean)" class="member-name-link">SparkMaxBrushedMotorSwerve</a><wbr>(com.revrobotics.CANSparkMax&nbsp;motor,
boolean&nbsp;isDriveMotor,
com.revrobotics.SparkMaxRelativeEncoder.Type&nbsp;encoderType,
int&nbsp;countsPerRevolution,
boolean&nbsp;useDataPortQuadEncoder)</code></div>
<div class="col-last odd-row-color">
<div class="block">Initialize the swerve motor.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#burnFlash()" class="member-name-link">burnFlash</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Save the configurations from flash to EEPROM.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#clearStickyFaults()" class="member-name-link">clearStickyFaults</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Clear the sticky faults on the motor controller.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#configureCANStatusFrames(int,int,int,int,int)" class="member-name-link">configureCANStatusFrames</a><wbr>(int&nbsp;CANStatus0,
int&nbsp;CANStatus1,
int&nbsp;CANStatus2,
int&nbsp;CANStatus3,
int&nbsp;CANStatus4)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the CAN status frames.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#configureIntegratedEncoder(double)" class="member-name-link">configureIntegratedEncoder</a><wbr>(double&nbsp;positionConversionFactor)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Configure the integrated encoder for the swerve module.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#configurePIDF(swervelib.parser.PIDFConfig)" class="member-name-link">configurePIDF</a><wbr>(<a href="../parser/PIDFConfig.html" title="class in swervelib.parser">PIDFConfig</a>&nbsp;config)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Configure the PIDF values for the closed loop controller.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#configurePIDWrapping(double,double)" class="member-name-link">configurePIDWrapping</a><wbr>(double&nbsp;minInput,
double&nbsp;maxInput)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Configure the PID wrapping for the position closed loop controller.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#factoryDefaults()" class="member-name-link">factoryDefaults</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Configure the factory defaults.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getMotor()" class="member-name-link">getMotor</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the motor object from the module.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPosition()" class="member-name-link">getPosition</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the position of the integrated encoder.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getVelocity()" class="member-name-link">getVelocity</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Get the velocity of the integrated encoder.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isAttachedAbsoluteEncoder()" class="member-name-link">isAttachedAbsoluteEncoder</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Queries whether the absolute encoder is directly attached to the motor controller.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#set(double)" class="member-name-link">set</a><wbr>(double&nbsp;percentOutput)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the percentage output.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setAbsoluteEncoder(swervelib.encoders.SwerveAbsoluteEncoder)" class="member-name-link">setAbsoluteEncoder</a><wbr>(<a href="../encoders/SwerveAbsoluteEncoder.html" title="class in swervelib.encoders">SwerveAbsoluteEncoder</a>&nbsp;encoder)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the absolute encoder to be a compatible absolute encoder.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setCurrentLimit(int)" class="member-name-link">setCurrentLimit</a><wbr>(int&nbsp;currentLimit)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the current limit for the swerve drive motor, remember this may cause jumping if used in conjunction with
voltage compensation.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setInverted(boolean)" class="member-name-link">setInverted</a><wbr>(boolean&nbsp;inverted)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the motor to be inverted.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setLoopRampRate(double)" class="member-name-link">setLoopRampRate</a><wbr>(double&nbsp;rampRate)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the maximum rate the open/closed loop output can change by.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setMotorBrake(boolean)" class="member-name-link">setMotorBrake</a><wbr>(boolean&nbsp;isBrakeMode)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the idle mode.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setPosition(double)" class="member-name-link">setPosition</a><wbr>(double&nbsp;position)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the integrated encoder position.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setReference(double,double)" class="member-name-link">setReference</a><wbr>(double&nbsp;setpoint,
double&nbsp;feedforward)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the closed loop PID controller reference point.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setVoltageCompensation(double)" class="member-name-link">setVoltageCompensation</a><wbr>(double&nbsp;nominalVoltage)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Set the voltage compensation for the swerve module motor.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="motor">
<h3>motor</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">com.revrobotics.CANSparkMax</span>&nbsp;<span class="element-name">motor</span></div>
<div class="block">SparkMAX Instance.</div>
</section>
</li>
<li>
<section class="detail" id="absoluteEncoder">
<h3>absoluteEncoder</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">com.revrobotics.AbsoluteEncoder</span>&nbsp;<span class="element-name">absoluteEncoder</span></div>
<div class="block">Absolute encoder attached to the SparkMax (if exists)</div>
</section>
</li>
<li>
<section class="detail" id="encoder">
<h3>encoder</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">com.revrobotics.RelativeEncoder</span>&nbsp;<span class="element-name">encoder</span></div>
<div class="block">Integrated encoder.</div>
</section>
</li>
<li>
<section class="detail" id="pid">
<h3>pid</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">com.revrobotics.SparkMaxPIDController</span>&nbsp;<span class="element-name">pid</span></div>
<div class="block">Closed-loop PID controller.</div>
</section>
</li>
<li>
<section class="detail" id="factoryDefaultOccurred">
<h3>factoryDefaultOccurred</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">factoryDefaultOccurred</span></div>
<div class="block">Factory default already occurred.</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(com.revrobotics.CANSparkMax,boolean,com.revrobotics.SparkMaxRelativeEncoder.Type,int,boolean)">
<h3>SparkMaxBrushedMotorSwerve</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">SparkMaxBrushedMotorSwerve</span><wbr><span class="parameters">(com.revrobotics.CANSparkMax&nbsp;motor,
boolean&nbsp;isDriveMotor,
com.revrobotics.SparkMaxRelativeEncoder.Type&nbsp;encoderType,
int&nbsp;countsPerRevolution,
boolean&nbsp;useDataPortQuadEncoder)</span></div>
<div class="block">Initialize the swerve motor.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>motor</code> - The SwerveMotor as a SparkMax object.</dd>
<dd><code>isDriveMotor</code> - Is the motor being initialized a drive motor?</dd>
<dd><code>encoderType</code> - <code>SparkMaxRelativeEncoder.Type</code> of encoder to use for the <code>CANSparkMax</code> device.</dd>
<dd><code>countsPerRevolution</code> - The number of encoder pulses for the <code>SparkMaxRelativeEncoder.Type</code> encoder per revolution.</dd>
<dd><code>useDataPortQuadEncoder</code> - Use the encoder attached to the data port of the spark max for a quadrature encoder.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(int,boolean,com.revrobotics.SparkMaxRelativeEncoder.Type,int,boolean)">
<h3>SparkMaxBrushedMotorSwerve</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">SparkMaxBrushedMotorSwerve</span><wbr><span class="parameters">(int&nbsp;id,
boolean&nbsp;isDriveMotor,
com.revrobotics.SparkMaxRelativeEncoder.Type&nbsp;encoderType,
int&nbsp;countsPerRevolution,
boolean&nbsp;useDataPortQuadEncoder)</span></div>
<div class="block">Initialize the <a href="SwerveMotor.html" title="class in swervelib.motors"><code>SwerveMotor</code></a> as a <code>CANSparkMax</code> connected to a Brushless Motor.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>id</code> - CAN ID of the SparkMax.</dd>
<dd><code>isDriveMotor</code> - Is the motor being initialized a drive motor?</dd>
<dd><code>encoderType</code> - <code>SparkMaxRelativeEncoder.Type</code> of encoder to use for the <code>CANSparkMax</code> device.</dd>
<dd><code>countsPerRevolution</code> - The number of encoder pulses for the <code>SparkMaxRelativeEncoder.Type</code> encoder per revolution.</dd>
<dd><code>useDataPortQuadEncoder</code> - Use the encoder attached to the data port of the spark max for a quadrature encoder.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="setVoltageCompensation(double)">
<h3>setVoltageCompensation</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setVoltageCompensation</span><wbr><span class="parameters">(double&nbsp;nominalVoltage)</span></div>
<div class="block">Set the voltage compensation for the swerve module motor.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#setVoltageCompensation(double)">setVoltageCompensation</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>nominalVoltage</code> - Nominal voltage for operation to output to.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setCurrentLimit(int)">
<h3>setCurrentLimit</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setCurrentLimit</span><wbr><span class="parameters">(int&nbsp;currentLimit)</span></div>
<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 class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#setCurrentLimit(int)">setCurrentLimit</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>currentLimit</code> - Current limit in AMPS at free speed.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setLoopRampRate(double)">
<h3>setLoopRampRate</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setLoopRampRate</span><wbr><span class="parameters">(double&nbsp;rampRate)</span></div>
<div class="block">Set the maximum rate the open/closed loop output can change by.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#setLoopRampRate(double)">setLoopRampRate</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>rampRate</code> - Time in seconds to go from 0 to full throttle.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getMotor()">
<h3>getMotor</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span>&nbsp;<span class="element-name">getMotor</span>()</div>
<div class="block">Get the motor object from the module.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#getMotor()">getMotor</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Returns:</dt>
<dd>Motor object.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="isAttachedAbsoluteEncoder()">
<h3>isAttachedAbsoluteEncoder</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">isAttachedAbsoluteEncoder</span>()</div>
<div class="block">Queries whether the absolute encoder is directly attached to the motor controller.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#isAttachedAbsoluteEncoder()">isAttachedAbsoluteEncoder</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Returns:</dt>
<dd>connected absolute encoder state.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="factoryDefaults()">
<h3>factoryDefaults</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">factoryDefaults</span>()</div>
<div class="block">Configure the factory defaults.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#factoryDefaults()">factoryDefaults</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="clearStickyFaults()">
<h3>clearStickyFaults</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">clearStickyFaults</span>()</div>
<div class="block">Clear the sticky faults on the motor controller.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#clearStickyFaults()">clearStickyFaults</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setAbsoluteEncoder(swervelib.encoders.SwerveAbsoluteEncoder)">
<h3>setAbsoluteEncoder</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></span>&nbsp;<span class="element-name">setAbsoluteEncoder</span><wbr><span class="parameters">(<a href="../encoders/SwerveAbsoluteEncoder.html" title="class in swervelib.encoders">SwerveAbsoluteEncoder</a>&nbsp;encoder)</span></div>
<div class="block">Set the absolute encoder to be a compatible absolute encoder.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#setAbsoluteEncoder(swervelib.encoders.SwerveAbsoluteEncoder)">setAbsoluteEncoder</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>encoder</code> - The encoder to use.</dd>
<dt>Returns:</dt>
<dd>The <a href="SwerveMotor.html" title="class in swervelib.motors"><code>SwerveMotor</code></a> for easy instantiation.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="configureIntegratedEncoder(double)">
<h3>configureIntegratedEncoder</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">configureIntegratedEncoder</span><wbr><span class="parameters">(double&nbsp;positionConversionFactor)</span></div>
<div class="block">Configure the integrated encoder for the swerve module. Sets the conversion factors for position and velocity.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#configureIntegratedEncoder(double)">configureIntegratedEncoder</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>positionConversionFactor</code> - The conversion factor to apply.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="configurePIDF(swervelib.parser.PIDFConfig)">
<h3>configurePIDF</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">configurePIDF</span><wbr><span class="parameters">(<a href="../parser/PIDFConfig.html" title="class in swervelib.parser">PIDFConfig</a>&nbsp;config)</span></div>
<div class="block">Configure the PIDF values for the closed loop controller.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#configurePIDF(swervelib.parser.PIDFConfig)">configurePIDF</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>config</code> - Configuration class holding the PIDF values.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="configurePIDWrapping(double,double)">
<h3>configurePIDWrapping</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">configurePIDWrapping</span><wbr><span class="parameters">(double&nbsp;minInput,
double&nbsp;maxInput)</span></div>
<div class="block">Configure the PID wrapping for the position closed loop controller.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#configurePIDWrapping(double,double)">configurePIDWrapping</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>minInput</code> - Minimum PID input.</dd>
<dd><code>maxInput</code> - Maximum PID input.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="configureCANStatusFrames(int,int,int,int,int)">
<h3>configureCANStatusFrames</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">configureCANStatusFrames</span><wbr><span class="parameters">(int&nbsp;CANStatus0,
int&nbsp;CANStatus1,
int&nbsp;CANStatus2,
int&nbsp;CANStatus3,
int&nbsp;CANStatus4)</span></div>
<div class="block">Set the CAN status frames.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>CANStatus0</code> - Applied Output, Faults, Sticky Faults, Is Follower</dd>
<dd><code>CANStatus1</code> - Motor Velocity, Motor Temperature, Motor Voltage, Motor Current</dd>
<dd><code>CANStatus2</code> - Motor Position</dd>
<dd><code>CANStatus3</code> - Analog Sensor Voltage, Analog Sensor Velocity, Analog Sensor Position</dd>
<dd><code>CANStatus4</code> - Alternate Encoder Velocity, Alternate Encoder Position</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setMotorBrake(boolean)">
<h3>setMotorBrake</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setMotorBrake</span><wbr><span class="parameters">(boolean&nbsp;isBrakeMode)</span></div>
<div class="block">Set the idle mode.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#setMotorBrake(boolean)">setMotorBrake</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>isBrakeMode</code> - Set the brake mode.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setInverted(boolean)">
<h3>setInverted</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setInverted</span><wbr><span class="parameters">(boolean&nbsp;inverted)</span></div>
<div class="block">Set the motor to be inverted.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#setInverted(boolean)">setInverted</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>inverted</code> - State of inversion.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="burnFlash()">
<h3>burnFlash</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">burnFlash</span>()</div>
<div class="block">Save the configurations from flash to EEPROM.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#burnFlash()">burnFlash</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="set(double)">
<h3>set</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">set</span><wbr><span class="parameters">(double&nbsp;percentOutput)</span></div>
<div class="block">Set the percentage output.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#set(double)">set</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>percentOutput</code> - percent out for the motor controller.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setReference(double,double)">
<h3>setReference</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setReference</span><wbr><span class="parameters">(double&nbsp;setpoint,
double&nbsp;feedforward)</span></div>
<div class="block">Set the closed loop PID controller reference point.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#setReference(double,double)">setReference</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>setpoint</code> - Setpoint in MPS or Angle in degrees.</dd>
<dd><code>feedforward</code> - Feedforward in volt-meter-per-second or kV.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getVelocity()">
<h3>getVelocity</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">getVelocity</span>()</div>
<div class="block">Get the velocity of the integrated encoder.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#getVelocity()">getVelocity</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Returns:</dt>
<dd>velocity</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getPosition()">
<h3>getPosition</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">double</span>&nbsp;<span class="element-name">getPosition</span>()</div>
<div class="block">Get the position of the integrated encoder.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#getPosition()">getPosition</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Returns:</dt>
<dd>Position</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setPosition(double)">
<h3>setPosition</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setPosition</span><wbr><span class="parameters">(double&nbsp;position)</span></div>
<div class="block">Set the integrated encoder position.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="SwerveMotor.html#setPosition(double)">setPosition</a></code>&nbsp;in class&nbsp;<code><a href="SwerveMotor.html" title="class in swervelib.motors">SwerveMotor</a></code></dd>
<dt>Parameters:</dt>
<dd><code>position</code> - Integrated encoder position.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</div>
</body>
</html>