mech.html 15.4 KB
Newer Older
Jeroen Vreeken's avatar
Jeroen Vreeken committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<html>

<head>
 <title>
  Dwingeloo Mech console interface
 </title>
</head>

<body background="achtergrond.jpg">

 <table border="0">
  <tr>
   <td width="300">
    <div style="border: thin solid black; background: lightgrey"
     id="Azimuth_Soft_Enabled">
     Azimuth Software Control<br>
     
     <ul>
      <div style="border: thin solid black; background: lightgrey"
       id="Azimuth_Safe">
       Safety
      </div>
      <br>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
25
26
27
28
29
      <div id="Azimuth_Position">??</div>
      <div id="Azimuth_Setpoint">??</div>
      <div id="Azimuth_Setpoint_Error">??</div>
      <div id="Azimuth_Spg0">??</div>
      <div id="Azimuth_Error">??</div>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
30
31
32
33
     </ul>

     <center>
      <input style="background: springgreen" type="button" value="Enable"
Jeroen Vreeken's avatar
Jeroen Vreeken committed
34
       onClick="do_shell(azimuth_enable_param);">
Jeroen Vreeken's avatar
Jeroen Vreeken committed
35
      <input style="background: red" type="button" value="Disable"
Jeroen Vreeken's avatar
Jeroen Vreeken committed
36
37
38
39
40
41
42
43
       onClick="do_shell(azimuth_disable_param);">
      <input style="background: red" type="button" value="Emergency"
       onClick="do_shell(azimuth_emergency_param);">
      <br> 
      <input style="background: springgreen" type="button" value="Normal operation"
       onClick="do_shell(azimuth_normal_param);">
      <input style="background: orange" type="button" value="Safety Override"
       onClick="do_shell(azimuth_override_param);">
Jeroen Vreeken's avatar
Jeroen Vreeken committed
44
45
46
47
48
49
50
51
52
53
54
     </center>
     
    </div>
   </td>
   
   <td width="50"><hr></td>
   
   <td>
    <div style="border: thin solid black; background: lightgrey"
     id="Azimuth_Enabled">
     Azimuth Drive<br>
55
56
57
58
59
60
     <ul>
      <div style="border: thin solid black; background: lightgrey"
       id="dt_az.external_enable">
       External_enable<br>
      </div>
     </ul>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
61
62
63
64
65
    </div>
   </td>

   <td width="50"><hr></td>
   
Jeroen Vreeken's avatar
Jeroen Vreeken committed
66
   <td width="300">
Jeroen Vreeken's avatar
Jeroen Vreeken committed
67
68
69
70
71
    <div style="border: thin solid black; background: lightgrey">
     Azimuth Mechanics<br>
     
     <ul>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
72
73
74
75
76
77
78
      <div id="Azimuth_Speed">??</div>
      <div id="Azimuth_Torque">??</div>
      <br>
      
      <div style="border: thin solid black; background: grey"
       id="Azimuth_Drive_Safety_p270">
       Endstop Positive
Jeroen Vreeken's avatar
Jeroen Vreeken committed
79
80
      </div>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
81
82
83
      <div style="border: thin solid black; background: grey"
       id="Azimuth_Drive_Safety_m270">
       Endstop Negative
Jeroen Vreeken's avatar
Jeroen Vreeken committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
      </div>

     </ul>

    </div>
   </td>

  </tr>

  <tr>
   <td width="250">
    <div style="border: thin solid black; background: lightgrey"
     id="Azimuth_Soft_Enabled">
     Focusbox <br>
     
     <ul>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
101
      <div id="Focusbox_Position">??</div>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

     </ul>

    </div>
   </td>
   
   <td></td>

   <td>
    <div style="border: thin solid black; background: lightgrey"
     id="Azimuth_Soft_Enabled">
     EtherCat Communication<br>
     
     <center>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
