Go Down

Topic: Quadrotor project (Read 1 time) previous topic - next topic

Sep 03, 2013, 12:34 pm Last Edit: Sep 03, 2013, 12:58 pm by stunito0o0 Reason: 1
Hey guys,
I am building my first quadrotor project.I am using Arduino mega ADK for controller and Pololu MinIMU-9  for sensor board.
I am using Arduino AHRS software  and Arduino PID library for the hover controll of the robot.
The problem is that i can't tune the PID parameters because the sensor output is too noisy.Here is a sample sensor output when the sensor board is not moved at all.
Code: [Select]
 
            !ANG:Roll: 0.01,Pitch: 0.00,Yaw:-21.98
    !ANG:Roll: 0.28,Pitch: -0.05,Yaw:-21.98
    !ANG:Roll: 0.19,Pitch: -0.15,Yaw:-21.99
    !ANG:Roll: 0.09,Pitch: -0.07,Yaw:-22.00
    !ANG:Roll: 0.15,Pitch: -0.03,Yaw:-21.97
    !ANG:Roll: 0.07,Pitch: 0.03,Yaw:-21.95
    !ANG:Roll: -0.12,Pitch: 0.13,Yaw:-21.93
    !ANG:Roll: -0.15,Pitch: 0.02,Yaw:-21.90
    !ANG:Roll: -0.25,Pitch: 0.15,Yaw:-21.87
    !ANG:Roll: -0.25,Pitch: 0.14,Yaw:-21.85
    !ANG:Roll: -0.18,Pitch: 0.04,Yaw:-21.83
    !ANG:Roll: -0.18,Pitch: 0.06,Yaw:-21.80
    !ANG:Roll: -0.25,Pitch: 0.07,Yaw:-21.77
    !ANG:Roll: -0.38,Pitch: 0.08,Yaw:-21.75
    !ANG:Roll: -0.34,Pitch: 0.06,Yaw:-21.73
    !ANG:Roll: -0.21,Pitch: -0.06,Yaw:-21.70
    !ANG:Roll: -0.28,Pitch: -0.17,Yaw:-21.71
    !ANG:Roll: -0.32,Pitch: -0.02,Yaw:-21.72
    !ANG:Roll: -0.24,Pitch: 0.20,Yaw:-21.73
    !ANG:Roll: -0.31,Pitch: 0.22,Yaw:-21.74
    !ANG:Roll: -0.48,Pitch: 0.18,Yaw:-21.75
    !ANG:Roll: -0.56,Pitch: 0.16,Yaw:-21.76
    !ANG:Roll: -0.60,Pitch: 0.19,Yaw:-21.77
    !ANG:Roll: -0.68,Pitch: 0.13,Yaw:-21.79
    !ANG:Roll: -0.66,Pitch: 0.14,Yaw:-21.80
    !ANG:Roll: -0.54,Pitch: -0.03,Yaw:-21.81
    !ANG:Roll: -0.51,Pitch: -0.09,Yaw:-21.83
    !ANG:Roll: -0.55,Pitch: -0.27,Yaw:-21.84
    !ANG:Roll: -0.54,Pitch: -0.29,Yaw:-21.82
    !ANG:Roll: -0.67,Pitch: -0.30,Yaw:-21.81
    !ANG:Roll: -0.52,Pitch: -0.34,Yaw:-21.81
    !ANG:Roll: -0.47,Pitch: -0.22,Yaw:-21.80
    !ANG:Roll: -0.33,Pitch: -0.29,Yaw:-21.79
    !ANG:Roll: -0.25,Pitch: -0.27,Yaw:-21.79
    !ANG:Roll: -0.38,Pitch: -0.22,Yaw:-21.81
    !ANG:Roll: -0.36,Pitch: -0.16,Yaw:-21.82
    !ANG:Roll: -0.26,Pitch: -0.19,Yaw:-21.84
    !ANG:Roll: -0.35,Pitch: -0.28,Yaw:-21.85
    !ANG:Roll: -0.43,Pitch: -0.36,Yaw:-21.86
    !ANG:Roll: -0.51,Pitch: -0.41,Yaw:-21.87
    !ANG:Roll: -0.57,Pitch: -0.37,Yaw:-21.89
    !ANG:Roll: -0.40,Pitch: -0.22,Yaw:-21.90

