First off Quadcopter project which I worked on, is open source and over GitHub, Happy experimenting..!!
so I got to know about of couple of mistakes I did-
Difference between Plus Config and X config of a quad-
Its a pretty basic thing, X config flies as X and + flies as plus.
Now to the PID implementation. What I thought was Plus and eX are one and the same but how you do things with the radio in your code is what makes it move in Plus or X.
Here’s a snip-
error holds Yaw Pitch and Roll error..Yaw Pitch and Roll are values from IMU and setpoint_X are setpoint values for Yaw Pitch and Roll from the RC.
and the above is for Plus configuration..
to fly it in X configuration changes I made were
which is utterly wrong, it’d fall off.
what I did above is give partial value of setpoint Pitch and Roll over Roll and Pitch axis..so If I just simply shifted the motion from Plus to eX.
and figured since Pitch and Roll are orthogonal and independently tuned, any error in between these axis will be distributed among these two, and system would stay balanced. what I did not thought was-
suppose if I tilt the quad by hand on the pitch axis by 30 degrees, so IMU pitch reading would be 30 degree and roll would be zero. If I shift the 30 degree tilt say 20 degree from pitch axis(it’d 70 degree from roll axis too), IMU pitch value wont read 30 degree it would read less than 30 degree and IMU roll wont read zero, its pretty obvious. so Quad won’t balance itself at that axis in between pitch and roll axis because isn’t actually getting the correct error reading for that axis. so to fly it in eX I don’t have to change that radio part, I have to get the Yaw Pitch Roll values for X configuration and change the PIDs, so as corrections are distributed to all four motors. In plus config Pitch Roll corrections are over two motor each on different axis..but in X pitch roll corrections are over all for motors.
Its a very foolish thing to do, but I did because it was intuitive.
and about Integral part of the PID controller..I knew Integral manages the steady state errors and what I observed recently is I also helps quad to maintain its current position..very minute error would cause quad to drift..if I is high enough to accumulate over short amount of time, it wouldn’t let it drift..because it will correct that small amount of error.
I’ve been working with ARM based STM32 for a while, and made a library for UART debug and I2C basics and example code with MPU6050.