How do I use absolute encoders on my Arm?
What are absolute encoders?
External Encoders
Limitations of Absolute Encoders
Last updated
Last updated
private final SparkMax armMotor = new SparkMax(1, MotorType.kBrushless);
private final SmartMotorControllerConfig motorConfig = new SmartMotorControllerConfig(this)
.withClosedLoopController(4, 0, 0, DegreesPerSecond.of(180), DegreesPerSecondPerSecond.of(90))
.withSoftLimit(Degrees.of(-30), Degrees.of(100))
.withGearing(new MechanismGearing(GearBox.fromReductionStages(3, 4)))
.withIdleMode(MotorMode.BRAKE)
.withTelemetry("ArmMotor", TelemetryVerbosity.HIGH)
.withStatorCurrentLimit(Amps.of(40))
.withMotorInverted(false)
.withClosedLoopRampRate(Seconds.of(0.25))
.withOpenLoopRampRate(Seconds.of(0.25))
.withFeedforward(new ArmFeedforward(0, 0, 0, 0))
.withControlMode(ControlMode.CLOSED_LOOP)
.withExternalEncoder(armMotor.getAbsoluteEncoder())
.withExternalEncoderInverted(false)
.withExternalEncoderGearing(1)
.withExternalEncoderZeroOffset(Degrees.of(33.25))
.withUseExternalFeedbackEncoder(true);
private final SmartMotorController motor = new SparkWrapper(armMotor,
DCMotor.getNEO(1),
motorConfig);