Car speed measurement using 3-axis accelerometer - accelerometer

Description of the situation
I want to use the BOSCH BMI160 sensor to check the speed of the vehicle on the go.
GPS is not available in the current situation.
Question
What is the formula for getting velocity from a 3-axis acceleration sensor?
Is there an error of more than 10% when an error occurs in an uneven area of the hill or the ground?
Resources
BOSCH BMI160 DataSheet : https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMI160-DS000.pdf
Thank you

What you want to do is called "inertial navigation", which is an error prone technique, by nature.
The operation you need is 3 axis accelerometer integration and 3 rotation integration, to get the heading and speed of your system. Moreover you need your initial state (speed and orientation) from which your integration should start. It is not at all a simple operation, and errors accumulate with time, and depend from many factors (starting from the accuracy of the sensor).
If you don't need the heading and you just care about linear speed in the direction of the car, you can reduce to single axis integration in the car direction, which is simpler, and may work well for a short period of time. Due to gravitational acceleration, you could have problems when going up-or-down-hill, because you will have to get rid of the average acceleration

Related

I want to calculate spped of android device using accelerometers sensor only not with GPS?

I need to create an app that Calculates the moving car velocity/speed, with x/y/z speed.
My idea is using device's accelerometer.
I am using Sensor.TYPE_ACCELEROMETER and getting ax,ay,az (acceleration in x,y,z direction). how to get sped of device. Lots of physics formulas suggested by people to get speed but any one of then not giving correct speed compared to GPS. Please tell me code or good link which solve my problem.
That would be very difficult. To calculate the speed of the device, you need to calculate the integral of the acceleration. But to do so, you need to very accurately know for very dense points in time both the device's rotation and its acceleration. Assuming you do have those things, you simply need to take the device's initial speed, and for each point in time add to it (rotation matrix * acceleration vector * time to next measurement). That's probably the most accurate thing you can that is simple enough.

Get position from accelerometer

I am working in a monocular 3D Mapping project, and I need every time both position and rotation (angle).
To filter Gyroscope Data, I decided to use the "compass" and set 0 value to the angle if it's north.
But to get the position, I will need to double integrate the accelerometer value with a small sampling step (1ms) and 7 values mean filter.
I think this will make position more accurate. But does someone have an idea about the error range ? for example, in 10 meters, How much the error will be.
And does anyone have a better idea?
The sensors are from STM32F3 Discovery Board
Thanks
The STM32F3 has two sensors you'd be using:
LSM303DLHC accelerometer and magnetometer
L3GD20 3-axis digital gyroscope.
The sensor accuracy should appear somewhere in the datasheet. Since you'll be using several sensors, you'll have to calculate the total error over the time your measuring. Note, the error won't be a single number like 10 meters because it will accumulate over time. If you had a GPS or some other way of determining your position you'd be able to limit your accumulated error.
What you're doing sounds like an Inertial Measurement Unit. If you haven't already, I'd recommend reading up on that and also Dead Reckoning.

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 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.

Determining speed of shake

Is it possible to determine the speed at which someone is shaking their iPhone? This would be the time they start moving to the ending point where they are now going back to the origin. Basically it is one swipe that I'd like to measure the speed of. This discussion comments on initial speed: http://discussions.apple.com/message.jspa?messageID=8297689#8297689. It seems that the important component of distance is lacking in the iPhone to get a good measure of speed.
Sure, it sounds like all you'd need to do would be to numerically integrate the acceleration twice to get the distance traveled. For instance, look at
Calculate the position of an accelerating body after a certain time
Note that you'll have to subtract gravity from the measured acceleration to get the kinetic acceleration, which is what you should integrate. As for how to do that, re: GoatRider's comment: I might try storing the last measured acceleration whose magnitude was equal to gravity (I think that's 1 in iPhone units?). Then for each acceleration measurement you make whose magnitude is greater than 1, subtract the last known acceleration of gravity - this will need to be a vector subtraction - and use that as the kinetic acceleration. Of course, this assumes that the user keeps the phone in the same orientation throughout the swipe, which I think would be approximately true.
Unfortunately, there's no technique you can use to distinguish between gravitational acceleration and kinetic acceleration in general - that is, a determined user could always find a way to fool whatever algorithm you might come up with. (Trivia: that's called the equivalence principle, and it's the foundation of Einstein's theory of general relativity)
You'll have to do the calculations yourself. Each acceleration event you receive will tell you the relative G-forces registering on the accelerometer and the time at which the event was recorded. You'll have to sample over several events and interpolate. Here's more info on the acceleration event itself:
UIAcceleration Class Reference