Get all listeners in ROSLibJS
Is there any function in ROSLibJS to get all listeners?
Below is my workaround:
var listeners = [];
for (var i = 0; i < count; i++) {
var topic = "/test/topic_" + i;
var listener = new ROSLIB.Topic({
ros: ros,
name: topic,
messageType: "std_msgs/String",
});
listeners.push(listener.name);
listener.subscribe(handleCallback);
}
function getAllListeners() {
for (var i = 0; i < listeners.length; i++) {
console.log(i + " = " + listeners[i]);
}
}