ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

[ros2][galactic]Shutdown node when log level is ERROR or FATAL

asked 2021-09-23 08:52:22 -0500

anastasiaPan gravatar image

Hello I have a node launched by my own launch file (specifically https://github.com/KumarRobotics/ublo...) that occasionally fails on boot. When this happens I can see the log level on ERROR or FATAL. Is there a way to shutdown the node from the launch level when I get this log output?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-09-23 15:00:46 -0500

flo gravatar image

For something like this a LifeCycle node would fit quite perfect. The node is written in Cpp but only uses a standard rclcpp::Node as base interface.

With a LifeCycle node you could easily restart your node from outside and maybe fiddle with the parameters in between startup tests.. (or try to reset your external devices etc. pp.)

But this needs to be implemented directly into the node.

How you could subscribe to the logging level is also open. I beleive that you could hook into the rclcpp logging system and listen to the output from your given node. If you then register error output you could toggle a LifeCycle "restart" (go from active to unconfigured and back)

But again, this is not something you just enable. It needs to be done in code. But I'm sure that the maintainer would like to welcome this addition.

Also be aware that you are working with a foxy node and tagged galactic. This could easily work but also come up with some nasty runtime errors that are not already known/fixed by the maintainer. Maybe considering using foxy to be safe or help identify upgradeable points for the node to be 100% galactic ready. There are exact changes described for nodes upgrading from foxy to galactic. Maybe start searching there if you want to give something back.. :)

edit flag offensive delete link more

Comments

I am aware of the lifecycle nodes and this is what I am using when I am developing. The foxy branch is used in the official galactic package (see https://index.ros.org/p/ublox_msgs/gi...) so I linked this branch. I have been using it for sometime now.

Do you have maybe any suggestions/examples on how to listen to the output of the node from my launch file? I could write a simple subscriber too if that is also an option to read the logging output. I can open an issue on github and request this feature (which is how this should be done) but I am also in need of a temporary solution for now.

anastasiaPan gravatar image anastasiaPan  ( 2021-09-24 01:16:59 -0500 )edit

This gives me the idea that one should not use logging output for reacting to error handling: https://autowarefoundation.gitlab.io/... (see guidelines)

I’m actually not sure if there exists a centralized logging server.. maybe listing to the topic /rosout could help you here..?

flo gravatar image flo  ( 2021-09-24 01:47:29 -0500 )edit

Thanks for your answers! I will look into getting an output from the node instead of a logging error. Otherwise I might also try to use the rosout topic. It is also true what you say log is just log - these errors should be handled by code it is meant to be a workaround for now.

anastasiaPan gravatar image anastasiaPan  ( 2021-09-24 03:17:33 -0500 )edit

If you think about getting feedback of your node maybe think about parsing it into an action server. With a special error return code you could then react on killing / respawning it..

Also consider ticking this answer as correct if it helped you. Cheers

flo gravatar image flo  ( 2021-09-24 07:36:17 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-09-23 08:52:22 -0500

Seen: 335 times

Last updated: Sep 23 '21