I need to track position and orientation of a gun in 3d space. I purchased a 10-dof IMU sensor (GY-87) to learn properly how to implement the solution of my problem. I am unable to find proper guidance due to lack of my knowledge in the field of electronics and Sensors. I found some good examples, but unable to implement it in arduino.
I am currently able to detect Yaw, Pitch and Roll from the Sensor, from which i can detect the proper orientation of my gun. But I cant find a way to calculate position(x,y,z).
I would be grateful to you if someonce can help me in this regards.
Thank you
P.S: I cant find much resources for GY-87, may be it is deprecated. But due to unavailability of resources in my country, I had to use this sensor. I am a computer science student and new towards electronics, so please correct me if I am not using any proper term.
An accelerometer will never give you a position, it will give you… acceleration.
But acceleration is related to speed which is related to position.
If you look at the units, you see that relation. Acceleration is expressed in meter per second squared (m/s²) while speed is in meter per second (m/s) and position in meter (m).
So if
t is the time elapsed since you last calculated the position (in a loop for instance),
a the acceleration you read from the sensor,
s the old speed, s’ the new speed,
p the old position and p’ the new position,
s’ = s + a * t
p’ = p + s’ * t
You need to do the same calculation in the 3 axes (x, y, z). Assuming you know the starting position and the starting speed is zero, you can track your object in real-time.