deployment ready
This commit is contained in:
@@ -34,6 +34,48 @@ ros.connectionName = 'ws://' + master + ':9090';
|
||||
// ros.connectionName = 'ws://titan.aescape.co:9090';
|
||||
console.log('ros.connectionName = ' + ros.connectionName);
|
||||
|
||||
function enableUI() {
|
||||
try {
|
||||
var buttons = document.getElementById("coordinator").getElementsByTagName("button");
|
||||
for(var i = 0; i < buttons.length; i++)
|
||||
{
|
||||
buttons.item(i).classList.remove("disabled");
|
||||
}
|
||||
var checkBoxes = document.getElementById("coordinator").querySelectorAll(".pretty .state");
|
||||
for(var i = 0; i < checkBoxes.length; i++)
|
||||
{
|
||||
checkBoxes.item(i).classList.add("p-success-o");
|
||||
}
|
||||
document.querySelector('.dropdown').classList.remove("disabled");
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
function disableUI() {
|
||||
try {
|
||||
var buttons = document.getElementById("coordinator").getElementsByTagName("button");
|
||||
for(var i = 0; i < buttons.length; i++)
|
||||
{
|
||||
buttons.item(i).classList.add("disabled");
|
||||
}
|
||||
var checkBoxes = document.getElementById("coordinator").querySelectorAll(".pretty .state");
|
||||
for(var i = 0; i < checkBoxes.length; i++)
|
||||
{
|
||||
checkBoxes.item(i).classList.remove("p-success-o");
|
||||
}
|
||||
document.querySelector('.dropdown').classList.add("disabled");
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setTimeout(function(){
|
||||
disableUI();
|
||||
})
|
||||
|
||||
|
||||
// If there is an error on the backend, an 'error' emit will be emitted.
|
||||
ros.on('error', function(error) {
|
||||
/*
|
||||
@@ -44,14 +86,34 @@ ros.on('error', function(error) {
|
||||
document.getElementById("rosbridgeconnection_badge").innerHTML = 'No connection';
|
||||
document.getElementById("ROSNodes").innerHTML = "No Nodes Detected";
|
||||
*/
|
||||
/*
|
||||
$(document).ready(function(){
|
||||
$.notify({
|
||||
message: "Something went wrong in the connection: "+ ros.connectionName
|
||||
}, {
|
||||
"placement" : {
|
||||
from: "bottom",
|
||||
align: "right"
|
||||
},
|
||||
type: 'danger',
|
||||
delay: 1000
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
rosbridgeconnection_badge
|
||||
document.getElementById("ConnectionButton").innerHTML = "Connect";
|
||||
document.getElementById("ConnectionIPInput").value = ros.connectionName;
|
||||
document.getElementById("task-connection-message").innerHTML = "Disconnected"
|
||||
disableUI();
|
||||
//rosbridgeconnection_badge
|
||||
console.log(error);
|
||||
});
|
||||
// Find out exactly when we made a connection.
|
||||
ros.on('connection', function() {
|
||||
ros.connected = true;
|
||||
console.log('Connection made!');
|
||||
document.getElementById("ConnectionButton").innerHTML = "Disconnect";
|
||||
document.getElementById("ConnectionIPInput").value = ros.connectionName;
|
||||
/*
|
||||
document.getElementById("ConnectionIPForm").className = "form-group has-success has-feedback";
|
||||
document.getElementById("ConnectionIPInput").value = ros.connectionName;
|
||||
@@ -60,21 +122,60 @@ ros.on('connection', function() {
|
||||
document.getElementById("ConnectionButton").className = "btn btn-success";
|
||||
*/
|
||||
|
||||
$(document).ready(function(){
|
||||
$.notify({
|
||||
message: "Connected to: "+ ros.connectionName
|
||||
}, {
|
||||
"placement" : {
|
||||
from: "bottom",
|
||||
align: "right"
|
||||
},
|
||||
type: 'success',
|
||||
delay: 1000
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
enableUI();
|
||||
document.getElementById("task-connection-message").innerHTML = "Connected to: " + ros.connectionName;
|
||||
getMasterName();
|
||||
|
||||
ros.nodes = Array();
|
||||
ros.topics = Array();
|
||||
|
||||
});
|
||||
|
||||
ros.on('close', function() {
|
||||
try { throw Error('') } catch(err) { console.log(err) }
|
||||
console.log('Connection closed.');
|
||||
ros.connected = false;
|
||||
|
||||
|
||||
/*
|
||||
document.getElementById("ConnectionIPForm").className = "form-group has-warning has-feedback";
|
||||
document.getElementById("ConnectionIPLabel").innerHTML = 'Connection closed';
|
||||
document.getElementById("ConnectionButton").className = "btn btn-warning"
|
||||
document.getElementById("rosbridgeconnection_badge").innerHTML = 'Connection closed';
|
||||
*/
|
||||
/*
|
||||
$(document).ready(function(){
|
||||
$.notify({
|
||||
message: "Disconnected from "+ ros.connectionName
|
||||
}, {
|
||||
"placement" : {
|
||||
from: "bottom",
|
||||
align: "right"
|
||||
},
|
||||
type: 'danger',
|
||||
delay: 1000
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
document.getElementById("ConnectionButton").innerHTML = "Connect";
|
||||
document.getElementById("ConnectionIPInput").value = ros.connectionName;
|
||||
document.getElementById("task-connection-message").innerHTML = "Disconnected"
|
||||
|
||||
disableUI();
|
||||
|
||||
ros.nodes = Array();
|
||||
ros.topics = Array();
|
||||
@@ -151,7 +252,7 @@ bagNotifier.subscribe(function(message) {
|
||||
// attept to connect to the ros master from the IP given orgrab it from the form
|
||||
ros.attemptConnection = function(ipAddress)
|
||||
{
|
||||
ros.close();
|
||||
//ros.close();
|
||||
if( typeof ipAddress !== "undefined")
|
||||
{
|
||||
ros.connectionName = ipAddress;
|
||||
@@ -162,7 +263,6 @@ ros.attemptConnection = function(ipAddress)
|
||||
}
|
||||
console.log('Connection = ' + ros.connectionName);
|
||||
ros.connect(ros.connectionName);
|
||||
getMasterName();
|
||||
}
|
||||
|
||||
function toggleRecording()
|
||||
@@ -204,10 +304,6 @@ function getMasterName()
|
||||
});
|
||||
|
||||
service.callService(request, function(result) {
|
||||
console.log('Master Name = ' + result.host);
|
||||
document.getElementById("MasterName").innerHTML = result.host;
|
||||
var title = result.host + " Lab UI"
|
||||
document.title = title;
|
||||
document.getElementById("Title").innerHTML = title;
|
||||
document.getElementById("task-connection-message").innerHTML = "Connected to: " + result.host;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user