Class DifferentialMechanismConfigurationException

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

public class DifferentialMechanismConfigurationException extends RuntimeException
Thrown by DifferentialMechanism or DifferentialMechanismConfig when a required field is missing or an attempt is made to violate a config invariant.

Common triggers include:

  • withSmartMotorControllers(SmartMotorController, SmartMotorController) called more than once the left or right motor controller has already been set
  • The left and right motor controllers do not share the same WPILib Subsystem instance
  • Starting tilt or twist angle not configured (withTiltStartingPosition(Angle) / withTwistStartingPosition(Angle))
  • Mechanism length not set (withLength(Distance)) required to compute the current end-effector position
  • Twist MOI not set (withMOI()) required for simulation

Resolution: Call DifferentialMechanismConfig.withSmartMotorControllers(left, right) exactly once, ensure both motors reference the same subsystem via SmartMotorControllerConfig.withSubsystem(Subsystem), and provide all required geometry and simulation parameters.

Example minimal configuration:

DifferentialMechanismConfig config = new DifferentialMechanismConfig()
    .withSmartMotorControllers(leftMotor, rightMotor)
    .withLength(Inches.of(20))
    .withTiltStartingPosition(Degrees.of(0))
    .withTwistStartingPosition(Degrees.of(0));
DifferentialMechanism mech = new DifferentialMechanism(config);
See Also:
  • Constructor Details

    • DifferentialMechanismConfigurationException

      public DifferentialMechanismConfigurationException(String message, String result, String remedyFunction)
      Differential Mechanism configuration exception.
      Parameters:
      message - Message to display.
      result - Result of the configuration.
      remedyFunction - Remedy function to use.