How could we use an accelerometer to find tilt angle?
-
Upload
serenity-mccarty -
Category
Documents
-
view
29 -
download
0
description
Transcript of How could we use an accelerometer to find tilt angle?
![Page 1: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/1.jpg)
The artist exists because the world is not perfect. Art would be useless if the world were perfect, as man wouldn’t look for harmony but would
simply live in it. Art is born out of an ill-designed world. Andrei Tarkovsky
State Estimation: The search for harmony in an unideal world
Mike Robinson
![Page 2: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/2.jpg)
How could we use an accelerometer to find tilt angle?
Product images from Sparkfun electronics
![Page 3: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/3.jpg)
How could we use an accelerometer to find tilt angle?
θ
𝑔
𝑎𝑥
𝑎𝑦
Product images from Sparkfun electronics
𝜃=𝑎𝑡𝑎𝑛2 (𝑎𝑦
𝑎𝑥)
![Page 4: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/4.jpg)
What’s the problem with using a low-pass filter to smooth out the data?
![Page 5: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/5.jpg)
What’s the problem with using a low-pass filter to smooth out the data?
![Page 6: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/6.jpg)
How could we use a gyroscope to find tilt angle?
Product images from Sparkfun electronics
![Page 7: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/7.jpg)
How could we use a gyroscope to find tilt angle?
Product images from Sparkfun electronics
𝜃=∫0
𝑡
�̇� 𝑑𝑡
theta = theta + thetaDot*dt
![Page 8: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/8.jpg)
What’s the problem with integrating a gyroscope?
![Page 9: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/9.jpg)
What’s the problem with integrating a gyroscope?
![Page 10: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/10.jpg)
The accelerometer is good long term and the gyroscope is good short term. How can we put them together?
![Page 11: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/11.jpg)
A state estimator lets us combine these two measurements by using feedback
�̇�Integrate
Signal from
gyroscope
+¿−
+¿−
Angle from accelerometer
Multiply by gain
𝜃𝑎𝑐𝑐𝑒𝑙
𝜃𝑒𝑟𝑟𝑜𝑟
![Page 12: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/12.jpg)
Let’s see if we can intuitively understand this feedback
What would happen if the gyroscope signal was zero and our estimate was larger than the angle we measured with the accelerometer?
Integrate−
+¿−
Angle from accelerometer
Multiply by gain
𝜃𝑎𝑐𝑐𝑒𝑙
𝜃𝑒𝑟𝑟𝑜𝑟
![Page 13: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/13.jpg)
Let’s see if we can intuitively understand this feedback
If is greater than , then we have a positive number here
Integrate−
+¿−
Angle from accelerometer
Multiply by gain
𝜃𝑎𝑐𝑐𝑒𝑙
𝜃𝑒𝑟𝑟𝑜𝑟
![Page 14: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/14.jpg)
Let’s see if we can intuitively understand this feedback
If is greater than , then we have a positive number here
Multiplied by a positive number
Integrate−
+¿−
Angle from accelerometer
Multiply by gain
𝜃𝑎𝑐𝑐𝑒𝑙
𝜃𝑒𝑟𝑟𝑜𝑟
![Page 15: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/15.jpg)
Let’s see if we can intuitively understand this feedback
If is greater than , then we have a positive number here
Multiplied by a positive number
Then subtracted from zero
And integrated, which reduces our estimate of
Integrate−
+¿−
Angle from accelerometer
Multiply by gain
𝜃𝑎𝑐𝑐𝑒𝑙
𝜃𝑒𝑟𝑟𝑜𝑟
![Page 16: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/16.jpg)
The block diagram may look confusing, but the code is easyaccelerometer angle = atan2(accel_y,accel_x)angle error = estimated angle - accelerometer angle estimated angle = estimated angle + (gyroscope reading – angle error*gain)*dt
![Page 17: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/17.jpg)
In general, high gains mean we trust the sensor (accelerometer), low gains mean we trust the model (integrated gyroscope)
Increasing gain
![Page 18: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/18.jpg)
It’s easy to see the improvement in performance over a low-pass filter
Estimated Low-pass filtered
![Page 19: How could we use an accelerometer to find tilt angle?](https://reader036.fdocuments.net/reader036/viewer/2022062407/56812cb7550346895d916d44/html5/thumbnails/19.jpg)
A Kalman filter is an optimal way to find the estimator gain (or gains)
• In this example, if you know the statistics of the accelerometer and the gyroscope, you could use a Kalman filter to find the gain, which will be a function of time.• You can also estimate the bias in the gyroscope,
which will improve the quality of your estimation.