Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: Quadrotor project on: September 15, 2013, 03:24:03 pm
Hi again ,
i was tweaking the pid again i have a little improvement, but the interesting part is that sometimes with the exact same parameters  the quad acts different .I mean  that sometimes is almost stable ,and sometimes it shakes and swings .I am wondering is this because of the  ballance of the frame.Or just sometimes the sensors are more noisy then other times.
I am wondering would the change of the sensor board with a less noisy one would solve the problem(if there are less noisy boards)? I even have a board in mind   it has not only 3 axis gyro,accel and magnetometer ,but also a barometer.Does somebody has an opinion for this board.
  

Your readings don't look very noisy to me, however the noise may be a problem if the D term is too high. Try setting the D term to zero and see how stable you can get it using just P and I terms. When you have optimised P and I, you can try adding a bit of D.
if you are talking about this readings
Code:
 
             !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
They are taken when the quadrotor is not moving at all .I mean the motors are not rotating and the quad is on the ground.
And by the way this is noting i caught a 1+ degree  error once with motors off and quadrotor on ground.It was someting like:
!ANG:Roll: -0.35,Pitch....
!ANG:Roll: -1.47,Pitch....
2  Using Arduino / Sensors / Re: Quadrotor project on: September 12, 2013, 06:13:06 am
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). smiley-mad
3  Using Arduino / Sensors / Re: Quadrotor project on: September 11, 2013, 07:13:14 pm
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.
4  Using Arduino / Sensors / Re: Quadrotor project on: September 11, 2013, 06:40:43 pm
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
5  Using Arduino / Sensors / Re: Quadrotor project on: September 11, 2013, 02:46:06 pm
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?
6  Using Arduino / Sensors / Re: Quadrotor project on: September 08, 2013, 10:10:36 am
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.
7  Using Arduino / Programming Questions / Re: Sending numbers to arduino on: September 07, 2013, 03:14:40 pm
Oops sorry its working with the atol too i just forgot that the max value is 4,294,967,295 and i am writing 9,999,999,999.
For others reading this topic:
here is the code with the atol function:
Code:
unsigned long data = atol(buffer);
and here is the code with the strtoul function:
Code:
unsigned long data = strtoul(buffer, NULL, 0);
8  Using Arduino / Programming Questions / Re: Sending numbers to arduino on: September 07, 2013, 02:03:01 pm
Quote
error message says "at this point in file"

No, it doesn't. It says:
Quote
c:/users/pjs9486/documents/arduino-1.0.5/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:242: error: too few arguments to function 'long unsigned int strtoul(const char*, char**, int)'
sketch_sep07a:17: error: at this point in file

No one said that strtol() or strtoul() was called in exactly the same way as atoi().
Ok how it is called then?
Thanks
9  Using Arduino / Programming Questions / Re: Sending numbers to arduino on: September 07, 2013, 01:46:07 pm
Quote
P.S  strtol() or strtoul() doesn't work
Then, you are doing something wrong. Where is the code that doesn't work, and the proof?

strtoul -->
Code:
const char STOP_BYTE = '\n'; // In the serial monitor, you will need to select the appropriate drop down to append the newline char
char buffer[20]; // stores the characters to be converted to an int

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  static byte i=0;
  if (Serial.available() > 0)
  {
    char inByte = Serial.read();  
    if (inByte=='\n') // We've received the end of our input
    {
      buffer[i] = '\0'; // null terminate the string
     unsigned long data = strtoul(buffer);
      // Do something with the data
      i=0; // reset the index
        Serial.print("I received: ");
                Serial.println(data, DEC);
            }
    
        else
    {
      buffer[i++] = inByte; // add character to buffer and increment index
    }
  }
}
error message says "at this point in file"
and marks  "unsigned long data = strtoul(buffer); " line
The strtol function gives the same error
10  Using Arduino / Programming Questions / Re: Sending numbers to arduino on: September 07, 2013, 01:21:05 pm
Unsigned long doesn't hold negative numbers.
atoi returns integers

Try atol or atoll

Thanks now its up to 999,999,999 with the atol function .Is there an "atoul" or something(i guess atol is from  long).
P.S  strtol() or strtoul() doesn't work
11  Using Arduino / Programming Questions / Sending numbers to arduino on: September 07, 2013, 12:04:02 pm
Hi again guys,
can someone please tell me why this program don't want to receive from serial numbers bigger than 32767(int limit)  and smaller than 0?

Code:
const char STOP_BYTE = '\n'; // In the serial monitor, you will need to select the appropriate drop down to append the newline char
char buffer[20]; // stores the characters to be converted to an int

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  static byte i=0;
  if (Serial.available() > 0)
  {
    char inByte = Serial.read(); 
    if (inByte=='\n') // We've received the end of our input
    {
      buffer[i] = '\0'; // null terminate the string
     unsigned long data = atoi(buffer);
      // Do something with the data
      i=0; // reset the index
        Serial.print("I received: ");
                Serial.println(data, DEC);
            }
   
        else
    {
      buffer[i++] = inByte; // add character to buffer and increment index
    }
  }
}
 
I need the program to be able to receive nubers to the unsigned long limit.
Thanks in advance!
12  Using Arduino / Sensors / Re: Quadrotor project on: September 03, 2013, 06:42:44 pm
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. smiley
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
13  Using Arduino / Sensors / Re: Quadrotor project on: September 03, 2013, 05:16:32 pm
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.
14  Using Arduino / Sensors / Re: Quadrotor project on: September 03, 2013, 09:30:19 am
What do the values you printed out represent?

(I mean are they deflection, speed, acceleration, something else?)
Degrees in x ,y ,z axes.
15  Using Arduino / Sensors / Quadrotor project on: September 03, 2013, 05:34:22 am
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:
 
             !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.
Pages: [1] 2 3 4