Hello, thanks for the message. This is a good question. The answer is that the motor is using a PID control algorithm to drive the motor to the desired position (here, 720), which may overshoot the setpoint in order to reach it quicker. This can be avoided by tweaking the underlying P, I, and D control parameters.
Here’s a graph showing the different kinds of overshoot that you may see for different values of the three terms:
To avoid overshoot, try reducing the D term. Also try reducing the P term. Dampening the control system to eliminate overshoot will likely result in it going slower and taking more time to reach the desired setpoint.
You can use the pidSetTunings(Kp, Ki, Kd) function of BricktronicsMotor to change the tunings. The default values are 2.64, 14.432, and 0.1207 for Kp, Ki, and Kd, respectively.
Thanks for your quick response!
When I read the book “LEGO and Arduino Projects”, I notice the PID but not understand. Your detailed description and graph help me understand the concept. I will try to adjust these parameters.