Add ros master label.

This commit is contained in:
David Walsh
2019-04-04 15:45:44 -04:00
parent faed7b42bb
commit 2687f2e4de
2 changed files with 51 additions and 19 deletions

View File

@@ -155,3 +155,22 @@ function toggleRecording()
} }
} }
} }
function getMasterName()
{
var service = new ROSLIB.Service({
ros : ros,
name : '/rosapi/service_host',
serviceType : 'rosapi/ServiceHost'
});
var request = new ROSLIB.ServiceRequest({
service: '/rosout/get_loggers' // Only the master hosts this service.
});
service.callService(request, function(result) {
console.log('Master Name = ' + result.host);
document.getElementById("MasterName").innerHTML = result.host;
});
}

View File

@@ -64,8 +64,20 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
<div class="container"> <div class="container">
<div id="jumbotronTitle" class="jumbotron text-center"> <div id="jumbotronTitle" class="jumbotron text-center">
<h1>Lab UI</h1> <h1>Lab UI</h1>
</div>
</div>
<div class="container">
<div class="col-md-1">
Master:
</div>
<div class="col-md-3">
<label id="MasterName"></label>
<script>
getMasterName();
</script>
</div>
</div>
<div class="row-md-3">
<ul id="tabs" class="nav nav-pills" data-tabs="tabs" > <ul id="tabs" class="nav nav-pills" data-tabs="tabs" >
<li> <a href="#rosbridgeconnection" data-toggle="tab"> <li> <a href="#rosbridgeconnection" data-toggle="tab">
ROS Bridge Connection ROS Bridge Connection
@@ -84,6 +96,7 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
</a> </a>
</li> </li>
</ul> </ul>
</div>
<div id="my-tab-content" class="tab-content"> <div id="my-tab-content" class="tab-content">