117
118
119
120
      <input style="background: springgreen" type="button" value="Enable PDOs"
       onClick="do_shell(ethercat_enable_param);"><br>
      <input style="background: red" type="button" value="Disable PDOs"
       onClick="do_shell(ethercat_disable_param);"><br>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
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

     </center>

   </td>

    <td></td>
    
    <td width="250">
    <div style="border: thin solid black; background: lightgrey">
     Weather <br>
     
     <ul>

      <div style="border: thin solid black; background: white">
       <span id="weather">
        ??
       </span>
      </div>

     </ul>

    </div>
   </td>

  </tr>

  <tr>

   <td>
    <div style="border: thin solid black; background: lightgrey"
     id="Elevation_Soft_Enabled">
     Elevation Software Control<br>
     
     <ul>
      <div style="border: thin solid black; background: lightgrey"
       id="Elevation_Safe">
       Safety
      </div>
      <br>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
161
162
163
164
165
166
      <div id="Elevation_Position">??</div>
      <div id="Elevation_Setpoint">??</div>
      <div id="Elevation_Setpoint_Error">??</div>
      <div id="Elevation_Spg0">??</div>
      <div id="Elevation_Error">??</div>
      <div id="Elevation_Torsion">??</div>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
167
168
169
170
     </ul>

     <center>
      <input style="background: springgreen" type="button" value="Enable"
Jeroen Vreeken's avatar
Jeroen Vreeken committed
171
       onClick="do_shell(elevation_enable_param);">
Jeroen Vreeken's avatar
Jeroen Vreeken committed
172
      <input style="background: red" type="button" value="Disable"
Jeroen Vreeken's avatar
Jeroen Vreeken committed
173
174
175
176
177
178
179
180
       onClick="do_shell(elevation_disable_param);">
      <input style="background: red" type="button" value="Emergency"
       onClick="do_shell(elevation_emergency_param);">
      <br> 
      <input style="background: springgreen" type="button" value="Normal operation"
       onClick="do_shell(elevation_normal_param);">
      <input style="background: orange" type="button" value="Safety Override"
       onClick="do_shell(elevation_override_param);">
Jeroen Vreeken's avatar
Jeroen Vreeken committed
181
182
183
184
185
186
187
188
189
190
191
     </center>

    </div>
   </td>

   <td width="50"><hr></td>
   
   <td>
    <div style="border: thin solid black; background: lightgrey"
     id="Elevation_Enabled">
     Elevation Drives<br>
192
193
194
195
196
197
198
199
200
201
     <ul>
      <div style="border: thin solid black; background: lightgrey"
       id="dt_el_r.external_enable">
       External_enable Right<br>
      </div>
      <div style="border: thin solid black; background: lightgrey"
       id="dt_el_l.external_enable">
       External_enable Left<br>
      </div>
     </ul>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
202
203
204
    </div>
   </td>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
205
   <td width="60"><hr></td>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
206
207
208
209
210
211
212
   
   <td>
    <div style="border: thin solid black; background: lightgrey">
     Elevation Mechanics<br>
     
     <ul>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
213
214
215
216
217
218
      <div id="Elevation_Speed_Right">??</div>
      <div id="Elevation_Torque_Right">??</div>
      <div id="Elevation_Speed_Left">??</div>
      <div id="Elevation_Torque_Left">??</div>
      <br>
      
Jeroen Vreeken's avatar
Jeroen Vreeken committed
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
      <div style="border: thin solid black; background: grey"
       id="Elevation_Top_Safe">
       Endstop Top
      </div>

      <div style="border: thin solid black; background: grey"
       id="Elevation_Bottom_Safe">
       Endstop Bottom
      </div>

     </ul>

    </div>
   </td>

  </tr>

</table>

</body>


Jeroen Vreeken's avatar
Jeroen Vreeken committed
241
242

<script src="load.js"></script>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
243
244
245
246
247
248
249
<script src="trace.js"></script>
<script src="shell.js"></script>
<script src="utils.js"></script>
<script src="weather.js"></script>

