What kind of sensor should I use to measure acceleration or velocity of object? - virtual-reality

I'm trying to make simple VR HMD that can track user's head movement in 6 DoF(Forward and Backward, Left and Right, Up and Down, Pitch, Yaw, Roll). Applying 6 DoF Accelerometer and Gyroscope(GY-521, MPU-6050) made me can track user's rotation, but I still can not track positional differences.
I have googled if there is a way to calculate its spatial velocity or acceleration with accelerometer, but there weren't. Because output values of accelerometer mean not linear acceleration, but angular acceleration.
I wonder what kind of sensor or model can measure rotation and linear motion at the same time. Also, How standalone HMD can measure user's motion with its IMU?

Related

IMU fall detection

I am trying to detect a free fall scenario. I have accelerometer and gyroscope.
A simple fall I can detect by inspecting a total acceleration of 0g
However, my problem is when the IMU falls and rotates at the same time (centrifugal force). Any idea how to distinguish this scenario?
I don't have the solution, but let me state 2 points:
if the IMU is near the center of mass of your hardware, the centrifugal acceleration should be negligible
If you have a constant rotation you should read a constant rate on the gyroscope, and a constant acceleration too ( if the IMU is not in the center of mass). Morover, the constant rotation should be on an axis perpendicular to that of the constant rotation

Getting a trajectory from accelerometer and gyroscope (IMU)

I am well aware of the existence of this question but mine will differ. I also know that there could be significant errors with this approach but I want to understand the configuration also theoretically.
I have some basic questions which I find hard to answer for myself clearly. There is a lot of information about accelerometers and gyroscopes but I still haven't found an explanation "from first principles" of some basic properties.
So I have a plate sensor that contains an accelerometer and gyroscope. There is also a magnetometer which I skip for now.
The accelerometer gives information in each time t about the temporary acceleration vector a = (ax, ay, az) in m/s^2 according to the fixed coordinate system to the sensor.
The gyroscope gives a 3D vector in deg/s which says the temporary speed of rotation of the three axes (Ox, Oy and Oz). From this information, one can get a rotation matrix that corresponds to an infinitesimal rotation of the coordinate system (according to the previous moment). Here is some explanation how to obtain a quaternion, that represents R.
So we know that the infinitesimal movement can be calculated considering that the acceleration is the second derivative of the position.
Imagine that your sensor is attached to your hand or leg. In the first moment we can consider its point in 3D space as (0,0,0) and the initial coordinate system also attached in this physical point. So for the very first time step we will have
r(1) = 0.5a(0)dt^2
where r is the infinitesimal movement vector, a(0) is the acceleration vector.
In each of the following steps we will use the calculations
r(t+1) = 0.5a(t)dt^2 + v(t)dt + r(t)
where v(t) is the speed vector which will be estimated in some way, for example as (r(t)-r(t-1)) / dt.
Also, after each infinitesimal movement we will have to take into account the data from the gyroscope. We will use the rotation matrix to rotate the vector r(t+1).
In this way, probably with tremendous error I will get some trajectory according to the initial coordinate system.
My queries are:
Am I principally correct with this algorithm? If not, where am I wrong?
I would very much appreciate some resources with a working example where the first principles are not skipped.
How should I proceed with using the Kalman's filter to obtain a better trajectory? In what way exactly do I pass all the IMU data (accelerometer, gyroscope and magnetometer) to the Kalman filter?
Your conceptual framework is correct, but the equations need some work. The acceleration is measured in the platform frame, which can rotate very quickly, so it is not advisable to integrate acceleration in the platform frame and rotate the position change. Rather, the accelerations are transformed into a relatively slowly rotating frame and the integration to velocity change and position change is done there. Typically a locally-level frame (e.g. North-East-Down or Wander Aziumuth) or an Earth-centered frame (ECEF or ECI). Gravity and Coriolis force must be included in the acceleration.
Derivations from first principles can be found in many references, one of my favorites is Strapdown Inertial Navigation Technology by Titterton and Weston. Derivations of the inertial navigation equations in locally-level and Earth-fixed frames are given in Chapter 3.
As you've recognized in your question - the initial velocity is an unknown constant of integration. Without some estimate of initial velocity the trajectory resulting from integrating the inertial data can be wildly wrong.

How do I calculate acceleration/deceleration in the direction of travel from X,Y,Z accelerometer readings from iphone

