kroshu/kuka_drivers

Monitoring loop stops before activation [sporadic] [sunrise_driver_original]

Svastits opened this issue · 1 comments

When activating the system manager, sporadically a log message is seen about stopping the monitoring loop. In these cases this message does not show by deactivation, so the monitoring loop is stopped at its first tick.
Possible reason:
the loop is created on a new thread in the on_activate function of the system_manager (at system_manager.cpp L174), as one of the last steps of the activation. The loop terminates if the system manager node is not active, so if the condition is evaluated before the activation finishes, it terminates immediately.

Proposed solution:
use a mutex to wait for finished activation

Logs:
[robot_control_node-2] LBRiiwaClient state changed from 0 to 1
[robot_control_node-2] LBRiiwaClient state changed from 1 to 2
[system_manager-3] [WARN] [system_manager]: Stopping monitoring loop
[robot_control_node-2] LBRiiwaClient state changed from 2 to 3
[robot_control_node-2] LBRiiwaClient state changed from 3 to 4
[----------deactivating----------]
[robot_control_node-2] LBRiiwaClient state changed from 4 to 2
[robot_control_node-2] LBRiiwaClient state changed from 2 to 0

@resizoltan This will not be supported by the driver officially, there is a branch, referenced here, on which this probably could be solved if needed.