now can choose which topics to bag in the control pannel
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user