当前位置:网站首页>Polynomial locus of order 5

Polynomial locus of order 5

2022-07-07 05:41:00 An audience who doesn't understand music

Prerequisite

  • In order to get a track with continuous speed , Then each track in the track needs to meet the position and speed constraints (4 A boundary condition ), That is, the previous track J i − 1 J_{i-1} Ji1 The position and speed of the end point should be the same as that of the next track J i J_{i} Ji The position and speed are the same , Therefore, the third-order polynomial is used to represent each trajectory .
  • In order to obtain a continuous acceleration trajectory , Then each track in the track needs to meet the position 、 Velocity and acceleration constraints (6 A boundary condition ), That is, the previous track J i − 1 J_{i-1} Ji1 The end position of 、 The speed and acceleration should be consistent with the later trajectory J i J_{i} Ji The location of 、 The speed and acceleration are the same , Therefore, the fifth order polynomial is used to represent each trajectory .

Text

   about One In terms of trajectory , Usually, a continuous trajectory can be segmented into multi segment polynomial trajectory , Here, consider using 5 Polynomial of order . The corresponding time of each track is from 0 0 0 Start to T i T_i Ti end , That is to say, for the i i i Segment trajectory J i J_i Ji for , Its start time is 0 0 0, The end time is T i T_i Ti, The starting position 、 Speed 、 The accelerations are p i p_i pi v i v_i vi and a i a_i ai. According to the definition of polynomial trajectory
