Datasheet
DMC60C™ Software Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 15 of 16
6.2 Tuning closed loop parameters
The DMC60C features two closed-loop control modes, position mode and velocity mode, that require a quadrature
encoder. These modes require proper PID configuration to operate correctly. The PID constants can be set
programmatically (section 4.4), although we recommend setting them in the web configuration utility (section
2.2.4). The PID constants will differ between position and velocity mode, so it is suggested that the settings be
saved in separate PID slots.
6.2.1 Position Mode
To start, set the I, D, and F constants to 0 and the P constant to 0.1. Open the position mode example project
(Found in dmc60c-frc-api\Examples). Edit the code to match your DMC60C’s device number and encoder/wheel
parameters. Add a call to getClosedLoopError in the TeleOp Periodic Function if it doesn’t already exist:
In C++: frc::SmartDashboard::PutNumber("Closed Loop Error", _dmc->getClosedLoopError());
In Java: SmartDashboard.putNumber("Closed Loop Error", _dmc.GetClosedLoopError());
This will report the closed loop error to an FRC Smart Dashboard. It is recommended that these be mapped to
graphs in the Smart Dashboard to make tuning easier. The Labview example project is already set up and does not
require any additional changes.
Run the code and drive the motor forward or backwards in teleoperated mode. The motor should slowly move to
the position relative to the joystick. Watch the closed loop error graph to see how the system reacts to your
commands. The motor will likely come up short, so double the P constant until the motor responds quickly without
too much overshoot. At this point the motor should be able to reach a set position. You can continue tuning the
remaining closed loop parameters (I, D, F, ramp rate, max/nominal duty cycle, and allowable closed-loop error) to
fine tune the acceleration and deceleration of the closed loop.
6.2.2 Velocity Mode
To start, set the feed-forward (F) gain to a small value. Open the velocity mode example project and set the proper
DMC60C parameters in the code. Run the code and drive the motor forward. Watch the velocity closed loop error
in the Smart Dashboard to see how the system reacts to your commands. Double the F gain until the system can
reach the target velocity somewhat reliably. Next, tune the P gain so that the closed-loop can perform error
correction. The remaining closed loop parameters can then be modified to fine tune the closed-loop response.
6.3 Using current limiting
Current limiting can be used to prevent brownouts when attempting to drive the motors connected to the
DMC60C. Current limiting has 3 parameters to keep in mind: Continuous Current Limit, Peak Current Limit, and
Peak Current Duration.
6.3.1 Fixed Current Limit
The continuous current limit parameter can be used alone to limit the current to a fixed value. This can be done by
setting only the continuous current limit parameter while leaving the peak current limit and duration at 0.
6.3.2 Variable Current Limit
In some applications, a current spike is needed to get things moving initially. This can be accomplished by setting
the peak current limit and duration to values other than 0. Once configured, the DMC60C will enable current