now can choose which topics to bag in the control pannel

This commit is contained in:
Glen Turner
2015-06-29 16:56:20 -07:00
parent d146020719
commit 09f78ce4d8
14 changed files with 205 additions and 96 deletions

View File

@@ -1,6 +1,4 @@
ros.topics = [];
ros.nodes = [];
$("#myImage").click ( function (evt) {
@@ -62,34 +60,41 @@ function updateVoltage(voltage)
function updateTopicsGUI()
{
ros.getTopics(function(result)
{
ros.topics = result;
}
);
ros.getTopics(ros.buildTopicList);
var topics = ros.topics;
var topics = ros.getTopicsList();
topics.sort();
if(topics != null){
var innerHTML = "";
for (var i = 0; i < topics.length; i++ )
{
innerHTML = innerHTML.concat(generateCheckbox(topics[i]));
innerHTML = innerHTML.concat(generateTopicCheckbox(topics[i]));
}
document.getElementById("ROSTopics").innerHTML = innerHTML;
}
};
function generateCheckbox(name)
function generateTopicCheckbox(topic)
{
var str = "<div class=\"checkbox\"> <label><input type=\"checkbox\" value=\"\">";
str = str.concat(name);
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()
{
@@ -99,6 +104,7 @@ function updateNodesGUI()
});
var nodes = ros.nodes;
nodes.sort()
if(nodes != null){
@@ -115,8 +121,10 @@ function updateNodesGUI()
};
window.setInterval(function(){
updateTopicsGUI()
updateNodesGUI()
updateTopicsGUI();
updateNodesGUI();
}, 500);
function validateForm()
@@ -155,6 +163,11 @@ function addInputsForConnection()
}
function mylog(input)
{
console.log(input)
}