Speed control

Report your hardware problems here. Include as many details as possible with pictures to get the best possible help and feedback.
balink
Posts: 9
Joined: 14 Oct 2016, 17:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Speed control

Postby balink » 28 Oct 2016, 18:05

I'm using a VESC to control a 1/8th scale RC car, with a 1418kv inrunner on 4s, and I'm having issues with using speed control. If gets up to a high enough speed and then I set the speed to zero, it immediately goes into Overcurrent fault and drifts to a stop. I have tried to tune the speed PID controller (by default it was taking literally 30 seconds to ramp up to speed) but I don't know what I need to change so that it doesn't try to draw too much current. I'm using firmware 2.18 with a custom application to control a standard RC servo.

arvidb
Posts: 234
Joined: 26 Dec 2015, 14:38
Location: Sweden, Stockholm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby arvidb » 28 Oct 2016, 20:46

First a question: Do you really want a speed servo (speed PID control) on your RC car? I.e.: do you really want it to apply the brakes to slow down to whatever speed signal it is sent at the moment? (Usually one would like the car to coast when the gas trigger is released.)

Maybe you have a problem with the braking current settings (just guessing)?

pf26
Posts: 310
Joined: 28 Mar 2016, 14:37
Location: FR Valence
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby pf26 » 29 Oct 2016, 07:14

Did you try duty cycle control ? Duty cycle is highly correlated with speed, and then your motor current limit will determine your max acceleration.
This sounds much simpler for your application I guess..

balink
Posts: 9
Joined: 14 Oct 2016, 17:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby balink » 30 Oct 2016, 04:15

I'm not using the RC car for racing, I'm developing a computer controlled autonomous car, so it would be extremely helpful if we could control the speed accurately, which is why I initially selected the VESC. I would edit the code to try to limit the PID controller to not command it to draw too much current, but I don't know how the code works and I don't really want to destroy my VESC trying.

rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby rew » 30 Oct 2016, 07:22

When you command the duty cycle, then you are already commanding the speed, through a physically implemented PID regulator. The I and D terms are zero, but the P term is pretty high.

For robotics applications, knowing the location is usually more useful than the speed. Of course you think that knowing the speed allows you to calculate the location, but this is not really true.

If it is a 100km drive to a friend, and you drive 100km/h for an hour, will you be exactly at the parking spot in front of his house?

As a location feedback, consider using the tacho count. As long as there is no slippage that is a very accurate count of how far you've moved. Much better than integrating the speed.

arvidb
Posts: 234
Joined: 26 Dec 2015, 14:38
Location: Sweden, Stockholm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby arvidb » 31 Oct 2016, 13:20

balink: I think the answer is that noone knows why your VESC/motor combination trips the overcurrent fault. In principle, my opinion is that it should be possible to set a current limit that would be respected while braking, regardless of control mode. I don't know if your problem is due to wrong settings, intended features of the VESC that works differently than you and I expect, or some bug or problem with the hardware. :(

balink
Posts: 9
Joined: 14 Oct 2016, 17:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby balink » 31 Oct 2016, 16:58

First, to be pedantic, a PID controller with no I or D term is not a PID controller, but a P controller.

Second, I will try to command duty cycle, and test how well that works.

Third, I am using other things (a 3 axis accelerometer and cameras) to determine the cars position in space. My plan was to use the speed control function of the VESC to be the "inner" velocity PID loop for position control, and then implement an outer PID loop which controls position to output velocity commands to the inner PID loop on the VESC itself.

Finally, I've looked at the code in the firmware for the speed control loop, and it specifically does not break the motor if the speed is higher than it should be, so I am even more confused about why the current spikes. The only thing I can think of is that it shorts the phases together and then calculates the current between the phases spikes up above the current rating of the motor...

Is there any way I can contact someone that's a relative expert on the firmware of the VESC so I can ask questions about this?

rew
Posts: 943
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby rew » 31 Oct 2016, 20:31

Yeah. Post in the forum. :-) I've been looking at the code enough to know a thing or two.

My guess is that the duty cycle command will work just great for your control-application.

Actually. Important question in this case is: are you in FOC mode or not?

In FOC mode... two things:

First, there is no natural duty cycle control. So there is a PID loop that controls the current, in an attempt to reach a specific dutycycle setting.

Secondly, in FOC mode, the speed control loop is called with a different frequency (*). That modifies all the speed PID parameters in such a way that the default ones are WAY off. You need to completely tune the speed PID from scratch if you're in FOC mode.

I'm going to check your statement about no braking in the speed PID. I doubt it. ... OK checked.... The speed PID code WILL brake the motor if the RPM is higher than the setpoint. I've checked this for the BLDC mode code. (what it won't do is go below min dutycycle. Thus if your max speed is 35km/h at 95% duty, and your min-duty is 5%, then commanding a speed below about 2km/h will only try to "pull" the motor towards 1.84 km/h at the most.

(*) Or something else, but the result is that the speed PID parameters are entirely different between FOC and BLDC mode.

balink
Posts: 9
Joined: 14 Oct 2016, 17:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby balink » 03 Nov 2016, 02:26

I'm in BLDC mode. I tried FOC mode, but even under no load at low speed, the motor was getting worryingly hot after only running for ~30 seconds.
I might have misinterpreted the code, because I don't actually know what I'm talking about. I am using duty cycle now, that was definitely a good call. Makes me wonder why they even have a speed control PID loop... This will work great with a lower frequency PID loop running on the computer.
Thanks for all of you guy's help!

On a mostly unrelated note, is there a good way to manually tune FOC mode to work better? I would love a much quieter motor, especially at low speed.

pf26
Posts: 310
Joined: 28 Mar 2016, 14:37
Location: FR Valence
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Speed control

Postby pf26 » 03 Nov 2016, 09:43

FOC requires clean current measurements. You may want to use shunts with higher values, like 0.005 or even 0.01Ohm (make sure you don't reach +/-0.166volts at the analog input using the default amplifier gain of 10, otherwise your current measurements will saturate).

A good speed control PID is not so easy, because speed is hard to assess without delay and in all ranges (from very low to high speeds). BLDC motors have so fast reactions that the control loop can easily get lost. Using motors in real application (=with inertia and drag) would help stabilize.


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Return to “Hardware Problems”

Who is online

Users browsing this forum: No registered users and 0 guests