Package yams.core.motorcontrollers.local


package yams.core.motorcontrollers.local
REV Robotics motor controller wrappers whose closed-loop control runs on the roboRIO.

This package contains adapters for REV SPARK MAX and SPARK FLEX motor controllers. Because the REV hardware offloads PID execution to the roboRIO (rather than to the motor controller itself), these wrappers are classified as local: the control loop runs on the robot controller and sends periodic duty-cycle or voltage commands to the hardware.

Core type

  • SparkWrapper unified adapter for both the SPARK MAX (NEO, NEO 550) and SPARK FLEX (NEO Vortex).

Absolute encoder range

An absolute encoder, such as a REV Through Bore Encoder on a SparkAbsoluteEncoder, reads [0, 1) rotations. With SmartMotorControllerConfig.withContinuousWrapping(Angle, Angle), it reads the wrapping range instead, with the encoder on the mechanism:

  • [-0.5, 0.5): when the mechanism travels through zero.
  • [0, 1): when zero is never crossed.

Construction

SmartMotorControllerConfig config = new SmartMotorControllerConfig()
    .withClosedLoopController(4, 0, 0)
    .withContinuousWrapping(Rotations.of(-0.5), Rotations.of(0.5));
SmartMotorController motor = new SparkWrapper(
    new SparkMax(5, MotorType.kBrushless), DCMotor.getNEO(1), config);
See Also: