Ok, I’ve built myself a radio controlled shopping cart, just like in the video by the Odrive crew.
I used two 250W hoverboard motors and a 7S Lipo (so about 29V) , combined with a V3.6 56V Odrive.
It took some tinkering, but I got everything working by following the hoverboard instructions and some extra hints and tips I found in this forum and online.
The next thing (I think) is trying to tune the gains. I’ve tried driving the cart around, but it’s pretty hard to control. It’s like there’s a delay in me operating the transmitter and the cart reacting, which oftentimes leads to overcompensation (I try to steer it in a cerain direction, but the cart doesn’t respond immediately, so I keep steering and once the cart reacts, it keeps going even after I stopped the steering input).
My problem is, that’s it’s not clear to me if I should follow the tuning instructions https://docs.odriverobotics.com/control.html, or if the gains provided in the hoverboard guide are the best to use.
I also think I have to increase the current limit? (odrv0.axisX.motor.config.current_lim). I’ve got it set to 20 now, because at 10 the motors wouldn’t finish the calibration sequence.
Any help would be greatly appreciated!
Your integrator gain is way too high. Reduce it a lot (by an order of magnitude or two) or better yet just set it to zero and tune with proportional gains only.
With most “manual control” applications, it’s not useful to have any “integral action” because the human brain is MUCH better at that sort of thing than any PID controller.
This would be different if you were operating in position control, of course.
I’ve set the gains according to the hoverboard guide, it says to use these numbers:
odrv0.axis0.motor.config.current_control_bandwidth = 100
odrv0.axis0.motor.config.torque_constant = 8.27 / measured KV (in my case 0.516875)
odrv0.axis0.encoder.config.cpr = 90
odrv0.axis0.controller.config.vel_gain = 0.02 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_integrator_gain = 0.1 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
So:
vel-gain = 0.02 * 0.516875 * 90 = 0.930375
vel_integrator_gain = 0.1 * 0.516875 * 90 = 4.651875
That doesn’t work in your application, so instead set odrv0.axis0.controller.config.vel_integrator_gain = 0
and just increase vel_gain
until it starts to become unstable given a step-change of input, then reduce it by a factor of two.
Ok, I’ll try that, thanks very much!
Do I also have to increase the current limit? As it says that: “The default current limit, for safety reasons, is set to 10A. This is quite weak, but good for making sure the drive is stable. Once you have tuned the oDrive, you can increase this to 60A”.
That worked a treat! I set the vel_integrator_gain to “0” and the vel_gain to “2.5” (I got some vibration at “3”). Now it’s almost as easy to control as an rc car.
Thanks for your help!
Powdered by ODrive! Thanks again for all the help! ALDI kerst commercial 2021: Geweldige feestdagen hoeven niet duur - YouTube