Closed Loop Control Getting Started
Setting up Closed-Loop Control
// Initialize the motor (Flex/MAX are setup the same way)
SparkFlex m_motor = new SparkFlex(deviceID, MotorType.kBrushless);
// Initialize the closed loop controller
SparkClosedLoopController m_controller = m_motor.getClosedLoopController();using namespace rev::spark;
// Initialize the motor (Flex/MAX are setup the same way)
SparkMax m_motor{deviceID, SparkMax::MotorType::kBrushless};
// Initialize the closed loop controller
SparkClosedLoopController m_controller = m_motor.GetClosedLoopController();// Set the setpoint of the PID controller in raw position mode
m_controller.setSetpoint(setPoint, ControlType.kPosition);// Set the setpoint of the PID controller in raw position mode
m_controller.SetSetpoint(setPoint, SparkBase::ControlType::kPosition);PID Constants and Configuration
PID Parameters
Feedforward Parameters
MAXMotion Parameters
Slots
Last updated
Was this helpful?