Is there a way to reduse the noise from the sensors ,or tell the PID library to ignore it?
P.S. I can show source code if needed
Thanks.

PeterH

What do the values you printed out represent?

(I mean are they deflection, speed, acceleration, something else?)
I only provide help via the forum - please do not contact me for private consultancy.


What do the values you printed out represent?

(I mean are they deflection, speed, acceleration, something else?)

Degrees in x ,y ,z axes.

Nick Gammon

Can you average it? Would that help?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

I can try but i don't think that this would help because the readings will get slower. I mean if  i get 1 reading every 20 milliseconds that's 50hz right? But if i average 5 readings to get them smoother i will receive a reading every 100 milliseconds and that is 10hz.

Nick Gammon

Well, how often do you actually get the readings?

In any case by tweaking the PID parameters you can make it react slowly to value changes, which would effectively average them.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

#6
Sep 04, 2013, 01:42 am Last Edit: Sep 04, 2013, 01:49 am by stunito0o0 Reason: 1

Well, how often do you actually get the readings?

In any case by tweaking the PID parameters you can make it react slowly to value changes, which would effectively average them.

Ok first sorry for my bad english.
I already posted that i am looking for a way to reduse the noise of the output,and if there isn't one i am looking for a way to tell the PID library to ignore the noise.Arduino autotune library has a function called "Set NoiseBand()" and it is for setting noise value that would be ignored.But i don't see that kind of function in the original Arduino PID library.
P.S.Thank you for your answer i will try to tune the pid without noise reduction or noise ignorance,but in the meantime i take advices. :)
P.S.2 I think the readings are at 50hz.But i am not sure.I am using the original Arduino AHRS code for the sensors

#7
Sep 08, 2013, 05:10 pm Last Edit: Sep 08, 2013, 05:19 pm by stunito0o0 Reason: 1
Hey again today i tried to tune the roll kp ,but i am little confused .I was watching this video as a tutorial .But my quadrotor doesn't act like the one in the video .I do not have  immediate bounsing(instead when its stable and i run the program it starts slowly to swing and  the more it swings  the faster it gets.) no matter how  high is my kp.
So my question is what am i doing wrong?
In the PID  input i am putting the sensor roll value in degrees.I gave min value of the output to be -25 degrees and max value to be 25 degrees.And i tested with what differens between the motors i have 1 degree differens in the roll axes and it was 4 microseconds for 1 degree.So when the output comes in degrees i multiply it by 4 to make it in PWM value.Is all this correct?I accept any advices.
Thanks.

#8
Sep 11, 2013, 09:46 pm Last Edit: Sep 11, 2013, 09:51 pm by stunito0o0 Reason: 1
Up.. With some days playing with the pid i managed to make it go to the setpoint angle but it still swings a little.. Advices?

Nick Gammon

I don't know, personally.

I have played with a PID before and it can take a lot of time tweaking it to get things right. It's just guesswork without the hardware in front of me.

Did you try the idea of averaging the readings?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics


I don't know, personally.

I have played with a PID before and it can take a lot of time tweaking it to get things right. It's just guesswork without the hardware in front of me.

Did you try the idea of averaging the readings?

No but i made something like a noise filter .I mean i made an if statement that doesn't compute the pid unless the differens between to consecutive readings is more than 1 degree

Nick Gammon

Quote

Can you average it? Would that help?


...

Quote

I can try  ...


But you didn't try.

I don't know about the other forum members here, but when I suggest something, and it is ignored, I lose a little interest in the thread.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics


Quote

Can you average it? Would that help?


...

Quote

I can try  ...


But you didn't try.

I don't know about the other forum members here, but when I suggest something, and it is ignored, I lose a little interest in the thread.

No sorry i didn't mean to ignore it .To tell the truth i forgot.But i promise i will try it tomorrow.

Ok i tried the averaging (i add 4 reading in to one and then divide by 4) and the result is still the same(it goes eventually to the setpoint ,but too slow and when it reaches the setpoint starts to  swing slowly). :0

Nick Gammon

I was working on something a little similar (a sensor controlled a motor) and the PID parameters made a huge difference to performance. I can't tell you which ones will fix it, but I suspect tweaking them will.

http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up