Adaptive Controller
Adaptive Controller for Pendulum

Adaptive Controller

Quite often we don't know the exact physical parameters for the system we want to control. Adaptive controller is one way to solve the problem. It uses the following equations to solve it. I will be going through explanations what each equation does.

Manipulator Equation:

No alt text provided for this image

M,C,N matrix for Double Pendulum:

  • mass1 - m1
  • mass2 - m2
  • angle1 -q1
  • angle2 -q2
  • arm_length1 -a1
  • arm_length2 -a2
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Now we try to rewrite the equation in terms of the unknown parameter. For us it is m1 and m2 as we don't know the pendulum masses.

No alt text provided for this image
No alt text provided for this image

Now to design the Adaptive Controller We write the equation for torque along with defining the error space:

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Using equation 6 we derive the following equations:

No alt text provided for this image
No alt text provided for this image

From Equation 12

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

The above equation can be coded using Eigen library in C++. Even without Eigen it can be done using vectors and arrays. To have a walkthrough please check my github link: https://github.com/Shubhranshu153/AdaptiveControllerCpp

Now we want to pick a lyapunov candidate Function. There is no particular way to do it but it is really important that it is positive and globally decreasing:

No alt text provided for this image

To get P we solve the lyapunov Equation:

No alt text provided for this image

We have to solve this equation numerically for C++. Matlab has a neat function. A c++ implementation is in the previous github link. To implement it i have followed the literature from this link- https://people.kth.se/~eliasj/NLA/matrixeqs.pdf

Another property of the lyapunov function is that the derivative of V is negative.

No alt text provided for this image

To get it we first differentiate V with respect to time and then set the following.

No alt text provided for this image

Now all this set we have to integrate our state equation with respect to time to observe the behavior of the dynamical system with respect to time. I have used runge kutta integration technique to do it. It is fairly accurate and the solution is comparable to the output given by matlab.

RESULT

Prediction of Mass over time. Our initial prediction for mass 1 is 2Kg and for mass2 is 3 Kg:

No alt text provided for this image

Desired angular trajectory we want the controller to follow

No alt text provided for this image
No alt text provided for this image

Desired angular velocity trajectory we want the controller to follow

No alt text provided for this image
No alt text provided for this image




要查看或添加评论,请登录

Shubhranshu Mahapatra的更多文章

  • Improvise Adapt and Overcome

    Improvise Adapt and Overcome

    “Improvise Adapt and Overcome” – I saw it in a meme featuring Bear Grylls I like to google things up (Well most…

社区洞察

其他会员也浏览了