Get all listeners in ROSLibJS

asked 2022-04-14 05:51:08 -0500

Ravi Joshi gravatar image

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]);
    }
}
edit retag flag offensive close merge delete