<script type="text/javascript">

Jeroen Vreeken's avatar
Jeroen Vreeken committed
250
251
252
eval(load("dt_ui.js"));


Jeroen Vreeken's avatar
Jeroen Vreeken committed
253
254
var trace_url = "trace.cgi";
var shell_url = "shell.cgi";
Jeroen Vreeken's avatar
Jeroen Vreeken committed
255
256
var weather_url = "status.cgi";

257
258
var ethercat_enable_param =  'controller \'params { { "ethercat", "pdo_enabled", (int)1 } } \' ';
var ethercat_disable_param = 'controller \'params { { "ethercat", "pdo_enabled", (int)0 } } \' ';
Jeroen Vreeken's avatar
Jeroen Vreeken committed
259

Jeroen Vreeken's avatar
Jeroen Vreeken committed
260
261
262
263
264
265
266
267
268
269
270
var azimuth_enable_param =  'controller \'params { { "azimuth_servo_state", "override", (int)0 } { "azimuth_servo_state", "enabled", (int)1 } { "elevation_safety", "recover", (int)0 } } \' ';
var azimuth_disable_param = 'controller \'params { { "azimuth_servo_state", "override", (int)0 } { "azimuth_servo_state", "enabled", (int)0 } { "elevation_safety", "recover", (int)0 } } \' ';
var azimuth_emergency_param = 'controller \'params { { "azimuth_servo_state", "override", (int)0 } { "azimuth_servo_state", "emergency", (int)1 } { "elevation_safety", "recover", (int)0 } } \' ';
var azimuth_normal_param =  'controller \'params { { "azimuth_servo_state", "override", (int)0 } { "azimuth_safety", "recover", (int)0 } } \' ';
var azimuth_override_param = 'controller \'params { { "azimuth_servo_state", "override", (int)1 } { "azimuth_safety", "recover", (int)1 }} \' ';

var elevation_enable_param = 'controller \'params { { "elevation_servo_state", "override", (int)0 } { "elevation_servo_state", "enabled", (int)1 } { "elevation_safety", "recover", (int)0 } } \' ';
var elevation_disable_param = 'controller \'params { { "elevation_servo_state", "override", (int)0 } { "elevation_servo_state", "enabled", (int)0 } { "elevation_safety", "recover", (int)0 } } \' ';
var elevation_emergency_param = 'controller \'params { { "elevation_servo_state", "override", (int)0 } { "elevation_servo_state", "emergency", (int)1 } { "elevation_safety", "recover", (int)0 } } \' ';
var elevation_normal_param =  'controller \'params { { "elevation_servo_state", "override", (int)0 } { "elevation_safety", "recover", (int)0 } } \' ';
var elevation_override_param = 'controller \'params { { "elevation_servo_state", "override", (int)1 } { "elevation_safety", "recover", (int)1 } } \' ';
Jeroen Vreeken's avatar
Jeroen Vreeken committed
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


/***********************************************
	Azimuth software control
 */

function trace_value_bool(obj, time, value, unit)
{
	var text;
	if (value == 0.0)
		document.getElementById(obj.private).style.background =
		    'red';
	else
		document.getElementById(obj.private).style.background =
		    'lightgreen';
}

function trace_timeout_bool(obj)
{
	document.getElementById(obj.private).style.background =
	    'silver';
}

function trace_bool(name, traceobj)
{
	traceobj.private = name;
	traceobj.timeout = 30000;
	traceobj.timeout_callback = trace_timeout_bool;
	traceobj.callback = trace_value_bool;
	traceobj.open(trace_url, name, 2);
}


Azimuth_Safety_trace = new trace();
trace_bool('Azimuth_Safe', Azimuth_Safety_trace);

function trace_value_4dec_deg(obj, time, value, unit)
{
	document.getElementById(obj.private).innerHTML =
	    decimals(rad2deg(value), 4) + ' deg';
	document.getElementById(obj.private).style.background =
	    'white';
}

