diff --git a/client/app/components/coordinator/coordinator.html b/client/app/components/coordinator/coordinator.html index a8a892b..285ab30 100644 --- a/client/app/components/coordinator/coordinator.html +++ b/client/app/components/coordinator/coordinator.html @@ -547,7 +547,11 @@ + + diff --git a/client/app/components/coordinator/js/ros_scripts.js b/client/app/components/coordinator/js/ros_scripts.js index 47cd2d5..0b1de8b 100644 --- a/client/app/components/coordinator/js/ros_scripts.js +++ b/client/app/components/coordinator/js/ros_scripts.js @@ -314,6 +314,7 @@ bagPlayingTopic.subscribe(function(message) { // Services //////////////////////////////////////////////////////////////// + function triggerService(serviceName) { var service = new ROSLIB.Service({ @@ -323,7 +324,8 @@ function triggerService(serviceName) }); var request = new ROSLIB.ServiceRequest({}); - + var serviceCallTimeStamp = Date.now(); + var serviceCallReturned = false; service.callService(request, function(result) { console.log('Result for service call on ' + serviceName @@ -357,8 +359,7 @@ function triggerService(serviceName) }); }); } - console.log(result); - + serviceCallReturned = true; }, function(error){ console.log("errored"); $(document).ready(function(){ @@ -373,7 +374,30 @@ function triggerService(serviceName) delay: 1000 }); }); + serviceCallReturned = true; }); + var responseCheckInterval = setInterval(function() { + var timeElapsedSinceServiceCall = Date.now() - serviceCallTimeStamp; // milliseconds elapsed since start + if(serviceCallReturned) { + clearInterval(responseCheckInterval); + return; + } else if (timeElapsedSinceServiceCall > 3000){ + $(document).ready(function(){ + $.notify({ + message: "Timeout on " + serviceName + }, { + "placement" : { + from: "bottom", + align: "right" + }, + type: 'danger', + delay: 1000 + }); + }); + clearInterval(responseCheckInterval); + return; + } + }, 1000); } @@ -390,6 +414,9 @@ function triggerMessageService(serviceName, textInput) var request = new ROSLIB.ServiceRequest({ message : text }); + + var serviceCallTimeStamp = Date.now(); + var serviceCallReturned = false; service.callService(request, function(result) { console.log('Result for service call on ' @@ -424,7 +451,7 @@ function triggerMessageService(serviceName, textInput) }); }); } - console.log(result); + serviceCallReturned = true; }, function(error){ console.log("errored"); @@ -440,7 +467,30 @@ function triggerMessageService(serviceName, textInput) delay: 1000 }); }); + serviceCallReturned = true; }); + var responseCheckInterval = setInterval(function() { + var timeElapsedSinceServiceCall = Date.now() - serviceCallTimeStamp; // milliseconds elapsed since start + if(serviceCallReturned) { + clearInterval(responseCheckInterval); + return; + } else if (timeElapsedSinceServiceCall > 3000){ + $(document).ready(function(){ + $.notify({ + message: "Timeout on " + serviceName + }, { + "placement" : { + from: "bottom", + align: "right" + }, + type: 'danger', + delay: 1000 + }); + }); + clearInterval(responseCheckInterval); + return; + } + }, 1000); } @@ -452,3 +502,16 @@ function playselectedBag() { } + + +document.addEventListener("keydown", invokeSafetyController); +function invokeSafetyController(event) +{ + var keyID = event.keyCode; + //8 == backspace, 46 == delete + if(keyID == 8 || keyID == 46) { + triggerService('/aescape/safety_activate') + } +} + + diff --git a/client/app/main.css b/client/app/main.css index 0095ad8..d7e6983 100644 --- a/client/app/main.css +++ b/client/app/main.css @@ -106,8 +106,20 @@ html, body { float: right; } - .main-tabs-container { + .header-bar { + display: flex; + flex-wrap: wrap; margin-top: 10px; + padding: 0px 15px; + } + + .fa-circle { + background: -webkit-gradient(linear, left top, left bottom, from(#bf9000), to(#7f6000)); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + } + + .main-tabs-container { display: flex; flex-wrap: wrap; } @@ -119,7 +131,7 @@ html, body { #task-connection-message { position: relative; margin: auto; - left: -10%; + left: -8%; font-weight: 600; font-size: 19pt; text-transform: capitalize; @@ -214,9 +226,6 @@ html, body { background: #020625; } - .nav-pills { - margin-left: 40px; - } .nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover, .nav>li>a:focus, .nav>li>a:hover{ //color: #EDF0F4; @@ -352,6 +361,12 @@ html, body { color: grey; } + .safety-button { + width: 100%; + height: 200px; + font-size: 32px; + } + \ No newline at end of file diff --git a/client/index.html b/client/index.html index 03db4f5..ce52585 100644 --- a/client/index.html +++ b/client/index.html @@ -19,6 +19,25 @@ + + +