Package yams.units

Class EasyCRT

java.lang.Object
yams.units.EasyCRT

public class EasyCRT extends Object
A CRT style absolute mechanism angle estimator using two absolute encoders.
  1. Generate all mechanism angle candidates consistent with encoder 1 within the allowed range.
  2. For each candidate, predict what encoder 2 should read and score the modular error.
  3. 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.

  • Constructor Details

    • EasyCRT

      public EasyCRT(EasyCRTConfig easyCrtConfig)
      Creates an EasyCRT solver.
      Parameters:
      easyCrtConfig - configuration describing encoder ratios, offsets, and limits
  • Method Details

    • getAngleOptional

      public Optional<Angle> 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

      public EasyCRT.CRTStatus 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