So i wired up 2 hoverboard motors into a bobby car, using the hoverboard guide.
However, i have one problem i don’t understand:
The motors are in CTRL_MODE_VELOCITY_CONTROL and if i manually turn them for some distance, or push the bobby car, the motor undoes the manual move by rotating back to the original position.
The same happens if i sit on the car and stop from high speed. after stop the car will drive 1-2 meters backwards, apparently undoing some (positional?) overshot.
Is this supposed to happen? Why does the motor apparently try to keep position?
And most importantly, how do i stop this from happening?
Ahh Yes, that makes sense, and after looking at the code how the controller works is totally logical from the math perspective. Is also seems that this is a normal characteristic of a PID controller.
However, undoing some velocity overshot by a negative velocity does not make sense (or is there any application where is does?) . So, does this mean a PID controller, with the I part != 0, are not useful for controlling velocity? That also sounds wrong. What am i missing?
When I said “it’s a bit overzealous and winds up indefinitely” I meant that there is no configurable limit on what the integral term can grow to. This is known as integrator wind-up. Some controllers allow you to limit the maximum effect of the integral, and then a non-zero term can be useful even for velocity control, i.e. eliminating steady-state error.