Telemetry, Simulation & Vision
Telemetry verbosity, simulation, and fusing vision pose estimates
Telemetry
YAMS pushes swerve drive and module data to NetworkTables under Mechanisms/swerve (the table name is currently always swerve, regardless of your subsystem's name). This is the data most dashboards (Shuffleboard, Elastic, AdvantageScope) read to render swerve widgets — see the AdvantageScope how-to guide. Every one of these fields is also written to a WPILib DataLog automatically — see How to view your DataLog in AdvantageScope to look at a recorded run after the fact.

modules/<name>/encoder is the raw absolute encoder reading, in degrees — this is the value you read to determine absoluteEncoderOffset for that module. It sits directly under the module's table, as a sibling of drive and azimuth, not nested inside either of them.
How much gets published is controlled by yams.motorcontrollers.SmartMotorControllerConfig.TelemetryVerbosity:
Higher telemetry verbosity can induce some lag on the robot and slow down loop cycle times — be deliberate about what you choose, especially in competition.
Reading module telemetry while bringing up a robot
The most useful pair of values while bringing up a new robot are modules/<name>/encoder (the raw absolute encoder, in degrees) and modules/<name>/azimuth/mechanism/position (the angle motor's own relative encoder, tracking the absolute encoder once seeded):
If the absolute encoder decreases while the module is rotated counter-clockwise (should be CCW+), set
absoluteEncoderInvertedfor that module.If the drive or angle motor's telemetry decreases when it should be increasing (or vice versa), invert that motor in
inverted.drive/inverted.angle.
See Determine Motor/Encoder Inversion for the full procedure.
Simulation
YAMS simulates the whole swerve drive using the same vendor simulation models as the real hardware, to varying degrees of fidelity per vendor. All you need to do is call simIterate() from your subsystem's simulationPeriodic():
For more on WPILib's simulation framework generally:
Vision Odometry
YAMS's SwerveDrive maintains a SwerveDrivePoseEstimator internally, and extends its vision-fusion API directly onto SwerveDrive so you don't need to construct or manage your own estimator:
Feed this from your vision subsystem (PhotonVision, Limelight, etc.) every time a new pose estimate is available. Standard deviations control how much the pose estimator trusts a given vision measurement relative to odometry — tighter (smaller) values pull the estimate toward vision more aggressively; looser (larger) values let odometry dominate. Tune these empirically; see Swerve Drive Drift Causes if pose estimates drift or jump unexpectedly.
Last updated
Was this helpful?