RobotWebTools / roslibjs

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

roslibjs logging functions missing? #352

Open joshua-glazer opened 4 years ago

joshua-glazer commented 4 years ago

My team was looking into how to use ROS logging (loginfo, logerr, logwarn) in roslibjs for our project but it doesn't look like this functionality exists right now. If it does exist, how can I use it? Otherwise, I think it would be good to have.

Rayman commented 4 years ago

On the browser side, I always use console.log because that is very well integrated in the chrome debugger (viewing/filtering)

If you want, you could create a publisher to the rosout topic.

joshua-glazer commented 4 years ago

I suppose that works, but to correctly publish to /rosout I would need to generate the seq, header and other data in the message.

joshua-glazer commented 4 years ago

I've made significant progress in writing functions to behave like the rospy log functions. Some things are still missing but I'm hoping to make a PR with my code at some point.

MatthijsBurgh commented 3 years ago

@vashmata still planning to open a PR with logging functions?

joshua-glazer commented 3 years ago

@vashmata still planning to open a PR with logging functions?

Thanks for the reminder @MatthijsBurgh, last year I actually did finish the basic functionalities on our end. I'd like to make a PR, but where do I put the code? It's a script that has to be loaded after the ROSLIB.ros() object is created and ROS connection has been established. Not sure where in your file/folder structure it belongs. I created a little example webpage with buttons that demos the functionality too.

joshua-glazer commented 3 years ago

You can take a look at Logging.html and ros_log.js over here to get an idea: https://github.com/vashmata/roslibjs/tree/ros_logging/examples

joshua-glazer commented 2 years ago

Made a PR to get some eyes on it, but the CI test for noetic failed, not sure why. Here's the error that I think is causing the failure:

Firefox 95.0 (Ubuntu 0.0.0) TF2 Republisher Example tf republisher FAILED
    Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

I don't know what this has to do with my changes, firstly because it's referencing an example (tf2 republisher) I didn't touch, and secondly because I'm not super familiar with async and whatnot and I don't think I even used that in my files.

MatthijsBurgh commented 2 years ago

@vashmata I trigger a re-run of the CI. Let's see what happens.