RobotWebTools / roslibjs

The Standard ROS JavaScript Library
https://robotwebtools.github.io/roslibjs
Other
660 stars 373 forks source link

ROSlib not receiving all Logs from /rosout_agg #559

Closed owuraku-zenas closed 1 year ago

owuraku-zenas commented 1 year ago

Description I'm using ROSlibjs to subscribe to /rosout_agg and I'm not receiving all the logs. Only level 2 and error logs come through but rostopic echo /rosout_agg echos all the logs. Is this issue from end?

Steps To Reproduce

var rosout_agg = new ROSLIB.Topic({
                ros: ros,
                name: "/rosout_agg",
                messageType: "rosgraph_msgs/Log"
})
rosout_agg.subscribe((message) => {
            let today = new Date();
            let date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
            let time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
            let dateTime = date + ' ' + time;
            console.log(dateTime)
            console.log("message", message);
            setLogs([...logs, { date: dateTime, data: message }])
            localStorage.setItem('logs', JSON.stringify(logs))
})

Expected Behavior

Actual Behavior

MatthijsBurgh commented 1 year ago

With level 2, you mean info level?

You are just using a generic topic. So ROSLIB is not doing any magic there. Try to subscribe to a custom topic on which you just publish manually.

If that fails to work, try the syntax used in the test example, https://github.com/RobotWebTools/roslibjs/blob/112f8dc07592686161a21b777dca5432678a73be/test/examples/pubsub.example.js#L31-L37