2023-02-13 14:37:05 -06:00
<!DOCTYPE HTML>
< html lang = "en" >
< head >
2024-01-15 14:39:17 -06:00
<!-- Generated by javadoc (17) on Mon Jan 15 14:38:31 CST 2024 -->
< title > SwerveController< / title >
2023-02-14 22:03:02 -06:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
2023-02-13 14:37:05 -06:00
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" >
2024-01-15 14:39:17 -06:00
< meta name = "dc.created" content = "2024-01-15" >
2023-02-14 22:03:02 -06:00
< meta name = "description" content = "declaration: package: swervelib, class: SwerveController" >
< meta name = "generator" content = "javadoc/ClassWriterImpl" >
2023-02-13 15:03:55 -06:00
< link rel = "stylesheet" type = "text/css" href = "../stylesheet.css" title = "Style" >
2023-02-14 22:03:02 -06:00
< link rel = "stylesheet" type = "text/css" href = "../script-dir/jquery-ui.min.css" title = "Style" >
2023-02-13 15:03:55 -06:00
< link rel = "stylesheet" type = "text/css" href = "../jquery-ui.overrides.css" title = "Style" >
< script type = "text/javascript" src = "../script.js" > < / script >
2024-01-15 14:39:17 -06:00
< script type = "text/javascript" src = "../script-dir/jquery-3.5.1.min.js" > < / script >
2023-02-14 22:03:02 -06:00
< script type = "text/javascript" src = "../script-dir/jquery-ui.min.js" > < / script >
2023-02-13 14:37:05 -06:00
< / head >
2023-02-14 22:03:02 -06:00
< body class = "class-declaration-page" >
< script type = "text/javascript" > v a r e v e n R o w C o l o r = " e v e n - r o w - c o l o r " ;
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
2023-02-13 15:03:55 -06:00
var pathtoroot = "../";
2023-02-13 14:37:05 -06:00
loadScripts(document, 'script');< / script >
< noscript >
< div > JavaScript is disabled on your browser.< / div >
< / noscript >
2023-02-14 22:03:02 -06:00
< div class = "flex-box" >
< header role = "banner" class = "flex-header" >
2023-02-13 14:37:05 -06:00
< nav role = "navigation" >
<!-- ========= START OF TOP NAVBAR ======= -->
2023-02-14 22:03:02 -06:00
< 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" >
2023-02-13 15:03:55 -06:00
< li > < a href = "../index.html" > Overview< / a > < / li >
2023-02-13 14:37:05 -06:00
< li > < a href = "package-summary.html" > Package< / a > < / li >
2023-02-14 22:03:02 -06:00
< li class = "nav-bar-cell1-rev" > Class< / li >
2023-02-13 14:37:05 -06:00
< li > < a href = "package-tree.html" > Tree< / a > < / li >
2024-01-15 14:39:17 -06:00
< li > < a href = "../index-files/index-1.html" > Index< / a > < / li >
2023-02-14 22:03:02 -06:00
< li > < a href = "../help-doc.html#class" > Help< / a > < / li >
2023-02-13 14:37:05 -06:00
< / ul >
< / div >
2023-02-14 22:03:02 -06:00
< div class = "sub-nav" >
2023-02-13 14:37:05 -06:00
< div >
2023-02-14 22:03:02 -06:00
< ul class = "sub-nav-list" >
2023-02-13 14:37:05 -06:00
< li > Summary: < / li >
< li > Nested | < / li >
2023-02-14 22:03:02 -06:00
< li > < a href = "#field-summary" > Field< / a > | < / li >
< li > < a href = "#constructor-summary" > Constr< / a > | < / li >
< li > < a href = "#method-summary" > Method< / a > < / li >
2023-02-13 14:37:05 -06:00
< / ul >
2023-02-14 22:03:02 -06:00
< ul class = "sub-nav-list" >
2023-02-13 14:37:05 -06:00
< li > Detail: < / li >
2023-02-14 22:03:02 -06:00
< li > < a href = "#field-detail" > Field< / a > | < / li >
< li > < a href = "#constructor-detail" > Constr< / a > | < / li >
< li > < a href = "#method-detail" > Method< / a > < / li >
2023-02-13 14:37:05 -06:00
< / ul >
< / div >
2023-02-14 22:03:02 -06:00
< 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" >
2023-02-13 14:37:05 -06:00
< / div >
2023-02-14 22:03:02 -06:00
< / div >
<!-- ========= END OF TOP NAVBAR ========= -->
< span class = "skip-nav" id = "skip-navbar-top" > < / span > < / nav >
2023-02-13 14:37:05 -06:00
< / header >
2023-02-14 22:03:02 -06:00
< div class = "flex-content" >
2023-02-13 14:37:05 -06:00
< main role = "main" >
2023-02-14 22:03:02 -06:00
<!-- ======== START OF CLASS DATA ======== -->
2023-02-13 14:37:05 -06:00
< div class = "header" >
2023-02-14 22:03:02 -06:00
< div class = "sub-title" > < span class = "package-label-in-type" > Package< / span > < a href = "package-summary.html" > swervelib< / a > < / div >
< h1 title = "Class SwerveController" class = "title" > Class SwerveController< / h1 >
2023-02-13 14:37:05 -06:00
< / div >
2023-02-14 22:03:02 -06:00
< 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" > swervelib.SwerveController< / div >
< / div >
< section class = "class-description" id = "class-description" >
2023-02-13 14:37:05 -06:00
< hr >
2023-02-14 22:03:02 -06:00
< div class = "type-signature" > < span class = "modifiers" > public class < / span > < span class = "element-name type-name-label" > SwerveController< / span >
< span class = "extends-implements" > extends < 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 > < / div >
2023-02-13 14:37:05 -06:00
< div class = "block" > Controller class used to convert raw inputs into robot speeds.< / div >
2023-02-14 22:03:02 -06:00
< / section >
< section class = "summary" >
< ul class = "summary-list" >
2023-02-13 14:37:05 -06:00
<!-- =========== FIELD SUMMARY =========== -->
2023-02-14 22:03:02 -06:00
< 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 >
2023-02-22 20:50:16 -06:00
< div class = "col-first even-row-color" > < code > edu.wpi.first.math.filter.SlewRateLimiter< / code > < / div >
< div class = "col-second even-row-color" > < code > < a href = "#angleLimiter" class = "member-name-link" > angleLimiter< / a > < / code > < / div >
2023-02-14 22:03:02 -06:00
< div class = "col-last even-row-color" >
2023-02-22 20:50:16 -06:00
< div class = "block" > < code > SlewRateLimiter< / code > for angular movement in radians/second.< / div >
< / div >
< div class = "col-first odd-row-color" > < code > final < a href = "parser/SwerveControllerConfiguration.html" title = "class in swervelib.parser" > SwerveControllerConfiguration< / a > < / code > < / div >
< div class = "col-second odd-row-color" > < code > < a href = "#config" class = "member-name-link" > config< / a > < / code > < / div >
< div class = "col-last odd-row-color" >
2023-08-29 19:59:07 -05:00
< div class = "block" > < a href = "parser/SwerveControllerConfiguration.html" title = "class in swervelib.parser" > < code > SwerveControllerConfiguration< / code > < / a > object storing data to generate the < code > PIDController< / code > for controlling the
robot heading, and deadband for heading joystick.< / div >
2023-02-14 22:03:02 -06:00
< / div >
2023-02-22 20:50:16 -06:00
< div class = "col-first even-row-color" > < code > double< / code > < / div >
< div class = "col-second even-row-color" > < code > < a href = "#lastAngleScalar" class = "member-name-link" > lastAngleScalar< / a > < / code > < / div >
< div class = "col-last even-row-color" >
< div class = "block" > Last angle as a scalar [-1,1] the robot was set to.< / div >
< / div >
2023-03-22 20:02:49 -05:00
< div class = "col-first odd-row-color" > < code > final edu.wpi.first.math.controller.PIDController< / code > < / div >
2023-02-22 20:50:16 -06:00
< div class = "col-second odd-row-color" > < code > < a href = "#thetaController" class = "member-name-link" > thetaController< / a > < / code > < / div >
2023-02-14 22:03:02 -06:00
< div class = "col-last odd-row-color" >
2023-02-22 20:50:16 -06:00
< div class = "block" > PID Controller for the robot heading.< / div >
2023-02-14 22:03:02 -06:00
< / div >
2023-02-22 20:50:16 -06:00
< div class = "col-first even-row-color" > < code > edu.wpi.first.math.filter.SlewRateLimiter< / code > < / div >
< div class = "col-second even-row-color" > < code > < a href = "#xLimiter" class = "member-name-link" > xLimiter< / a > < / code > < / div >
2023-02-14 22:03:02 -06:00
< div class = "col-last even-row-color" >
2023-02-22 20:50:16 -06:00
< div class = "block" > < code > SlewRateLimiter< / code > for movement in the X direction in meters/second.< / div >
< / div >
< div class = "col-first odd-row-color" > < code > edu.wpi.first.math.filter.SlewRateLimiter< / code > < / div >
< div class = "col-second odd-row-color" > < code > < a href = "#yLimiter" class = "member-name-link" > yLimiter< / a > < / code > < / div >
< div class = "col-last odd-row-color" >
< div class = "block" > < code > SlewRateLimiter< / code > for movement in the Y direction in meters/second.< / div >
2023-02-14 22:03:02 -06:00
< / div >
< / div >
2023-02-13 14:37:05 -06:00
< / section >
2023-02-14 22:03:02 -06:00
< / li >
2023-02-13 14:37:05 -06:00
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
2023-02-14 22:03:02 -06:00
< 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(swervelib.parser.SwerveControllerConfiguration)" class = "member-name-link" > SwerveController< / a > < wbr > (< a href = "parser/SwerveControllerConfiguration.html" title = "class in swervelib.parser" > SwerveControllerConfiguration< / a > cfg)< / code > < / div >
< div class = "col-last even-row-color" >
2023-08-29 19:59:07 -05:00
< div class = "block" > Construct the SwerveController object which is used for determining the speeds of the robot based on controller
input.< / div >
2023-02-14 22:03:02 -06:00
< / div >
< / div >
2023-02-13 14:37:05 -06:00
< / section >
2023-02-14 22:03:02 -06:00
< / li >
2023-02-13 14:37:05 -06:00
<!-- ========== METHOD SUMMARY =========== -->
2023-02-14 22:03:02 -06:00
< 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-tab1" role = "tab" aria-selected = "false" aria-controls = "method-summary-table.tabpanel" tabindex = "-1" onkeydown = "switchTab(event)" onclick = "show('method-summary-table', 'method-summary-table-tab1', 3)" class = "table-tab" > Static 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 >
2023-02-22 20:50:16 -06:00
< 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 = "#addSlewRateLimiters(edu.wpi.first.math.filter.SlewRateLimiter,edu.wpi.first.math.filter.SlewRateLimiter,edu.wpi.first.math.filter.SlewRateLimiter)" class = "member-name-link" > addSlewRateLimiters< / a > < wbr > (edu.wpi.first.math.filter.SlewRateLimiter x,
edu.wpi.first.math.filter.SlewRateLimiter y,
edu.wpi.first.math.filter.SlewRateLimiter angle)< / code > < / div >
< div class = "col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" >
< div class = "block" > Add slew rate limiters to all controls.< / div >
< / div >
2023-03-30 23:28:07 -05:00
< 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 = "#getJoystickAngle(double,double)" class = "member-name-link" > getJoystickAngle< / a > < wbr > (double headingX,
double headingY)< / 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 angle in radians based off of the heading joysticks.< / div >
< / div >
< div class = "col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > edu.wpi.first.math.kinematics.ChassisSpeeds< / code > < / div >
< div class = "col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > < a href = "#getRawTargetSpeeds(double,double,double)" class = "member-name-link" > getRawTargetSpeeds< / a > < wbr > (double xSpeed,
2023-02-22 20:50:16 -06:00
double ySpeed,
double omega)< / code > < / div >
2023-03-30 23:28:07 -05:00
< div class = "col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" >
2023-08-29 19:59:07 -05:00
< div class = "block" > Get the < code > ChassisSpeeds< / code > based of raw speeds desired in meters/second and heading in radians.< / div >
2023-02-22 20:50:16 -06:00
< / div >
2023-03-30 23:28:07 -05:00
< div class = "col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > edu.wpi.first.math.kinematics.ChassisSpeeds< / code > < / div >
< div class = "col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > < a href = "#getRawTargetSpeeds(double,double,double,double)" class = "member-name-link" > getRawTargetSpeeds< / a > < wbr > (double xSpeed,
2023-02-22 20:50:16 -06:00
double ySpeed,
double targetHeadingAngleRadians,
2023-02-14 22:03:02 -06:00
double currentHeadingAngleRadians)< / code > < / div >
2023-03-30 23:28:07 -05:00
< div class = "col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" >
2023-08-29 19:59:07 -05:00
< div class = "block" > Get the < code > ChassisSpeeds< / code > based of raw speeds desired in meters/second and heading in radians.< / div >
2023-02-14 22:03:02 -06:00
< / div >
2023-03-30 23:28:07 -05:00
< div class = "col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > edu.wpi.first.math.kinematics.ChassisSpeeds< / code > < / div >
2023-11-09 18:54:46 -06:00
< div class = "col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > < a href = "#getTargetSpeeds(double,double,double,double,double)" class = "member-name-link" > getTargetSpeeds< / a > < wbr > (double xInput,
2023-02-22 20:50:16 -06:00
double yInput,
double angle,
2023-11-09 18:54:46 -06:00
double currentHeadingAngleRadians,
double maxSpeed)< / code > < / div >
2023-03-30 23:28:07 -05:00
< div class = "col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" >
2023-02-23 21:12:29 -06:00
< div class = "block" > Get the chassis speeds based on controller input of 1 joystick [-1,1] and an angle.< / div >
2023-02-22 20:50:16 -06:00
< / div >
2023-03-30 23:28:07 -05:00
< div class = "col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > edu.wpi.first.math.kinematics.ChassisSpeeds< / code > < / div >
2023-11-09 18:54:46 -06:00
< div class = "col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > < a href = "#getTargetSpeeds(double,double,double,double,double,double)" class = "member-name-link" > getTargetSpeeds< / a > < wbr > (double xInput,
2023-02-14 22:03:02 -06:00
double yInput,
double headingX,
double headingY,
2023-11-09 18:54:46 -06:00
double currentHeadingAngleRadians,
double maxSpeed)< / code > < / div >
2023-03-30 23:28:07 -05:00
< div class = "col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" >
2023-02-13 14:37:05 -06:00
< div class = "block" > Get the chassis speeds based on controller input of 2 joysticks.< / div >
2023-02-14 22:03:02 -06:00
< / div >
2023-03-30 23:28:07 -05:00
< div class = "col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4" > < code > static edu.wpi.first.math.geometry.Translation2d< / code > < / div >
< div class = "col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4" > < code > < a href = "#getTranslation2d(edu.wpi.first.math.kinematics.ChassisSpeeds)" class = "member-name-link" > getTranslation2d< / a > < wbr > (edu.wpi.first.math.kinematics.ChassisSpeeds speeds)< / code > < / div >
< div class = "col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4" >
2023-02-13 14:37:05 -06:00
< div class = "block" > Helper function to get the < code > Translation2d< / code > of the chassis speeds given the < code > ChassisSpeeds< / code > .< / div >
2023-02-14 22:03:02 -06:00
< / div >
2023-03-30 23:28:07 -05:00
< 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 = "#headingCalculate(double,double)" class = "member-name-link" > headingCalculate< / a > < wbr > (double currentHeadingAngleRadians,
2023-02-23 22:46:43 -06:00
double targetHeadingAngleRadians)< / code > < / div >
2023-03-30 23:28:07 -05:00
< div class = "col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" >
2023-02-23 22:46:43 -06:00
< div class = "block" > Calculate the angular velocity given the current and target heading angle in radians.< / div >
< / div >
2023-03-30 23:28:07 -05:00
< 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 = "#setMaximumAngularVelocity(double)" class = "member-name-link" > setMaximumAngularVelocity< / a > < wbr > (double angularVelocity)< / code > < / div >
< div class = "col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" >
2023-03-29 07:24:24 -05:00
< div class = "block" > Set a new maximum angular velocity that is different from the auto-generated one.< / div >
< / div >
2023-03-30 23:28:07 -05:00
< div class = "col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > boolean< / code > < / div >
< div class = "col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" > < code > < a href = "#withinHypotDeadband(double,double)" class = "member-name-link" > withinHypotDeadband< / a > < wbr > (double x,
2023-03-29 07:24:24 -05:00
double y)< / code > < / div >
2023-03-30 23:28:07 -05:00
< div class = "col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4" >
2023-02-13 14:37:05 -06:00
< div class = "block" > Calculate the hypot deadband and check if the joystick is within it.< / div >
2023-02-14 22:03:02 -06:00
< / div >
< / div >
< / div >
< / div >
< div class = "inherited-list" >
< h3 id = "methods-inherited-from-class-java.lang.Object" > Methods inherited from class 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 >
2023-02-13 14:37:05 -06:00
< / section >
< / li >
< / ul >
2023-02-14 22:03:02 -06:00
< / section >
< section class = "details" >
< ul class = "details-list" >
2023-02-13 14:37:05 -06:00
<!-- ============ FIELD DETAIL =========== -->
2023-02-14 22:03:02 -06:00
< li >
< section class = "field-details" id = "field-detail" >
< h2 > Field Details< / h2 >
< ul class = "member-list" >
< li >
< section class = "detail" id = "config" >
< h3 > config< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public final< / span > < span class = "return-type" > < a href = "parser/SwerveControllerConfiguration.html" title = "class in swervelib.parser" > SwerveControllerConfiguration< / a > < / span > < span class = "element-name" > config< / span > < / div >
2023-08-29 19:59:07 -05:00
< div class = "block" > < a href = "parser/SwerveControllerConfiguration.html" title = "class in swervelib.parser" > < code > SwerveControllerConfiguration< / code > < / a > object storing data to generate the < code > PIDController< / code > for controlling the
robot heading, and deadband for heading joystick.< / div >
2023-02-14 22:03:02 -06:00
< / section >
2023-02-13 14:37:05 -06:00
< / li >
2023-02-14 22:03:02 -06:00
< li >
< section class = "detail" id = "thetaController" >
< h3 > thetaController< / h3 >
2023-03-22 20:02:49 -05:00
< div class = "member-signature" > < span class = "modifiers" > public final< / span > < span class = "return-type" > edu.wpi.first.math.controller.PIDController< / span > < span class = "element-name" > thetaController< / span > < / div >
2023-02-13 14:37:05 -06:00
< div class = "block" > PID Controller for the robot heading.< / div >
2023-02-14 22:03:02 -06:00
< / section >
2023-02-13 14:37:05 -06:00
< / li >
2023-02-14 22:03:02 -06:00
< li >
2023-02-22 20:50:16 -06:00
< section class = "detail" id = "lastAngleScalar" >
< h3 > lastAngleScalar< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > double< / span > < span class = "element-name" > lastAngleScalar< / span > < / div >
< div class = "block" > Last angle as a scalar [-1,1] the robot was set to.< / div >
< / section >
< / li >
< li >
< section class = "detail" id = "xLimiter" >
< h3 > xLimiter< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > edu.wpi.first.math.filter.SlewRateLimiter< / span > < span class = "element-name" > xLimiter< / span > < / div >
< div class = "block" > < code > SlewRateLimiter< / code > for movement in the X direction in meters/second.< / div >
< / section >
< / li >
< li >
< section class = "detail" id = "yLimiter" >
< h3 > yLimiter< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > edu.wpi.first.math.filter.SlewRateLimiter< / span > < span class = "element-name" > yLimiter< / span > < / div >
< div class = "block" > < code > SlewRateLimiter< / code > for movement in the Y direction in meters/second.< / div >
< / section >
< / li >
< li >
< section class = "detail" id = "angleLimiter" >
< h3 > angleLimiter< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > edu.wpi.first.math.filter.SlewRateLimiter< / span > < span class = "element-name" > angleLimiter< / span > < / div >
< div class = "block" > < code > SlewRateLimiter< / code > for angular movement in radians/second.< / div >
2023-02-14 22:03:02 -06:00
< / section >
2023-02-13 14:37:05 -06:00
< / li >
< / ul >
< / section >
2023-02-14 22:03:02 -06:00
< / li >
2023-02-13 14:37:05 -06:00
<!-- ========= CONSTRUCTOR DETAIL ======== -->
2023-02-14 22:03:02 -06:00
< li >
< section class = "constructor-details" id = "constructor-detail" >
< h2 > Constructor Details< / h2 >
< ul class = "member-list" >
< li >
< section class = "detail" id = "<init>(swervelib.parser.SwerveControllerConfiguration)" >
< h3 > SwerveController< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "element-name" > SwerveController< / span > < wbr > < span class = "parameters" > (< a href = "parser/SwerveControllerConfiguration.html" title = "class in swervelib.parser" > SwerveControllerConfiguration< / a > cfg)< / span > < / div >
2023-08-29 19:59:07 -05:00
< div class = "block" > Construct the SwerveController object which is used for determining the speeds of the robot based on controller
input.< / div >
2023-02-14 22:03:02 -06:00
< dl class = "notes" >
< dt > Parameters:< / dt >
2023-08-29 19:59:07 -05:00
< dd > < code > cfg< / code > - < a href = "parser/SwerveControllerConfiguration.html" title = "class in swervelib.parser" > < code > SwerveControllerConfiguration< / code > < / a > containing the PIDF variables for the heading PIDF.< / dd >
2023-02-14 22:03:02 -06:00
< / dl >
< / section >
2023-02-13 14:37:05 -06:00
< / li >
< / ul >
< / section >
2023-02-14 22:03:02 -06:00
< / li >
2023-02-13 14:37:05 -06:00
<!-- ============ METHOD DETAIL ========== -->
2023-02-14 22:03:02 -06:00
< li >
< section class = "method-details" id = "method-detail" >
< h2 > Method Details< / h2 >
< ul class = "member-list" >
< li >
< section class = "detail" id = "getTranslation2d(edu.wpi.first.math.kinematics.ChassisSpeeds)" >
< h3 > getTranslation2d< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public static< / span > < span class = "return-type" > edu.wpi.first.math.geometry.Translation2d< / span > < span class = "element-name" > getTranslation2d< / span > < wbr > < span class = "parameters" > (edu.wpi.first.math.kinematics.ChassisSpeeds speeds)< / span > < / div >
2023-02-13 14:37:05 -06:00
< div class = "block" > Helper function to get the < code > Translation2d< / code > of the chassis speeds given the < code > ChassisSpeeds< / code > .< / div >
2023-02-14 22:03:02 -06:00
< dl class = "notes" >
< dt > Parameters:< / dt >
2023-02-13 14:37:05 -06:00
< dd > < code > speeds< / code > - Chassis speeds.< / dd >
2023-02-14 22:03:02 -06:00
< dt > Returns:< / dt >
2023-02-13 14:37:05 -06:00
< dd > < code > Translation2d< / code > of the speed the robot is going in.< / dd >
< / dl >
2023-02-14 22:03:02 -06:00
< / section >
2023-02-13 14:37:05 -06:00
< / li >
2023-02-14 22:03:02 -06:00
< li >
2023-02-22 20:50:16 -06:00
< section class = "detail" id = "addSlewRateLimiters(edu.wpi.first.math.filter.SlewRateLimiter,edu.wpi.first.math.filter.SlewRateLimiter,edu.wpi.first.math.filter.SlewRateLimiter)" >
< h3 > addSlewRateLimiters< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > void< / span > < span class = "element-name" > addSlewRateLimiters< / span > < wbr > < span class = "parameters" > (edu.wpi.first.math.filter.SlewRateLimiter x,
edu.wpi.first.math.filter.SlewRateLimiter y,
edu.wpi.first.math.filter.SlewRateLimiter angle)< / span > < / div >
2023-08-29 19:59:07 -05:00
< div class = "block" > Add slew rate limiters to all controls. This prevents the robot from ramping up too much. To disable a
< code > SlewRateLimiter< / code > set the desired one to null.< / div >
2023-02-22 20:50:16 -06:00
< dl class = "notes" >
< dt > Parameters:< / dt >
< dd > < code > x< / code > - The < code > SlewRateLimiter< / code > for the X velocity in meters/second.< / dd >
< dd > < code > y< / code > - The < code > SlewRateLimiter< / code > for the Y velocity in meters/second.< / dd >
< dd > < code > angle< / code > - The < code > SlewRateLimiter< / code > for the angular velocity in radians/second.< / dd >
< / dl >
< / section >
< / li >
< li >
2023-02-14 22:03:02 -06:00
< section class = "detail" id = "withinHypotDeadband(double,double)" >
< h3 > withinHypotDeadband< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > boolean< / span > < span class = "element-name" > withinHypotDeadband< / span > < wbr > < span class = "parameters" > (double x,
double y)< / span > < / div >
2023-02-13 14:37:05 -06:00
< div class = "block" > Calculate the hypot deadband and check if the joystick is within it.< / div >
2023-02-14 22:03:02 -06:00
< dl class = "notes" >
< dt > Parameters:< / dt >
2023-02-13 14:37:05 -06:00
< dd > < code > x< / code > - The x value for the joystick in which the deadband should be applied.< / dd >
< dd > < code > y< / code > - The y value for the joystick in which the deadband should be applied.< / dd >
2023-02-14 22:03:02 -06:00
< dt > Returns:< / dt >
2023-08-29 19:59:07 -05:00
< dd > Whether the values are within the deadband from
< a href = "parser/SwerveControllerConfiguration.html#angleJoyStickRadiusDeadband" > < code > SwerveControllerConfiguration.angleJoyStickRadiusDeadband< / code > < / a > .< / dd >
2023-02-13 14:37:05 -06:00
< / dl >
2023-02-14 22:03:02 -06:00
< / section >
2023-02-13 14:37:05 -06:00
< / li >
2023-02-14 22:03:02 -06:00
< li >
2023-11-09 18:54:46 -06:00
< section class = "detail" id = "getTargetSpeeds(double,double,double,double,double)" >
2023-02-14 22:03:02 -06:00
< h3 > getTargetSpeeds< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > edu.wpi.first.math.kinematics.ChassisSpeeds< / span > < span class = "element-name" > getTargetSpeeds< / span > < wbr > < span class = "parameters" > (double xInput,
double yInput,
double angle,
2023-11-09 18:54:46 -06:00
double currentHeadingAngleRadians,
double maxSpeed)< / span > < / div >
2023-02-23 21:12:29 -06:00
< div class = "block" > Get the chassis speeds based on controller input of 1 joystick [-1,1] and an angle.< / div >
2023-02-14 22:03:02 -06:00
< dl class = "notes" >
< dt > Parameters:< / dt >
2023-11-09 18:54:46 -06:00
< dd > < code > xInput< / code > - X joystick input for the robot to move in the X direction. X = xInput * maxSpeed< / dd >
< dd > < code > yInput< / code > - Y joystick input for the robot to move in the Y direction. Y = yInput *
maxSpeed;< / dd >
2023-02-13 14:37:05 -06:00
< dd > < code > angle< / code > - The desired angle of the robot in radians.< / dd >
< dd > < code > currentHeadingAngleRadians< / code > - The current robot heading in radians.< / dd >
2023-11-09 18:54:46 -06:00
< dd > < code > maxSpeed< / code > - Maximum speed in meters per second.< / dd >
2023-02-14 22:03:02 -06:00
< dt > Returns:< / dt >
2023-02-13 14:37:05 -06:00
< dd > < code > ChassisSpeeds< / code > which can be sent to th Swerve Drive.< / dd >
< / dl >
2023-02-14 22:03:02 -06:00
< / section >
2023-02-13 14:37:05 -06:00
< / li >
2023-02-14 22:03:02 -06:00
< li >
2023-03-30 23:28:07 -05:00
< section class = "detail" id = "getJoystickAngle(double,double)" >
< h3 > getJoystickAngle< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > double< / span > < span class = "element-name" > getJoystickAngle< / span > < wbr > < span class = "parameters" > (double headingX,
double headingY)< / span > < / div >
< div class = "block" > Get the angle in radians based off of the heading joysticks.< / div >
< dl class = "notes" >
< dt > Parameters:< / dt >
< dd > < code > headingX< / code > - X joystick which controls the angle of the robot.< / dd >
< dd > < code > headingY< / code > - Y joystick which controls the angle of the robot.< / dd >
< dt > Returns:< / dt >
< dd > angle in radians from the joystick.< / dd >
< / dl >
< / section >
< / li >
< li >
2023-11-09 18:54:46 -06:00
< section class = "detail" id = "getTargetSpeeds(double,double,double,double,double,double)" >
2023-02-14 22:03:02 -06:00
< h3 > getTargetSpeeds< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > edu.wpi.first.math.kinematics.ChassisSpeeds< / span > < span class = "element-name" > getTargetSpeeds< / span > < wbr > < span class = "parameters" > (double xInput,
double yInput,
double headingX,
double headingY,
2023-11-09 18:54:46 -06:00
double currentHeadingAngleRadians,
double maxSpeed)< / span > < / div >
2023-08-29 19:59:07 -05:00
< div class = "block" > Get the chassis speeds based on controller input of 2 joysticks. One for speeds in which direction. The other for
the angle of the robot.< / div >
2023-02-14 22:03:02 -06:00
< dl class = "notes" >
< dt > Parameters:< / dt >
2023-02-13 14:37:05 -06:00
< dd > < code > xInput< / code > - X joystick input for the robot to move in the X direction.< / dd >
< dd > < code > yInput< / code > - Y joystick input for the robot to move in the Y direction.< / dd >
< dd > < code > headingX< / code > - X joystick which controls the angle of the robot.< / dd >
< dd > < code > headingY< / code > - Y joystick which controls the angle of the robot.< / dd >
< dd > < code > currentHeadingAngleRadians< / code > - The current robot heading in radians.< / dd >
2023-11-09 18:54:46 -06:00
< dd > < code > maxSpeed< / code > - Maximum speed of the drive motors in meters per second, multiplier of the xInput
and yInput.< / dd >
2023-02-14 22:03:02 -06:00
< dt > Returns:< / dt >
2023-02-13 14:37:05 -06:00
< dd > < code > ChassisSpeeds< / code > which can be sent to th Swerve Drive.< / dd >
< / dl >
2023-02-14 22:03:02 -06:00
< / section >
2023-02-13 14:37:05 -06:00
< / li >
2023-02-22 20:50:16 -06:00
< li >
< section class = "detail" id = "getRawTargetSpeeds(double,double,double)" >
< h3 > getRawTargetSpeeds< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > edu.wpi.first.math.kinematics.ChassisSpeeds< / span > < span class = "element-name" > getRawTargetSpeeds< / span > < wbr > < span class = "parameters" > (double xSpeed,
double ySpeed,
double omega)< / span > < / div >
2023-08-29 19:59:07 -05:00
< div class = "block" > Get the < code > ChassisSpeeds< / code > based of raw speeds desired in meters/second and heading in radians.< / div >
2023-02-22 20:50:16 -06:00
< dl class = "notes" >
< dt > Parameters:< / dt >
< dd > < code > xSpeed< / code > - X speed in meters per second.< / dd >
< dd > < code > ySpeed< / code > - Y speed in meters per second.< / dd >
< dd > < code > omega< / code > - Angular velocity in radians/second.< / dd >
< dt > Returns:< / dt >
< dd > < code > ChassisSpeeds< / code > the robot should move to.< / dd >
< / dl >
< / section >
< / li >
< li >
< section class = "detail" id = "getRawTargetSpeeds(double,double,double,double)" >
< h3 > getRawTargetSpeeds< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > edu.wpi.first.math.kinematics.ChassisSpeeds< / span > < span class = "element-name" > getRawTargetSpeeds< / span > < wbr > < span class = "parameters" > (double xSpeed,
double ySpeed,
double targetHeadingAngleRadians,
double currentHeadingAngleRadians)< / span > < / div >
2023-08-29 19:59:07 -05:00
< div class = "block" > Get the < code > ChassisSpeeds< / code > based of raw speeds desired in meters/second and heading in radians.< / div >
2023-02-22 20:50:16 -06:00
< dl class = "notes" >
< dt > Parameters:< / dt >
< dd > < code > xSpeed< / code > - X speed in meters per second.< / dd >
< dd > < code > ySpeed< / code > - Y speed in meters per second.< / dd >
< dd > < code > targetHeadingAngleRadians< / code > - Target heading in radians.< / dd >
< dd > < code > currentHeadingAngleRadians< / code > - Current heading in radians.< / dd >
< dt > Returns:< / dt >
< dd > < code > ChassisSpeeds< / code > the robot should move to.< / dd >
< / dl >
< / section >
< / li >
2023-02-23 22:46:43 -06:00
< li >
< section class = "detail" id = "headingCalculate(double,double)" >
< h3 > headingCalculate< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > double< / span > < span class = "element-name" > headingCalculate< / span > < wbr > < span class = "parameters" > (double currentHeadingAngleRadians,
double targetHeadingAngleRadians)< / span > < / div >
< div class = "block" > Calculate the angular velocity given the current and target heading angle in radians.< / div >
< dl class = "notes" >
< dt > Parameters:< / dt >
< dd > < code > currentHeadingAngleRadians< / code > - The current heading of the robot in radians.< / dd >
< dd > < code > targetHeadingAngleRadians< / code > - The target heading of the robot in radians.< / dd >
< dt > Returns:< / dt >
< dd > Angular velocity in radians per second.< / dd >
< / dl >
< / section >
< / li >
2023-03-29 07:24:24 -05:00
< li >
< section class = "detail" id = "setMaximumAngularVelocity(double)" >
< h3 > setMaximumAngularVelocity< / h3 >
< div class = "member-signature" > < span class = "modifiers" > public< / span > < span class = "return-type" > void< / span > < span class = "element-name" > setMaximumAngularVelocity< / span > < wbr > < span class = "parameters" > (double angularVelocity)< / span > < / div >
< div class = "block" > Set a new maximum angular velocity that is different from the auto-generated one. Modified the
2023-08-29 19:59:07 -05:00
< a href = "parser/SwerveControllerConfiguration.html#maxAngularVelocity" > < code > SwerveControllerConfiguration.maxAngularVelocity< / code > < / a > field which is used in the < a href = "SwerveController.html" title = "class in swervelib" > < code > SwerveController< / code > < / a > class
for < code > ChassisSpeeds< / code > generation.< / div >
2023-03-29 07:24:24 -05:00
< dl class = "notes" >
< dt > Parameters:< / dt >
< dd > < code > angularVelocity< / code > - Angular velocity in radians per second.< / dd >
< / dl >
< / section >
< / li >
2023-02-13 14:37:05 -06:00
< / ul >
< / section >
< / li >
< / ul >
2023-02-14 22:03:02 -06:00
< / section >
2023-02-13 14:37:05 -06:00
<!-- ========= END OF CLASS DATA ========= -->
2023-02-14 22:03:02 -06:00
< / main >
2023-02-13 14:37:05 -06:00
< / div >
< / div >
< / body >
< / html >