STEM 隨筆︰古典力學︰轉子【四】

不久後終於抵達北岸碼頭,空蕩蕩似無人煙。月兒升的更高了,望著眼前土丘,顯的有些淒冷。或許 Mrphs 見我不言不語,因說道︰跨過面前的小山,就到了『幽境夢鄉』。再穿越『幽境夢鄉 』,即達《卡夫卡村》。邊聽邊走,登上了山丘,『幽境夢鄉』在目,黑壓壓的一片,不知何處是盡頭。 Mrphs 又講起︰說來『幽境夢鄉』之名原該是『幽竟夢卿』的古稱。當地原鄉人本叫它『奇幻森林』 ,林內多有五十步高之參天巨木,樹蔭之大可蔽日,又為奇藤異草纏繞,彷彿是個天然暖房。故而林中香草靈芝常生,卵生溼生常居 。遂因此生生不斷,變異驚奇而得名。此林之中央有個『林中道』正是前往《卡夫卡村》的門徑。路底有塊大石,將入村道路分成了東西兩向。誰知一日有人卻意外的用『紫外線』拍着了這石,之後驚訝的發現其上儼然有圖文。北面刻的是『 幽 竟 』,南面上頭有『 夢 鄉』。故詢之 M♪o ,得其解為『幽竟夢卿』,然而此人以為是 M♪o 誤寫,當是作『幽境夢鄉』,於是延誤至今。這麼一說反而倒讓人好奇起來,故問︰難到 M♪o 沒有分辯。 Mrphs 接答︰據『小學堂』同學講,一回有人問過這事,老師說︰『幽竟夢卿』之本義是『 幽 』幽靜將『 竟 』盡,此景恐不再,或終『 夢 』在夢裡相『 鄉 』向。總帶著點『傷春悲秋』之意。錯讀為『幽境夢鄉』沒什麼不好的吧!!多少可以『安定人心』的啊??

只覺一時惘然不知所之何境何鄉的了。或許真應該振奮精神,換個調子續彈『 Sense Hat 』的『 IMU 』inertial measurement unit 之曲的乎!!何不就反其道而行,從『實驗』起頭的哩??

Raspberry Pi Experiment: Foucault Pendulum

200px-Foucault_pendulum

The Foucault Pendulum with some RPi’s Mounted to it

Purpose

Analyze the motion of a pendulum using an inertial measurement unit (IMU) with a Raspberry Pi.

……

─── 《勇闖新世界︰ W!O《卡夫卡村》變形祭︰感知自然‧幽境夢鄉

 

不解『時物』者︰

春夜宴諸從弟桃花園序》‧李白

夫天地者,萬物之逆旅也;光陰者,百代之過客也。而浮生若夢 ,為歡幾何?古人秉燭夜游,良有以也。況陽春加我以煙景,大塊假我以文章。會桃花之芳園,序天倫之樂事!群季俊秀,皆為惠連。吾人詠歌,獨慚康樂。幽賞未已,高談轉清。開瓊筵以坐花 ,飛羽觴而醉月,不有詠,何伸雅懷?如詩不成,罰依金谷酒數。

 

心無『桃花園』!

有人說︰機緣可遇不可求。會有『過了這個村,就沒那個店』之慨!真耶?假耶?倘若以『萬物靜觀皆自得』考之,怕是『童趣好奇之心』易失難得的吧!?

曾寫有人想用 IMU 追跡小汽車︰

從牛頓力學來講,假使我們知道一個物體的『加速度』 \vec{a} (t) ,而且如果『初始條件』︰該物位置在原點,速度為零。那麼任意時刻的『速度』是 \vec{v} (t)  = \int \limits_{0}^{t} \vec{a} (t) dt ,『位置』為 \vec{r} (t) = \int \limits_{0}^{t} \int \limits_{0}^{t} \vec{a} (t) dt 。這麼簡易的算術有什麼重要嗎?若是我們可以『追跡物體 』,舉凡相機拍照的防震、手腳運動之練習、肢體平衡復健的監督﹐…… 實有著不勝枚舉之『用途』。然而『微機電』所作的『慣性感測器』 IMU ,一有免不了的『加速度』之『度量誤差』,此誤差在長『時間』的『積累』下將越來『錯誤』越大!再者那個『量測值』只能是『加速度』的『時間序列』 \vec{a} ( t_i ) ,因此 t_mt_n 時刻間之事也就不得不有『假設』的了!!就像此處問答所說的一樣︰

