PMAC的PVT功能实现解析笔记
從上圖中我們可以得到如下信息:
- 速度截面是一個(gè)拋物線
- P0P_0P0?、V0V_0V0?是上一次指定的,P1P_1P1?、V1V_1V1?是當(dāng)前期望的,TA是當(dāng)前期望的運(yùn)動(dòng)時(shí)間
- A0A_0A0?是上一次計(jì)算的,A1A_1A1?是當(dāng)前計(jì)算的,加加速度dA/dtdA/dtdA/dt是常數(shù)
根據(jù)上述幾條信息,可以看出軌跡插補(bǔ)方式有點(diǎn)類(lèi)似于三次多項(xiàng)式。
此圖下方接下來(lái)有一段話:
PVT mode provides excellent contouring capability, because it takes the interpolated commanded path exactly through the programmed points. It creates a path known as a “Hermite spline”. To use PVT mode for this multi-axis contouring, the axis velocities at each programmed point must be specified in addition to the positions.
劃關(guān)鍵詞Hermite spline,結(jié)合文首推測(cè),應(yīng)該是用的三次Hermite曲線,不了解Hermite曲線的朋友可以移步這篇文章:傳送門(mén)
這里直接給出三次Hermite曲線的表達(dá)式:
p(t)=(1?3t2+2t3)p0+(t?2t2+t3)v0+(3t2?2t3)p1+(t3?t2)v1p(t)=(1-3t^2+2t^3)p_0+(t-2t^2+t^3)v_0+(3t^2-2t^3)p_1+(t^3-t^2)v_1p(t)=(1?3t2+2t3)p0?+(t?2t2+t3)v0?+(3t2?2t3)p1?+(t3?t2)v1?
v(t)=(6t2?6t)p0+(3t2?4t+1)v0+(6t?6t2)p1+(3t2?2t)v1v(t)=(6t^2-6t)p_0+(3t^2-4t+1)v_0+(6t-6t^2)p_1+(3t^2-2t)v_1v(t)=(6t2?6t)p0?+(3t2?4t+1)v0?+(6t?6t2)p1?+(3t2?2t)v1?
a(t)=(12t?6)p0+(6t?4)v0+(6?12t)p1+(6t?2)v1a(t)=(12t-6)p_0+(6t-4)v_0+(6-12t)p_1+(6t-2)v_1a(t)=(12t?6)p0?+(6t?4)v0?+(6?12t)p1?+(6t?2)v1?
j(t)=12p0+6v0?12p1+6v1j(t)=12p_0+6v_0-12p_1+6v_1j(t)=12p0?+6v0??12p1?+6v1?
由此可見(jiàn),加加速度確實(shí)為定值。
令p0=0p_0=0p0?=0、v0=0v_0=0v0?=0、p1=△Pp_1=\triangle Pp1?=△P、v1=Vv_1 = Vv1?=V,則有:
v(t)=(6t?6t2)△P+(3t2?2t)V=(3V?6△P)t2+(6△P?2V)tv(t)=(6t-6t^2)\triangle P+(3t^2-2t)V=(3V-6\triangle P)t^2+(6\triangle P-2V)tv(t)=(6t?6t2)△P+(3t2?2t)V=(3V?6△P)t2+(6△P?2V)t
a(t)=(6?12t)△P+(6t?2)V=(6V?12△P)t+(6△P?2V)a(t)=(6-12t)\triangle P+(6t-2)V=(6V-12\triangle P)t+(6\triangle P-2V)a(t)=(6?12t)△P+(6t?2)V=(6V?12△P)t+(6△P?2V)
以下是說(shuō)明書(shū)中給出的常見(jiàn)PVT模式的時(shí)間-速度曲線,發(fā)現(xiàn)圖像與上述公式完全相符。轉(zhuǎn)載請(qǐng)注明出處,羅伯特祥。matlab符號(hào)運(yùn)算驗(yàn)證代碼如下:
syms t p0 p1 v0 v1 real;p = (1 - 3*t^2 + 2*t^3)*p0 + (t - 2*t^2 + t^3)*v0 + (3*t^2-2*t^3)*p1 + (t^3-t^2)*v1v = diff(p,t)v = subs(v,p0,0); v = subs(v,v0,0); v = subs(v,p1,2*v1/3); v = expand(v)注意:下圖中▲P與V的關(guān)系中,橫坐標(biāo)標(biāo)注的t是一個(gè)單位量,代入公式時(shí)應(yīng)當(dāng)作一個(gè)常量看待。
此外,說(shuō)明書(shū)還給出了一個(gè)比較有意思的圓弧構(gòu)建案例:
最后,給出一個(gè)PVT插補(bǔ)案例,代碼如下:
clear,clc,close alldt = 1; t = 0:dt:20; X = 100*sin(0.2*pi*t); Vx = 0.2*pi*100*cos(0.2*pi*t);count = 1; time = 0; n = 1000; for i=1:length(X)if(i>=2)q0 = X(i-1);q1 = X(i);v0 = Vx(i-1);v1 = Vx(i);traj = pvt(q0,q1,v0,v1,n);for k=1:length(traj)Xpvt(count) = traj(k);time = time + dt/n;tpvt(count) = time;count = count + 1;endend endplot(t,X,"*") hold on plot(tpvt,Xpvt) t = 0:0.0001:20; plot(t,100*sin(0.2*pi*t)) legend("插值點(diǎn)","pvt","理想軌跡")function traj = pvt(p0,p1,v0,v1,n)dt = 1/n;tt = dt:dt:1;for i=1:length(tt)t = tt(i);H0 = 1 - 3*t^2 + 2*t^3;H1 = t - 2*t^2 + t^3;H2 = 3*t^2 - 2*t^3;H3 = t^3 - t^2;traj(i) = H0 * p0 + H1*v0 + H2*p1 + H3*v1;end end結(jié)論: PMAC應(yīng)用三次Hermite spline實(shí)現(xiàn)的PVT功能。
總結(jié)
以上是生活随笔為你收集整理的PMAC的PVT功能实现解析笔记的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 你真的了解Cadence吗?
- 下一篇: 【JS继承】JS继承之寄生式继承