Package yams.units
Class EasyCRT
java.lang.Object
yams.units.EasyCRT
A CRT style absolute mechanism angle estimator using two absolute encoders.
- Generate all mechanism angle candidates consistent with encoder 1 within the allowed range.
- For each candidate, predict what encoder 2 should read and score the modular error.
- Select the best unique match within a configurable tolerance.
This is not a textbook Chinese Remainder Theorem solve; it is a "CRT-inspired" unwrapping method that is easier to keep stable with backlash and sensor noise.
Created by team 6911.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe list of possible statuses from the previous solve attempt. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the mechanism angle if a unique solution is found.doubleReturns the last best-match modular error in rotations.intReturns the number of candidates evaluated in the last solve attempt.Returns the last solver status string.
-
Constructor Details
-
EasyCRT
Creates an EasyCRT solver.- Parameters:
easyCrtConfig- configuration describing encoder ratios, offsets, and limits
-
-
Method Details
-
getAngleOptional
Returns the mechanism angle if a unique solution is found.If no unique solution is found (outside tolerance or ambiguous), returns
Optional.empty().- Returns:
- optional containing mechanism angle when uniquely resolved
-
getLastStatus
Returns the last solver status string.- Returns:
- status from the previous solve attempt
-
getLastErrorRotations
public double getLastErrorRotations()Returns the last best-match modular error in rotations.- Returns:
- last modular error, or NaN if not solved
-
getLastIterations
public int getLastIterations()Returns the number of candidates evaluated in the last solve attempt.- Returns:
- iteration count from the previous solve attempt
-