hi there . i'm currently working on a thesis which involves designing a fast nonsingular terminal sliding-mode controller for attitude control of a quadrotor. the outputs of sliding mode controller which are three control inputs u2,u3,u4 are used as inputs of attitude dynamic subsystem which in turn generates euler angles for position dynamic subsystem. and prior to sliding mode controller block we have a kinematic inversion block which generates reference euler angles for controller to track. as you may know, on the right side of the euler angles dynamic equations we have a combination of the components p,q,r,omega_r,u2,u3,u4,Jr,etc.

we define the term (omega_r) as follows :

omega_r=w1-w2+w3_w4

in this equation , wi is the angular velocity of i'th rotor . each two rotors which rotate in the same direction (counter-clockwise or clockwise) appear with the same sign in the above equation. and on the other hand we know that vector of squares of angular velocities of rotors is equal to a 4*4 matrix multiplied by a vector consisting of four control inputs. each of four inputs should be designed in such a way that make the left side of the equation( i mean wi^2) greater than or equal to zero, because if it becomes negative, then complex values are achieved for angular velocities of rotors which are completely meaningless. and this is exactly the error that i'm facing with in the simulink :'' Domain error. To compute complex results from real x, use 'sqrt(complex(x))''. and i should mention that i used to achieve reference values for fi,teta,sai by a sin^-1 block but then i wondered that the possible cause for this error might be that the term inside the sin^-1 gets greater than 1 or less than -1 so it outputs complex results for reference values of angles . so instead of designing the kinematic inversion block based on sin^-1 , i decided to design it based on tan^-1 block. but even after doing this, the debugger also keeps giving the same error. so it attributed this error to the fact that maybe u(vector of ui's) is changing in such a way that makes the left side of the aforementioned equation negative. and if we want matlab to calculate square root of left side, instead of sqrt(x), we should write sqrt(complex(x)) which is wrong because complex values for angular velocitis are meaningless in our thesis. i have attached a photo of my own calculations for better understanding.

i would appreciate any suggestion of yours on how to fix this error or where might this error originate from.

More Alireza Salimi's questions See All
Similar questions and discussions