1 Commits

Author SHA1 Message Date
David Walsh
e88b783ce2 Initial bodyscaling panel. 2019-04-04 15:46:26 -04:00
10 changed files with 82 additions and 218 deletions

View File

@@ -1,12 +1,5 @@
# Aescape Lab UI # Aescape Lab UI
## To install
```
sudo apt install npm -y
sudo npm install http-server -g
sudo ln -s /usr/bin/nodejs /usr/bin/node
```
## To run ## To run
Set your master to be what you want - default is `phoebe`. Set your master to be what you want - default is `phoebe`.
Then run Then run

View File

@@ -7,32 +7,8 @@ ros.recording = false;
ros.connected = false; ros.connected = false;
// ros.connectionName = 'ws://192.168.1.105:9090'; // ros.connectionName = 'ws://192.168.1.105:9090';
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){
return pair[1];
}
}
}
var master = "localhost"
master = getQueryVariable("master")
if(master == null)
{
master = window.location.hostname
//"localhost"
}
console.log('Master = ' + master);
ros.connectionName = 'ws://' + master + ':9090';
// ros.connectionName = 'ws://localhost:9090'; // ros.connectionName = 'ws://localhost:9090';
// ros.connectionName = 'ws://titan.aescape.co:9090'; ros.connectionName = 'ws://titan.aescape.co:9090';
console.log('ros.connectionName = ' + ros.connectionName);
// If there is an error on the backend, an 'error' emit will be emitted. // If there is an error on the backend, an 'error' emit will be emitted.
ros.on('error', function(error) { ros.on('error', function(error) {
@@ -44,7 +20,7 @@ ros.on('error', function(error) {
document.getElementById("ROSNodes").innerHTML = "No Nodes Detected"; document.getElementById("ROSNodes").innerHTML = "No Nodes Detected";
rosbridgeconnection_badge rosbridgeconnection_badge
console.log(error); console.log(error);192
}); });
// Find out exactly when we made a connection. // Find out exactly when we made a connection.
ros.on('connection', function() { ros.on('connection', function() {
@@ -143,7 +119,6 @@ bagNotifier.subscribe(function(message) {
// attept to connect to the ros master from the IP given orgrab it from the form // attept to connect to the ros master from the IP given orgrab it from the form
ros.attemptConnection = function(ipAddress) ros.attemptConnection = function(ipAddress)
{ {
ros.close();
if( typeof ipAddress !== "undefined") if( typeof ipAddress !== "undefined")
{ {
ros.connectionName = ipAddress; ros.connectionName = ipAddress;
@@ -154,7 +129,6 @@ ros.attemptConnection = function(ipAddress)
} }
console.log('Connection = ' + ros.connectionName); console.log('Connection = ' + ros.connectionName);
ros.connect(ros.connectionName); ros.connect(ros.connectionName);
getMasterName();
} }
function toggleRecording() function toggleRecording()
@@ -198,8 +172,5 @@ function getMasterName()
service.callService(request, function(result) { service.callService(request, function(result) {
console.log('Master Name = ' + result.host); console.log('Master Name = ' + result.host);
document.getElementById("MasterName").innerHTML = result.host; document.getElementById("MasterName").innerHTML = result.host;
var title = result.host + " Lab UI"
document.title = title;
document.getElementById("Title").innerHTML = title;
}); });
} }

View File

@@ -47,12 +47,12 @@ function updateNodesGUI()
}; };
// window.setInterval(function(){ window.setInterval(function(){
// updateTopicsGUI(); updateTopicsGUI();
// updateNodesGUI(); updateNodesGUI();
// }, 5000); }, 5000);
function validateForm() function validateForm()
{ {

View File

@@ -4,40 +4,19 @@
Select Operation Mode Select Operation Mode
</div> </div>
<div class="panel-body text-center"> <div class="panel-body text-center">
<div class="col-md-6"> <button id="teachingModeButton" type="button" onclick="triggerService('/aescape/mode/activateTeachingController')" class="btn btn-primary">
<button id="teachingModeButton" type="button" onclick="triggerService('/aescape/mode/activateTeachingController')" class="btn btn-primary"> Teaching Mode
Teaching Mode </button>
</button> <button id="executionModeButton" type="button" onclick="triggerService('/aescape/mode/activateExecutionController')" class="btn btn-primary">
<button id="executionModeButton" type="button" onclick="triggerService('/aescape/mode/activateExecutionController')" class="btn btn-primary"> Massage Mode
Massage Mode </button>
</button> <button id="standbyModeButton" type="button" onclick="triggerService('/aescape/mode/activateStandbyController')" class="btn btn-primary">
<button id="readyModeButton" type="button" onclick="triggerService('/aescape/mode/activateReadyController')" class="btn btn-primary"> Standby Mode
Ready Mode </button>
</button> <button id="stoppedModeButton" type="button" onclick="triggerService('/aescape/mode/stopControllers')" class="btn btn-primary">
<button id="standbyModeButton" type="button" onclick="triggerService('/aescape/mode/activateStandbyController')" class="btn btn-primary"> Stopped Mode
Standby Mode </button>
</button>
<button id="stoppedModeButton" type="button" onclick="triggerService('/aescape/mode/stopControllers')" class="btn btn-primary">
Stopped Mode
</button>
</div>
<div class="col-md-6">
Safety Monitor Status:
<div class="row-md-3">
<h4><span id="safetyRunning" class="label label-default">Running</span></h4>
</div>
<div class="row-md-3">
<h4><span id="safetyStopped" class="label label-default">Stopped</span></h4>
</div>
<div class="row-md-3">
<button type="button" onclick="triggerService('/aescape/mode/activateSafetyController')" class="btn btn-sm btn-default">
Activate Safety Monitor
</button>
</div>
</div>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
@@ -105,18 +84,10 @@
Teaching Mode Operations Teaching Mode Operations
</div> </div>
<div class="panel-body text-center"> <div class="panel-body text-center">
<span class="row"> <button id="recordingStartButton" type="button" onclick="triggerService('/aescape/bags/startTeachRecording')" class="btn btn-primary">
<label id="RecordingStatusLabel" class="label-warning">
Bag manager not connected!
</label>
</span>
<button type="button" onclick="triggerService('/aescape/mode/activateReadyController')" class="btn btn-default">
Activate Ready Mode
</button>
<button id="recordingStartButton" type="button" onclick="triggerService('/aescape/hardware/calibrateRobotiq'); triggerService('/aescape/mode/activateTeachingController'); triggerService('/aescape/bags/startTeachRecording')" class="btn btn-primary">
Start Teach Recording Start Teach Recording
</button> </button>
<button id="recordingStopButton" type="button" onclick="triggerService('/aescape/bags/stopTeachRecording'); triggerService('/aescape/mode/activateReadyController')" class="btn btn-primary"> <button id="recordingStopButton" type="button" onclick="triggerService('/aescape/bags/stopTeachRecording')" class="btn btn-primary">
Stop Teach Recording Stop Teach Recording
</button> </button>
</div> </div>
@@ -126,28 +97,16 @@
<div class="panel-heading"> <div class="panel-heading">
Execution Mode Operations Execution Mode Operations
</div> </div>
<div class="panel-body text-center"> <div class="panel-body text-center">
<span class="row">
<label id="ExecutionStatusLabel" class="label-warning">
Bag manager not connected!
</label>
</span>
Last Bag Playing: Last Bag Playing:
<span id="lastbagText"> <span id="bagPlayingText">
None None
</span> </span>
<div> <div>
<button type="button" onclick="triggerService('/aescape/mode/activateReadyController')" class="btn btn-default"> <button id="executionStartButton" type="button" onclick="triggerService('/aescape/bags/startPlayingLastRecording')" class="btn btn-primary">
Activate Ready Mode
</button>
<button id="executionStartButton" type="button" onclick="triggerService('/aescape/mode/activateExecutionController'); triggerService('/aescape/bags/startPlayingLastRecording')" class="btn btn-primary">
Play Last Recording Play Last Recording
</button> </button>
<button id="executionStopButton" type="button" onclick="triggerService('/aescape/bags/stopPlayingBag'); triggerService('/aescape/mode/activateReadyController')" class="btn btn-primary"> <button id="executionStopButton" type="button" onclick="triggerService('/aescape/bags/stopPlayingBag')" class="btn btn-primary">
Stop Playing Recording Stop Playing Recording
</button> </button>
<div class="row"> <div class="row">
@@ -165,8 +124,6 @@
</div> </div>
</div> </div>
</div> </div>
<!-- </div> -->
</div> </div>
</div> </div>

View File

@@ -27,112 +27,33 @@ var modeStatus = new ROSLIB.Topic({
modeStatus.subscribe(function(message) { modeStatus.subscribe(function(message) {
document.getElementById("stoppedModeButton").className = "btn btn-secondary" document.getElementById("stoppedModeButton").className = "btn btn-secondary"
document.getElementById("standbyModeButton").className = "btn btn-primary" document.getElementById("standbyModeButton").className = "btn btn-primary"
document.getElementById("readyModeButton").className = "btn btn-primary"
document.getElementById("teachingModeButton").className = "btn btn-primary" document.getElementById("teachingModeButton").className = "btn btn-primary"
document.getElementById("executionModeButton").className = "btn btn-primary" document.getElementById("executionModeButton").className = "btn btn-primary"
document.getElementById("recordingStartButton").disabled = true
document.getElementById("executionStartButton").disabled = true
if (message.data == "stopped") {
if (message.data == "stopped")
{
document.getElementById("stoppedModeButton").className = "btn btn-warning" document.getElementById("stoppedModeButton").className = "btn btn-warning"
} } else if (message.data == "standby")
else if (message.data == "standby")
{ {
document.getElementById("standbyModeButton").className = "btn btn-primary btn-success" document.getElementById("standbyModeButton").className = "btn btn-primary btn-success"
} } else if (message.data == "teach")
else if (message.data == "teach")
{ {
document.getElementById("teachingModeButton").className = "btn btn-primary btn-success" document.getElementById("teachingModeButton").className = "btn btn-primary btn-success"
} } else if (message.data == "execution")
else if (message.data == "execution")
{ {
document.getElementById("executionModeButton").className = "btn btn-primary btn-success" document.getElementById("executionModeButton").className = "btn btn-primary btn-success"
} }
else if (message.data == "ready")
{
document.getElementById("readyModeButton").className = "btn btn-primary btn-success"
document.getElementById("recordingStartButton").disabled = false
document.getElementById("executionStartButton").disabled = false
}
}); });
// Safety Status // Playing Bag
var safetyStatusTopic = new ROSLIB.Topic({
ros : ros,
name : '/aescape/mode/safety_status',
messageType : 'std_msgs/String',
throttle_rate : 500 // 2Hz
});
safetyStatusTopic.subscribe(function(message) {
document.getElementById("safetyRunning").className = 'label label-default';
document.getElementById("safetyStopped").className = 'label label-default';
if (message.data == "stopped")
{
document.getElementById("safetyStopped").className = 'label label-danger';
}
else if (message.data == "running")
{
document.getElementById("safetyRunning").className = 'label label-success';
}
});
// Recording Bag
var recordingBagTopic = new ROSLIB.Topic({
ros : ros,
name : '/aescape/bags/recording_status',
messageType : 'std_msgs/String'
});
recordingBagTopic.subscribe(function(message) {
if (message.data == "stopped")
{
document.getElementById("RecordingStatusLabel").innerHTML = 'Not Running';
document.getElementById("RecordingStatusLabel").className = 'label label-warning';
}
else if (message.data == "running")
{
document.getElementById("RecordingStatusLabel").innerHTML = 'RUNNING!';
document.getElementById("RecordingStatusLabel").className = 'label label-success';
}
});
// Executing Bag
var executingBagTopic = new ROSLIB.Topic({
ros : ros,
name : '/aescape/bags/execution_status',
messageType : 'std_msgs/String'
});
executingBagTopic.subscribe(function(message) {
if (message.data == "stopped")
{
document.getElementById("ExecutionStatusLabel").innerHTML = 'Not Running';
document.getElementById("ExecutionStatusLabel").className = 'label label-warning';
}
else if (message.data == "running")
{
document.getElementById("ExecutionStatusLabel").innerHTML = 'RUNNING!';
document.getElementById("ExecutionStatusLabel").className = 'label label-success';
}
});
// Last Bag
var bagPlayingTopic = new ROSLIB.Topic({ var bagPlayingTopic = new ROSLIB.Topic({
ros : ros, ros : ros,
name : '/aescape/bags/last_played', name : '/aescape/bags/playing',
messageType : 'std_msgs/String' messageType : 'std_msgs/String'
}); });
bagPlayingTopic.subscribe(function(message) { bagPlayingTopic.subscribe(function(message) {
document.getElementById("lastbagText").innerHTML = message.data document.getElementById("bagPlayingText").innerHTML = message.data
}); });
// FrankaState // FrankaState

View File

@@ -39,21 +39,31 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
<script type="text/javascript" src="coordinator/js/update_guis.js"></script> <script type="text/javascript" src="coordinator/js/update_guis.js"></script>
<!-- <script> <script>
$(function(){ $(function(){
$("#visionContent").load("vision/vision.html"); $("#visionContent").load("vision/vision.html");
}); });
</script> </script>
<script type="text/javascript" src="vision/js/ros_scripts.js"></script> <script type="text/javascript" src="vision/js/ros_scripts.js"></script>
<script type="text/javascript" src="vision/js/update_guis.js"></script> --> <script type="text/javascript" src="vision/js/update_guis.js"></script>
<script>
$(function(){
$("#visionContent").load("vision/vision.html");
});
</script>
<script type="text/javascript" src="vision/js/ros_scripts.js"></script>
<script type="text/javascript" src="vision/js/update_guis.js"></script>
<meta content="text/html; charset=UTF-8; X-Content-Type-Options=nosniff" http-equiv="Content-Type" /> <meta content="text/html; charset=UTF-8; X-Content-Type-Options=nosniff" http-equiv="Content-Type" />
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div id="jumbotronTitle" class="jumbotron text-center"> <div id="jumbotronTitle" class="jumbotron text-center">
<h1 id="Title">Lab UI</h1> <h1>Lab UI</h1>
</div> </div>
<div class="container"> <div class="container">
@@ -81,7 +91,7 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
</a> </a>
</li> </li>
<li> <li>
<a href="vision/vision.html"> <a href="#Vision" data-toggle="tab">
Vision Vision
</a> </a>
</li> </li>
@@ -93,9 +103,9 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
<div class="tab-pane active" id="Coordinator"> <div class="tab-pane active" id="Coordinator">
<div id="coordinatorContent"></div> <div id="coordinatorContent"></div>
</div> </div>
<!-- <div class="tab-pane" id="Vision"> <div class="tab-pane" id="Vision">
<div id="visionContent"></div> <div id="visionContent"></div>
</div> --> </div>
<div class="tab-pane" id="rosbridgeconnection"> <div class="tab-pane" id="rosbridgeconnection">
@@ -133,26 +143,26 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
Predefined ROSBridge Connections Predefined ROSBridge Connections
</div> </div>
<div class="panel-body"> <div class="panel-body">
<button id="localhostButton" type="button" onclick="ros.attemptConnection('ws://localhost:9090')" class="btn btn-primary"> <!-- <button id="localhostButton" type="button" onclick="ros.attemptConnection('ws://localhost:9090')" class="btn btn-primary">
localhost localhost
<script type="text/javascript"> <script type="text/javascript">
document.getElementById("ConnectionIPInput").value = ros.connectionName; document.getElementById("ConnectionIPInput").value = ros.connectionName;
</script> </script>
</button> </button>
<button id="TitanButton" type="button" onclick="ros.attemptConnection('ws://titan.local:9090')" class="btn btn-primary">
Titan
<script type="text/javascript">
document.getElementById("ConnectionIPInput").value = ros.connectionName;
</script>
</button>
<button id="PhoebeButton" type="button" onclick="ros.attemptConnection('ws://phoebe.local:9090')" class="btn btn-primary"> <button id="PhoebeButton" type="button" onclick="ros.attemptConnection('ws://phoebe.local:9090')" class="btn btn-primary">
Phoebe Phoebe
<script type="text/javascript"> <script type="text/javascript">
document.getElementById("ConnectionIPInput").value = ros.connectionName; document.getElementById("ConnectionIPInput").value = ros.connectionName;
</script> </script>
</button> </button>
<button id="RheaButton" type="button" onclick="ros.attemptConnection('ws://rhea.local:9090')" class="btn btn-primary"> <button id="TitanButton" type="button" onclick="ros.attemptConnection('ws://titan.local:9090')" class="btn btn-primary">
Rhea Titan
<script type="text/javascript">
document.getElementById("ConnectionIPInput").value = ros.connectionName;
</script>
</button> -->
<button id="TitanButton" type="button" onclick="ros.attemptConnection('ws://titan.aescape.co:9090')" class="btn btn-primary">
titan.aescape.co
<script type="text/javascript"> <script type="text/javascript">
document.getElementById("ConnectionIPInput").value = ros.connectionName; document.getElementById("ConnectionIPInput").value = ros.connectionName;
</script> </script>

View File

@@ -1,8 +1,10 @@
<launch> <launch>
<include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch" /> <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch" />
<node name="lab_ui_web_server" pkg="aescape_lab_ui" type="webserver.sh" respawn="false" /> <node name="lab_ui_web_server" pkg="aescape_lab_ui" type="webserver.sh" respawn="true" />
<node name="lab_ui_video_server" pkg="web_video_server" type="web_video_server" respawn="false" /> <node name="lab_ui_video_server" pkg="web_video_server" type="web_video_server" respawn="true" >
<param name="address" value="titan.aescape.co" />
</node>
</launch> </launch>

View File

@@ -41,8 +41,6 @@
<run_depend>rospy</run_depend> <run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend> <run_depend>std_msgs</run_depend>
<run_depend>web_video_server</run_depend>
<run_depend>rosbridge_server</run_depend>
<!-- The export tag contains other, unspecified, tags --> <!-- The export tag contains other, unspecified, tags -->
<export> <export>

View File

@@ -1,7 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cd $(rospack find aescape_lab_ui) cd $(rospack find aescape_lab_ui)
# python3 -m http.server 8000 python3 -m http.server 8000 --bind titan.aescape.co
# Node webserver: https://www.npmjs.com/package/http-server
http-server -p 8000

View File

@@ -80,9 +80,6 @@
</div> --> </div> -->
<script type="text/javascript" src="vision/js/ros_scripts.js"></script>
<script type="text/javascript" src="vision/js/update_guis.js"></script>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
Camera Views Camera Views
@@ -100,13 +97,31 @@
<div class="row-lg-4"> <div class="row-lg-4">
<img height="350" alt="No Camera Image" id="imageStream" src="http://titan.aescape.co:8080/stream?topic=/real_green/color/image_raw&type=ros_compressed"></img> <img height="350" alt="No Camera Image" id="imageStream" src="http://titan.aescape.co:8080/stream?topic=/real_green/color/image_raw&type=ros_compressed"></img>
</div> </div>
Thermal
<div class="row-lg-4">
<img height="350" alt="No Camera Image" id="imageStream" src="http://titan.aescape.co:8080/stream?topic=/thermal/image_raw&type=ros_compressed"></img>
</div>
</div> </div>
</div> </div>
<div class="panel panel-default">
<div class="panel-heading">
Bodyscaling
</div>
<div class="panel-body">
<div class="col-lg-4">
<button id="stoppedModeButton" type="button" onclick="triggerService('/aescape/mode/stopControllers')" class="btn btn-primary">
Stopped Mode
</button>
</div>
<div class="col-lg-4">
Realsense Red - Capture
<div class="row-lg-4">
<img height="350" alt="No Camera Image" id="imageStream" src="http://titan.aescape.co:8080/stream?topic=/real_red/color/image_raw&type=ros_compressed"></img>
</div>
Realsense Green - Capture
<div class="row-lg-4">
<img height="350" alt="No Camera Image" id="imageStream" src="http://titan.aescape.co:8080/stream?topic=/real_green/color/image_raw&type=ros_compressed"></img>
</div>
</div>
</div>
</div>
<!-- <div class="panel panel-default"> <!-- <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
Execution Recording Operations Execution Recording Operations