linux_peripheral_interfaces
linux_peripheral_interfaces copied to clipboard
laptop_battery_monitor: Cannot run multiple instances for diagnostics
Currently you cannot run multiple instances of laptop_battery_monitor for diagnostics because every instance of the node assigns the same name to the diagnostics status message. It might make sense to switch to either use the hostname or use diagnostic updater, which puts the node name in the status name.
You have multiple batteries in your system?
While it is definitely possible to have multiple batteries, I don't. I was more talking about a system with multiple laptops in it (for example a turtlebot with a laptop on it that is controlled by another laptop).
@mitchellwills Is this resolved by https://github.com/ros-drivers/linux_peripheral_interfaces/pull/2?
No there is an issue here: https://github.com/ros-drivers/linux_peripheral_interfaces/blob/master/laptop_battery_monitor/scripts/laptop_battery.py#L203. Currently the diagnostic status name is hard coded to "Laptop Battery". While this works fine with one instance of the node it, running multiple instances of the node will result in the messages from each node being treated as the same diagnostic status. You can test this by running two instances of the node (with different names), diagnostic_aggregator and rqt_robot_monitor. There are two ways to solve this I think. One is to make a name parameter that defaults to the current string. The second solution would be to prefix the name with the node name. This is what diagnostic_updater does. I think that the second solution is the better solution; however, it is technically a breaking change as it may require users to update their diagnostic_aggregator config.