You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

563 lines
11 KiB

<html>
<head>
<title>
Dwingeloo Mech console interface
</title>
</head>
<body background="achtergrond.jpg">
<table border="0">
<tr>
<td width="300">
<div id="azimuth_software"></div>
</td>
<td width="50"><hr></td>
<td>
<div id="azimuth_drive"></div>
</td>
<td width="50"><hr></td>
<td width="300">
<div id="azimuth_mechanics"></div>
</td>
</tr>
<tr>
<td width="250">
<div id="focusbox"></div>
</td>
<td></td>
<td>
<div id="ethercat"></div>
</td>
<td></td>
<td width="250">
<div id="weather"></div>
</td>
</tr>
<tr>
<td>
<div id="elevation_software"></div>
</td>
<td width="50"><hr><hr></td>
<td>
<div id="elevation_drive"></div>
</td>
<td width="60"><hr><hr></td>
<td>
<div id="elevation_mechanics"></div>
</td>
</tr>
</table>
</body>
<script src="js/load.js"></script>
<script type="application/javascript">
eval(load("js/dt_ui.js"));
eval(load("js/dt_websocket.js"));
eval(load("js/trace.js"));
eval(load("js/utils.js"));
eval(load("js/status.js"));
new dt_websocket("ws://"+ window.location.host +"/dt");
function one(val)
{
return val;
}
var azimuth_software = new dt_ui_window_trace("azimuth_software", "Azimuth Software Control", [
{
name: "Azimuth_Safe",
frequency: 0,
label: "Safe",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
{
name: "Azimuth_Position",
frequency: 4,
label: "Position",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Azimuth_Setpoint",
frequency: 4,
label: "Setpoint",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Azimuth_Setpoint_Error",
frequency: 4,
label: "Setpoint Error",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Azimuth_Spg0",
frequency: 4,
label: "Spg",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Azimuth_Error",
frequency: 4,
label: "Error",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
]);
var elevation_software = new dt_ui_window_trace("elevation_software", "Elevation Software Control", [
{
name: "Elevation_Safe",
frequency: 0,
label: "Safe",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
{
name: "Elevation_Position",
frequency: 4,
label: "Position",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Elevation_Setpoint",
frequency: 4,
label: "Setpoint",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Elevation_Setpoint_Error",
frequency: 4,
label: "Setpoint Error",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Elevation_Spg0",
frequency: 4,
label: "Spg",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Elevation_Error",
frequency: 4,
label: "Error",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Elevation_Torsion",
frequency: 4,
label: "Torsion",
func: rad2deg,
suffix: "deg",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
]);
var azimuth_mechanics = new dt_ui_window_trace("azimuth_mechanics", "Azimuth Mechanics", [
{
name: "Azimuth_Speed",
frequency: 4,
label: "Speed",
func: rads2rpm,
suffix: "rpm",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Azimuth_Torque",
frequency: 4,
label: "Torque",
func: one,
suffix: "Nm ",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true
},
{
name: "Azimuth_Drive_Safety_p270",
frequency: 0,
label: "Endstop Positive",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
{
name: "Azimuth_Drive_Safety_m270",
frequency: 0,
label: "Endstop Negative",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
]);
var elevation_mechanics = new dt_ui_window_trace("elevation_mechanics", "Elevation Mechanics", [
{
name: "Elevation_Speed_Right",
frequency: 4,
label: "Speed Right",
func: rads2rpm,
suffix: "rpm",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Elevation_Torque_Right",
frequency: 4,
label: "Torque Right",
func: one,
suffix: "Nm ",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true
},
{
name: "Elevation_Speed_Left",
frequency: 4,
label: "Speed Left",
func: rads2rpm,
suffix: "rpm",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true,
},
{
name: "Elevation_Torque_Left",
frequency: 4,
label: "Torque Left",
func: one,
suffix: "Nm ",
is_bool: false,
is_number: true,
decimals: 4,
highlight: true
},
{
name: "Elevation_Top_Safe",
frequency: 0,
label: "Endstop Top",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
{
name: "Elevation_Bottom_Safe",
frequency: 0,
label: "Endstop Bottom",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
]);
var azimuth_drive = new dt_ui_window_trace("azimuth_drive", "Azimuth Drive", [
{
name: "Azimuth_Enabled",
frequency: 0,
label: "Enabled",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
{
name: "dt_az.external_enable",
frequency: 0,
label: "External enable",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
]);
var ethercat = new dt_ui_window_trace("ethercat", "Ethercat", [
{
name: "ethercat.operational",
frequency: 0,
label: "Operational",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
{
name: "ethercat.pdo_data",
frequency: 0,
label: "PDO data",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
]);
var elevation_drive = new dt_ui_window_trace("elevation_drive", "Elevation Drive", [
{
name: "Elevation_Enabled",
frequency: 0,
label: "Enabled",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
{
name: "dt_el_r.external_enable",
frequency: 0,
label: "External enable Right",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
{
name: "dt_el_l.external_enable",
frequency: 0,
label: "External enable Left",
func: one,
is_bool: true,
is_number: false,
highlight: false,
},
]);
var focusbox = new dt_ui_window_trace("focusbox", "Focusbox", [
{
name: "Focusbox_Position",
frequency: 2,
label: "Focusbox Position",
func: one,
suffix: "V",
is_bool: false,
is_number: true,
decimals: 2,
highlight: true,
},
]);
var weather_url = "status.cgi";
var azimuth_enable_command = new controller_command("azimuth_servo_state", "bool");
var azimuth_recover_command = new controller_command("azimuth_recover", "bool");
var elevation_enable_command = new controller_command("elevation_servo_state", "bool");
var elevation_recover_command = new controller_command("elevation_safety", "bool");
var button_azimuth_enable = new dt_ui_button("button_azimuth_enable");
var button_azimuth_disable = new dt_ui_button("button_azimuth_disable");
var button_azimuth_override = new dt_ui_button("button_azimuth_override");
var button_azimuth_normal = new dt_ui_button("button_azimuth_normal");
azimuth_software.add([
button_azimuth_enable, button_azimuth_disable,
button_azimuth_override, button_azimuth_normal, ]);
button_azimuth_enable.text_set("Enable");
button_azimuth_enable.color_set("darkgreen");
button_azimuth_enable.onclick = function azimuth_enable() {
azimuth_enable_command.send(1);
azimuth_recover_command.send(0);
}
button_azimuth_disable.text_set("Disable");
button_azimuth_disable.color_set("red");
button_azimuth_disable.onclick = function azimuth_disable() {
azimuth_enable_command.send(0);
azimuth_recover_command.send(0);
}
button_azimuth_normal.text_set("Normal");
button_azimuth_normal.color_set("darkgreen");
button_azimuth_normal.onclick = function azimuth_normal() {
azimuth_recover_command.send(0);
}
button_azimuth_override.text_set("Override");
button_azimuth_override.color_set("#e08000");
button_azimuth_override.onclick = function azimuth_override() {
azimuth_recover_command.send(1);
}
azimuth_software.resize_equal([
button_azimuth_enable, button_azimuth_disable,
button_azimuth_override, button_azimuth_normal, ]);
azimuth_software.align_vertical([ button_azimuth_enable, button_azimuth_normal ]);
azimuth_software.align_horizontal([ button_azimuth_enable, button_azimuth_disable ]);
azimuth_software.align_horizontal([ button_azimuth_normal, button_azimuth_override ]);
var button_elevation_enable = new dt_ui_button("button_elevation_enable");
var button_elevation_disable = new dt_ui_button("button_elevation_disable");
var button_elevation_override = new dt_ui_button("button_elevation_override");
var button_elevation_normal = new dt_ui_button("button_elevation_normal");
elevation_software.add([
button_elevation_enable, button_elevation_disable,
button_elevation_override, button_elevation_normal, ]);
button_elevation_enable.text_set("Enable");
button_elevation_enable.color_set("darkgreen");
button_elevation_enable.onclick = function elevation_enable() {
elevation_enable_command.send(1);
elevation_recover_command.send(0);
}
button_elevation_disable.text_set("Disable");
button_elevation_disable.color_set("red");
button_elevation_disable.onclick = function elevation_disable() {
elevation_enable_command.send(0);
elevation_recover_command.send(0);
}
button_elevation_normal.text_set("Normal");
button_elevation_normal.color_set("darkgreen");
button_elevation_normal.onclick = function elevation_normal() {
elevation_recover_command.send(0);
}
button_elevation_override.text_set("Override");
button_elevation_override.color_set("#e08000");
button_elevation_override.onclick = function elevation_override() {
elevation_recover_command.send(1);
}
elevation_software.resize_equal([
button_elevation_enable, button_elevation_disable,
button_elevation_override, button_elevation_normal, ]);
elevation_software.align_vertical([ button_elevation_enable, button_elevation_normal ]);
elevation_software.align_horizontal([ button_elevation_enable, button_elevation_disable ]);
elevation_software.align_horizontal([ button_elevation_normal, button_elevation_override ]);
/******************************************************************
*
* Weather
*
******************************************************************/
weather = new dt_ui_window("weather");
weather.title_set("Weather");
weather_status = new dt_ui_value("weather_value");
weather.add([ weather_status ]);
weather_status.value_set("??_C,_????_mbar");
weather.room(weather_status);
weather.align_vertical([ weather_status ], 0);
function dt_weather_callback(line)
{
weather_status.value_set(line);
}
weatherstat = new status(weather_url, "weather");
weatherstat.callback = dt_weather_callback;
weatherstat.open();
</script>
</html>