How to determine position of GY521 in cartesian cordinates .

Hi everyone,
i have a problem about MPU6050
I can determine the pitch and roll of MPU and i want to simulate the motion of the mpu6050 from a point A to a point B.
How to determine position of GY521 in cartesian cordinates base on PITCH & ROLL.
Thanks!

It is VERY hard to get an accurate position from only an accelerometer and gyroscope. To determine position you have to take the acceleration and integrate over time to get velocity and integrate that over time to get position. The hard part is subtracting the gravity vector. To do that you need to know which way is DOWN. To do that you can try and use the rate gyroscope integrated over time to determine orientation. Unfortunately all those integrations will accumulate error. If your values are off your position will drift quite a bit. Adding a magnetometer (3-axis compass) can help but is subject to magnetic interference.

Similar question, similar answer here

johnwasser:
It is VERY hard to get an accurate position from only an accelerometer and gyroscope. To determine position you have to take the acceleration and integrate over time to get velocity and integrate that over time to get position. The hard part is subtracting the gravity vector. To do that you need to know which way is DOWN. To do that you can try and use the rate gyroscope integrated over time to determine orientation. Unfortunately all those integrations will accumulate error. If your values are off your position will drift quite a bit. Adding a magnetometer (3-axis compass) can help but is subject to magnetic interference.

thank for comment but if i want to simulate in 2D , whether or not to do it?

AWOL:
Similar question, similar answer here

thank for your reply!
but after reading, i still don't understand all comments.So, i haven't determined where is my solve?
Could you tell me about it?
Many thanks!

CHRobotics has the clearest explanation of the problem I've yet to find, and includes some very useful practical estimates of the accuracy of obtaining position data from hobby-grade acce/gyro sensors. http://www.chrobotics.com/library/accel-position-velocity

The overview has a nice summary of sensors and coordinate systems, too: http://www.chrobotics.com/library

FOr plotting data in 2D or even 3D I personally like the freeIMU a lot, though the guy who made is now dead(RIP) but still its supported and in the past a lot of people have used it to develop really creative stuff, check it out yourself, it may get your job done with less hassle.

jremington:
CHRobotics has the clearest explanation of the problem I've yet to find, and includes some very useful practical estimates of the accuracy of obtaining position data from hobby-grade acce/gyro sensors. http://www.chrobotics.com/library/accel-position-velocity

The overview has a nice summary of sensors and coordinate systems, too: http://www.chrobotics.com/library

thank for your help.
i want to ask you more clearly:
a(B) is the actual body-frame acceleration: is that the output raw Ax,Ay,Az?
and :the formula??? the rotation matrix from the inertial frame to the body frame of the sensor?
Many thanks!

I don't completely understand your question, but I also don't think it is easy to improve on the clarity of the material in these two pages:
http://www.chrobotics.com/library/sensors-for-estimation
http://www.chrobotics.com/library/accel-position-velocity
This is not simple mathematics, although it is straightforward. You will need to work through everything yourself, with pencil and paper, in order to familiarize yourself with the notation and to understand the material completely.

jremington:
I don't completely understand your question, but I also don't think it is easy to improve on the clarity of the material in these two pages:
http://www.chrobotics.com/library/sensors-for-estimation
http://www.chrobotics.com/library/accel-position-velocity
This is not simple mathematics, although it is straightforward. You will need to work through everything yourself, with pencil and paper, in order to familiarize yourself with the notation and to understand the material completely.

i see that they use both acc (roll & pitch) and magnetometer(yaw) to estimate position and velocity.
But i want to ask:
can i do it only base on pith and roll? maybe it is more simple.
thanks!

kate213:
Can I do it only based on pitch and roll?

No, you can't.

johnwasser:

kate213:
Can I do it only based on pitch and roll?

No, you can't.

that mean i must add a magnetometer.
But:
because MPU and Magnetomter are 2 different sensors, so they can't be at the same position.
will the result be wrong?
Thanks!

The magnetometer doesn't care whether it translates as well as rotates - it only gives you orientation.

Thank all,
U can see in this link: Real-time Joint Angle Measurement - YouTube
they simulate the motion of sensor simply.
could you tell me:What they have done to simulate?
Many thanks!

kate213:
Thank all,
U can see in this link: Real-time Joint Angle Measurement - YouTube
they simulate the motion of sensor simply.
could you tell me:What they have done to simulate?
Many thanks!

They say exactly what they are using. Each part of the leg has an accelerometer, gyroscope, and magnetometer:

This demonstration focus on lower leg joint angle, and uses a single Shimmer 9DOF unit placed on each body segment of interest. For the assessment of a single joint, two Shimmers are required. Each Shimmer 9DOF unit contains a tri-axial accelerometer, a tri-axial gyroscope and a tri-axial magnetometer. The Shimmer unit transmits the data from each sensor axes in real-time to a host PC. A Kalman filter based algorithm derives the three dimensional orientation of the body segment from the streamed data to the point where a physician can see the data on the 'Real-time Joint Angle Measurement' Application.

i know they use accelerometer, gyroscope, and magnetometer but i want to know: how many steps to do as their? what is that?
if you know it, please tell me about it.

kate213:
i know they use accelerometer, gyroscope, and magnetometer but i want to know: how many steps to do as their? what is that?
if you know it, please tell me about it.

I'm sorry. I do not know what you mean by "how many step".

If you want to know which way each part of a leg is pointing you will need at least a three-axis accelerometer for pitch and roll and a three-axis magnetometer for yaw for each part of the leg. To draw the leg, start with a fixed point (either the hip or the toe) and draw segments the length of each foot part in the orientation you calculate from the sensors.

[/quote]

I'm sorry. I do not know what you mean by "how many step".

If you want to know which way each part of a leg is pointing you will need at least a three-axis accelerometer for pitch and roll and a three-axis magnetometer for yaw for each part of the leg. To draw the leg, start with a fixed point (either the hip or the toe) and draw segments the length of each foot part in the orientation you calculate from the sensors.
[/quote]
thank guy,
That mean: after i have pitch,roll from accelerometer, i need a magnetometer to measure yaw.
but i don't know: how to connect a MPU6050 ,a magnetometer with arduino uno ?
and what is the formula to calculate yaw when i have mx,my,mz from magnetometer?
Many thanks!

how to connect a MPU6050, a magnetometer with arduino uno ?
LMGTFY - Let Me Google That For You

what is the formula to calculate yaw when i have mx,my,mz from magnetometer?
LMGTFY - Let Me Google That For You

Why don't you and kate213 get together?
You've got the same IP address.