ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How do I extract specific information from the /diagnostics topic?

asked 2018-10-02 15:26:39 -0500

acasanova gravatar image

This is probably a stupid question and I apologize in advance.

I'm trying to monitor the state of a robot platform's battery (not a turtlebot) but afaik it doesn't have a battery state topic. But when I use the rqt_robot_monitor, I can see the state of the battery in the diagnostics. Is there a way to record just the battery state from the /diagnostics topic?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-03 01:40:46 -0500

Delb gravatar image

updated 2018-10-03 01:43:33 -0500

First, have you read the diagnostics wiki ? It states :

The diagnostics toolchain is built around the /diagnostics topic. On this topic, hardware drivers and devices publish diagnostic_msgs/DiagnosticArray messages with the device names, status and specific data points.

If you are able to visualize the battery state with rqt_robot_monitor then you can access to the battery state from the /diagnostics topic. This topic receives diagnostic_msgs/DiagnosticArray which is a header and a list of diagnostic_msgs/DiagnosticStatus messages (message definition here).

If you want to monitor the battery state you can susbscribe to the /diagnostics topic, then in the list of the components in the status attribute of the message search for the one which name is Battery (or if it's different write the same name as in rqt_robot_monitor). Once you have found it you can monitor the battery state as desired.

I think the diagnostic aggregator can be useful for you.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-10-02 15:26:39 -0500

Seen: 313 times

Last updated: Oct 03 '18