Skip to content

Encoder testing - #29

Merged
nlaverdure merged 2 commits into
mainfrom
Encoder_testing
Aug 12, 2026
Merged

nlaverdure merged 2 commits into
mainfrom
Encoder_testing

Conversation

@JShriller

Copy link
Copy Markdown
Contributor

We moved the align encoders at start from the constructor to the periodic function. A flag was added for the moved code to run only when the flag was false and then makes the flag true so the code ins't run multiple times.

@nlaverdure
nlaverdure merged commit 22fe798 into main Aug 12, 2026
2 checks passed
nlaverdure added a commit that referenced this pull request Sep 25, 2026
Port the turn-zero timing fix from main (#29, with the encoderInitialized
name from 039554e). The Module constructor read inputs.turnZero before
io.updateInputs() had ever run. inputs.turnZero defaults to
Rotation2d.ZERO, and only ModuleIOTalonFXBase.readSignalInputs fills it
from the CANcoder magnet offset. So on a robot with no stored
preference, Preferences.initDouble was seeded with 0 instead of the
CANcoder value. This also kept a Preferences read at the earliest boot
point.

Apply the turn zero once, in the first periodic() after inputs are
updated and logged.

ModuleTest uses a fake IO that reports a CANcoder zero only from
updateInputs(). It checks that the constructor applies no turn zero,
that the first periodic() applies and stores the CANcoder value, and
that later periodic() calls do not apply it again. It fails without
this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nlaverdure
nlaverdure deleted the Encoder_testing branch September 25, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants