1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604
|
function []=mvcr(x,y,theta,phi)
///////////////%% BEGIN OF SCRIPT-FILE mvcr %%%%%%%%%%%%%%%
//
// CAR PACKING VIA FLATNESS AND FRENET FORMULAS
//
// explicit computation and visualisation of the motions.
//
// February 1993
//
// ............................................................
// : pierre ROUCHON <rouchon@cas.ensmp.fr> :
// : Centre Automatique et Systemes, Ecole des Mines de Paris :
// : 60, bd Saint Michel -- 75272 PARIS CEDEX 06, France :
// : Telephone: (1) 40 51 91 15 --- Fax: (1) 43 54 18 93 :
// :..........................................................:
//
//
// bigL: car length (m)
// bigT: basic time interval for one smooth motion (s)
// a0, a1, p(3): intermediate variables for polynomial
// curves definition
//
//
// Copyright INRIA
xbasc() ;
bigT = 1 ; bigL = 1 ;
a0 =0 ; a1 = 0 ;
p= [0 0 0 ] ;
//
// initial configuration of the car
x1 = x ; y1 = y ; theta1 = theta ; phi1 = phi ;
// final configuration of the car
x2 = 0 ; y2 = 0 ; theta2 =0; phi2 = 0 ;
// Constraints: y1 > y2 and -%pi/2 < theta1,2, phi1,2 < %pi/2
//
// sampling of motion 1 --> 0 and 0 --> 2
nbpt = 40 ;
// computation of intermediate configuration
x0 = maxi(x1,x2) ....
+ bigL*abs(tan(theta1)) .....
+ bigL*abs(tan(theta2)) .....
+ bigL*(abs(y1-y2)/bigL)^(1/2) ;
y0 = (y1+y2)/2 ;
//
//
// first polynomial curve
a0 = x0 ; b0 = y0 ;
a1 = x1 ; b1 = y1 ;
M = [
(a1-a0)^3 (a1-a0)^4 (a1-a0)^5
3*(a1-a0)^2 4*(a1-a0)^3 5*(a1-a0)^4
6*(a1-a0) 12*(a1-a0)^2 20*(a1-a0)^3
] ;
q = [
b1-b0
tan(theta1)
tan(phi1)/(bigL*(cos(theta1)^3))
] ;
p = inv(M)*q ;
//
// computation the first motion, time: 1 -> 0
state=[ x1 y1 theta1 phi1 ] ;
for i=1:(nbpt+1)
tau = (i-1)/nbpt ;
phi=tau*tau*(3-2*tau) ;
a = (1-phi)*a1 + phi*a0 ;
f= b0+ p(1).*(a-a0)^3 + p(2).*(a-a0)^4 + p(3).*(a-a0)^5 ;
df = 3*p(1).*(a-a0)^2 + 4*p(2).*(a-a0)^3 + 5*p(3).*(a-a0)^4 ;
ddf = 6*p(1).*(a-a0) + 12*p(2).*(a-a0)^2 + 20*p(3).*(a-a0)^3 ;
k = ddf / ((1+df*df)^(3/2)) ;
state = [ state; a f atan(df) atan(k*bigL)] ;
end
//
//
// second polynomial curve
a0 = x0 ; b0 = y0 ;
a1 = x2 ; b1 = y2 ;
M = [
(a1-a0)^3 (a1-a0)^4 (a1-a0)^5
3*(a1-a0)^2 4*(a1-a0)^3 5*(a1-a0)^4
6*(a1-a0) 12*(a1-a0)^2 20*(a1-a0)^3
] ;
q = [
b1-b0
tan(theta2)
tan(phi2)/(bigL*(cos(theta2)^3))
] ;
p = inv(M)*q ;
//
// computation of the second motion 0 --> 2
for i=1:(nbpt+1)
tau = (i-1)/nbpt ;
phi=tau*tau*(3-2*tau) ;
a = (1-phi)*a0 + phi*a1 ;
f= b0+ p(1).*(a-a0)^3 + p(2).*(a-a0)^4 + p(3).*(a-a0)^5 ;
df = 3*p(1).*(a-a0)^2 + 4*p(2).*(a-a0)^3 + 5*p(3).*(a-a0)^4 ;
ddf = 6*p(1).*(a-a0) + 12*p(2).*(a-a0)^2 + 20*p(3).*(a-a0)^3 ;
k = ddf / ((1+df*df)^(3/2)) ;
state = [ state; a f atan(df) atan(k*bigL)] ;
end
//
//
// Graphics
//
// window size
xmini = mini(state(:,1))-0.5*bigL ;
xmaxi = maxi(state(:,1))+1.5*bigL ;
ymini = mini(state(:,2))-1.5*bigL ;
ymaxi = maxi(state(:,2))+1.5*bigL ;
//xsetech([0,0,1,1],[xmini,ymini,xmaxi,ymaxi]);
pixb=xget("pixmap");xset("pixmap",1);xset("wwpc");
isoview(xmini,xmaxi,ymini,ymaxi)
rect=[xmini ymini xmaxi ymaxi]
xpoly(rect([1 3 3 1]),rect([2,2,4,4]),'lines',1)
// starting configuration
ptcr([x1,y1,theta1,phi1]) ;
// end configuration
ptcr([x2,y2,theta2,phi2]) ;
// intermediate configuration (inversion of velocity)
ptcr([x0,y0,0,0]) ;
// trajectory of the linearizing output
xpoly(state(:,1),state(:,2),'lines') ;
if xget('pixmap')==1 then xset("wshow");end
// movies
[n m] = size(state) ;
if driver()<>'Pos' then
if xget('pixmap')==0 then
xset('alufunction',6);...
for i=1:n,
ptcr( state(i,:)) ; ptcr( state(i,:)) ;
end ;
xset('alufunction',3);
else
xset('alufunction',6);
for i=1:n,
ptcr( state(i,:)) ;
xset("wshow");
ptcr( state(i,:))
end ;
xset('alufunction',3)
ptcr( state(n,:)) ;
xset("wshow");
end
else //used for gif animation generation
for i=1:2:n,
xpoly(rect([1 3 3 1]),rect([2,2,4,4]),'lines',1)
ptcr([x1,y1,theta1,phi1]) ;
ptcr([x2,y2,theta2,phi2]) ;
ptcr([x0,y0,0,0])
xpoly(state(:,1),state(:,2),'lines') ;
ptcr( state(i,:)) ;
xset("wshow");
end ;
end
xset("pixmap",pixb)
function []=mvcr2T(x,y,theta1,theta2,theta3,phi)
xbasc();
//
// CAR WITH 2 TRAILERS PACKING VIA FLATNESS AND FRENET FORMULAS
//
// explicit computation and visualisation of the motions.
//
// February 1993
//
// ............................................................
// : pierre ROUCHON <rouchon@cas.ensmp.fr> :
// : Centre Automatique et Systemes, Ecole des Mines de Paris :
// : 60, bd Saint Michel -- 75272 PARIS CEDEX 06, France :
// : Telephone: (1) 40 51 91 15 --- Fax: (1) 43 54 18 93 :
// :..........................................................:
//
// lengths
// bigL: car length (m)
// d1: trailer 1 length (m)
// d2: trailer 2 length (m)
// bigT: basic time interval for one smooth motion (s)
// a0, a1, b0, p(5): intermediate variables for polynomial
// curves definition
//
bigT = 1 ;
bigL = 1 ; d1 = 1.5 ; d2 = 1 ;
a0 =0 ; a1 = 0 ; b0 = 0 ;
p= [0 0 0 0 0 ] ;
//
// initial configuration
// the system is described via the coordinates of last trailer
//
x2_1 = x ; y2_1 = y ;
theta2_1= theta1; theta12_1 = theta2 ; theta01_1= theta3 ;
phi_1 = phi ;
//
// final configuration of the car
x2_2 = 0 ; y2_2 = 0 ;
theta2_2= 0 ; theta12_2 = 0 ; theta01_2= 0 ;
phi_2 = 0 ;
//
// sampling of motion 1 --> 0 and of motion 0 --> 2
nbpt1 = 40 ; nbpt2 = 40 ;
//
// Constraints: y2_1 > y2_2 and
// the 4 angles theta2_1,2
// theta12_1,2
// theta01_1,2
// phi_1,2
// must belong to ] -%pi/2 , + %pi/2 [
//
//
// conputation of intermediate configuration
LL=bigL+d1+d2
x2_0 = maxi(x2_1,x2_2) ....
+ LL*abs(tan(theta2_1)) ....
+ LL*abs(tan(theta12_1)) ....
+ LL*abs(tan(theta01_1)) ....
+ LL*( abs(y2_1-y2_2)/(d1+d2+bigL) )^(1/2) ;
y2_0 = (y2_1+y2_2)/2 ;
//
//
// first polynomial curve
a0 = x2_0 ; b0 = y2_0 ;
a1 = x2_1 ; b1 = y2_1 ;
p=cr2Tkf((b1-b0),theta2_1,theta12_1,theta01_1,phi_1) ;
//
// computation the first motion 1 -> 0
theta2 = theta2_1 ;
theta1 = theta12_1+theta2 ;
theta0 = theta01_1+theta1 ;
phi = phi_1 ;
x0=x2_1+d2*cos(theta2)+d1*cos(theta1) ;
y0=y2_1+d2*sin(theta2)+d1*sin(theta1) ;
state_1 = [x0 y0 theta0 theta1 theta2 phi] ;
for i=1:(nbpt1+1)
tau = (i-1)/nbpt1 ;
phi=tau*tau*(3-2*tau) ;
aa = (1-phi)*a1 + phi*a0 ;
[bb df d2f d3f d4f d5f] = cr2Tfjt(aa) ;
[k2 k1 k0 dk0]=cr2Tfk(df,d2f,d3f,d4f,d5f) ;
theta2 = atan(df);
theta1 = atan(k2*d2)+theta2;
theta0 = atan(k1*d1) + theta1 ;
phi = atan(k0*bigL) ;
x0=aa+d2*cos(theta2)+d1*cos(theta1) ;
y0=bb+d2*sin(theta2)+d1*sin(theta1) ;
state_1 = [ state_1 ; x0 y0 theta0 theta1 theta2 phi] ;
end ;
//
// second polynomial curve
a0 = x2_0 ; b0 = y2_0 ;
a1 = x2_2 ; b1 = y2_2 ;
p=cr2Tkf((b1-b0),theta2_2,theta12_2,theta01_2,phi_2) ;
//
// computation of the second motion 0 -> 2
theta2 = 0 ;
theta1 = 0 ;
theta0 = 0 ;
phi = 0 ;
x0=x2_0+d2*cos(theta2)+d1*cos(theta1) ;
y0=y2_0+d2*sin(theta2)+d1*sin(theta1) ;
state_2 = [x0 y0 theta0 theta1 theta2 phi] ;
for i=1:(nbpt2+1)
tau = (i-1)/nbpt2 ;
phi=tau*tau*(3-2*tau) ;
aa = (1-phi)*a0 + phi*a1 ;
[bb df d2f d3f d4f d5f] = cr2Tfjt(aa) ;
[k2 k1 k0 dk0]=cr2Tfk(df,d2f,d3f,d4f,d5f) ;
theta2 = atan(df);
theta1 = atan(k2*d2)+theta2;
theta0 = atan(k1*d1) + theta1 ;
phi = atan(k0*bigL) ;
x0=aa+d2*cos(theta2)+d1*cos(theta1) ;
y0=bb+d2*sin(theta2)+d1*sin(theta1) ;
state_2 = [ state_2 ; x0 y0 theta0 theta1 theta2 phi] ;
end ;
//
// Graphics
//
// window size
xmini = mini([mini(state_1(:,1)) mini(state_2(:,1))]) -1.5*(d1+d2) ;
xmaxi = maxi([maxi(state_1(:,1)) maxi(state_1(:,1))]) +1.5*bigL ;
ymini = mini([mini(state_1(:,2)) mini(state_2(:,2))])-bigL;
ymaxi = maxi([maxi(state_1(:,2)) maxi(state_1(:,2))])+bigL;
rect=[xmini ymini xmaxi ymaxi]
pixb=xget("pixmap");xset("pixmap",1);xset("wwpc");
xsetech([0,0,1,1],rect);
isoview(xmini,xmaxi,ymini,ymaxi)
xpoly(rect([1 3 3 1]),rect([2,2,4,4]),'lines',1)
//
xy_T1 = [ [-bigL/3 bigL/3 bigL/3 -bigL/3 -bigL/3
-bigL/3 -bigL/3 bigL/3 bigL/3 -bigL/3 ], .....
[ bigL/3 d1;
0 0], .....
[-bigL/8 bigL/8
bigL/6 bigL/6
], ....
[-bigL/8 bigL/8
-bigL/6 -bigL/6 ] ] ;
xy_T2 = [[-bigL/3 bigL/3 bigL/3 -bigL/3 -bigL/3
-bigL/3 -bigL/3 bigL/3 bigL/3 -bigL/3 ],...
[bigL/3 d2
0 0 ],[ -bigL/8 bigL/8
bigL/6 bigL/6
],[ -bigL/8 bigL/8
-bigL/6 -bigL/6 ] ] ;
// starting configuration
x2=x2_1 ; y2=y2_1 ;
theta2 = theta2_1 ;
theta1 = theta12_1+theta2 ;
theta0 = theta01_1+theta1 ;
phi = phi_1 ;
x1=x2+d2*cos(theta2) ;
y1=y2+d2*sin(theta2) ;
x0=x1+d1*cos(theta1) ;
y0=y1+d1*sin(theta1) ;
ptsts=[x0,y0,theta0,theta1,theta2,phi] ;
ptcr2T(ptsts) ;
// end configuration
x2=x2_2 ; y2=y2_2 ;
theta2 = theta2_2 ;
theta1 = theta12_2+theta2 ;
theta0 = theta01_2+theta1 ;
phi = phi_2 ;
x1=x2+d2*cos(theta2) ;
y1=y2+d2*sin(theta2) ;
x0=x1+d1*cos(theta1) ;
y0=y1+d1*sin(theta1) ;
ptste=[x0,y0,theta0,theta1,theta2,phi]
ptcr2T(ptste) ;
// intermediate configuration (inversion of velocity)
x2=x2_0 ; y2=y2_0 ;
theta2 = 0 ;
theta1 = 0;
theta0 = 0 ;
phi = 0;
x1=x2+d2*cos(theta2) ;
y1=y2+d2*sin(theta2) ;
x0=x1+d1*cos(theta1) ;
y0=y1+d1*sin(theta1) ;
ptsti=[x0,y0,theta0,theta1,theta2,phi]
ptcr2T(ptsti) ;
state_1 =[state_1;state_2] ;
x_lin = state_1(:,1)-d1*cos(state_1(:,4))-d2*cos(state_1(:,5)) ;
y_lin = state_1(:,2)-d1*sin(state_1(:,4))-d2*sin(state_1(:,5)) ;
// motion
//
// trajectory of the linearizing output
xpoly(x_lin,y_lin,'lines')
if xget('pixmap')==1 then xset("wshow");end
// movies
[n,m] = size(state_1) ;
if driver()<>'Pos' then
if xget('pixmap')==0 then
xset('alufunction',6);
for j=1:n
ptcr2T(state_1(j,:));ptcr2T(state_1(j,:));
end ;
xset('alufunction',3);
else
xset('alufunction',6);
for j=1:n
ptcr2T(state_1(j,:));
xset("wshow");
ptcr2T(state_1(j,:));
end
xset('alufunction',3);
ptcr2T(state_1(n,:));
xset("wshow");
end
else //only use for gif animation generation
for j=1:4:n
xpoly(rect([1 3 3 1]),rect([2,2,4,4]),'lines',1)
ptcr2T(ptsts) ;
ptcr2T(ptsti) ;
ptcr2T(ptste) ;
xpoly(x_lin,y_lin,'lines')
ptcr2T(state_1(j,:))
xset("wshow");
end
end
xset("pixmap",pixb)
////%%%%%%%%%%%% END OF SCRIPT-FILE mvcr2T %%%%%%%%%%%%%
function []=dbcr()
//
// CAR PACKING VIA FLATNESS AND FRENET FORMULAS
//
// debugg and verification via integration
// of the non holonomic system
//
// February 1993
//
// ............................................................
// : pierre ROUCHON <rouchon@cas.ensmp.fr> :
// : Centre Automatique et Systemes, Ecole des Mines de Paris :
// : 60, bd Saint Michel -- 75272 PARIS CEDEX 06, France :
// : Telephone: (1) 40 51 91 15 --- Fax: (1) 43 54 18 93 :
// :..........................................................:
//
//
// bigL: car length (m)
// bigT: basic time interval for one smooth motion (s)
// a0, a1, p(3): intermediate variables for polynomial
// curves definition
//
//
bigT = 1 ; bigL = 1 ;
a0 =0 ; a1 = 0 ;
p= [0 0 0 ] ;
//
// initial configuration of the car
x1 = 0 ; y1 = 4 ; theta1 = %pi/2.5 ; phi1 = 0 ;
// final configuration of the car
x2 = 0 ; y2 = 0 ; theta2 =0; phi2 = 0 ;
// Constraints: y1 > y2 and -%pi/2 < theta1,2, phi1,2 < %pi/2
//
// conputation of intermediate configuration
x0 = maxi(x1,x2) ....
+ bigL*abs(tan(theta1)) .....
+ bigL*abs(tan(theta2)) .....
+ bigL*(abs(y1-y2)/bigL)^(1/2) ;
y0 = (y1+y2)/2 ;
//
//
// first polynomial curve
a0 = x0 ; b0 = y0 ;
a1 = x1 ; b1 = y1 ;
M = [
(a1-a0)^3 (a1-a0)^4 (a1-a0)^5
3*(a1-a0)^2 4*(a1-a0)^3 5*(a1-a0)^4
6*(a1-a0) 12*(a1-a0)^2 20*(a1-a0)^3
] ;
q = [
b1-b0
tan(theta1)
tan(phi1)/(bigL*(cos(theta1)^3))
] ;
p = inv(M)*q ;
//
// simulation of the first motion, time: 0 -> bigT
[t_1,state_1]=ode23('car',0,bigT, [ x1 y1 theta1 phi1 ]);
//
//
// second polynomial curve
a0 = x0 ; b0 = y0 ;
a1 = x2 ; b1 = y2 ;
M = [
(a1-a0)^3 (a1-a0)^4 (a1-a0)^5
3*(a1-a0)^2 4*(a1-a0)^3 5*(a1-a0)^4
6*(a1-a0) 12*(a1-a0)^2 20*(a1-a0)^3
] ;
q = [
b1-b0
tan(theta2)
tan(phi2)/(bigL*(cos(theta2)^3))
] ;
p = inv(M)*q ;
//
// simulation of the second motion, time: bigT -> 2bigT
[n m]=size(t_1);
[t_2,state_2]=ode23('car',bigT,2*bigT, state_1(n,:) );
//
//
// result array merging
t_1=t_1(2:n) ; state_1=state_1(2:n,:);
t=[
t_1
t_2
];
state = [
state_1
state_2
];
//
//
plot(t,state) ;
// xlabel('time (s)') ;
// ylabel('x y theta phi ') ;
//%%%%%%%%%//%%%% END OF SCRIPT-FILE dbcr %%%%%%%%%%%%
function []=dbcr2T()
//
// CAR WITH 2 TRAILERS PACKING VIA FLATNESS AND FRENET FORMULAS
//
// debugg and verification via the integration
// of the non holonomic system.
//
// February 1993
//
// ............................................................
// : pierre ROUCHON <rouchon@cas.ensmp.fr> :
// : Centre Automatique et Systemes, Ecole des Mines de Paris :
// : 60, bd Saint Michel -- 75272 PARIS CEDEX 06, France :
// : Telephone: (1) 40 51 91 15 --- Fax: (1) 43 54 18 93 :
// :..........................................................:
//
// lengths
// bigL: car length (m)
// d1: trailer 1 length (m)
// d2: trailer 2 length (m)
// bigT: basic time interval for one smooth motion (s)
// a0, a1, p(5): intermediate variables for polynomial
// curves definition
//
bigT = 1 ;
bigL = 1 ; d1 = 1.5 ; d2 = 1 ;
a0 =0 ; a1 = 0 ; b0 = 0 ;
p= [0 0 0 0 0 ] ;
//
// initial configuration
// the system is described via the coordinates of last trailer
x2_1 = 0 ; y2_1 = 6 ;
theta2_1= %pi/8; theta12_1 = %pi/8 ; theta01_1= %pi/8 ;
phi_1 = %pi/8 ;
//
// final configuration of the car
x2_2 = 0 ; y2_2 = 0 ;
theta2_2= 0 ; theta12_2 = 0 ; theta01_2= 0 ;
phi_2 = 0 ;
//
// Constraints: y2_1 > y2_2 and
// the 4 angles theta2_1,2
// theta12_1,2
// theta01_1,2
// phi_1,2
// must belong to ] -%pi/2 , + %pi/2 [
//
//
// conputation of intermediate configuration
LL=bigL+d1+d2 ;
x2_0 = maxi(x2_1,x2_2) ....
+ LL*abs(tan(theta2_1)) ....
+ LL*abs(tan(theta12_1)) ....
+ LL*abs(tan(theta01_1)) ....
+ LL*( abs(y2_1-y2_2)/(d1+d2+bigL) )^(1/2) ;
y2_0 = (y2_1+y2_2)/2 ;
//
//
//
// first polynomial curve
a0 = x2_0 ; b0 = y2_0 ;
a1 = x2_1 ; b1 = y2_1 ;
p=cr2Tkf((b1-b0),theta2_1,theta12_1,theta01_1,phi_1) ;
//
// simulation of the first motion 0 -> T
// time t between 0 and bigT
theta2 = theta2_1 ;
theta1 = theta12_1+theta2 ;
theta0 = theta01_1+theta1 ;
phi = phi_1 ;
x0=x2_1+d2*cos(theta2)+d1*cos(theta1) ;
y0=y2_1+d2*sin(theta2)+d1*sin(theta1) ;
[t_1,state_1]=ode45('car2T',0,bigT, ....
[ x0 y0 theta0 theta1 theta2 phi ]);
// graphics
subplot(121);
plot(t_1,state_1(:,1:2)) ;
xlabel('time (s)') ;
ylabel('x_car y_car (m)') ;
subplot(122);
plot(t_1,state_1(:,3:6)) ;
xlabel('time (s)') ;
ylabel('theta0 theta1 theta2 phi (rd)') ;
//
//
// second polynomial curve
a0 = x2_0 ; b0 = y2_0 ;
a1 = x2_2 ; b1 = y2_2 ;
p=cr2Tkf((b1-b0),theta2_2,theta12_2,theta01_2,phi_2) ;
//
// simulation of the second motion bigT -> 2*bigT
//
// important remark: due to numerical instability of the
// integration during inverse motion, we integrate
// from the final position 2 to the intermediate position 0.
//
theta2 = theta2_2 ;
theta1 = theta12_2+theta2 ;
theta0 = theta01_2+theta1 ;
phi = phi_2 ;
x0=x2_2+d2*cos(theta2)+d1*cos(theta1) ;
y0=y2_2+d2*sin(theta2)+d1*sin(theta1) ;
[t_2,state_2]=ode45('car2T',0,bigT, ....
[ x0 y0 theta0 theta1 theta2 phi ]);
//
//
//
// graphics
t_2 = 2*bigT - t_2 ;
subplot(121);
plot(t_2,state_2(:,1:2)) ;
xlabel('time (s)') ;
ylabel('x_car y_car (m)') ;
subplot(122);
plot(t_2,state_2(:,3:6)) ;
xlabel('time (s)') ;
ylabel('theta0 theta1 theta2 phi (rd)') ;
//%%%%%%%%%%%%%% END OF SCRIPT-FILE dbcr2T %%%%%%%%%%%%
|