Improving Angle Control

Hello there,

I am very much in the early days of using the FOC Library.

I have a setup of Ardunio Uno, Simple FOC Shield (I built) and a 7pole gimble type BLDC motor (2204) with a CUI encoder 500ppr.

I have the angle control running after following Owen’s you tube tuning guide. Although it works as it moves the point to the angle request it does not have much torque to hold this angle. How can this be improved?

I have the P and I gains turned up as high as I can without it going unstable. I have also tried turning up the motor voltage (12Volts) but this has little effect. The motor seems it can develop a good torque but you need to turn it about 1 Rad before you feel it kick in.

Any ideas?

What TorqueControlType and MotionControlType are you using?

Thanks for the reply

// control config
motor.controller = MotionControlType::angle;

whats the differences between the two control types

You can learn about TorqueControlType here.

In my (short) experience:

  • It’s not possible to achieve strong torque with TorqueControlType::voltage.
  • With TorqueControlType::dc_current and TorqueControlType::foc_current, the key to achieve strong torque is to optimize PID_current_q (especially PID_current_q.I).

Did you have a look at SimpleFOCStudio? It allows to dynamically modify parameters. I don’t think I could ever achieve anything good with my motor without it.

Hi, I think I have a similar problem.

My current setup is, Arduino Uno, GM5208-24 motor, AMT102(500ppr) and V2.0.3 SimpleFOC shield.

In closed-loop velocity mode, the motor first initializes and after the motor is ready, typing T2, T10, T0 in the serial monitor, I could get the motor to spin/stop. But when I put pressure or a rotational force to the motor, it’s not compensating for the external force, as of result, the motor is not returning to the previous angle/position. Also with different PID values e.g. P = 0.5, I = 20, D = 0, I could get the motor to compensate for rotations under 0.1 rad. However, if I give it more than that rotational force/angle, the motor would shift its current angle to a different position. The recovery time of the motor seems to be relatively slow.

Hello, Sorry if these sound like silly question but as I said its early days for me.

So do you set the motor.torque_controller = TorqueControlType::foc_current; or dc_current or voltage

but also have the motor.controller = MotionControlType::angle; ??

I have had a look at the SimpleFOCStudio and looks like a useful tool my only concern is that when you turn the monitoring on it slowed things down and the graph refresh rate is far to slow to be useful.

on a side note (might be worth a post of it own) when a set up a closed loop velcity controller, the signal I get from (encoder.getVelocity()) appears to be noisy no matter what tuning I do. If I watch in the motor.monitor the refresh rate is slowly and looks better. Could this be part of the problem?

motor.controller and motor.torque_controller are different things. See the doc here and here.

motor.controller is defined by what you want to do. If you want to control the motor angle, use motor.controller = MotionControlType::angle.

motor.torque_controller sets the algorithm for driving the motor. First try TorqueControlType::voltage and tune the various parameters. Then, if your board is powerful enough and your driver supports current sensing, try to move to TorqueControlType::dc_current. Then do the same with TorqueControlType::foc_current.