Increase Odrive torque stiffness?

Using the existing PID-control in postion mode, the current (any by that torque) is more or less “zero”, when no disturbance acts. Depending on the PID parameters, only when the setpoint deviation is > 0, the current will increase. The P-part of the controller needs a deviation to do anything and the I (&D) part needs time (=delay) to act. Finally the torque stiffness (delta_torque/delta_setpoint_deviation) is defined by the odrive software and to maximize the stiffness, we need aggressive tuning, which implies other issues.

Using “normal” 2 phase hybrid stepper motors, the torque stiffness is proportional to the (“constant”) current until it saturates. In the end these motors are also just BLDCs. So why not just use a constant base current with the Odrive, to increase the torque stiffness and disturbance rejection ? That means adding a constant current to the controller output of the PID-loop.

For sure one advantage of Odrive is not to heat the environment too much, but a 4th tuning parameter to increase the base current - if wanted - would increase the real life torque stiffness a lot - without the problems of too aggressive tuning. A lot of applications, where the plan is to follow trajectories as good as possible and the “disturbance” is known in advance, could increase this base current in advance and optimize the torque stiffness/heat/trajectory relation furthermore.

It is clear, that there are hardware possibilities (number of poles, steps etc.) to influence the torque stiffness, but software changes are for “free” and often the only possible way to go.

This is also true for steppers, their electromechanical torque stiffness is also finite. You can even calculate this stiffness. Like you said, both motors are brushless permanent magnet motors, and follow the same equations, steppers simply having a much higher pole count.
Specifically, for a constant current vector, the torque as a function of deflection is: kT * I * sin(deflection/pole_pair_angle). The pole_pair_angle of a stepper is step angle times 4 (there are 4 whole steps per pole pair). The pole_pair_angle of a regular bldc is unsurprisingly 360 degrees / number of pole pairs. kT is the torque constant of the motor, and I is the current.
Note that kT * I is the holding torque of a stepper, and the “peak/rated” torque of the brushless motor (depending if you are using peak/rated current for I).

You can beat a stepper stiffness with just the P gain of the electronic controller if your encoder resolution is high enough to allow aggressive tuning. Meanwhile adding a D-axis current (the type of current used in steppers, and that you’re describing) with the kind of pole pair count you usually find in normal brushless motors would have a negligible effect compared, while wasting motor-cooling aka. peak torque potential.

You’re not wrong, your point is valid. Many brushless gimbal controllers use the “D-axis current” and the sin(deflection) torque for their control. It can be used, but I’d say it’s less effective than the active control, and not worth the added motor heat.

Thanks for your explanations, i know the equations and i still don´t get the point.

In my opinion, the point is, that in the odrive case it depends on tuning and encoder resolution. The number of poles cannot really be changed, 14 poles are common and 22 poles are already limiting the possible available motors a lot. A normal 200 steps stepper has afaik 50 poles. If i e.g. use a 14 pole 3 phase BLDC than the torque stiffness advantage out of the box of the 200 steps stepper is about 50/14 = 3.6 (please correct me, if that is nonsense). This combined with a much better Nm/A kT value of the stepper, makes it “harder” to outperform a stepper at lower speeds using odrive.

I did compare a SK3 5055 with AMT102 8192 steps and 50 A (max) with a 2.4 A 200 NEMA17 stepper. The comparison is somehow weird, because i compare a 20 EUR solution (stepper +driver) with a > 200 Euro solution (but i don´t care in his case). It is also clear that the real advantages of odrive are not at low speeds, but on the other side most “stepper” applications have to work as perfect as possible at low speeds and the high speed area is a “bonus”.
In the end it is hard to find a really reliable tuning. Cranking up pos_gain is also with 8192 steps not enough and using vel_gain and especially vel_integrator_gain is a must, but adds other issues.

The PID-tuning assumes a linear (and by that also constant) process. So if the process is non linear or changes over time or load case, there is no perfect tuning available. Using a “base current” would reject disturbance out of the box without tuning reliability issues. In my understanding using a base current, the overall stiffness of the process would be increased and by that shifting oscillations to higher frequencies with smaller amplitudes - adding even more robustness.

What you say is more or less: Because of the small number of poles using BLDCs, we need more current to achieve the same torque stiffness (compared to motors with more poles). Gimbals have in general more poles, so it is more “efficient” there to use a constant base current. I also understand that normal hybrid steppers are made for high torque (stiffness) at low speeds, whereas BLDCs are made for high power (at high speeds).
But why should we not decrease the disadvantages of BLCDs in the low speed range (or why should we increase them artificially) ? So as long as one can handle the heat “problem” where is the big disadvantage to apply a constant base current ? Now i limit a 90 amper BLDC to 50 max amps (because it gets expensive to supply more amps using bigger PSUs and/or batteries). What is the problem if it constantly draws e.g. 5-10 amps ?

A reasonable aggressive tuning of 100Hz bandwidth on an example system: 1kg mass and 40 tooth GT5 pulley comes out to an effective stiffness of 7 Nm/degree.


