Hello, I'm creating my app.
I obtain with your api from the sensortag some value +/- 2.5, but I need to convert these value to degree. I want to check the tilt angle...
Any idea?
Convert raw data to tilt angle value
Re: Convert raw data to tilt angle value
the tilt raw value should be between -1.0 and +1.0
you would need to understand what the raw data values actually mean; there is a good discussion of this on another forum:
http://www.i2cdevlib.com/forums/topic/4 ... gyrometer/
you will need to figure out if the relationship between 0 and +1 and -1 and 0 are linear in nature and map them to an angle between 0 and 90. maybe you can start a logging of raw values.. with different degree increments.. either find a pattern; or use a lookup table to convert the raw data into angles. there was a similar discussion on stack overflow which may shed some better light into how to map between raw and angles.
http://stackoverflow.com/questions/2371 ... elerometer
you need to make sure the raw values are between -1.0 and +1.0 - if you are receiving other values you'll need to map them to this range.
you would need to understand what the raw data values actually mean; there is a good discussion of this on another forum:
http://www.i2cdevlib.com/forums/topic/4 ... gyrometer/
you will need to figure out if the relationship between 0 and +1 and -1 and 0 are linear in nature and map them to an angle between 0 and 90. maybe you can start a logging of raw values.. with different degree increments.. either find a pattern; or use a lookup table to convert the raw data into angles. there was a similar discussion on stack overflow which may shed some better light into how to map between raw and angles.
http://stackoverflow.com/questions/2371 ... elerometer
Code: Select all
float calcInclinationAngle(int iDataPos)
{
float xVal = fAccel[0][iDataPos];
float yVal = fAccel[1][iDataPos];
float zVal = fAccel[2][iDataPos];
float pitch = 0;
//Pitch in radians
pitch = atan2(xVal, sqrt(pow(yVal,2)+pow(zVal,2)));
//Pitch in degrees
pitch = pitch * 180/PI;
return pitch;
}
you need to make sure the raw values are between -1.0 and +1.0 - if you are receiving other values you'll need to map them to this range.
Who is online
Users browsing this forum: No registered users and 6 guests