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;
}