Pivot motor: add gravity compensation and auto-zero on enable#528
Open
phurley67 wants to merge 1 commit into
Open
Pivot motor: add gravity compensation and auto-zero on enable#528phurley67 wants to merge 1 commit into
phurley67 wants to merge 1 commit into
Conversation
kG was set to 0 and never applied to motor config, so only the P-term fought gravity. Also start pivotZeroed=false so zeroing runs on first enable, and default toward stow for safety. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Collector pivot motor configuration and startup behavior to improve holding performance and ensure a deterministic encoder reference by applying gravity feedforward and forcing a zeroing routine on first enable.
Changes:
- Add a non-zero
kG(gravity compensation) constant and apply it to the pivot motor Slot0 configuration. - Change startup defaults so the pivot auto-zeros on first enable, zeroing toward the stow hard stop by default.
| // Gravity compensation voltage. Negative = upward force (same convention | ||
| // as Hood kG). START LOW and increase until the arm holds position without | ||
| // sagging. If the arm drifts up, make the value less negative (closer to 0). | ||
| public static final double PIVOT_KG = RobotMap.IS_OASIS ? -0.15d : -0.15d; // tune me! |
There was a problem hiding this comment.
The conditional on RobotMap.IS_OASIS is currently redundant because both branches use the same value (-0.15d). This adds noise and implies the constants may diverge when they don’t. Consider replacing with a single literal (or provide distinct tuned values per robot if that was the intent).
Suggested change
| public static final double PIVOT_KG = RobotMap.IS_OASIS ? -0.15d : -0.15d; // tune me! | |
| public static final double PIVOT_KG = -0.15d; // tune me! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pivotZeroed = false(wastrue) andstowZero = true(wasfalse). The motor encoder reads 0 at power-on regardless of physical arm position, so skipping zeroing caused unpredictable behavior.Test plan
PIVOT_KGvalue if needed: more negative if arm sags, less negative if arm drifts up🤖 Generated with Claude Code
Closes #527