File: wheel.dem

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (57 lines) | stat: -rw-r--r-- 1,527 bytes parent folder | download | duplicates (2)
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
mode(-1);
// Copyright ENPC 
path=get_absolute_file_path("wheel.dem");
getf(path+'show.sci');

xbasc();
fs = get('figure_style');
set("figure_style","old")
flag1=tk_choose(['Reading a precomputed trajectory';
 'Simulation with ode (needs f77 and link. may fail, see help link)'],...
 'Simulation or Visualisation ? (click below)');

select flag1,
 case 2 then 
  if ~(haveacompiler()) then
    x_message(['Scilab doesn''t find a C compiler','This demo is disabled'])
  else
	  mode(0);
	  wheel_build_and_load() 
	  wheelg=wheelgf;
	  tmin=0.0;tmax=15;nn=300;
	  times=(0:(nn-1));
	  times=tmax*times/(nn-1) +tmin*((nn-1)*ones(times)-times);
	  //               INITIAL CONDITIONS
	  x0=[0;                 	//theta
  	  	%pi/2+0.1;   	//phi
    		0;              //psi
    		5.0;        	//Dtheta
    		0.0;          	//Dphi
    		4.0;         	//Dpsi
    		0;           	//x
    		0];           	//y

	  //               SIMULATION
	  x=ode(x0,tmin,times,'wheel');
	  xselect();
	  xbasc();
	  show(x)
	  ystr=[ 'phi';'theta';'psi';'Dpsi';'Dtheta';'Dpsi';'x';'y'];
        flag=2;
	  while flag==2, [n1,n2]=size(x);
  		flag=tk_choose(['Stop';'Go on'],'Choose');
                if flag==2,x0=evstr(x_mdialog(['Initial conditions'],...
                      ystr,string(x(:,n2))));
  		x=ode(x0,tmin,times,'wheel');
  		xbasc();show(x);
		end;
	 end
	end
 case 1 then // A precomputed value for 
	     //x0=[0;%pi/2+0.1;0;5.0;0.0;4.0;0;0];
	x=read(path+'/x.wrt',8,301);
	wheelg=wheelgs;
	show(x);
end

set('figure_style',fs);