0
$\begingroup$

Rosanswers logo

What is best practice for reporting global errors throughout ROS?

One option is to report errors through ROS_ERROR only. A node could then subscribe to /rosout_agg to receive and parse the error messages. The advantage would be that I get the topic and macros for free, and the messages even contain the posting node etc. Disadvantage is that I need to discard a lot of messages with info level and debug level. And if I need things like an error code, I need to encode this in the log message text.

Another option is of course to create a dedicated topic for reporting errors and warnings. All nodes in the system then needs to publish to this topic.

Any advice appreciated, thanks.


Originally posted by knxa on ROS Answers with karma: 811 on 2018-01-05

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I would actually use diagnostics for this. This is bascially an implementation of your second option with some additional sugar like analysis, aggregation and a viewer.

(All assuming "Reporting" means to send this to the user...)


Originally posted by mgruhler with karma: 12390 on 2018-01-05

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by knxa on 2018-01-12:
Thanks, I have come across diagnostics before, but have honestly been a bit confused about best practice. For example REP 107 states that is intended for reporting hardware data and errors. I was looking for something that reports errors in general...

Comment by knxa on 2018-01-12:
... which might include that some user input was wrong, some file could not be found, etc.

Comment by knxa on 2018-01-12:
(As you state) it also seems Diagnostics is intended for user info. I was thinking that reported errors could also be used as input to an error handler. A global place that could be configured to take certain actions if certain errors occurs. But this seems like misuse of Diagnostics?

Comment by mgruhler on 2018-01-12:
I agree about it being a misuse of diagnotics when using this for error handling in code. I understand that diagnostics has been intended for HW mainly, but I think it is helpful in a lot of other places as well (as Long as it is about getting info to the user) (some might consider that misues too).

Comment by mgruhler on 2018-01-12:
IMO, error handling should happen in the single nodes. So wrong user Input should be detected at the Moment of Input. Not existing files once you try to read/load them. And then the error should be produced in that node.

Maybe I am missing your Goal/idea why you want to have that centralized...

Comment by knxa on 2018-01-12:
I was imagining any error referring so a globally defined error code. A configuration could then specify various handlers for each error code. E.g. a node emits an error about low disk space or high temperature for X. An error handler node decides the appropriate action.

Comment by gvdhoorn on 2018-01-12:
These would seem to be largely application level and specific concerns, so creating an application specific implementation with topics and application-defined error codes with specific semantics seems justified.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.