bgkatz / motorcontrol

motor controller firmware
MIT License
241 stars 101 forks source link

Motor does not reach high velocities #9

Closed MaximilianKoestler closed 2 years ago

MaximilianKoestler commented 2 years ago

Hi @bgkatz !

I got my motor hardware running with the firmware in this repo (after some adaptions outlined in my last comment in #8 ) and now I am diving deeper into testing.

The control is working relatively smoothly, but I was surprised to see that the velocity of the motor saturates very early. I am using a gear reduction of 1:36 right now and the velocity after reduction does not surpass 5 rad/s, even in pure open loop torque control mode.

Torque Control (ramp up to 1 Nm desired torque):

$ candump ncan3
  ncan3  001   [8]  FF FF FF FF FF FF FF FC
  ncan3  000   [6]  01 85 20 80 07 FF
  ncan3  001   [8]  7F FF 7F F0 00 00 07 FF
  ncan3  000   [6]  01 85 1E 7F E7 FE
  ...
  ncan3  001   [8]  7F FF 7F F0 00 00 08 70
  ncan3  000   [6]  01 89 D0 8C 48 45
  ncan3  001   [8]  FF FF FF FF FF FF FF FD
  ncan3  000   [6]  01 89 DC 8D 18 62

1658739874 3788807

According to my bench power supply, the current consumption remains below 0.6 A at 24 V.

At higher voltages (40 V) I manage to achieve higher velocities: 1658740988 7093077

These are the current parameters in the setup menu:

 Configuration Options 
 prefix parameter                       min   max    current value

 Motor:
 g    Gear Ratio                      0     -      36.000
 k    Torque Constant (N-m/A)         0     -      0.45000

 Control:
 b    Current Bandwidth (Hz)          100   2000   1000.0
 l    Current Limit (A)               0.0   60.0   30.0
 p    Max Position Setpoint (rad)     -     -      95.0
 v    Max Velocity Setpoint (rad)/s   -     -      45.0
 x    Max Position Gain (N-m/rad)     0.0   1000.0? 500.0
 d    Max Velocity Gain (N-m/rad/s)   0.0   5.0?   10.0
 f    FW Current Limit (A)            0.0   33.0   0.0
 c    Continuous Current (A)          0.0   40.0   10.0
 a    Calibration Current (A)         0.0   20.0   8.0

 CAN:
 i    CAN ID                          0     127    1    
 m    CAN TX ID                       0     127    0    
 t    CAN Timeout (cycles)(0 = none)  0     100000 10000

Do you have an idea what the limiting factor might be here? I can of cause start poking around and arbitrarily raise limits for the currents and other parameters, but I decided I would rather ask before risking to fry yet another driver PCB (the previous frying did not occur with your new firmware by the way).

bgkatz commented 2 years ago

Looks voltage limited. What motor are you using?

You can reach higher top speeds by increasing the field weakening (FW) current limit.

MaximilianKoestler commented 2 years ago

Thanks for the fast response!

I am using a Chinese clone of your original design (http://steadywin.cn/).

I will try increasing the field weakening current. I left it at the default of 0, so there is definitely potential there. I increased the value once before while I was still trying to properly tune the motor constants and stopped since the motor was drawing a lot of current and getting quite hot.

But now that the controller works well, I can give it another shot.

MaximilianKoestler commented 2 years ago

Increasing the FW current indeed increases the maximum velocity a bit, I have reached up to 8 rad/s at the output of the reducer now with I_FW_MAX == 10.0. I do not really need that high speeds anyway and with a 1:36 reducer I guess I should also not expect more.

Thanks for looking into it!