mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
668 lines
46 KiB
HTML
668 lines
46 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (17) on Thu Feb 16 22:12:26 CST 2023 -->
|
|
<title>SwerveDrive</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-16">
|
|
<meta name="description" content="declaration: package: swervelib, class: SwerveDrive">
|
|
<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: </li>
|
|
<li>Nested | </li>
|
|
<li><a href="#field-summary">Field</a> | </li>
|
|
<li><a href="#constructor-summary">Constr</a> | </li>
|
|
<li><a href="#method-summary">Method</a></li>
|
|
</ul>
|
|
<ul class="sub-nav-list">
|
|
<li>Detail: </li>
|
|
<li><a href="#field-detail">Field</a> | </li>
|
|
<li><a href="#constructor-detail">Constr</a> | </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> <a href="package-summary.html">swervelib</a></div>
|
|
<h1 title="Class SwerveDrive" class="title">Class SwerveDrive</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">swervelib.SwerveDrive</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">SwerveDrive</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>
|
|
<div class="block">Swerve Drive class representing and controlling the swerve drive.</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>edu.wpi.first.wpilibj.smartdashboard.Field2d</code></div>
|
|
<div class="col-second even-row-color"><code><a href="#field" class="member-name-link">field</a></code></div>
|
|
<div class="col-last even-row-color">
|
|
<div class="block">Field object.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color"><code>private <a href="imu/SwerveIMU.html" title="class in swervelib.imu">SwerveIMU</a></code></div>
|
|
<div class="col-second odd-row-color"><code><a href="#imu" class="member-name-link">imu</a></code></div>
|
|
<div class="col-last odd-row-color">
|
|
<div class="block">Swerve IMU device for sensing the heading of the robot.</div>
|
|
</div>
|
|
<div class="col-first even-row-color"><code>final <a href="math/SwerveKinematics2.html" title="class in swervelib.math">SwerveKinematics2</a></code></div>
|
|
<div class="col-second even-row-color"><code><a href="#kinematics" class="member-name-link">kinematics</a></code></div>
|
|
<div class="col-last even-row-color">
|
|
<div class="block">Swerve Kinematics object utilizing second order kinematics.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color"><code>private int</code></div>
|
|
<div class="col-second odd-row-color"><code><a href="#moduleSynchronizationCounter" class="member-name-link">moduleSynchronizationCounter</a></code></div>
|
|
<div class="col-last odd-row-color">
|
|
<div class="block">Counter to synchronize the modules relative encoder with absolute encoder when not moving.</div>
|
|
</div>
|
|
<div class="col-first even-row-color"><code>private <a href="simulation/SwerveIMUSimulation.html" title="class in swervelib.simulation">SwerveIMUSimulation</a></code></div>
|
|
<div class="col-second even-row-color"><code><a href="#simIMU" class="member-name-link">simIMU</a></code></div>
|
|
<div class="col-last even-row-color">
|
|
<div class="block">Simulation of the swerve drive.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color"><code><a href="SwerveController.html" title="class in swervelib">SwerveController</a></code></div>
|
|
<div class="col-second odd-row-color"><code><a href="#swerveController" class="member-name-link">swerveController</a></code></div>
|
|
<div class="col-last odd-row-color">
|
|
<div class="block">Swerve controller for controlling heading of the robot.</div>
|
|
</div>
|
|
<div class="col-first even-row-color"><code>final <a href="parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a></code></div>
|
|
<div class="col-second even-row-color"><code><a href="#swerveDriveConfiguration" class="member-name-link">swerveDriveConfiguration</a></code></div>
|
|
<div class="col-last even-row-color">
|
|
<div class="block">Swerve drive configuration.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color"><code>final edu.wpi.first.math.estimator.SwerveDrivePoseEstimator</code></div>
|
|
<div class="col-second odd-row-color"><code><a href="#swerveDrivePoseEstimator" class="member-name-link">swerveDrivePoseEstimator</a></code></div>
|
|
<div class="col-last odd-row-color">
|
|
<div class="block">Swerve odometry.</div>
|
|
</div>
|
|
<div class="col-first even-row-color"><code>private final <a href="SwerveModule.html" title="class in swervelib">SwerveModule</a>[]</code></div>
|
|
<div class="col-second even-row-color"><code><a href="#swerveModules" class="member-name-link">swerveModules</a></code></div>
|
|
<div class="col-last even-row-color">
|
|
<div class="block">Swerve modules.</div>
|
|
</div>
|
|
</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(swervelib.parser.SwerveDriveConfiguration,swervelib.parser.SwerveControllerConfiguration)" class="member-name-link">SwerveDrive</a><wbr>(<a href="parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a> config,
|
|
<a href="parser/SwerveControllerConfiguration.html" title="class in swervelib.parser">SwerveControllerConfiguration</a> controllerConfig)</code></div>
|
|
<div class="col-last even-row-color">
|
|
<div class="block">Creates a new swerve drivebase subsystem.</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="#addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d,double,boolean)" class="member-name-link">addVisionMeasurement</a><wbr>(edu.wpi.first.math.geometry.Pose2d robotPose,
|
|
double timestamp,
|
|
boolean soft)</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Add a vision measurement to the <code>SwerveDrivePoseEstimator</code> and update the <a href="imu/SwerveIMU.html" title="class in swervelib.imu"><code>SwerveIMU</code></a> gyro reading with
|
|
the given timestamp of the vision measurement.</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="#drive(edu.wpi.first.math.geometry.Translation2d,double,boolean,boolean)" class="member-name-link">drive</a><wbr>(edu.wpi.first.math.geometry.Translation2d translation,
|
|
double rotation,
|
|
boolean fieldRelative,
|
|
boolean isOpenLoop)</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">The primary method for controlling the drivebase.</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="#getFieldVelocity()" class="member-name-link">getFieldVelocity</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current field-relative velocity (x, y and omega) of the robot</div>
|
|
</div>
|
|
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>edu.wpi.first.math.geometry.Rotation3d</code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getGyroRotation3d()" class="member-name-link">getGyroRotation3d</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current gyro <code>Rotation3d</code> of the robot, as reported by the imu.</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.SwerveModulePosition[]</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getModulePositions()" class="member-name-link">getModulePositions</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current module positions (azimuth and wheel position (meters))</div>
|
|
</div>
|
|
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>edu.wpi.first.math.geometry.Rotation2d</code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPitch()" class="member-name-link">getPitch</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current pitch angle of the robot, as reported by the imu.</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.geometry.Pose2d</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getPose()" class="member-name-link">getPose</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current pose (position and rotation) of the robot, as reported by odometry.</div>
|
|
</div>
|
|
<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="#getRobotVelocity()" class="member-name-link">getRobotVelocity</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current robot-relative velocity (x, y and omega) of the robot</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.geometry.Rotation2d</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getRoll()" class="member-name-link">getRoll</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current roll angle of the robot, as reported by the imu.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="math/SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a>[]</code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getStates()" class="member-name-link">getStates</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current module states (azimuth and velocity)</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.geometry.Pose2d[]</code></div>
|
|
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSwerveModulePoses(edu.wpi.first.math.geometry.Pose2d)" class="member-name-link">getSwerveModulePoses</a><wbr>(edu.wpi.first.math.geometry.Pose2d robotPose)</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 swerve module poses and on the field relative to the robot.</div>
|
|
</div>
|
|
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>edu.wpi.first.math.geometry.Rotation2d</code></div>
|
|
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getYaw()" class="member-name-link">getYaw</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Gets the current yaw angle of the robot, as reported by the imu.</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="#lockPose()" class="member-name-link">lockPose</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Point all modules toward the robot center, thus making the robot very difficult to move.</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="#postTrajectory(edu.wpi.first.math.trajectory.Trajectory)" class="member-name-link">postTrajectory</a><wbr>(edu.wpi.first.math.trajectory.Trajectory trajectory)</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Post the trajectory to the field</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="#replaceSwerveModuleFeedforward(edu.wpi.first.math.controller.SimpleMotorFeedforward)" class="member-name-link">replaceSwerveModuleFeedforward</a><wbr>(edu.wpi.first.math.controller.SimpleMotorFeedforward feedforward)</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Setup the swerve module feedforward.</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="#resetOdometry(edu.wpi.first.math.geometry.Pose2d)" class="member-name-link">resetOdometry</a><wbr>(edu.wpi.first.math.geometry.Pose2d pose)</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Resets odometry to the given pose.</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="#setChassisSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds)" class="member-name-link">setChassisSpeeds</a><wbr>(edu.wpi.first.math.kinematics.ChassisSpeeds chassisSpeeds)</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Set chassis speeds with closed-loop velocity control.</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="#setModuleStates(swervelib.math.SwerveModuleState2%5B%5D,boolean)" class="member-name-link">setModuleStates</a><wbr>(<a href="math/SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a>[] desiredStates,
|
|
boolean isOpenLoop)</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 module states (azimuth and velocity) directly.</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="#setMotorIdleMode(boolean)" class="member-name-link">setMotorIdleMode</a><wbr>(boolean brake)</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Sets the drive motors to brake/coast 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="#synchronizeModuleEncoders()" class="member-name-link">synchronizeModuleEncoders</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Synchronize angle motor integrated encoders with data from absolute encoders.</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="#updateOdometry()" class="member-name-link">updateOdometry</a>()</code></div>
|
|
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Update odometry should be run every loop.</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="#zeroGyro()" class="member-name-link">zeroGyro</a>()</code></div>
|
|
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
|
|
<div class="block">Resets the gyro angle to zero and resets odometry to the same position, but facing toward 0.</div>
|
|
</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>
|
|
</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="kinematics">
|
|
<h3>kinematics</h3>
|
|
<div class="member-signature"><span class="modifiers">public final</span> <span class="return-type"><a href="math/SwerveKinematics2.html" title="class in swervelib.math">SwerveKinematics2</a></span> <span class="element-name">kinematics</span></div>
|
|
<div class="block">Swerve Kinematics object utilizing second order kinematics.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="swerveDriveConfiguration">
|
|
<h3>swerveDriveConfiguration</h3>
|
|
<div class="member-signature"><span class="modifiers">public final</span> <span class="return-type"><a href="parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a></span> <span class="element-name">swerveDriveConfiguration</span></div>
|
|
<div class="block">Swerve drive configuration.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="swerveDrivePoseEstimator">
|
|
<h3>swerveDrivePoseEstimator</h3>
|
|
<div class="member-signature"><span class="modifiers">public final</span> <span class="return-type">edu.wpi.first.math.estimator.SwerveDrivePoseEstimator</span> <span class="element-name">swerveDrivePoseEstimator</span></div>
|
|
<div class="block">Swerve odometry.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="swerveModules">
|
|
<h3>swerveModules</h3>
|
|
<div class="member-signature"><span class="modifiers">private final</span> <span class="return-type"><a href="SwerveModule.html" title="class in swervelib">SwerveModule</a>[]</span> <span class="element-name">swerveModules</span></div>
|
|
<div class="block">Swerve modules.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="field">
|
|
<h3>field</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">edu.wpi.first.wpilibj.smartdashboard.Field2d</span> <span class="element-name">field</span></div>
|
|
<div class="block">Field object.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="swerveController">
|
|
<h3>swerveController</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="SwerveController.html" title="class in swervelib">SwerveController</a></span> <span class="element-name">swerveController</span></div>
|
|
<div class="block">Swerve controller for controlling heading of the robot.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="imu">
|
|
<h3>imu</h3>
|
|
<div class="member-signature"><span class="modifiers">private</span> <span class="return-type"><a href="imu/SwerveIMU.html" title="class in swervelib.imu">SwerveIMU</a></span> <span class="element-name">imu</span></div>
|
|
<div class="block">Swerve IMU device for sensing the heading of the robot.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="simIMU">
|
|
<h3>simIMU</h3>
|
|
<div class="member-signature"><span class="modifiers">private</span> <span class="return-type"><a href="simulation/SwerveIMUSimulation.html" title="class in swervelib.simulation">SwerveIMUSimulation</a></span> <span class="element-name">simIMU</span></div>
|
|
<div class="block">Simulation of the swerve drive.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="moduleSynchronizationCounter">
|
|
<h3>moduleSynchronizationCounter</h3>
|
|
<div class="member-signature"><span class="modifiers">private</span> <span class="return-type">int</span> <span class="element-name">moduleSynchronizationCounter</span></div>
|
|
<div class="block">Counter to synchronize the modules relative encoder with absolute encoder when not moving.</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="<init>(swervelib.parser.SwerveDriveConfiguration,swervelib.parser.SwerveControllerConfiguration)">
|
|
<h3>SwerveDrive</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="element-name">SwerveDrive</span><wbr><span class="parameters">(<a href="parser/SwerveDriveConfiguration.html" title="class in swervelib.parser">SwerveDriveConfiguration</a> config,
|
|
<a href="parser/SwerveControllerConfiguration.html" title="class in swervelib.parser">SwerveControllerConfiguration</a> controllerConfig)</span></div>
|
|
<div class="block">Creates a new swerve drivebase subsystem. Robot is controlled via the <a href="#drive(edu.wpi.first.math.geometry.Translation2d,double,boolean,boolean)"><code>drive(edu.wpi.first.math.geometry.Translation2d, double, boolean, boolean)</code></a> method, or via the
|
|
<a href="#setModuleStates(swervelib.math.SwerveModuleState2%5B%5D,boolean)"><code>setModuleStates(swervelib.math.SwerveModuleState2[], boolean)</code></a> method. The <a href="#drive(edu.wpi.first.math.geometry.Translation2d,double,boolean,boolean)"><code>drive(edu.wpi.first.math.geometry.Translation2d, double, boolean, boolean)</code></a> method incorporates kinematics— it takes
|
|
a translation and rotation, as well as parameters for field-centric and closed-loop velocity control.
|
|
<a href="#setModuleStates(swervelib.math.SwerveModuleState2%5B%5D,boolean)"><code>setModuleStates(swervelib.math.SwerveModuleState2[], boolean)</code></a> takes a list of SwerveModuleStates and directly passes them to the modules.
|
|
This subsystem also handles odometry.</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>config</code> - The <a href="parser/SwerveDriveConfiguration.html" title="class in swervelib.parser"><code>SwerveDriveConfiguration</code></a> configuration to base the swerve drive off of.</dd>
|
|
<dd><code>controllerConfig</code> - The <a href="parser/SwerveControllerConfiguration.html" title="class in swervelib.parser"><code>SwerveControllerConfiguration</code></a> to use when creating the
|
|
<a href="SwerveController.html" title="class in swervelib"><code>SwerveController</code></a>.</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="drive(edu.wpi.first.math.geometry.Translation2d,double,boolean,boolean)">
|
|
<h3>drive</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">drive</span><wbr><span class="parameters">(edu.wpi.first.math.geometry.Translation2d translation,
|
|
double rotation,
|
|
boolean fieldRelative,
|
|
boolean isOpenLoop)</span></div>
|
|
<div class="block">The primary method for controlling the drivebase. Takes a Translation2d and a rotation rate, and calculates and
|
|
commands module states accordingly. Can use either open-loop or closed-loop velocity control for the wheel
|
|
velocities. Also has field- and robot-relative modes, which affect how the translation vector is used.</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>translation</code> - <code>Translation2d</code> that is the commanded linear velocity of the robot, in meters per
|
|
second. In robot-relative mode, positive x is torwards the bow (front) and positive y is
|
|
torwards port (left). In field-relative mode, positive x is away from the alliance wall
|
|
(field North) and positive y is torwards the left wall when looking through the driver station
|
|
glass (field West).</dd>
|
|
<dd><code>rotation</code> - Robot angular rate, in radians per second. CCW positive. Unaffected by field/robot
|
|
relativity.</dd>
|
|
<dd><code>fieldRelative</code> - Drive mode. True for field-relative, false for robot-relative.</dd>
|
|
<dd><code>isOpenLoop</code> - Whether to use closed-loop velocity control. Set to true to disable closed-loop.</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="setModuleStates(swervelib.math.SwerveModuleState2[],boolean)">
|
|
<h3>setModuleStates</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setModuleStates</span><wbr><span class="parameters">(<a href="math/SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a>[] desiredStates,
|
|
boolean isOpenLoop)</span></div>
|
|
<div class="block">Set the module states (azimuth and velocity) directly. Used primarily for auto pathing.</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>desiredStates</code> - A list of SwerveModuleStates to send to the modules.</dd>
|
|
<dd><code>isOpenLoop</code> - Whether to use closed-loop velocity control. Set to true to disable closed-loop.</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="setChassisSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds)">
|
|
<h3>setChassisSpeeds</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setChassisSpeeds</span><wbr><span class="parameters">(edu.wpi.first.math.kinematics.ChassisSpeeds chassisSpeeds)</span></div>
|
|
<div class="block">Set chassis speeds with closed-loop velocity control.</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>chassisSpeeds</code> - Chassis speeds to set.</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getPose()">
|
|
<h3>getPose</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">edu.wpi.first.math.geometry.Pose2d</span> <span class="element-name">getPose</span>()</div>
|
|
<div class="block">Gets the current pose (position and rotation) of the robot, as reported by odometry.</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>The robot's pose</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getFieldVelocity()">
|
|
<h3>getFieldVelocity</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">getFieldVelocity</span>()</div>
|
|
<div class="block">Gets the current field-relative velocity (x, y and omega) of the robot</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>A ChassisSpeeds object of the current field-relative velocity</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getRobotVelocity()">
|
|
<h3>getRobotVelocity</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">getRobotVelocity</span>()</div>
|
|
<div class="block">Gets the current robot-relative velocity (x, y and omega) of the robot</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>A ChassisSpeeds object of the current robot-relative velocity</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="resetOdometry(edu.wpi.first.math.geometry.Pose2d)">
|
|
<h3>resetOdometry</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">resetOdometry</span><wbr><span class="parameters">(edu.wpi.first.math.geometry.Pose2d pose)</span></div>
|
|
<div class="block">Resets odometry to the given pose. Gyro angle and module positions do not need to be reset when calling this
|
|
method. However, if either gyro angle or module position is reset, this must be called in order for odometry to
|
|
keep working.</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>pose</code> - The pose to set the odometry to</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="postTrajectory(edu.wpi.first.math.trajectory.Trajectory)">
|
|
<h3>postTrajectory</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">postTrajectory</span><wbr><span class="parameters">(edu.wpi.first.math.trajectory.Trajectory trajectory)</span></div>
|
|
<div class="block">Post the trajectory to the field</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>trajectory</code> - the trajectory to post.</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getStates()">
|
|
<h3>getStates</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="math/SwerveModuleState2.html" title="class in swervelib.math">SwerveModuleState2</a>[]</span> <span class="element-name">getStates</span>()</div>
|
|
<div class="block">Gets the current module states (azimuth and velocity)</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>A list of SwerveModuleStates containing the current module states</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getModulePositions()">
|
|
<h3>getModulePositions</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">edu.wpi.first.math.kinematics.SwerveModulePosition[]</span> <span class="element-name">getModulePositions</span>()</div>
|
|
<div class="block">Gets the current module positions (azimuth and wheel position (meters))</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>A list of SwerveModulePositions containg the current module positions</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="zeroGyro()">
|
|
<h3>zeroGyro</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">zeroGyro</span>()</div>
|
|
<div class="block">Resets the gyro angle to zero and resets odometry to the same position, but facing toward 0.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getYaw()">
|
|
<h3>getYaw</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">edu.wpi.first.math.geometry.Rotation2d</span> <span class="element-name">getYaw</span>()</div>
|
|
<div class="block">Gets the current yaw angle of the robot, as reported by the imu. CCW positive, not wrapped.</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>The yaw as a <code>Rotation2d</code> angle</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getPitch()">
|
|
<h3>getPitch</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">edu.wpi.first.math.geometry.Rotation2d</span> <span class="element-name">getPitch</span>()</div>
|
|
<div class="block">Gets the current pitch angle of the robot, as reported by the imu.</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>The heading as a <code>Rotation2d</code> angle</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getRoll()">
|
|
<h3>getRoll</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">edu.wpi.first.math.geometry.Rotation2d</span> <span class="element-name">getRoll</span>()</div>
|
|
<div class="block">Gets the current roll angle of the robot, as reported by the imu.</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>The heading as a <code>Rotation2d</code> angle</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getGyroRotation3d()">
|
|
<h3>getGyroRotation3d</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">edu.wpi.first.math.geometry.Rotation3d</span> <span class="element-name">getGyroRotation3d</span>()</div>
|
|
<div class="block">Gets the current gyro <code>Rotation3d</code> of the robot, as reported by the imu.</div>
|
|
<dl class="notes">
|
|
<dt>Returns:</dt>
|
|
<dd>The heading as a <code>Rotation3d</code> angle</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="setMotorIdleMode(boolean)">
|
|
<h3>setMotorIdleMode</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setMotorIdleMode</span><wbr><span class="parameters">(boolean brake)</span></div>
|
|
<div class="block">Sets the drive motors to brake/coast mode.</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>brake</code> - True to set motors to brake mode, false for coast.</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="lockPose()">
|
|
<h3>lockPose</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">lockPose</span>()</div>
|
|
<div class="block">Point all modules toward the robot center, thus making the robot very difficult to move. Forcing the robot to keep
|
|
the current pose.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="getSwerveModulePoses(edu.wpi.first.math.geometry.Pose2d)">
|
|
<h3>getSwerveModulePoses</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">edu.wpi.first.math.geometry.Pose2d[]</span> <span class="element-name">getSwerveModulePoses</span><wbr><span class="parameters">(edu.wpi.first.math.geometry.Pose2d robotPose)</span></div>
|
|
<div class="block">Get the swerve module poses and on the field relative to the robot.</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>robotPose</code> - Robot pose.</dd>
|
|
<dt>Returns:</dt>
|
|
<dd>Swerve module poses.</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="replaceSwerveModuleFeedforward(edu.wpi.first.math.controller.SimpleMotorFeedforward)">
|
|
<h3>replaceSwerveModuleFeedforward</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">replaceSwerveModuleFeedforward</span><wbr><span class="parameters">(edu.wpi.first.math.controller.SimpleMotorFeedforward feedforward)</span></div>
|
|
<div class="block">Setup the swerve module feedforward.</div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>feedforward</code> - Feedforward for the drive motor on swerve modules.</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="updateOdometry()">
|
|
<h3>updateOdometry</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">updateOdometry</span>()</div>
|
|
<div class="block">Update odometry should be run every loop. Synchronizes module absolute encoders with relative encoders
|
|
periodically. In simulation mode will also post the pose of each module. Updates SmartDashboard with module encoder
|
|
readings and states.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="synchronizeModuleEncoders()">
|
|
<h3>synchronizeModuleEncoders</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">synchronizeModuleEncoders</span>()</div>
|
|
<div class="block">Synchronize angle motor integrated encoders with data from absolute encoders.</div>
|
|
</section>
|
|
</li>
|
|
<li>
|
|
<section class="detail" id="addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d,double,boolean)">
|
|
<h3>addVisionMeasurement</h3>
|
|
<div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">addVisionMeasurement</span><wbr><span class="parameters">(edu.wpi.first.math.geometry.Pose2d robotPose,
|
|
double timestamp,
|
|
boolean soft)</span></div>
|
|
<div class="block">Add a vision measurement to the <code>SwerveDrivePoseEstimator</code> and update the <a href="imu/SwerveIMU.html" title="class in swervelib.imu"><code>SwerveIMU</code></a> gyro reading with
|
|
the given timestamp of the vision measurement. <b>THIS WILL BREAK IF UPDATED TOO OFTEN.</b></div>
|
|
<dl class="notes">
|
|
<dt>Parameters:</dt>
|
|
<dd><code>robotPose</code> - Robot <code>Pose2d</code> as measured by vision.</dd>
|
|
<dd><code>timestamp</code> - Timestamp the measurement was taken as time since startup, should be taken from
|
|
<code>Timer.getFPGATimestamp()</code> or similar sources.</dd>
|
|
<dd><code>soft</code> - Add vision estimate using the
|
|
<code>SwerveDrivePoseEstimator.addVisionMeasurement(Pose2d, double)</code> function, or hard reset
|
|
odometry with the given position with
|
|
<code>SwerveDriveOdometry.resetPosition(Rotation2d, SwerveModulePosition[], Pose2d)</code>.</dd>
|
|
</dl>
|
|
</section>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|