1
$\begingroup$

I'm trying to implement two PIDs for stabilizing quadrotor for position tracking. The inputs are $x_{d}(t), y_{d}(t), z_{d}(t)$ and $\psi_{d}(t)$. For position tracking, usually the small angle assumption is assumed. This assumption allows for acquiring $\theta_{d}$ and $\phi_{d}$. These are the results

enter image description here

The x-axis position is driving me crazy. After alot of attempts for tuning the PIDs, I felt something wrong is going on. Is this a normal behavior for PID controller? Also, what I've noticed is that once $\psi$ reaches to zero, the platform starts oscillating (after 1.5 second in the figure).

For solving ODEs and computing the derivatives for the velocities, I use Euler methods.


It is simulation in Matlab.

$\endgroup$
4
  • $\begingroup$ Explain in more detail how you tuned your PID controller. $\endgroup$
    – Paul
    Apr 17, 2015 at 15:33
  • $\begingroup$ @Paul, do you want to know the actual values of the gains? $\endgroup$
    – CroCo
    Apr 17, 2015 at 20:20
  • $\begingroup$ Not the values, just the steps you took to arrive at those values. $\endgroup$
    – Paul
    Apr 17, 2015 at 21:30
  • $\begingroup$ @Paul, after a deep thinking, I believe these results are good (not perfect). I've double checked the trajectory, it seems from 0 sec to 1.5 sec, the trajectory is fixed. After 1.5 sec, the trajectory starts varying. I've implemented backstepping controller and the results are perfect. Thank you. $\endgroup$
    – CroCo
    Apr 18, 2015 at 18:42

2 Answers 2

2
$\begingroup$

is it real or simulation application?

If simulation there is good examples in matlab codes/models you can look deeper

If real:

1- filter the sensor data

2- use tan2 function for angular error calculations

3- begin PID calculations with all P, I and D constants. if you use just one of them stabilization is not possible. PI or PD control is possible. Be carefefull first constants P>I>D than you can use :

http://sts.bwk.tue.nl/7y500/readers/.%5CInstellingenRegelaars_ExtraStof.pdf

or

http://www.expertune.com/tutor.aspx

$\endgroup$
3
  • $\begingroup$ simulation in matlab. yes there are a lot of matlab codes, but the majority of them use simulink. I'm using script. $\endgroup$
    – CroCo
    Apr 17, 2015 at 20:24
  • $\begingroup$ This is a good thesis I did simulink model from this and works fine. Also be carefull about using tan2 in angular calculations. also If you can send or share the code may be(if familiar language) I can help/fix your code $\endgroup$
    – acs
    Apr 17, 2015 at 23:16
  • $\begingroup$ @cagdasecking, after a deep thinking, I believe these results are good (not perfect). I've double checked the trajectory, it seems from 0 sec to 1.5 sec, the trajectory is fixed. After 1.5 sec, the trajectory starts varying. I've implemented backstepping controller and the results are perfect. Thank you. $\endgroup$
    – CroCo
    Apr 18, 2015 at 18:42
2
$\begingroup$

The controller has a definite performance problem after t=1.5sec. [This can be due to the system model or some other coding error.]

The system (model + controller) behaves smooth until t=1.5sec. It is best to magnify and debug the code at that region. The controller behaves as expected until then. Only the X has no error from T0, which makes assessing the X-axis controller impossible.

Another point also worth noting is that, the Y and Z errors should have caused some error in X, but we don't see this. So the simulation model could be simplified (like decoupled in X direction from others maybe?)

Euler angles sometimes cause computational errors in attitudes (for exact zero, or pi or pi/2's). That might be the reason.

For an understanding of the maths behind euler representation singularities, and their solutions, please refer to textbooks or articles, one example is: http://lairs.eng.buffalo.edu/pdffiles/pconf/C10.pdf

$\endgroup$
1
  • $\begingroup$ The problem was with the trajectory. From 0-1.5 sec, the trajectory is fixed. This explains why the error decays, after 1.5 sec, the trajectory started varying and hence the error doesn't decay, therefore I just hoped to reduce the error which I've done. I've implemented backstepping controller and the results are much better than PID but still PID is a valid choice. $\endgroup$
    – CroCo
    Apr 23, 2015 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.