This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Open loop control

Other Parts Discussed in Thread: DRV8305, MOTORWARE

I am working on a custom board based on the F28027F with DRV8305, the design is very close the the launchpad+BOOSTXL-DRV8305 combination.  4 of these boards are being used to fly a quadcopter.

I have the system flying, but something is quite right.  I probably just need to adjust the PID tuning.  As a starting point I'd like to get the response of my board closer to that of a traditional brushless controller.  In a traditional controller there is no speed regulation, you essentially have duty cycle control of the PWM.  Is it possible to accomplish something similar with instaspin FOC?  Obviously some control loop on the current needs to happen, but would for example just running the Id loop work?

I based my code on lab11:  The main ISR does this:

outMax_pu = _IQsqrt(_IQ(USER_MAX_VS_MAG_PU * USER_MAX_VS_MAG_PU)
- _IQmpy(gVdq_out_pu.value[0],gVdq_out_pu.value[0]));

PID_setMinMax(pidHandle[2],-outMax_pu,outMax_pu);

PID_run(pidHandle[2],refValue,fbackValue,&(gVdq_out_pu.value[1]));

What if I just did something like:

gVdq_out_pu.value[1]=Input_duty_cycle_percent*outMax_Pu?

I fully intend to go back to using the speed regulator, but establishing open-loop control might help me track down some of the trouble.  Is the sort of open-loop control I desire possible?

  • if you are controlling Id = 0 and Vq to some voltage/duty value you aren't taking advantage of the current control properties of FOC. You will have issues in over current, guaranteed. We have seen this multiple times with e-bikes and drones.

    if you want to run in a torque mode, you can command IqRef_A directly.

    but most drones are using speed control mode as the algorithms that create the motion/movement/stability are typically outputting propeller speeds, not torque in Amps.

    You likely just need to tune your speed controller.

    I have found that with a propeller a good starting point is to divide the default speed Kp and Ki by 3. This gives very good response on most drones. In the next version of MotorWare we will include some labs with graphs that show you how to use the tools to tune your current and speed loops easier.

    also, for these high speed motors you may want to try increasing this user.h value
    USER_SPEED_POLE_rps

    to (600.0) or (1000.0) range to give faster speed estimation feedback into the control system
  • You're likely right on the tuning. I have some instrumentation that can plot RPM at high speed. I did some tuning by plotting step response and tuning to get squarest RPM response. After this I ended up with KP=24 and KI=0.03. Considerably greater than default from what I recall. This tuning also showed MUCH faster step response than the older controller. I am suspicious that the integrator gain is causing trouble. I intend to add some software so I can adjust the KP/KI for all motors while in flight.

    I'll try the USER_SPEED_POLE_rps as well. Can you define "high speed"? My motor runs about 35Krpm (electrical)
  • 35 KRPM is mechanical
    electrical Hz = RPM * poles / 120

    Most of these hobby motors run from 800 - 1600 Hz, which is high speed.
  • 35Krpm=5krpm(mechanical)*7 pole pairs. Electical RPM, but if it is then considered a 2 pole motor it works out the same.

    Working this out I get 583hz, so actually lower than what you said. This is also the full throttle RPM, hover is closer to 3500rpm.

    Are there any bench tests I can do that might help me pinpoint some trouble? I can do step response easily, but I could alter my instrumentation to to frequency response as well if you think it is worthwhile.
  • 5 KRPM with 7 pole pairs = 583 Hz you are correct.
    That is really low speed for a propeller motor. Are these extremely high current or something?

    for tuning the speed loop a step response is the best. you can try 1KRPM to 2KRPM with extremely high acceleration.

    for checking the current loop I recommend doing a step response on Id. Change it from Id = 0 to Id= -X amps and tune the Id response. You can do this with a speed controller, which makes it easier than trying to run in torque mode and doing a step response on the Iq.

    You can then use your tuning for both Id and Iq (but the default values should be pretty good; you may increase your Kp up to 4x)
  • These motors are spinning a large prop, average current draw with a heavy payload is ~6A per motor. The lift system is much more efficient than smaller propellers.

    I'll do some tests. I'll come up with some gains closer to the response of the original ESCs and see how that goes as well.

    How is the integrator implemented? I am still suspicious this is the root of the problem. Once I get my software done and get set the I gain to 0 during flight I should be able to narrow things down quite quickly.
  • which integrator? in the PI?

    what is not quite right in your application?

  • Yes, the PI integrator.

    The way the heli flies is not quite right. I have a lot of experience flying these things, and I know when something is not right. Very hard for me to quantify this though, just feels mushy and unstable. It could be purely the PIDs on the flight controller side too. This is why I want to get the new controllers responding more like the old controllers. This way I can better determine if flight controller tuning is to blame.
  • take some data on the speed controller. I know for sure you can get it tuned well to meet your needs, there are many drones flying now with InstaSPIN-FOC.