🎯要点
🎯运动学矢量计算 | 🎯跳远的运动学计算 | 🎯关节肢体运动最小加加速度模型 | 🎯膝关节和踝关节角度二维运动学计算 | 🎯上下肢体关节连接运动链数学模型 | 🎯刚体连接点速度加速度计算 | 🎯刚体变换二维三维运动学计算 | 🎯奇异值分解算法刚体变换 | 🎯三维运动角速度计算 | 🎯肌体和步态模型
📜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)=切向  
                   
                   
                  atu^t+法向  
                   
                   
                  anu^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 = 0
    for component in vector:
        magnitude += component ** 2
    return 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)



