function trace_value_4dec_rpm(obj, time, value, unit)
{
	document.getElementById(obj.private).innerHTML =
	    decimals(rads2rpm(value), 4) + ' rpm';
	document.getElementById(obj.private).style.background =
	    'white';
}

function trace_timeout_4dec_rpm(obj)
{
	document.getElementById(obj.private).innerHTML =
	    "No connection";
	document.getElementById(obj.private).style.background =
	    'silver';
}

function trace_4dec_rpm(name, traceobj)
{
	traceobj.private = name;
	traceobj.timeout = 30000;
	traceobj.timeout_callback = trace_timeout_4dec_rpm;
	traceobj.callback = trace_value_4dec_rpm;
	traceobj.open(trace_url, name, 4);
}

function trace_value_4dec(obj, time, value, unit)
{
	document.getElementById(obj.private).innerHTML =
	    decimals(value, 4) + ' ' + unit;
	document.getElementById(obj.private).style.background =
	    'white';
}

function trace_timeout_4dec(obj)
{
	document.getElementById(obj.private).innerHTML =
	    "No connection";
	document.getElementById(obj.private).style.background =
	    'silver';
}

function trace_4dec(name, traceobj)
{
	traceobj.private = name;
	traceobj.timeout = 30000;
	traceobj.timeout_callback = trace_timeout_4dec;
	traceobj.callback = trace_value_4dec;
	traceobj.open(trace_url, name, 4);
}

Jeroen Vreeken's avatar
Jeroen Vreeken committed
365
366
367
368
function one(val)
{
	return val;
}
Jeroen Vreeken's avatar
Jeroen Vreeken committed
369

Jeroen Vreeken's avatar
Jeroen Vreeken committed
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
traceval_list = [
	{
		name: 		"Azimuth_Position",
		divname:	"Azimuth_Position",
		label:		"Position",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Azimuth_Error",
		divname:	"Azimuth_Error",
		label:		"Error",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Azimuth_Spg0",
		divname:	"Azimuth_Spg0",
		label:		"Spg",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Azimuth_Setpoint",
		divname:	"Azimuth_Setpoint",
		label:		"Setpoint",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Azimuth_Setpoint_Error",
		divname:	"Azimuth_Setpoint_Error",
		label:		"Setpoint Error",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Position",
		divname:	"Elevation_Position",
		label:		"Position",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Error",
		divname:	"Elevation_Error",
		label:		"Error",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Spg0",
		divname:	"Elevation_Spg0",
		label:		"Spg",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Setpoint",
		divname:	"Elevation_Setpoint",
		label:		"Setpoint",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Setpoint_Error",
		divname:	"Elevation_Setpoint_Error",
		label:		"Setpoint Error",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Torsion",
		divname:	"Elevation_Torsion",
		label:		"Torsion",
		func:		rad2deg,
		suffix:		"deg",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Azimuth_Speed",
		divname:	"Azimuth_Speed",
		label:		"Speed",
		func:		rads2rpm,
		suffix:		"rpm",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Speed_Right",
		divname:	"Elevation_Speed_Right",
		label:		"Speed Right",
		func:		rads2rpm,
		suffix:		"rpm",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Speed_Left",
		divname:	"Elevation_Speed_Left",
		label:		"Speed Left",
		func:		rads2rpm,
		suffix:		"rpm",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Azimuth_Torque",
		divname:	"Azimuth_Torque",
		label:		"Torque",
		func:		one,
		suffix:		"Nm ",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Torque_Right",
		divname:	"Elevation_Torque_Right",
		label:		"Torque Right",
		func:		one,
		suffix:		"Nm ",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Elevation_Torque_Left",
		divname:	"Elevation_Torque_Left",
		label:		"Torque Left",
		func:		one,
		suffix:		"Nm ",
		decimals:	4,
		highlight:	true
	},
	{
		name: 		"Focusbox_Position",
		divname:	"Focusbox_Position",
		label:		"Position",
		func:		one,
		suffix:		"V",
		decimals:	2,
		highlight:	true
	}
];

