"______________________________________________________________________________";
"исходные данные";
dano={r1->0.953,r2->0.847,  r3->0.457,Vd->0.304,al->4.35,xd0->-2.16,yd0->1.18,tau->1.37,delta->0.01};
dano0={ fi1->1.63, fi2->3.37, fi3->2.87}; 
"координаты звеньев";
R1={{0,0},{r1 Cos[fi1],r1 Sin[fi1]}};
R2={R1[[2]],{R1[[2,1]]+ r2 Cos[fi2],R1[[2,2]]+ r2 Sin[fi2]} };
R3M={R2[[2]],{R2[[2,1]]+ 2 r3 Cos[fi3],R2[[2,2]]+ 2 r3 Sin[fi3]} };   
R3C={R2[[2]],{R2[[2,1]]+ r3 Cos[fi3+Pi/2],R2[[2,2]]+ r3 Sin[fi3+Pi/2]} };
"______________________________________________________________________________";



"прорисовка звеньев";
st1=Graphics[{Thick ,Line[R1]}];
st2=Graphics[{Thick ,Line[R2]}];
st3=Graphics[{Thick ,Line[R3M]}];
st4=Graphics[{Thick ,Line[R3C]}];
"прорисовка треугольника";
plita=Graphics[{EdgeForm[Thick], Pink,Polygon[ {R2[[2]],R2[[2]]+(R3M[[2]]-R3M[[1]])/3,R2[[2]]+(R3C[[2]]-R3C[[1]])/3 } ] }] ;
"прорисовка катка";
katok=Graphics[{Thick ,Circle[R3C[[2]],0.2]}]; 
"прорисовка схвата";
shvat=Graphics[{Thick ,Line[{{-0.12,-0.06}+R3M[[2]],{-0.06,-0.06}+R3M[[2]],{0,0}+R3M[[2]],{-0.06,0.06}+R3M[[2]],{-0.12,0.06}+R3M[[2]]} ]}];   
"прорисовка шарниров";
sh1=Graphics[{EdgeForm[Thick ], White,Disk[R1[[1]],0.02]}];
sh2=Graphics[{EdgeForm[Thick ], White,Disk[R1[[2]],0.02]}];
sh3=Graphics[{EdgeForm[Thick ], White,Disk[R2[[2]],0.02]}];
sh4=Graphics[{EdgeForm[Thick ], White,Disk[R3C[[2]],0.02]}];
sh5=Graphics[{EdgeForm[Thick ], White,Disk[R3M[[2]],0.02]}];



"______________________________________________________________________________"; 
"прорисовка земли";
zem=Table[Graphics[Line[{R3C[[2]]+{-0.5+i,-0.2}  ,R3C[[2]]+{-0.5+i-0.1,-0.3} }]],{i,0,1,0.1}]//.dano//.dano0 ;
zem=Append[zem,Graphics[{Thick ,Line[{R3C[[2]]+ {0.5,-0.2},R3C[[2]]+{-0.5,-0.2} }]}]//.dano//.dano0];
zem=Show[zem];
"прорисовка опоры";
opora= Table[Graphics[Line[{{-0.07+i,-0.07},{-0.07+i-0.05,-0.1} }]],{i,0,0.15,0.05}];
opora=Append[opora,Graphics[{Thick ,Line[{{0.07,-0.07},{0,0}, {-0.07 ,-0.07 },{0.07,-0.07}} ]}]];
opora=Show[opora ];
"______________________________________________________________________________"; 


"Вариант 31"
Show[opora,shvat,zem,katok,plita,st1,st2,st3,st4,sh1,sh2,sh3,sh4,sh5] //.dano //.dano0

"кинематика манипулятора";
GR[l_,om_,fi_]:={-l om Sin[fi],l om Cos[fi]};
"граф O--A--B--C"
yr1={0,0}+GR[r1,om1,fi1]+GR[r2,om2,fi2]+GR[r3,om3,fi3+Pi/2] -{Vc,0};(yr1//MatrixForm)==({0,0}//MatrixForm) 
"граф O--A--B--M"
yr2={0,0}+GR[r1,om1,fi1]+GR[r2,om2,fi2]+GR[2 r3,om3,fi3] -{Vmx,Vmy};(yr2//MatrixForm)==({0,0}//MatrixForm) 
"Решение СЛАУ";
sol=Solve[{yr1[[1]]==0,yr1[[2]]==0,yr2[[1]]==0,yr2[[2]]==0 },{om1,om2,om3,Vc}][[1]];sol//MatrixForm
"Подстановка формул сближения схвата с точкой Д";
sol=sol//.{Vmx->Vdx+(xd-xm)/T,Vmy->Vdy+(yd-ym)/T};
sol=sol//.T->-tau/Log[delta]; 
sol=sol//.{ xd->xd0+Vdx t, yd->yd0+Vdy t };
sol=sol//.{ xm->R3M [[2,1]], ym->R3M [[2,2]]};
sol=sol//.{Vdx->Vd Cos[al],Vdy->Vd Sin[al]}; 
"при t=0"
sol//.dano//.dano0//.t->0 //MatrixForm
"Решения дифференцальных уравнений";
Ddano={fi1->f1[t],fi2->f2[t],fi3->f3[t]};
Dsol=NDSolve[{D[f1[t],t]==(om1//.sol//.dano //.Ddano),f1[0] ==(fi1//.dano0),
                               D[f2[t],t]==(om2//.sol//.dano //.Ddano ),f2[0] ==(fi2//.dano0),
              D[f3[t],t]==(om3//.sol//.dano //.Ddano ),f3[0] ==(fi3//.dano0) },{f1,f2,f3},{t,0,(tau//.dano)} ][[1]];
Plot[(f1[t]/.Dsol),{t,0,(tau//.dano) },AxesLabel->{t,f1}] 
omm1=D[f1[t]/.Dsol,t];
Plot[omm1,{t,0,(tau//.dano) },AxesLabel->{t,om1}]

Plot[(f2[t]/.Dsol),{t,0,(tau//.dano) },AxesLabel->{t,f2} ]
omm2=D[f1[t]/.Dsol,t];
Plot[omm2,{t,0,(tau//.dano) },AxesLabel->{t,om2}] 

Plot[(f3[t]/.Dsol),{t,0,(tau//.dano) },AxesLabel->{t,f3} ]
omm3=D[f3[t]/.Dsol,t];
Plot[omm3,{t,0,(tau//.dano) },AxesLabel->{t,om3}] 

Plot[((Vc//.sol//.dano //.Ddano )/.Dsol),{t,0,(tau//.dano) },AxesLabel->{t,Vc} ] 
ParametricPlot[((R3M[[2]]//.sol//.dano //.Ddano )/.Dsol),{t,0,(tau//.dano) },AxesLabel->{Xм,Yм} ]

danoONLINE ={ fi1->f1[t], fi2->f2[t], fi3->f3[t]}/.Dsol;
RM[T_]:=ParametricPlot[((R3M[[2]]//.sol//.dano //.Ddano )/.Dsol),{t,0,T},Axes->False];
RD[T_]:=ParametricPlot[(({xd0+Vd Cos[al] t,yd0+Vd Sin[al] t}//.sol//.dano //.Ddano )/.Dsol),{t,0,T},Axes->False];
Animate[Show[RD[T],RM[T],(Show[opora,shvat,zem,katok,plita,st1,st2,st3,st4,sh1,sh2,sh3,sh4,sh5 ] //.dano //.danoONLINE /.{t->T}),PlotRange->{{-2.5,0.5},{-0.2,1.5}}],{T,0,(tau//.dano) },AnimationRunning->False,ControlPlacement->Bottom]