🎯要點
🎯運動學矢量計算 | 🎯跳遠的運動學計算 | 🎯關節肢體運動最小加加速度模型 | 🎯膝關節和踝關節角度二維運動學計算 | 🎯上下肢體關節連接運動鏈數學模型 | 🎯剛體連接點速度加速度計算 | 🎯剛體變換二維三維運動學計算 | 🎯奇異值分解算法剛體變換 | 🎯三維運動角速度計算 | 🎯肌體和步態模型
📜Python,R,C++/C#和MATLAB運動學剛體動力學用例
📜Python重力彈弓流體晃動微分方程模型和交直流電阻電容電路
📜Python和R概率統計算法建模評估氣象和運動
📜Python流體數據統計模型和淺水滲流平流模型模擬
📜Python自行車六自由度飛行器多連接件非線性運動方程模型
📜Python協作運動機器人剛體力學解耦模型
📜ROS2(Cpp或Python)機器學習路徑選擇三維模擬平衡車及YOLOv8視覺消息
📜Python | C++ | MATLAB機器人正逆向運動學動力學求解器及算法
📜Python | C# | MATLAB 庫卡機器人微分運動學 | 歐拉-拉格朗日動力學 | 混合動力控制
📜C++和Python螞蟻搬食和蚊蟲趨光性和浮標機群行為算法神經網絡
📜Python人形機踴躍跨欄舉重投籃高維數動作算法模型
📜MATLAB和Python發那科ABB庫卡史陶比爾工業機器人模擬示教框架
📜MATLAB雨刮通風空調模糊器和發電廠電力聚變器卷積神經
🍪語言內容分比
🍇Python運動學可視化
運動學是力學的一個分支,涉及物體的運動,而不考慮引起運動的力。給定一個描述粒子位置矢量隨時間變化的方程,就可以計算各種運動學屬性。最重要的是速度和加速度。如果粒子沿直線運動,則運動是直線運動。類似地,沿著彎曲路徑行進的粒子也進行曲線運動。
x x x、 y y y 和 z z z 笛卡爾坐標系定義了粒子在歐幾里得空間中的空間位置。方程 1 顯示了粒子位置隨時間的變化。秒 (s) 是時間單位,米 (m) 是位置單位。
r ? ( t ) = x ( t ) ? ^ + y ( t ) ? ^ + z ( t ) k ^ ( 1 ) \vec{r}(t)=x(t) \hat{\imath}+y(t) \hat{\jmath}+z(t) \hat{k}\qquad(1) r(t)=x(t)^+y(t)^?+z(t)k^(1)
曲率半徑 (rho) 是從粒子 P 到路徑 C 的曲率中心的距離。當粒子在空間中移動時,曲率半徑會根據描述運動的函數而變化。
速度是由方程 2 表示的位置的一階導數。速度矢量與粒子的軌跡相切。
v ? ( t ) = d x ( t ) d t ? ^ + d y ( t ) d t ? ^ + d z ( t ) d t k ^ ( 2 ) \vec{v}(t)=\frac{d x(t)}{d t} \hat{\imath}+\frac{d y(t)}{d t} \hat{\jmath}+\frac{d z(t)}{d t} \hat{k}\qquad(2) v(t)=dtdx(t)?^+dtdy(t)?^?+dtdz(t)?k^(2)
該方向上的單位矢量是單位切矢量,由公式 3 給出。它等于速度矢量除以幅值。
u ^ t = v ? v ( 3 ) \hat{u}_t=\frac{\stackrel{\rightharpoonup}{v}}{v}\qquad(3) u^t?=vv??(3)
向量有方向和大小。公式 4 顯示了如何計算 3 維位置矢量的大小。它可以應用于任何向量并擴展到任意數量的維度。
∥ r ? ∥ = r = x 2 + y 2 + z 2 ( 4 ) \|\vec{r}\|=r=\sqrt{x^2+y^2+z^2}\qquad(4) ∥r∥=r=x2+y2+z2?(4)
加速度是位置的二階導數或速度的一階導數。法向分量和切向分量包括加速度。
- 切向加速度與速度方向相同。
- 法向加速度是朝著粒子路徑的曲率中心的方向。
方程 5 顯示了加速度的兩個分量。單位切向加速度矢量和法向加速度矢量是正交單位矢量。因此,它們形成一個稱為密切平面的平面。
a ? ( t ) = a t u ^ t ? 切向? + a n u ^ n ? 法向? ( 5 ) \vec{a}(t)=\underbrace{a_t \hat{u}_t}_{\text {切向 }}+\underbrace{a_n \hat{u}_n}_{\text {法向 }}\qquad(5) a(t)=切向? at?u^t???+法向? an?u^n???(5)
單位副法向量垂直于密切平面,構成右手正交系。因此,方程 6 給出了單位副法線。
u ^ b = u ^ t × u ^ n = v ? × a ? ∥ v ? × a ? ∥ ( 6 ) \hat{u}_b=\hat{u}_t \times \hat{u}_n=\frac{\vec{v} \times \vec{a}}{\|\vec{v} \times \vec{a}\|}\qquad(6) u^b?=u^t?×u^n?=∥v×a∥v×a?(6)
單位法線指向曲率中心,這意味著曲率中心 C 位于密切平面內。因此,相對于粒子 P,曲率中心 C 由方程 7 給出。
r ? c / p = ρ u ^ n ( 7 ) \vec{r}_{c / p}=\rho \hat{u}_n\qquad(7) rc/p?=ρu^n?(7)
向量相加給出了 C 的位置向量,如公式 8 所示。
r ? c = r ? + r ? c / p ( 8 ) \vec{r}_c=\vec{r}+\vec{r}_{c / p}\qquad(8) rc?=r+rc/p?(8)
Python模擬三維運動學
模擬從 0 秒開始,360 秒后結束。以下代碼顯示了時間線束參數。
t0 = 0
tf = 720
dt = 1
time = np.arange(t0, tf, dt, dtype='float')
方程 9 定義了粒子的位置如何隨時間變化,從而定義了軌跡。
r ? ( t ) = sin ? ( 3 t ) ? ^ + cos ? ( t ) ? ^ + cos ? ( 2 t ) k ^ ( 9 ) \vec{r}(t)=\sin (3 t) \hat{\imath}+\cos (t) \hat{\jmath}+\cos (2 t) \hat{k}\qquad(9) r(t)=sin(3t)^+cos(t)^?+cos(2t)k^(9)
以下顯示了該符號運動方程以及速度和加速度導數的聲明。還提出了切向加速度方程,它是速度大小的導數。
t = sp.symbols('t')
R = [sp.cos(t), sp.sin(t), t / 5]
V = vector_derivative(R, t)
A = vector_derivative(V, t)
At = vector_magnitude(V).diff(t)
矢量方程
def vector_derivative(vector, wrt):return [component.diff(wrt) for component in vector]def vector_magnitude(vector):magnitude = 0for component in vector:magnitude += component ** 2return magnitude ** (1 / 2)def unit_vector(from_vector_and_magnitude=None, from_othogonal_vectors=None, from_orthogonal_unit_vectors=None):if from_vector_and_magnitude is not None:vector_a, magnitude = from_vector_and_magnitude[0], from_vector_and_magnitude[1]return [component / magnitude for component in vector_a]if from_othogonal_vectors is not None:vector_a, vector_b = from_othogonal_vectors[0], from_othogonal_vectors[1]vector_normal = np.cross(vector_a, vector_b)return unit_vector(from_vector_and_magnitude=(vector_normal, vector_magnitude(vector_normal)))if from_orthogonal_unit_vectors is not None:u1, u2 = from_orthogonal_unit_vectors[0], from_orthogonal_unit_vectors[1]return np.cross(u1, u2)def evaluate_vector(vector, time_step):numerical_vector = [float(component.subs(t, time_step).evalf()) for component in vector]magnitude = vector_magnitude(numerical_vector)return numerical_vector, magnitude
定義了相關的矢量函數后,就可以開始隨時間傳播。以下顯示了用于運行模擬的代碼。
propagation_time_history = []for ti in time:ti_r = d2r(ti)r, r_mag = evaluate_vector(R, ti_r)v, v_mag = evaluate_vector(V, ti_r)v_theta = [r2d(angle) for angle in direction_angles(v, v_mag)]a_theta = [r2d(angle) for angle in direction_angles(a, a_mag)]ut = unit_vector(from_vector_and_magnitude=(v, v_mag))ub = unit_vector(from_othogonal_vectors=(v, a))un = unit_vector(from_orthogonal_unit_vectors=(ub, ut))at = float(At.subs(t, ti_r).evalf())rc = r + (rho * un)rc_mag = vector_magnitude(rc)iteration_results = {'t': ti, 'rx': r[0], 'ry': r[1], 'rz': r[2], 'r_mag': r_mag,'vx': v[0], 'vy': v[1], 'vz': v[2], 'v_mag': v_mag,'rcx': rc[0], 'rcy': rc[1], 'rcz': rc[2], 'rc_mag': rc_mag, 'rho': rho,'ax': a[0], 'ay': a[1], 'az': a[2], 'a_mag': a_mag, 'an': an, 'at': at,'ubx': ub[0], 'uby': ub[1], 'ubz': ub[2],'utx': ut[0], 'uty': ut[1], 'utz': ut[2],'unx': un[0], 'uny': un[1], 'unz': un[2]}propagation_time_history.append(iteration_results)df = pd.DataFrame(propagation_time_history)