for (i = 0; i < traceval_list.length; i++) {
	var dtt = new dt_traceval(traceval_list[i].divname);
	
	dtt.label_set(traceval_list[i].label);
	dtt.suffix_set(traceval_list[i].suffix);
	dtt.value_func_set(traceval_list[i].func);
	dtt.align_set("left");
	dtt.number_set(true, traceval_list[i].decimals);
	dtt.highlight_set(traceval_list[i].highlight, "powderblue", "white");
	dtt.trace_open(trace_url, traceval_list[i].name, 4);
}
Jeroen Vreeken's avatar
Jeroen Vreeken committed
546
547
548
549
550
551
552
553
554
555
556




/***********************************************
	Azimuth Drive
 */

Azimuth_Enabled_trace = new trace();
trace_bool('Azimuth_Enabled', Azimuth_Enabled_trace);

557
Azimuth_External_Enable_trace = new trace();
Jeroen Vreeken's avatar
Jeroen Vreeken committed
558
trace_bool('dt_az.external_enable', Azimuth_External_Enable_trace);
559

Jeroen Vreeken's avatar
Jeroen Vreeken committed
560
561
Azimuth_Drive_Safety_p270_trace = new trace();
trace_bool('Azimuth_Drive_Safety_p270', Azimuth_Drive_Safety_p270_trace);
Jeroen Vreeken's avatar
Jeroen Vreeken committed
562

Jeroen Vreeken's avatar
Jeroen Vreeken committed
563
564
Azimuth_Drive_Safety_m270_trace = new trace();
trace_bool('Azimuth_Drive_Safety_m270', Azimuth_Drive_Safety_m270_trace);
Jeroen Vreeken's avatar
Jeroen Vreeken committed
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586




/***********************************************
	Elevation software control
 */


Elevation_Safe_trace = new trace();
trace_bool('Elevation_Safe', Elevation_Safe_trace);



/***********************************************
	Elevation Drives
 */


Elevation_Enabled_trace = new trace();
trace_bool('Elevation_Enabled', Elevation_Enabled_trace);

587
588
589
Elevation_External_Enable_Right_trace = new trace();
trace_bool('dt_el_r.external_enable', Elevation_External_Enable_Right_trace);

Jeroen Vreeken's avatar
Jeroen Vreeken committed
590
Elevation_External_Enable_Left_trace = new trace();
591
trace_bool('dt_el_l.external_enable', Elevation_External_Enable_Left_trace);
Jeroen Vreeken's avatar
Jeroen Vreeken committed
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631



/***********************************************
	Elevation mechanics
 */

Elevation_Top_Safe_trace = new trace();
trace_bool('Elevation_Top_Safe', Elevation_Top_Safe_trace);

Elevation_Bottom_Safe_trace = new trace();
trace_bool('Elevation_Bottom_Safe', Elevation_Bottom_Safe_trace);




/******************************************************************
 *
 * Shell access (for enable & disable)
 *
 ******************************************************************/

var do_shell_obj = new shell();

function do_shell(command)
{
	do_shell_obj.open(shell_url, command);
}

/******************************************************************
 *
 * Weather
 *
 ******************************************************************/

function dt_weather_callback(line)
{
	document.getElementById("weather").innerHTML = line;
}

Jeroen Vreeken's avatar
Jeroen Vreeken committed
632
weather = new weatherstatus(weather_url, "weather");
Jeroen Vreeken's avatar
Jeroen Vreeken committed
633
weather.callback = dt_weather_callback;
Jeroen Vreeken's avatar
Jeroen Vreeken committed
634
weather.open();
Jeroen Vreeken's avatar
Jeroen Vreeken committed
635
636
637
638
639
640


</script>

</html>