Hoverboard Motor Bobbycar moves backwards after breaking

Hi

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?

Regards
Dirk

Hah.

This is due to the integral term in the velocity controller - It’s a bit overzealous and winds up indefinitely.
Set vel_integrator_gain to 0 and it won’t do this.

1 Like

Ahh :slight_smile: 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?

1 Like

I think these behaviors may be the same thing.
When you are riding your bobby car, how are you stopping?

How are you controlling the ODrive? Arduino… PWM… Serial… USB… ?
Are you commanding a velocity of zero, or using some other method?

-John

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.

Highly usable if your car is going over hard terrain. I-part is pushing wheel over obstacles and work as electronic brake on hills

It only winds up to vel_limit