I think I'm crazy. LQR instead of PID?

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
gsenroc
Posts: 10
Joined: Mon Dec 30, 2013 11:45 pm

I think I'm crazy. LQR instead of PID?

Post by gsenroc »

Yes I think I'm crazy, but I can easily achieve better results with LQR (linear quadratic regulator) than PID controller (in Simulink for my assignments in the university). Of course if I have the model of my machine I can even make a pole placement controller but that can be a lot of work and not very realistic for a hobby.
But I really feel an easier life if the controller is LQR and only consider the Q1 and Q2 weighting factor (for x'*Q1*x and u'*Q2*u). Computing power of ATmega maybe enough.
And there are also some papers that shows the good part of LQR.
COMPARISON OF PID, POLE PLACEMENT AND LQR
Comparison Performance Between PID and LQR Controllers for 4- leg V...
Crazy idea, but perhaps is that feasible? Correct me if I'm wrong :P

User avatar
treym
Posts: 258
Joined: Sat Jul 21, 2012 12:28 am

Re: I think I'm crazy. LQR instead of PID?

Post by treym »

PID, LQR and LQR-PID on a Quadcopter Platform
Looking back at the step responses shown above, it is clear
that each control system has a different response for the same
attitudes. However, it is possible to choose the most suitable
technique based on the characteristics that is needed for the
quadcopter


your are not crazy .. but the overall benefit looks négligeable (for a hobby rc mulitirotor)

felixrising
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: I think I'm crazy. LQR instead of PID?

Post by felixrising »

Submit a patch for a third controller based on LQR :)

Just reading through those papers... this stands out to me as a potential problem: "However, as a method the determination of PID parameters are easier to obtain using LQR method." people often struggle with PID tuning already. Also, it appears that although LQR achieves the desired state very quickly, some damping or de-tuning may be required for a multirotor application to allow the motors to change speeds at efficient rates and provide time to overcome inertia of the craft.

gsenroc
Posts: 10
Joined: Mon Dec 30, 2013 11:45 pm

Re: I think I'm crazy. LQR instead of PID?

Post by gsenroc »

felixrising wrote:Submit a patch for a third controller based on LQR :)

Just reading through those papers... this stands out to me as a potential problem: "However, as a method the determination of PID parameters are easier to obtain using LQR method." people often struggle with PID tuning already. Also, it appears that although LQR achieves the desired state very quickly, some damping or de-tuning may be required for a multirotor application to allow the motors to change speeds at efficient rates and provide time to overcome inertia of the craft.

Yes I'm thinking the same thing. Such adjustment is necessary and not very difficult, after all people just tune the Q (or sometimes called Q1) most of the time, so we have only one parameter here, sounds very attractive. If the overshoot is too high, just reduce Q a little bit or increase R (Q2) until satisfied. Multiwii has already real time data reading in the GUI, this could help tuning a lot.

PID tuning can sometimes be very frustrating for people if the system has some bad poles at low frequency, like DJI frame that has soft arms. If it's not tuning right, one may crash his copter. LQR seems better at this point, not that easy to go crazy like a badly tuned PID though. BTW the lowpass filter of MultiWii does work very well with such frames onces it's set right.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: I think I'm crazy. LQR instead of PID?

Post by Hamburger »

felixrising wrote:Submit a patch for a third controller based on LQR :)


Yes. What we care about the most is real world experience.
If you are convinced then go the next step and do an alternate implementation.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: I think I'm crazy. LQR instead of PID?

Post by timecop »

Computing power of ATmega maybe enough.

But why waste time on hardware you can't debug or where you have to worry about not overrunning some software PWM generating loop?

brm
Posts: 287
Joined: Mon Jun 25, 2012 12:00 pm

Re: I think I'm crazy. LQR instead of PID?

Post by brm »

gsenroc wrote:Yes I think I'm crazy, but I can easily achieve better results with LQR (linear quadratic regulator) than PID controller (in Simulink for my assignments in the university). Of course if I have the model of my machine I can even make a pole placement controller but that can be a lot of work and not very realistic for a hobby.
But I really feel an easier life if the controller is LQR and only consider the Q1 and Q2 weighting factor (for x'*Q1*x and u'*Q2*u). Computing power of ATmega maybe enough.
And there are also some papers that shows the good part of LQR.
COMPARISON OF PID, POLE PLACEMENT AND LQR
Comparison Performance Between PID and LQR Controllers for 4- leg V...
Crazy idea, but perhaps is that feasible? Correct me if I'm wrong :P


hi,
you're not crazy at all ;)
just continue with development with the LQR variant you mentioned.
i would opt for a simple c++ implementation (using px4 or apm).
best robert

Post Reply