I am writing an iPhone/iPad app. I need to compute the acceleration and deceleration in the direction of travel of a vehicle traveling in close to a straight horizontal line with erratic acceleration and deceleration. I have the sequence of 3 readings from the X,Y,Z orthogonal accelerometers. But the orientation of the iphone/ipad is arbitrary and the accelerometer readings include vehicle motion and the effect of gravity. The result should be a sequence of single acceleration values which are positive or negative depending on whether the vehicle is decelerating or accelerating. The positive and negative direction is arbitrary so long as acceleration has the opposite sign to deceleration. Gravity should be factored out of the result. Some amount of variable smoothing of the result would be useful.
The solution should be as simple as possible and must be computationally efficient. The answer should be some kind of pseudo-code algorithm, C code or a sequence of equations which could easily be converted to C code. An iPhone specific solution in Objective C would be fine too.
Thanks
You will need some trigonometry for this, for example to get the magnitude you need
magn = sqrt(x*x+y*y+z*z);
to get the angle you will need atan, then c function atan2 is better
xyangel = atan2(y,x);
xymagn = sqrt(x*x+y*y);
vertangle = atan2(z,xymagn)
no how you get negative and positive magnitude is arbitrary, you could for example interpret π/2 < xyangle < 3π/2 as negative. That would be taking the sign of x for the sign of magn, but it would be equally valid to take the sign from y
It is really tough to separate gravity and motion. It's easier if you can analyze the data together with a gyroscope and compass signal.
The gyroscope measures the rate of angular rotation. Its integral is theoretically the angular orientation (plus an unknown constant), but the integral is subject to drift, so is useless on its own. The accelerometer measures angular orientation plus gravity plus linear acceleration. With some moderately complex math, you can isolate all 3 of those quantities from the 2 sensors' values. Adding the compass fixes the XY plane (where Z is gravity) to an absolute coordinate frame.
See this great presentation.
Use userAcceleration.
You don't have to figure out how to remove gravity from the accelerometer readings and how to take into accont the orientation: It is already implemeted in the Core Motion Framework.
Track the mean value of acceleration. That will give you a reference for "down". Then subtract the mean from individual readings.
You'll need to play around with the sensitivity of the mean calculation, since, e.g., making a long slow turn on a freeway will cause the mean to slowly drift outwards.
If you wanted to compensate for this, you could use GPS tracking to compute a coarse-grained global acceleration to calibrate the accelerometer. In fact, you might find that differentiating the GPS velocity reading gives a good enough absolute acceleration all by itself (I haven't tried, so I can't say).

Accelerometers: Can I separate linear measurement from gravitational measurement

I am doing research on the tremors and Parkinson's disease.The plan is to use accelerometers and gyroscopes on the human arm. I plan on using Pulse for data collection and analysis. My questions are:
Is it true that there are some accelerometers that can separate gravitational acceleration from linear acceleration (heard it on the uncited grapevine). My suspicion is that we can't place an accelerometer on the patients arm to measure, say, the tremors caused by bicep and tricep contraction because if the patient rotates his wrist, the change in gravitational acceleration will contaminate our results. More to the point, can we measure acceleration due ONLY to the action of the muscles, and not due to changing gravitational forces with any of your accelerometers?
If a 3-axis accelerometer is rotating about an axis parallel to the ground, wouldn't the axis perpendicular to the ground pick up a sinusoidally varying (i.e. not DC) gravitational acceleration?
None of the accelerometers can separate the linear acceleration from the gravitational acceleration. This is achieved by sensor fusion, you merge the accelerometer and gyro readings in a clever way.
I developed a motion sensing applicaton to track human motion (elbow flexion). I am sure something similar would work fine for you.
My advice is to use orientation in your application (rotation matrices).
If you have to implement the sensor fusion yourself then the Direction Cosine Matrix IMU: Theory manuscript is a good place to start.

Gyroscope vs Accelerometer?

Now that iOS 4 is no longer NDA, I would like to know what Gyroscope has to offer over the Accelerometer for developers. Is there a difference in APIs? Other things?
Actually, the accelerometer measures linear acceleration; but since force is equal to mass times acceleration, people can consider it as measuring force as well as long as it has a constant mass. Linear acceleration is the rate of change of linear velocity. A gyro on the other hand provides the angular rotational velocity measurement as oppose to the linear acceleration of movement. Both sensors measures the rate of change; they just measure the rate of change for different things.
Technically, it is possible for a linear accelerometer to measure rotational velocity. This is due to the centrifugal force the device generates when it is rotating. The centrifugal force is directly related to its rotational speed. As a matter of fact, many MEMS gyro sensors actually uses linear accelerometers to determine the rotational speed by carefully placing them in certain orientations and measuring the centrifugal forces to compute the actual rotational gyro speed.
A MEMs gyroscope is a rate of change device. As the device rotates in any its axis, you can see a change in rotation. An accelerometer only provides the force along the X,Y,and Z vectors, and cannot solve for "twist". By using both sensors, you can often implement what is referred to as a 6DOF (degrees of freedom) inertial system - or dead reckoning - allowing you to find the relative physical location of the device. (Note that all inertial systems drift, so its not stable in the long term).
In short: gyroscopes measure rotation, accelerometers measure translation.
There is a new API for reading the gyroscope.