Add phoebe and titan connections.

This commit is contained in:
David Walsh
2019-02-24 21:51:04 -05:00
parent 184e9cc79a
commit afdb725937
3 changed files with 78 additions and 122 deletions

View File

@@ -115,62 +115,6 @@ bagNotifier.subscribe(function(message) {
///////////////////////////////////////////////////////////////////////////////////
ros.buildTopicList = function(fresh_topics)
{
// console.log(topics)
// fresh_topics = fresh_topics.sort();
// First check that all our current topics are in the list of fresh_topics
for( var topic = 0; topic < ros.topics.length; topic ++)
{
if (fresh_topics.indexOf(ros.topics[topic].name) > -1)
{
// We know that we have already found that topic so we don't need to remove it
}
else
{
// That topic is no longer being published so we need ro remove it
ros.topics.splice(topic,1);
}
}
for (var topic =0; topic < fresh_topics.length; topic ++ )
{
if (ros.topics.indexOfTopic(fresh_topics[topic]) > -1)
{
// We know that we have already found that topic so we don't need to re-add it
}
else
{
// We do not have that topic so we need to add it
// create the new topic
var new_topic = new Topic(fresh_topics[topic]);
// make sure to put in in the list in the order
ros.topics.push(new_topic);
}
}
ros.topics.sort(function(a, b) {
if ( a.name < b.name )
return -1;
if ( a.name > b.name )
return 1;
return 0;
})
};
ros.getTopicsList = function()
{
// var topicList = [];
return ros.topics;
}
// attept to connect to the ros master from the IP given orgrab it from the form
ros.attemptConnection = function(ipAddress)
{

View File

@@ -60,40 +60,26 @@ function updateVoltage(voltage)
function updateTopicsGUI()
{
ros.getTopics(ros.buildTopicList);
ros.getTopics(function(result)
{
ros.topics = result;
});
var topics = ros.getTopicsList();
var topics = ros.topics;
topics.sort()
if(topics != null){
var innerHTML = "";
for (var i = 0; i < topics.length; i++ )
{
innerHTML = innerHTML.concat(generateTopicCheckbox(topics[i]));
innerHTML = innerHTML.concat(topics[i]);
innerHTML = innerHTML.concat("<br>");
}
document.getElementById("ROSTopics").innerHTML = innerHTML;
}
};
function generateTopicCheckbox(topic)
{
var str = "<div class=\"checkbox\">";
var checked_str = "unchecked";
if (topic.bag == true)
{
checked_str = "checked"
}
str =str.concat("<label><input type=\"checkbox\" onclick=\"toggleToBag(\'"+ topic.name + "\')\" id=\"" + topic.name + "_checkbox\" "+ checked_str +">");
str = str.concat(topic.name);
str = str.concat("</label></div>");
return str;
};
function toggleToBag(topic_name)
{
// if($.inArray(topic_name, ros.topics))
ros.topics[ros.topics.indexOfTopic(topic_name)].bag = !ros.topics[ros.topics.indexOfTopic(topic_name)].bag ;
}
function updateNodesGUI()
{
@@ -113,7 +99,6 @@ function updateNodesGUI()
{
innerHTML = innerHTML.concat(nodes[i]);
innerHTML = innerHTML.concat("<br>");
}
document.getElementById("ROSNodes").innerHTML = innerHTML;
}

View File

@@ -43,55 +43,27 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
</head>
<body>
<div class="container">
<div id="jumbotronTitle" class="jumbotron">
<h1>ROS Display</h1>
<div id="jumbotronTitle" class="jumbotron text-center">
<h1>Lab UI</h1>
</div>
<!-- ##################################### ROS BAG PANEL ######################################### -->
<!-- ROS Bag Panel -->
<div class="panel panel-default">
<div class="panel-heading">
ROS Bag
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-3">
Bagfile name must not start with "/"
<div class="input-group">
<input type="text" id="recordText" class="form-control" placeholder="bag_filename">
<span class="input-group-btn">
<button class="btn btn-primary" id="recordButton" type="button" onclick="toggleRecording()">
<span id="recordButtonText">
Start
</span>
</button>
</span>
</div>
</div>
</div>
</div>
</div>
<!-- ##################################### END ROS BAG PANEL ######################################### -->
<ul id="tabs" class="nav nav-pills" data-tabs="tabs" >
<li class="active">
<li class="active"> <a href="#rosbridgeconnection" data-toggle="tab">
ROS Bridge Connection
<span id="rosbridgeconnection_badge" class="badge">
Not Connected
</span></a></li>
<li>
<a href="#DataDisplay" data-toggle="tab">
Data Display
</a>
</li>
<li> <a href="#rosbridgeconnection" data-toggle="tab">
ROS Bridge Connection
<span id="rosbridgeconnection_badge" class="badge">
Not Connected
</span></a></li>
</ul>
<div id="my-tab-content" class="tab-content">
<div class="tab-pane active" id="DataDisplay">
<div class="tab-pane" id="DataDisplay">
<!-- ##################################### ROBOT DISPLAY PANEL ######################################### -->
@@ -99,6 +71,34 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
<!-- ##################################### END DISPLAY PANEL ######################################### -->
<!-- ##################################### ROS BAG PANEL ######################################### -->
<!-- ROS Bag Panel -->
<div class="panel panel-default">
<div class="panel-heading">
ROS Bag
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-3">
Bagfile name must not start with "/"
<div class="input-group">
<input type="text" id="recordText" class="form-control" placeholder="bag_filename">
<span class="input-group-btn">
<button class="btn btn-primary" id="recordButton" type="button" onclick="toggleRecording()">
<span id="recordButtonText">
Start
</span>
</button>
</span>
</div>
</div>
</div>
</div>
</div>
<!-- ##################################### END ROS BAG PANEL ######################################### -->
</div>
@@ -106,7 +106,33 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
<div class="tab-pane" id="rosbridgeconnection">
<div class="tab-pane active" id="rosbridgeconnection">
<div class="panel panel-default">
<div class="panel-heading">
Predefined Masters Connections
</div>
<div class="panel-body">
<button id="localhostButton" type="button" onclick="ros.attemptConnection('ws://localhost:9090')" class="btn btn-primary">
localhost
<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">
Phoebe
<script type="text/javascript">
document.getElementById("ConnectionIPInput").value = ros.connectionName;
</script>
</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>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
@@ -129,21 +155,22 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
</script>
</button>
</span>
</div>
</span>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
ROS Topics. Checked topics will be bagged when "Start" is selected.
ROS Topics.
</div>
<div class="panel-body">
<div id="ROSTopics">
<div class="col-sm-1" id="ROSTopics">
N/A
</div>
</div>
@@ -151,7 +178,7 @@ Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
<div class="panel panel-default">
<div class="panel-heading">
ROS Nodes
ROS Nodes.
</div>
<div class="panel-body">