p = c 0 + c 1 t + c 2 t 2 + c 3 t 3 + c 4 t 4 + c 5 t 5 v = c 1 + 2 c 2 t + 3 c 3 t 2 + 4 c 4 t 3 + 5 c 5 t 4 a = 2 c 2 + 6 c 3 t + 12 c 4 t 2 + 20 c 5 t 3 j e r k = 6 c 3 + 24 c 4 t + 60 c 5 t 2 s n a p = 24 c 4 + 120 c 5 t . ( Male type 1 ) \begin{aligned} p&=c_{0}+c_{1}t+c_{2}t^2+c_{3}t^3+c_{4}t^4+c_{5}t^5 \\ v&=\quad\quad c_{1}+2c_{2}t+3c_{3}t^2+4c_{4}t^3+5c_{5}t^4 \\ a&=\quad\quad\quad\quad2c_{2}+6c_{3}t+12c_{4}t^2+20c_{5}t^3 \\ jerk&=\quad\quad\quad\quad\quad\quad \quad6c_{3}+24c_{4}t+60c_{5}t^2 \\ snap&=\quad\quad\quad\quad\quad\quad \quad\quad \quad\quad 24c_{4}+120c_{5}t. \quad\quad( The formula 1)\\ \end{aligned} pvajerksnap=c0+c1t+c2t2+c3t3+c4t4+c5t5=c1+2c2t+3c3t2+4c4t3+5c5t4=2c2+6c3t+12c4t2+20c5t3=6c3+24c4t+60c5t2=24c4+120c5t. Male type 1
By the end of 1 1 1 Take segment trajectory as an example , take t = 0 t=0 t=0 Into the ( The formula 1) You can get the beginning of the first track :
p 1 ( 0 ) = c 10 , v 1 ( 0 ) = c 11 , a 1 ( 0 ) = 2 c 12 . \begin{aligned} p_1(0)&=c_{10}, \\ v_1(0)&=c_{11},\\ a_1(0)&=2c_{12}. \end{aligned} p1(0)v1(0)a1(0)=c10,=c11,=2c12.
take t = T 1 t=T_1 t=T1 Into the ( The formula 1) You can get the initial end of the first track :
p 1 ( T 1 ) = c 10 + c 11 ( T 1 − 0 ) + c 12 ( T 1 − 0 ) 2 + c 13 ( T 1 − 0 ) 3 + c 14 ( T 1 − 0 ) 4 + c 15 ( T 1 − 0 ) 5 = c 10 + c 11 T 1 + c 12 T 1 2 + c 13 T 1 3 + c 14 T 1 4 + c 15 T 1 5 , v 1 ( T 1 ) = c 11 + 2 c 12 ( T 1 − 0 ) + 3 c 13 ( T 1 − 0 ) 2 + 4 c 14 ( T 1 − 0 ) 3 + 5 c 15 ( T 1 − 0 ) 4 = c 11 + 2 c 12 ( T 1 ) + 3 c 13 ( T 1 ) 2 + 4 c 14 ( T 1 ) 3 + 5 c 15 ( T 1 ) 4 , a 1 ( T 1 ) = 2 c 12 + 6 c 13 ( T 1 − 0 ) + 12 c 14 ( T 1 − 0 ) 2 + 20 c 15 ( T 1 − 0 ) 3 = 2 c 12 + 6 c 13 ( T 1 ) + 12 c 14 ( T 1 ) 2 + 20 c 15 ( T 1 ) 3 . \begin{aligned} p_1(T_1)&=c_{10}+c_{11}(T_1-0)+c_{12}(T_1-0)^2+c_{13}(T_1-0)^3+c_{14}(T_1-0)^4+c_{15}(T_1-0)^5 \\ & = c_{10}+c_{11}T_1+c_{12}T_1^2+c_{13}T_1^3+c_{14}T_1^4+c_{15}T_1^5, \\ v_1(T_1)&=c_{11}+2c_{12}(T_1-0)+3c_{13}(T_1-0)^2+4c_{14}(T_1-0)^3+5c_{15}(T_1-0)^4 \\ & = c_{11}+2c_{12}(T_1)+3c_{13}(T_1)^2+4c_{14}(T_1)^3+5c_{15}(T_1)^4, \\ a_1(T_1)&=2c_{12}+6c_{13}(T_1-0)+12c_{14}(T_1-0)^2+20c_{15}(T_1-0)^3\\ & = 2c_{12}+6c_{13}(T_1)+12c_{14}(T_1)^2+20c_{15}(T_1)^3. \end{aligned} p1(T1)v1(T1)a1(T1)=c10+c11(T10)+c12(T10)2+c13(T10)3+c14(T10)4+c15(T10)5=c10+c11T1+c12T12+c13T13+c14T14+c15T15,=c11+2c12(T10)+3c13(T10)2+4c14(T10)3+5c15(T10)4=c11+2c12(T1)+3c13(T1)2+4c14(T1)3+5c15(T1)4,=2c12+6c13(T10)+12c14(T10)2+20c15(T10)3=2c12+6c13(T1)+12c14(T1)2+20c15(T1)3.
Similarly, when the second track starts :
p 2 ( 0 ) = c 20 , v 2 ( 0 ) = c 21 , a 2 ( 0 ) = 2 c 22 . \begin{aligned} p_2(0)&=c_{20}, \\ v_2(0)&=c_{21},\\ a_2(0)&=2c_{22}. \end{aligned} p2(0)v2(0)a2(0)=c20,=c21,=2c22.
Because a trajectory is composed of multi segment polynomial trajectory , So it needs to meet :
{ c 10 = p 1 ( 0 ) : rise beginning position Set up edge world strip Pieces of c 11 = v 1 ( 0 ) : rise beginning speed degree edge world strip Pieces of 2 c 12 = a 1 ( 0 ) : rise beginning Add speed degree edge world strip Pieces of front One paragraph rail trace end stop j e r k And after One paragraph rail trace rise beginning s n a p phase Same as , nothing j e r k Big Small about beam , namely j e r k 1 ( T 1 ) − j e r k 2 ( 0 ) = 0 6 c 13 + 24 c 14 T 1 + 60 c 15 T 1 2 − 6 c 23 = 0 front One paragraph rail trace end stop s n a p And after One paragraph rail trace rise beginning s n a p phase Same as , nothing s n a p Big Small about beam , namely s n a p 1 ( T 1 ) − s n a p 2 ( 0 ) = 0 24 c 14 + 120 T 1 − 24 c 24 = 0 front One paragraph rail trace end stop position Set up And after One paragraph rail trace rise beginning position Set up phase Same as , namely p 1 ( T 1 ) = p 2 ( 0 ) : c 10 + c 11 T 1 + c 12 T 1 2 + c 13 T 1 3 + c 14 T 1 4 + c 15 T 1 5 = p 2 ( 0 ) c 10 + c 11 T 1 + c 12 T 1 2 + c 13 T 1 3 + c 14 T 1 4 + c 15 T 1 5 − c 20 = 0 front One paragraph rail trace end stop position Set up And after One paragraph rail trace rise beginning speed degree phase Same as , namely v 1 ( T 1 ) − v 2 ( 0 ) = 0 c 11 + 2 c 12 T 1 + 3 c 13 T 1 2 + 4 c 14 T 1 3 + 5 c 15 T 1 4 − c 21 = 0 front One paragraph rail trace end stop position Set up And after One paragraph rail trace rise beginning Add speed degree phase Same as , namely a 1 ( T 1 ) − a 2 ( 0 ) = 0 2 c 12 + 6 c 13 T 1 + 12 c 14 T 1 2 + 20 c 15 T 1 3 − 2 c 22 = 0 \left\{\begin{aligned} &c_{10}=p_1(0): Starting position boundary condition \\ &c_{11}=v_1(0): Initial velocity boundary condition \\ &2c_{12}=a_1(0): Initial acceleration boundary condition \\ & The previous track ends jerk Start with the next track snap identical , nothing jerk Size constraints , namely jerk_1(T_1)-jerk_2(0)=0\\ &6c_{13}+24c_{14}T_1+60c_{15}T_1^2-6c_{23}=0\\ & The previous track ends snap Start with the next track snap identical , nothing snap Size constraints , namely snap_1(T_1)-snap_2(0)=0\\ &24c_{14}+120T_1-24c_{24}=0\\ & The ending position of the previous track is the same as the starting position of the next track , namely p_1(T_1)=p_2(0):\\ &c_{10}+c_{11}T_1+c_{12}T_1^2+c_{13}T_1^3+c_{14}T_1^4+c_{15}T_1^5=p_2(0)\\ &c_{10}+c_{11}T_1+c_{12}T_1^2+c_{13}T_1^3+c_{14}T_1^4+c_{15}T_1^5-c_{20}=0\\ & The ending position of the previous track is the same as the starting speed of the next track , namely v_1(T_1)-v_2(0)=0\\ &c_{11}+2c_{12}T_1+3c_{13}T_1^2+4c_{14}T_1^3+5c_{15}T_1^4-c_{21}=0\\ & The ending position of the previous track is the same as the starting acceleration of the next track , namely a_1(T_1)-a_2(0)=0\\ &2c_{12}+6c_{13}T_1+12c_{14}T_1^2+20c_{15}T_1^3-2c_{22}=0\\ \end{aligned}\right. c10=p1(0): rise beginning position Set up edge world strip Pieces of c11=v1(0): rise beginning speed degree edge world strip Pieces of 2c12=a1(0): rise beginning Add speed degree edge world strip Pieces of front One paragraph rail trace end stop jerk And after One paragraph rail trace rise beginning snap phase Same as , nothing jerk Big Small about beam , namely jerk1(T1)jerk2(0)=06c13+24c14T1+60c15T126c23=0 front One paragraph rail trace end stop snap And after One paragraph rail trace rise beginning snap phase Same as , nothing snap Big Small about beam , namely snap1(T1)snap2(0)=024c14+120T124c24=0 front One paragraph rail trace end stop position Set up And after One paragraph rail trace rise beginning position Set up phase Same as , namely p1(T1)=p2(0):c10+c11T1+c12T12+c13T13+c14T14+c15T15=p2(0)c10+c11T1+c12T12+c13T13+c14T14+c15T15c20=0 front One paragraph rail trace end stop position Set up And after One paragraph rail trace rise beginning speed degree phase Same as , namely v1(T1)v2(0)=0c11+2c12T1+3c13T12+4c14T13+5c15T14c21=0 front One paragraph rail trace end stop position Set up And after One paragraph rail trace rise beginning Add speed degree phase Same as , namely a1(T1)a2(0)=02c12+6c13T1+12c14T12+20c15T132c22=0

Convert the above constraints into a matrix Ax=b form , Available :
x = [ c 10 c 11 c 12 c 13 c 14 c 15 c 20 c 21 c 22 c 23 c 24 c 25 ] x=\begin{bmatrix} c_{10}\\ c_{11}\\ c_{12} \\ c_{13} \\ c_{14} \\ c_{15} \\ c_{20} \\ c_{21} \\ c_{22} \\ c_{23} \\ c_{24} \\ c_{25} \\ \end{bmatrix} x=c10c11c12c13c14c15c20c21c22c23c24c25

b = [ p 1 ( 0 ) v 1 ( 0 ) a 1 ( 0 ) 0 0 p 2 ( 0 ) 0 0 0 ] b=\begin{bmatrix} {p_1(0)}\\ {v_1(0)}\\ {a_1(0)}\\ 0\\ 0\\ p_2(0)\\ 0\\ 0\\ 0\\ \\ \end{bmatrix} b=p1(0)v1(0)a1(0)00p2(0)000

structure A The matrix is as follows :

01234567891011
0 1 1 1
1 1 1 1
2 2 2 2
3 6 6 6 24 T 1 24T_1 24T1 60 T 1 2 60T_1^2 60T12 − 6 -6 6
4 24 24 24 120 T 1 120T_1 120T1 − 24 -24 24
5 1 1 1 T 1 T_1 T1 T 1 2 T_1^2 T12 T 1 3 T_1^3 T13 T 1 4 T_1^4 T14 T 1 5 T_1^5 T15
6 1 1 1 T 1 T_1 T1 T 1 2 T_1^2 T12 T 1 3 T_1^3 T13 T 1 4 T_1^4 T14 T 1 5 T_1^5 T15 − 1 -1 1
7 1 1 1 2 T 1 2T_1 2T1 3 T 1 2 3T_1^2 3T12 4 T 1 3 4T_1^3 4T13 5 T 1 4 5T_1^4 5T14 − 1 -1 1
8 2 2 2 6 T 6T 6T 12 T 1 2 12T_1^2 12T12 20 T 1 3 20T_1^3 20T13 − 2 -2 2
9
10 1 1 1 T 2 T_2 T2 T 2 2 T_2^2 T22 T 2 3 T_2^3 T23 T 2 4 T_2^4 T24 T 2 5 T_2^5 T25
11 1 1 1 2 T 2 2T_2 2T2 3 T 2 2 3T_2^2 3T22 4 T 2 3 4T_2^3 4T23 5 T 2 4 5T_2^4 5T24
12 2 2 2 6 T 2 6T_2 6T2 12 T 2 2 12T_2^2 12T22 20 T 2 3 20T_2^3 20T23

notes : Red is OK / Column label .

inline void generate(const Eigen::MatrixXd &inPs,
const Eigen::VectorXd &ts)
{
    
	T1 = ts;
	T2 = T1.cwiseProduct(T1);
	T3 = T2.cwiseProduct(T1);
	T4 = T2.cwiseProduct(T2);
	T5 = T4.cwiseProduct(T1);
	A.reset();
	b.setZero();
	A(0, 0) = 1.0;
	A(1, 1) = 1.0;
	A(2, 2) = 2.0;
	b.row(0) = headPVA.col(0).transpose();
	b.row(1) = headPVA.col(1).transpose();
	b.row(2) = headPVA.col(2).transpose();
	for (int i = 0; i < N - 1; i++)
	{
    
		A(6 * i + 3, 6 * i + 3) = 6.0;
		A(6 * i + 3, 6 * i + 4) = 24.0 * T1(i);
		A(6 * i + 3, 6 * i + 5) = 60.0 * T2(i);
		A(6 * i + 3, 6 * i + 9) = -6.0;
		A(6 * i + 4, 6 * i + 4) = 24.0;
		A(6 * i + 4, 6 * i + 5) = 120.0 * T1(i);
		A(6 * i + 4, 6 * i + 10) = -24.0;
		A(6 * i + 5, 6 * i) = 1.0;
		A(6 * i + 5, 6 * i + 1) = T1(i);
		A(6 * i + 5, 6 * i + 2) = T2(i);
		A(6 * i + 5, 6 * i + 3) = T3(i);
		A(6 * i + 5, 6 * i + 4) = T4(i);
		A(6 * i + 5, 6 * i + 5) = T5(i);
		A(6 * i + 6, 6 * i) = 1.0;
		A(6 * i + 6, 6 * i + 1) = T1(i);
		A(6 * i + 6, 6 * i + 2) = T2(i);
		A(6 * i + 6, 6 * i + 3) = T3(i);
		A(6 * i + 6, 6 * i + 4) = T4(i);
		A(6 * i + 6, 6 * i + 5) = T5(i);
		A(6 * i + 6, 6 * i + 6) = -1.0;
		A(6 * i + 7, 6 * i + 1) = 1.0;
		A(6 * i + 7, 6 * i + 2) = 2 * T1(i);
		A(6 * i + 7, 6 * i + 3) = 3 * T2(i);
		A(6 * i + 7, 6 * i + 4) = 4 * T3(i);
		A(6 * i + 7, 6 * i + 5) = 5 * T4(i);
		A(6 * i + 7, 6 * i + 7) = -1.0;
		A(6 * i + 8, 6 * i + 2) = 2.0;
		A(6 * i + 8, 6 * i + 3) = 6 * T1(i);
		A(6 * i + 8, 6 * i + 4) = 12 * T2(i);
		A(6 * i + 8, 6 * i + 5) = 20 * T3(i);
		A(6 * i + 8, 6 * i + 8) = -2.0;
		b.row(6 * i + 5) = inPs.col(i).transpose();
	}
	A(6 * N - 3, 6 * N - 6) = 1.0;
	A(6 * N - 3, 6 * N - 5) = T1(N - 1);
	A(6 * N - 3, 6 * N - 4) = T2(N - 1);
	A(6 * N - 3, 6 * N - 3) = T3(N - 1);
	A(6 * N - 3, 6 * N - 2) = T4(N - 1);
	A(6 * N - 3, 6 * N - 1) = T5(N - 1);
	A(6 * N - 2, 6 * N - 5) = 1.0;
	A(6 * N - 2, 6 * N - 4) = 2 * T1(N - 1);
	A(6 * N - 2, 6 * N - 3) = 3 * T2(N - 1);
	A(6 * N - 2, 6 * N - 2) = 4 * T3(N - 1);
	A(6 * N - 2, 6 * N - 1) = 5 * T4(N - 1);
	A(6 * N - 1, 6 * N - 4) = 2;
	A(6 * N - 1, 6 * N - 3) = 6 * T1(N - 1);
	A(6 * N - 1, 6 * N - 2) = 12 * T2(N - 1);
	A(6 * N - 1, 6 * N - 1) = 20 * T3(N - 1);
	b.row(6 * N - 3) = tailPVA.col(0).transpose();
	b.row(6 * N - 2) = tailPVA.col(1).transpose();
	b.row(6 * N - 1) = tailPVA.col(2).transpose();
	A.factorizeLU();
	A.solve(b);
	return;
原网站

版权声明
本文为[An audience who doesn't understand music]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207062339141608.html

随机推荐