Meanwhile, a 270kv motor with 10A of d-axis current and 7 pole pairs comes out to an effective stiffness of 0.00076 Nm/degree.

So my point is that yes you can do it, it just sucks 10,000 times worse, and is hence a waste of motor heating.

EDIT: oops I divided by pole pairs instead of multiplied. So it’s actually 0.037 Nm/degree for the d axis current, and only 200 times worse.

1 Like

I am sorry, but are you sure that you don´t compare apples with bananas ?

The 1st value is a dynamic one (e. g. mass spring system), in the end completely arbitrarily chosen and not defined by the motor. How do you calculate your bandwidth if you don´t move a mass, if your load is e.g. a spring (e.g. a 3D printer extruder) ?

The 2nd one is more or less the steady state torque stiffness (a spring) and totally defined by the motor.

Why don´t you do the following calculation ?
16T GT2 pulley with 100 g of mass (e.g. 3D Printer and many other applications where odrive can make sense). Your 1st equation gives “an effective torque stiffness” (as you call it) of 0.018 Nm/degree. From that follows 0.018 / 0.037 = 0.49. So in this example a base current of 10 amps provides twice as much torque stiffness as the PID closed loop can provide as your formula shows - and i even didn´t touch/change/question the 100 Hz bandwidth.

In other words combining the PID-torque stiffness with the “base current torque stiffness” gives about 3 times the torque stiffness of the closed loop PID-controller.

Maybe that is nothing for you, but i am sure it is not nothing for many customers of Odrive.

But i would would question the way this comparison (equations) was done.

I’m just using the example system to derive a reasonable position gain to compare against. I agree that it’s arbitrary, but we need to pick a load so we can compare dynamic stiffness with static stiffness, as you pointed out . As I understand it, the main the difference being that one has the delay of a few hundred microseconds in the controller and one is physical and hence instant. My point is that in a reasonably dimensioned system, the dynamic stiffness dwarfs the extra static stiffness. I wouldn’t call 5055 motors on a 100g 3D printer load reasonably dimensioned, but sure in this case you could get some extra stiffness.

Nevertheless, the main point of adding d-axis current is to extend the stiffness beyond what is stable by just turning up the position gain in the controller, right? I think we both agree that it’s better to just turn up the gain if the stiffness you want is achievable in this manner. So let’s say we want stiffer than that. Adding stiffness to reach a response bandwidth beyond what the controller can handle isn’t a good idea anyway, because you don’t also add the required damping, and you may get an under-damped response.

The d-axis current style is analyzed in detail in the following, and they demonstrate this under-damped response in both theory and experiment:
http://www.olliw.eu/2013/brushless-gimbal-direct-drive/#model

Either way, you are free to add a d-axis current component, and try it out. In motor.cpp, in the call to FOC_Current, you can change the d axis current set-point to be different from 0.0f. Let me know how it goes.

EDIT: Actually that d-axis current spins with the rotor, so while it adds stiffness, it will only do so for very high frequencies. Maybe that is what you want though, since the regular controller can handle the rest? Either way, if you want a static current component, you will have to add that to FOC_Current.

Thanks a lot for your comments. I have no time to start compiling, but in case i find the time i will try.

Some additional comments (just my opinion) just as feedback.

Is a SK3 5055 oversized for 3D printing ?
The whole Odrive environment consists of Odrive, PSU + (batteries, resistors), encoder + motor. In total it sums up to > 200 Euro. I bought the SK3 5055 for 35 EUR incl. shipping and everything. A cheaper motor would have cost e.g. 15-20 EUR less with multiples times smaller kv and max current rating - what doesn´t help at all, see above.
So in total in my opinion, it is the wrong way to save money on the motor side, it just doesn´t pay. The relation kv and max current vs EUR is very nonlinear towards the cheap motors and the motors are only one part of the whole costs.

I also know there is a lot of action going on combining BLDCs with gears to replace NEMAs, that won´t work unless one is able to compensate backlash/wear issues. Backlash just means “low torque stiffness” around the setpoint - not only “i cannot feel some gap”. If possible it is “always” better to invest the money in a “bigger” motor, than applying gears - that also costs money. Backlash in any way is really nasty and has to be avoided. So using smaller motors and gear them, doesn´t really save money and makes new problems. For sure some applications don´t need perfect accuracy but small/light compact drives.

So to get about the same torque stiffness as with cheap NEMAs at low speeds, we need “bigger” motors to avoid gears. I also don´t want to active cool them.

Do i agree that cranking up the gain would help “always” ?
The problem with every controller tuning is, that it is based on a (in this case constant linear) model. If you apply odrive to a delta or scara printer, that doesn´t work anymore. Or you have to choose the gain on the very save side, loosing torque stiffness. If a control engineer would know that the plant/process is nonlinear in the gain, he would use lower p-gain and try to get more action using the I-part. If a control engineer would be able to change the hardware, he would try to make the nonlinear effects smaller. Using a d-axis-current seems to do the same for me, i get better control performance around the setpoint at lower p-gain - independently from what the process gains does.

1 Like