Show Posts
Pages: [1] 2 3 ... 9
1  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: June 20, 2011, 10:28:15 am
hey Fabio!
sei fortissimo! smiley-grin grazie una cifra! smiley

thanks a lot for providing the freeIMU library and hardware for the community

I was about to send you an email asking the following 2 questions.
- do you sell the freeIMU boards as well? I know sparkfun has a similar board but I was wandering how much would it cost to buy it off of you directly

- do you think that the IMU can be done on the lower level version without magnetometers?? Solving the yaw missing piece somehow and the drifting problem? From your thesis it seems possible, but on the discussions we've been having on this forum post it seems as there are some drifting problems or some information (yaw) which cannot be obtained.

grazie ancora / thanks a lot
ciao
b.





2  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: June 17, 2011, 03:52:04 am
Yes he does sensor fusion with all 3 sensors using Sebastian Madgwick's algorithms

if you want to perform sensor fusion on just 2 sensors I've found this useful link smiley
http://mbed.org/cookbook/IMU

cheers
b.
3  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: June 16, 2011, 12:50:02 pm
Thank you Lauszus
I'll give it a try!

Although it uses one more sensor (the magnetometer) I found this guy's work pretty amazing - the FreeIMU (library and hardware)
an Arduino library for reading the 3 sensors (the accelerometer and gyroscopes are the same as yours)
and performs all the sensor fusion needed for a simple interface

http://www.varesano.net/projects/hardware/FreeIMU

inside the library you can actually see 3 separate libraries, one for each sensor
 
Now I'm just unsure if going with the 6DOF that you so well explained...or the 9DOF of Fabio Varesano smiley

thanks for all the help
cheers
b.




4  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: June 15, 2011, 01:20:24 pm
ok thanks for your reply
my fault I should have made it clearer: when I asked if it could be measured, I meant the ANGLE...not the acceleration

It's clear (sort of smiley ): you can't measure yaw with the accelerometer...but I was thinking with the gyro...and as you said you can.
in Fact at the end of your code you are only calculating x and y angles and not Z angle...is there are reason why?

Code:
compAngleX = (0.98*(compAngleX+(gyroXrate*dtime/1000)))+(0.02*(accXangle));
  compAngleY = (0.98*(compAngleY+(gyroYrate*dtime/1000)))+(0.02*(accYangle));
  xAngle = kalmanCalculateX(accXangle, gyroXrate, dtime);
  yAngle = kalmanCalculateY(accYangle, gyroYrate, dtime);

Can the same concept be extended to the Z angle?
Code:
compAngleZ = (0.98*(compAngleZ+(gyroZrate*dtime/1000)))+(0.02*(accZangle));
zAngle = kalmanCalculateZ(accZangle, gyroZrate, dtime);


Moreover...when you say "keep calibrating the zeroValue"
you mean that after the previous calculation I set the
gyroZeroZ = zAngle? so I keep calculating incremental angle variation?รน
or do you mean to take out the comments to the line

gyroZangle=gyroZangle+gyroZrate*dtime/1000;//Without any filter

why did you leave that commented? it wasn't working?

Anyhow, thanks a lot for the help smiley
if you ever need a quick hand drawn sketch (dirty and quick) just ask smiley-wink

cheers
b.
5  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: June 14, 2011, 10:48:50 am
ok let's check with an image
I really don't understand why one parameter can't be measured if it's said to be a 6DOF and not a 5DOF!?!?!
moreover gyroscopes measure angular velocity around themselves...not influenced by the force of gravity   smiley-confuse

So here goes the image


