Thanks for the replay, but accelerometers and gyros (sometimes in combination with magnetometers) are used all the time to measure position.
No, MEMS accelerometers and rate-gyros are used all the time to determine orientation, and usually need drift correction to do so if accurate yaw is needed.
Often compensatory or Kalman filtes are used to get more accurate results.
But now I am concerned.
Plus an optical sensor cannot be inside a casing… or can it?
Measuring position on a timescale of a few seconds or less, yes you can use MEMS accelerometers to measure position (not highly accurately), but long term drift means you cannot measure position on long timescales without correcting for drift using GPS/barometer or some such.
One application I’ve seen using accelerometer is a pedometer. The drift is corrected during the period the foot is planted on the ground, allowing the size of each step to be measured with reasonable accuracy.
Decently engineered precision accelerometers (not MEMS ones) can fare much much better, as they can be highly accurate by comparison, increasing the drift time scales significantly. This is how real inertial guidance systems work - and laser gyroscopes are used.
What are you actually trying to do?