Calculate tilt angle of a golf swing - accelerometer

So I got this problem, I am working with a 9-axis sensor that can collect acceleration, gyro, and magnetometer data. This sensor Is attached to a golf club and I would like to calculate the angle of the sensor on impact. I found this page https://www.hobbytronics.co.uk/accelerometer-info but the thing is they use the acceleration data to calculate the tilt angle of a sensor that is just in an idle position. When you add movement from the golf club it just does not work. Is there any other way to do it?

Related

Gravity removal algorithms from accelerometer in IMU units under acceleration? [duplicate]

I have a small remote controlled car going on the room floor. For simplicity let us assume it is moving along say x-axis. Now, the floor seems flat but there are very minute uneven bumps in every surface. So whenever the car is not exactly flat (as it was at starting position) or in other words whenever the car has even slightest of tilt then,
Total Acceleration obtained from accelerometer = Linear Acceleration + Acceleration due to tilt
My question is how to remove the acceleration due to tilt so that I get only linear acceleration? Can I somehow use gyroscope to do that?
I have implemented sensor fusion for the Shimmer platform based on this manuscript, it's basically a tutorial:
Direction Cosine Matrix IMU: Theory
This manuscript pretty much answers your question.
These have also been a big help:
An introduction to inertial navigation
An Introduction to the Kalman Filter
Pedestrian Localisation for Indoor Environments
Combine Gyroscope and Accelerometer Data
Just promise me you won't try double integrating the linear acceleration because it won't work and I suspect that it is what you are trying to do.

How does my iPhone get its altitude?

I made a simple app which displays the altitude according to the GPS position on iPhone.
How is the altitude obtained?
Does it get the altitude of the land at the coordinates I am or does it get the actual altitude? (I tried the same application in the same building; once at ground floor and once on the third floor but the same altitude is displayed)
Is it possible to obtain a different altitude on different floors? (Like my android phone has a barometer sensor and I calculate the elevation by the atmospheric pressure; but none of the iPhones has a barometer sensor)
The altitude as read by the gps receiver depends on the positions of the satellites over the horizon, relative to each other. It is possible then for the altitude reading to be unreliable when either there are not enough satellites in the sky or they are too close together. This then depends on the time of day, or date.
The signals from the satellites are very weak once they have reached the Earth's surface, and may not be received correctly inside buildings, or where there are other tall buildings nearby, such as a city centre like Manhattan.
Barometer readings will vary according to the weather and so an absolute reading can't be applied to a specific floor. However relative readings may be reliable enough for floor to floor changes, e.g. a lower value means going up.
Like any other device that uses GPS to calculate altitude, it's measuring the user's distance from the center of the satellites' orbits.
Your smartphone uses GPS technology to calculate your altitude depending on where you are. It measures how far away you are from the satilites which is calculating this information.
Note that newer IPhones (>= 6) have a barometer sensor which in my experience is significantly more accurate than GPS. With a barometers the accuracy appears to be within a foot whereas with GPS it would bounce around by 3-4 meters even when standing still.
http://www.iphonetricks.org/iphone-6-barometer-sensor-features/

How to obtain only linear acceleration from accelerometer using gyroscope?

I have a small remote controlled car going on the room floor. For simplicity let us assume it is moving along say x-axis. Now, the floor seems flat but there are very minute uneven bumps in every surface. So whenever the car is not exactly flat (as it was at starting position) or in other words whenever the car has even slightest of tilt then,
Total Acceleration obtained from accelerometer = Linear Acceleration + Acceleration due to tilt
My question is how to remove the acceleration due to tilt so that I get only linear acceleration? Can I somehow use gyroscope to do that?
I have implemented sensor fusion for the Shimmer platform based on this manuscript, it's basically a tutorial:
Direction Cosine Matrix IMU: Theory
This manuscript pretty much answers your question.
These have also been a big help:
An introduction to inertial navigation
An Introduction to the Kalman Filter
Pedestrian Localisation for Indoor Environments
Combine Gyroscope and Accelerometer Data
Just promise me you won't try double integrating the linear acceleration because it won't work and I suspect that it is what you are trying to do.

Distance moved by Accelerometer

I want to move objects on iPhone screen (rectangle, circle and so on) by moving iPhone.
For example, I move iPhone along X-axis and the object moves along X-axis. The same for Y,Z-axis.
How can I do this?
Can I get algorithm for it?
Thank you.
P.S:
I looked for a while and seems like it is possible using accelerometer.
You get position by integrating the linear acceleration twice but the error is horrible. It is useless in practice.
Here is an explanation why (Google Tech Talk) at 23:20. I highly recommend this video.
However the gyro mouse might work for your application, see between 37:00-38:25 in the video.
Similar questions:
track small movements of iphone with no GPS
What is the real world accuracy of phone accelerometers when used for positioning?
how to calculate phone's movement in the vertical direction from rest?
iOS: Movement Precision in 3D Space
How to use Accelerometer to measure distance for Android Application Development
How can I find distance traveled with a gyroscope and accelerometer?
Not easy to do accurately. An accelerometer only reports acceleration, not movement. You can try (numerically) integrating the acceleration over time, but you're likely to end up with cumulative errors adding up and leading to unintended motion.
Pseudocode, obviously untested:
init:
loc = {0, 0, 0} ; location of object on screen
vel = {0, 0, 0} ; velocity of object on screen
t = 0 ; last time measured
step:
t0 = time ; get amount of time since last measurement
dt = t0 - t
accel = readAccelerometer()
vel += accel * dt ; update velocity
loc += vel * dt ; update position
displayObjectAt(loc)
Why don't you use the acceleration itself instead distance moved? For example;
If your acceleration is 1.4G east, your object should move to east 14pixels per second until your acceleration changes.
So that object's movement is will be like it is under a relative force and I think it's more realistic. Faster moving device, bigger force to effect object.
Also look:
http://www.freescale.com/files/sensors/doc/app_note/AN3397.pdf
and
Using accelerometer, gyroscope and compass to calculate device's movement in 3D world

How can i handle distance through accelerometer?

My object starts from zero. When the time goes..It covers some distance, so how can I measure this?
Oh, it's simple. All you have to do is implement an Inertial Measurement Unit and then an Inertial Navigation System. It's going to be hard to do without rotation sensors, it would probably require a Kalman Filter for accuracy, and typically it is done with ring laser gyros or fiber optic gyros, which are "solid state" devices that work by measuring relativistic effects and sell for rather higher prices than the silicon micromachined sensors in the iPhone, but you might get it to work.
Or, you could just use the GPS.
Other than just being alerted that the device did move, the accelerometer will not be much use. You will not get a reading of "device moved 10cm" or something similar, as far as I know you'll just get a value for how much acceleration occurred.
If you need to track your device's movement in the physical world you'll need to use the Location APIs.
You can figure this out, but it won't be that accurate, mainly due to sample rate and the inaccuracy of the accelerometer.
First figure out direction and force of the movement. If the user moves the iphone at +0.1G along the X axis and 0G along the Y and Z axis, then our force is +0.1G on the X axis. 1G is 9.8m/s, so the phone has move 0.9m if it has been traveling for 1 second.