Class SparkWrapper

java.lang.Object
yams.core.motorcontrollers.SmartMotorController
yams.core.motorcontrollers.local.SparkWrapper

public class SparkWrapper extends SmartMotorController
Spark wrapper for REV Spark Motor controllers.

Absolute encoder range: with continuous wrapping, an absolute external encoder reads the wrapping range, from one rotation below its maximum up to it, so it must be on the mechanism.

  • SparkAbsoluteEncoder: the SPARK's range offset, for a wrapping maximum from 0 to 1 rotation, such as [-0.5, 0.5) or [0, 1).
  • DetachedEncoder: zero centered or not, for [-0.5, 0.5) or [0, 1).
Without continuous wrapping, an absolute encoder reads [0, 1).

Example

// Configure and create a SPARK MAX (NEO motor) on CAN ID 3
SmartMotorControllerConfig config = new SmartMotorControllerConfig()
    .withMotorInverted(false)
    .withStatorCurrentLimit(Amps.of(40))
    .withClosedLoopController(0.2,0,0)
    .withContinuousWrapping(Rotations.of(-0.5), Rotations.of(0.5));
SmartMotorController motor = new SparkWrapper( new SparkMax(3,
MotorType.kBrushless), DCMotor.getNEO(1), config); Arm arm = new Arm(new
ArmConfig(motor).withLength(Meters.of(0.6)));