PID cruise control oscillations

General topics and discussions about the VESC and its development.
whitepony
Posts: 38
Joined: 02 Jan 2016, 19:57
Location: Germany

PID cruise control oscillations

Postby whitepony » 26 Jan 2016, 18:16

heyho,

im running an R-specc 6355 single rear drive, 15T/36T gearing and with my weight of 80kg, the board is oscillating quite badly on cruise control - it lags behind and then overcompensates the target velocity.

I would guess as a start I could remove the integral part completely (KI) and maybe decrease the proportional part (KP) slightly, so that the controller surely wont overcompensate anymore. I rather not reach my desired velocity or get slightly slower or faster at a hill than constant swinging. does anyone have any tips or even a whole set of useful tested parameters for a similar setup?

thx 8-)
Last edited by whitepony on 26 Jan 2016, 18:40, edited 1 time in total.

whitepony
Posts: 38
Joined: 02 Jan 2016, 19:57
Location: Germany

Re: PID Cruise control: swinging

Postby whitepony » 26 Jan 2016, 18:29

ah, this is the wiki PID article - sounds quite useful what they write about manual tuning:

If the system must remain online, one tuning method is to first set K_i and K_d values to zero. Increase the K_p until the output of the loop oscillates, then the K_p should be set to approximately half of that value for a "quarter amplitude decay" type response. Then increase K_i until any offset is corrected in sufficient time for the process. However, too much K_i will cause instability. Finally, increase K_d, if required, until the loop is acceptably quick to reach its reference after a load disturbance. However, too much K_d will cause excessive response and overshoot. A fast PID loop tuning usually overshoots slightly to reach the setpoint more quickly; however, some systems cannot accept overshoot, in which case an over-damped closed-loop system is required, which will require a K_p setting significantly less than half that of the K_p setting that was causing oscillation.

lets see if i feel like removing my case to access the usb port just now or if will leave it for a nice day in spring :)

whitepony
Posts: 38
Joined: 02 Jan 2016, 19:57
Location: Germany

Re: PID cruise control oscillations

Postby whitepony » 27 Jan 2016, 22:30

I had about an hour dry roads and I managed to give it a go with KI simply down to zero and KP default value. sadly my USB access requires me to remove the case everytime, so testing is a little awkward.

anyway, results as expected: removing the integral and only leaving the proportional part resolved the oscillations, but also as expected: Im falling slightly below the speed I wanted it to keep now. guess extensive parameter tuning, following the wiki PID guide is now in order, but thats really something for spring. just wanted to test if I can remove the oscillations and the awkward carving behavior ... and I could. ;)

whitepony
Posts: 38
Joined: 02 Jan 2016, 19:57
Location: Germany

Re: PID cruise control oscillations

Postby whitepony » 28 Jan 2016, 17:54

fiddled a bit more today and pretty much just followed the wiki pid manual tweaking guide.

at KI = 0 and KP 0.005 it definitely started oscillating for me, so I roughly halved that value. then I started to increase the integral part a little until I felt like the board would keep nearly the same speed going up and downhill. also tested with manual foot braking!

the values I closed the session with were
KP 0.002 (0.001 default)
KI 0.002 (0.04 default if I remember correctly)

maybe it helps as starting values for somebody with similar troubles: single 63mm motor, 15/36 gearing, 80kg rider :)

User avatar
Dude
Posts: 33
Joined: 30 Dec 2015, 23:37

Re: PID cruise control oscillations

Postby Dude » 15 Feb 2016, 20:47

In order to get the right PID parameters it would be great to see the (e)rpm in the realtime plot of the BLDC tool. Do you know if/how this can be accomplished?

benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Re: PID cruise control oscillations

Postby benjamin » 18 Feb 2016, 12:41

I did some testing in a factory a day ago, and it turns out that it works best for me with kp and ki about the same. When I got the high KI was when I was testing in my basement, and to be able to drive up on the carpet edge slowly I needed hi ki. This is not a practical use case though, but the only one I could test since I cannot drive outdoors in the winter.

whitepony
Posts: 38
Joined: 02 Jan 2016, 19:57
Location: Germany

Re: PID cruise control oscillations

Postby whitepony » 20 Feb 2016, 06:55

benjamin wrote:I did some testing in a factory a day ago, and it turns out that it works best for me with kp and ki about the same. When I got the high KI was when I was testing in my basement, and to be able to drive up on the carpet edge slowly I needed hi ki. This is not a practical use case though, but the only one I could test since I cannot drive outdoors in the winter.


oh yea, so you basically used the supersmooth integral ramp to conquer the carpet edge :lol:

cool that we basically ended up at the same conclusion of KP = KI (I finished my testings with both at 0.002). I think it will be very helpful to adjust these parameters in future releases, because Im not sure how many people will make the connection of "swinging velocity -> adjust PID control". Im working in the autonomous car business, so Ive had my fair share of problems like that in lateral and longitudinal control. ;)

benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Re: PID cruise control oscillations

Postby benjamin » 22 Feb 2016, 11:35

oh yea, so you basically used the supersmooth integral ramp to conquer the carpet edge

Everything depends on the application. If the goal is to conquer carpet edges at low speed, high ki is the way to go :-)

I think it will be very helpful to adjust these parameters in future releases, because Im not sure how many people will make the connection of "swinging velocity -> adjust PID control".

The problem is that the good speed control parameters in FOC mode don't work in BLDC mode at all since the BLDC speed controller is based on voltage. I gave them a try in BLDC mode, and the motor would oscillate like crazy. One solution could be to make the BLDC speed controller current based. I will have a look at that. I haven't worked on the BLDC code for a long time now...

SteveS
Posts: 1
Joined: 25 Jun 2017, 18:02
Location: San Francisco

Re: PID cruise control oscillations

Postby SteveS » 25 Jun 2017, 18:11

I've recently been having problems with speed oscillations at constant, light (manual) throttle. It sounds very much like Whitepony's experience except that I'm not using cruise control. As the attached screenshot shows, my post-detection, default Kp and Ki are very far from Whitepony's. Should I change them? Should I change something else?

Aside from the oscillations, performance is excellent. Incidentally, I'm running a sensored Sk3 149kv motor at 12S.
Attachments
BLDC screenshot.jpg
BLDC screenshot.jpg (253.74 KiB) Viewed 1907 times


Return to “General”

Who is online

Users browsing this forum: No registered users and 2 guests