Class SmartMotorControllerConfigurationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
yams.core.exceptions.SmartMotorControllerConfigurationException
All Implemented Interfaces:
Serializable

public class SmartMotorControllerConfigurationException extends RuntimeException
Thrown by SmartMotorControllerConfig or a SmartMotorController wrapper when the applied configuration contains conflicting, incomplete, or incompatible settings.

Common triggers include:

  • withSubsystem(Subsystem) called more than once on the same config
  • Auto-synchronization threshold set while a distance-based (linear) mechanism circumference is configured the two options are mutually exclusive
  • Mechanism circumference undefined when a conversion method (e.g., withZeroOffset(), withSoftLimits(), or linear unit conversions) requires it fix with withMechanismCircumference(Distance)
  • External encoder discontinuity point outside the allowed values (must be Rotations.of(0.5) or Rotations.of(1))
  • Continuous wrapping requested while soft limits are also set, or while a distance-based (linear) mechanism circumference is configured
  • Continuous wrapping or closed-loop tolerance requested without a PID controller (withClosedLoopController())
  • Distance-based tolerance setter called on an angular controller (missing withLinearClosedLoopController(true))
  • MOI parameters (withMOI(Distance, Mass)) called with null length or mass
  • NEO 550 motor used without a stator current limit, or with a limit exceeding 40 A
  • Vendor-specific control request type incompatible with the underlying motor controller (e.g., a TalonFXS control request not supported by the configured motor type)
  • Required basic or external-encoder options not all provided before calling get()
  • Live tuning requested while the control mode is OPEN_LOOP requires withControlMode(ControlMode.CLOSED_LOOP)

Resolution: Read the exception message; it always names the specific SmartMotorControllerConfig method to call (or to remove) to resolve the conflict.

Example triggering continuous-wrapping conflict:

// WRONG soft limits and continuous wrapping cannot coexist
SmartMotorControllerConfig config = new SmartMotorControllerConfig()
    .withSoftLimits(Degrees.of(-90), Degrees.of(90))
    .withContinuousWrapping(Rotations.of(0), Rotations.of(1)); // throws

// CORRECT remove withSoftLimits() when using continuous wrapping
SmartMotorControllerConfig config = new SmartMotorControllerConfig()
    .withContinuousWrapping(Rotations.of(0), Rotations.of(1));
See Also:
  • Constructor Details

    • SmartMotorControllerConfigurationException

      public SmartMotorControllerConfigurationException(String message, String result, String remedyFunction)
      SmartMotorControllerConfigurationException constructor.
      Parameters:
      message - Message to display.
      result - Result of the configuration.
      remedyFunction - Remedy function to use.