Tracking 2D positioning with IMU Sensor

I am using a miniature car and I want to estimate the position. We can not use GPS modules and most of the tracking systems that I saw, are using IMU senson with the GPS module. In our car we are able to find our exact correct location with image processing but for some parts that dont have enough markings we can not do this. So we want to use the IMU as backup for our positioning. so as long as the positioning is close is good for us.

And we are only interested in our 2D position since the car is on a flat ground.

I am using a IMU 9DOF sensor and I want to calculate my movement. I have seen some amazing works with IMU for tracking body movements but no code or simple explanation is anywhere about it. So basically I have the reading from accelerometer, gyro and magnetometer. I also have orientation in quarternions. From the device I am getting also the linear acceleration but even when I am not moving it in any direction the values are not 0 which is really confusing.

Can you please help me how to approach this?

Thanks in advance

Update :

So right now we are getting the perfect heading from the quaternion values. We also have the delta_time between each heading. So what I believe we need right now is the velocity. either as a vector or as a total value.

shareimprove this question

───

Non-zero rates are normal for MEMS accelerometers and gyros. This is persistent error. It is eliminated by somehow making sure that the device is stationary for a couple of seconds (so the output can stabilize), then getting a reading. Henceforth, subtracting this steady-state error from all future measurements. Look up the datasheet of your sensor – there will be maximum values for this and other types of measurement tolerances.

Now, the much more complex subject of fusing the accelerometer, gyro and compass data. This can get hugely complicated, using Kalman filter, like Apolo once did. It can, however, be quite simple as well.

The general idea is that the magnetic sensor has slow response, low accuracy, but the error does not increase. On the other hand, a gyro’s output is velocity, which is integrated to get angular position. The error grows very fast – generally you can’t do dead reckoning for more than a minute with only a giro. The accelerometer is worse – it outputs acceleration, which gets integrated twice!

So, a simple fusing filter would be some linear combination of the readings of the accelerometer and compass, with the coefficient in front of the gyro descreasing over tyme.

Here is a discussion by much more knowledgeable people than me on the topic.

Note: What you are trying to do is called dead reckoning.

shareimprove this answer

─── 摘自《勇闖新世界︰ W!O《卡夫卡村》變形祭︰感知自然‧幽夢‧二

 

近日閱讀

scikit-kinematics – Documentation

scikit-kinematics is a library for scientific data analysis, with a focus on 3d kinematics.

It is hosted under https://github.com/thomas-haslwanter/scikit-kinematics, and contains the following modules:

imus Analysis routines for IMU-recordings
  • calculation of orientation from velocity, recorded with IMUs or space-fixed systems (four different algorithms are implemente here:
    • simple quaternion integration
    • a quaternion Kalman filter
    • Madgwick’s algorithm
    • Mahony’s algorithm
  • calculation of position and orientation from IMU-signals
  • The sub-directory sensors contains utility to import in data from xio, XSens, and yei system
markers Analysis routines for 3D movements from marker-based video recordings
  • a function that takes recordings from video-systems (e.g. Optotrak) and calculates position and orientation
  • calculation of joint movements from marker recordings
quat Functions for working with quaternions:
  • quaternion multiplication, inversion, conjugate
  • conversions to rotation matrices, axis angles, vectors
  • a Quaternion class, including operator overloading for multiplication and division
  • also work on data arrays
rotmat Functions for working with rotation matrices
  • rotation matrices for rotations about the x-, y-, and z-axis
  • symbolic rotation matrices
  • conversions to Euler, Fick, Helmholtz angles
vector Functions for working with vectors
  • angle between vectors
  • Gram-Schmidt orthogonalization
  • projection
  • normalization
  • rotation
  • also work on data arrays

view Visualization of time-series data, and of 3D orientations

_images/viewer_large.png

Interactively analyze time-series data.

_images/orientation_viewer.png

Visualize 3D orientations.

 

欣喜或可用來研究四軸飛行器的運動呦☆