I made it very simple smiley
can you please answer the questions at the bottom simply with a Y or N?
in your setup (I'm deducing) can the following be measured???
1.1 Yaw = N?!?! right?
1.2 Roll = Y
1.3 Pitch = Y
1.4 - 1.5 - 1.6 = x y z = Y Y Y

In my setup - can the following being measured??
2.1 - old Yaw - new Pitch = Y? N?
2.2 - Roll = Y
2.3 - old Pitch - new Yaw = Y? N?
2.4 - 2.5 - 2.6 - x y z = Y Y Y

What I really need for my project is (considering the my sensor positioning pictured right)
to be able to measure
x, y, z, ROLL, and PITCH (old yaw, blue line)

Will it work with Sparkfun's 6DOF Ultra-Thin IMU
or will I need one of the 9DOF? ( http://www.sparkfun.com/products/10321 & http://www.sparkfun.com/products/10125)

thanks for the patience smiley





6  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: June 13, 2011, 08:57:01 am
Ok thanks for the clarification...
one last thing: in my project there is actually one movement which I won't need to do: which is the "pitch" on the image I've posted earlier.

I'm guessing that all I need to do is position the sensor perpendicular to ground
hence transforming the yaw (which I wouldn't need) into the pitch
and your code would still work...is that right?
would it work if I shift the frame of reference in such a way or the code measures pitch and roll in reference to the force of gravity?

thanks
b.
7  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: June 12, 2011, 12:10:34 pm
Hey Lauszus
thanks for providing this great guide!!

I've read your comments to onidaito and I'm not exactly sure of what you mean when you are saying that
Quote
the accelerometer can not measure the yaw

I'm trying to understand if for my project I need 6 or 9 degrees of freedom
So let's be straight and have a visual example:



can the sensor you are using (and the code) measure all these 6 variables?
thanks in advance
b.
8  Forum 2005-2010 (read only) / Troubleshooting / Re: Export button resets PC on: December 11, 2005, 04:17:11 pm
hey david,

to answer to your questions:
- stdout.txt is empty

Quote
Are you running any other programs that use the serial ports?

I'm not sure but I don't thinks so, because the problem started appearing after a while: I had safely exported a few times before the problem happened. at the beginning I thought the problem was in the code I was uploading into arduino, I thought I found some sort of fork bomb that crashed my computer. But then I tryed to do a simple hello world or led blinking and it crashed as well.

I tryed to reinstall the arduino-00002 folder from scratch but that didn't work either, the pc keeps rebooting. It seems as it set some nasty global variable or somenthing else that tells it to reboot  ??? ???

Quote
Have you installed cygwin on your machine?

cygwin1.dll is inside the arduino program folder arduino-00002... I haven't done anything else with it.
searching on my pc there are other cygwin1.dll under several versions of the old ide and wiring folder as well...
there is only another one cygwincompiler.py (python) under open office but I don't think It has anything to do with it smiley

any other idea?
what is cygwin all about it?

Quote
 The export button simply recompiles your code and runs uisp

does this means that we can avoid clicking on the compile button? that the export button does it automatically?

thanks for the help
b.
9  Forum 2005-2010 (read only) / Troubleshooting / Export button resets PC on: December 10, 2005, 09:54:39 pm
Hello,
did anyone have this problem before?

My Arduino 2.0 usb was working great and now
by simply clicking the export button it RESTARTS my pc.

any simple program just reebots the pc
(after having compiled beautifully).

I've done all I could think of, even delete and recreate the arduino-0002 folder.

UPDATE:
I've tested the board with another pc and it works great.
Can somebody tell me what's going on under the hood when you press the "export button"?
the pc reboots at the first click of the button! It might be conflicting with somenthing that I don't know?


any ideas?
thanks in advance
beltran
10  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial speed and syncronization problem on: January 09, 2007, 10:42:20 am
I made some minor advancements but still can't solve the problem.

- changed the serialavailable function as noted by CosineKitty
- if I leave all default connection settings I get syncing problems...however if on the terminal I change to
stop bits=2  (instead of 1 as default and as specified in the arduino preferences)
I get it almost right...
90% of the time it gets the right data.

can it be an issue that maybe it is compiling with settings that aren't really specified in the preferencese txt?

11  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial speed and syncronization problem on: January 08, 2007, 09:31:13 am
here it goes
you have to quickly send a string like
M55555555555555555555555555555555555
or similar length

at 38400 works perfectly
if I try at 115200 I get errors


Code:
int totCols = 5;
int totRows = 7;
//set the string that will be received throughSerial
/*the string should start with an 'M' so that the code knows when it is starting
rows and columns notation
M      1000000
      0100000
      0010000
      0001000
      0000100      
continous string notation:  M10000000100000001000000010000000100
*/
char Matrix_string [5][7]; //putting [totCols][totRows] yelds a compiler error

//use this routine to prevent the fact that Serial.read() doesn't wait for a byte in the buffer
char Serial_getSecureByte() {
    while (Serial.available() == 0) {
      // do nothing
    }
    return Serial.read();
}

void Matrix_serialRead () {
    for (int c=0; c < totCols; c++) {
        for (int r=0; r < totRows; r++) {
                 //read a char from Serial - use function to be sure that the byte is there
              //char serIn = Serial_getSecureByte();
                 //convert it to an int since serIn will be 49(ASCII value of num 1)
                 //method 2 would be subtracting 48 - TODO test the fastest
              //int b = atoi(&serIn);
                 //store it in the appropriate slot in the string
              Matrix_string[c][r] = Serial_getSecureByte();//b;
                 //print feedback
              Serial.print(Matrix_string[c][r]);
                Serial.print(" ");
        }
    }
    Serial.println();
   //prepare the serial buffer for the next string
   Serial.flush();
}

//output the string
void Matrix_display() {
  //Serial.println("display: ");
   for (int c=0; c < totCols; c++) {
        for (int r=0; r < totRows; r++) {                
               Serial.print(Matrix_string[c][r]);
               Serial.print(" ");
        }
   }
   Serial.println();
}


void setup() {
  Serial.begin(115200); //can push it further up!!! why??
}

void loop () {
    //*check for serial data
    while (Serial.available()) {
        byte s = Serial.read();
        if(s == 'M'){;
          //start of the protocol Matrix
          Matrix_serialRead ();
        }
    }
    //continously display it all
    //Matrix_display();    
}

thanks in advance smiley
12  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial speed and syncronization problem on: January 08, 2007, 04:54:30 am
arduino 0007,

and these are the preferences set by the IDE in the Application Data folder

serial.stopbits=1
serial.databits=8
serial.download_rate=19200
serial.parity=N
serial.port=COM9
serial.debug_rate=38400
serial.burn_rate=115200

any idea?
I've got unzipped also other arduinos builds...can that be an issue?


now that I actually wait for a true byte to be available in the serial buffer
I can manage to push it to 115200 without getting bogus chars...
however I've still got syncing problems:

if I pass a long string of 555555555555555555
I get this
0 0 0 5 5 0 0 0 5 0 0 0 0 5 0 0 0 5 5 0 0 0 5 0 0 0 0 5 0
as if the Serial line read or decided to put now and then some 0 in the middle...
it works at 38400 but doesn't work anymore right above it.
this means that the problem is not waiting for a true serial byte...the problem must be somewhere else...

i'll try out a few things...
any idea?
13  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial speed and syncronization problem on: January 07, 2007, 07:11:15 pm
hehe you tricky little kitty smiley-wink
you are right...
thanks for the code tip

I've called the function Serial_getSecureByte()

this doesn't solve my other problem though...I can't still push the Serial line above 38400 smiley-sad
14  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial speed and syncronization problem on: January 07, 2007, 05:51:24 pm
ok here it is...
a simplified version but that still has the error

you should check it with a terminal software and rapidly send strings like
M10000000100000001000000010000000100
or
M11111111111111111111111111111111111

I get sync problems, so that sometimes when I read out the recorded chars I get bogus chars or a clutter of different chars together.

Code:
int totCols = 5;
int totRows = 7;
//set the string that will be received throughSerial
/*the string should start with an 'M' so that the code knows when it is starting
rows and columns notation
M      1000000
      0100000
      0010000
      0001000
      0000100      
continous string notation:  M10000000100000001000000010000000100
*/
char Matrix_string [5][7]; //putting [totCols][totRows] yelds a compiler error


void Matrix_serialRead () {
    for (int c=0; c < totCols; c++) {
        for (int r=0; r < totRows; r++) {
             //store a char in the appropriate location
             Matrix_string[c][r] = Serial.read();
             //need a delay before next Serial.read(); - delay can be also a Serial routine
             delayMicroseconds(200);
            
             //WARNING - if you comment the following line it won't work
             //this way it syncs right all led but flicker because it has to output the result
             //Serial.print(Matrix_string[c][r]);
             //Serial.print(" ");
        }
    }
   Serial.println(" done SerialRead");
    //prepare the serial buffer for the next string
   Serial.flush();
}

//output the string
void Matrix_display() {
   for (int c=0; c < totCols; c++) {
        for (int r=0; r < totRows; r++) {
               Serial.print(Matrix_string[c][r]);
               Serial.print(" ")
        }
   }
   Serial.println();
}


void setup() {
  Serial.begin(38400); //can push it further up!!! why??
}

void loop () {
    //*check for serial data
    while (Serial.available()) {
        byte s = Serial.read();
        if(s == 'M') {

          //I needed a delay here too...I discovered it by commenting the following Serial
          //if you comment or even take out one or two chars out of the string
          //the whole program is more likely to fail the syncronization
          Serial.println("read: ");

          //start of the protocol Matrix
          Matrix_serialRead ();
        }
    }
    //continously display it all
    Matrix_display();    
}


is there some particular thing I need to configure in order to push it to 115200???
I'm using the default port settings
data bits: 8
parity: none
stop bits: 1

I don't have an Arduino NG, I've got one of the first USBs with the Atmega8 and a 16Khz clock crystal

thanks for the help

15  Forum 2005-2010 (read only) / Troubleshooting / Serial speed and syncronization problem on: January 07, 2007, 03:35:19 pm
Hi again.
I've got a very weird sync problem right now.

first I couldn't push the Serial.begin() above 38400 bauds (currently working limit)
I got all sorts of bogus chars from all the terminals I used if I try to push it further.
- is that possible? I thought the upper limit was 115200...
- has anyone pushed it so high?
- is there something I should know/do in order to push it higher ?

second I've got some very weird behaviour with the serial sync:
When I do Serial.read()
I need to do a delay after it before performing another Serial.read()
or else I will record something weird, expecially if I'm repeatedely trasmitting long strings to Arduino and at a high pace.
The delay is performed either by a delayMicroseconds(200)
and/or by printing out Serial.print("some strings"); (which I imagine is just simply chewing off routine cycles to the cpu)

I have to say that this all happens because I'm performing a Serial.read() inside a double for loop, and storing the values coming from the serial buffer in a multidimensional array.

- is this whole delay thing possibly right or am I guessing wrong?
- is there a way to exactly compute the necessary delay between two Serial.read()?  (I went trial and error, but if I change the data in the serial buffer or the serial speed I have to go through the hand process again);

thanks in advance
b.
Pages: [1] 2 3 ... 9