ros2 / ros2cli

ROS 2 command line interface tools
Apache License 2.0
173 stars 159 forks source link

Command to monitor and pretty print the rosout logs #849 #850

Closed guillaumeautran closed 1 year ago

guillaumeautran commented 1 year ago

Creation of a rosout print command that generates pretty prints of the content of the /rosout topic. The commands also allows for the filtering of nodes based on a regular expression applied to the node name itself. Output color can be disabled (enabled by default) and the function information detail can also be displayed.

issue: #849

clalancette commented 1 year ago

I'm honestly not sure this is a feature we need to have in ros2 itself.

You can easily parse this kind of information using a YAML parser. For instance, I downloaded https://github.com/mikefarah/yq , and now I can do:

$ ros2 topic echo /rosout | yq '.msg'

Which just prints out the message field. You can also easily use something like it to select only the nodes you are interested in:

$ ros2 topic echo /rosout | yq 'select(.name == "talker") .msg'

So given that there are other tools out there that can do this, I'd rather not maintain this in the core itself.

guillaumeautran commented 1 year ago

That's fair. Just thought I'd bring it here to see if there was any interest.

clalancette commented 1 year ago

Sorry, I was maybe a little more terse than I meant to be.

Everything we put into the ROS 2 core has a cost, mostly in maintenance. That stuff always has to work before we can do a release, so keeping the size of the core smaller means it is somewhat easier to maintain. That's the main reason I always look for other tools to do things, rather than write our own.

However, the good news is that we've attempted to make ROS 2 as pluggable as possible. So if you find value in this extension, then I'd encourage you to put this in a separate repository and release it into Humble, Iron, and Rolling. That neatly sidesteps the problem of having it in the core, while still making the functionality available. Over time if we then find that this is a must-have feature, we can then promote it into the core.

Does that make sense?

guillaumeautran commented 1 year ago

I do understand the need to keep the core lean to reduce the maintenance cost. And although you are correct that you can use other tools to achieve very similar functionality, I do see the benefit of such command (and a similar one for the diagnostics topic as well).

Anyway, yes it is my plan to create a separate repo for these type of tools. Here at Clearpath, we use this utility all the time to follow the logs live. Will post the link to the repo once it is up.

Thanks for your feedback.

guillaumeautran commented 1 year ago

FYI: https://github.com/clearpathrobotics/clearpath_ros2cli More to come :)