Using a DetachedEncoder as a SPARK's feedback sensor
A DetachedEncoder, such as the MAXSpline Encoder, may be used as a FeedbackSensor for Closed Loop Control in SPARK MAX and SPARK Flex motor controllers.
This is configured in the ClosedLoopConfig class using the feedbackSensor(FeedbackSensor, int) or feedbackSensor(FeedbackSensor, DetachedEncoder) methods as follows:
SplineEncoder spline = new SplineEncoder(12);
SparkFlex spark = new SparkFlex(1, MotorType.kBrushless);
SparkFlexConfig sparkConfig = new SparkFlexConfig();
sparkConfig.closedLoop
feedbackSensor(FeedbackSensor.kDetachedAbsoluteEncoder, spline);
// Continue with other configurationusing namespace rev::detached;
using namespace rev::spark;
SplineEncoder m_spline{12};
SparkFlex m_spark{1, SparkFlex::MotorType::kBrushless};
SparkFlexConfig sparkConfig;
sparkConfig.closedLoop
.SetFeedbackSensor(FeedbackSensor::kDetachedAbsoluteEncoder, spline);
// Continue with other configuration
Last updated
Was this helpful?

