controller_manager: how to avoid escalating to SIGTERM?

asked 2018-12-13 03:14:22 -0600

bliss2006 gravatar image

updated 2018-12-13 03:26:45 -0600

I implemented my own plugin controller (GPSURPlugin) similar to this. The controller is spawned in a launch file like this:

<node name="controller_spawner" pkg="controller_manager" type="spawner" output="screen" args="GPSURPlugin" />

The controller works fine, however on exit (Ctrl+C) I get the following message:

[INFO] [1544689457.045036, 4.396000]: Shutting down spawner. Stopping and unloading controllers...
[INFO] [1544689457.045297, 4.396000]: Stopping all controllers...
[gazebo-2] killing on exit
[controller_spawner-4] escalating to SIGTERM
[gazebo-2] escalating to SIGTERM
[WARN] [1544689472.073600, 4.398000]: Controller Spawner error while taking down controllers: transport error completing service call: receive_once[/controller_manager/switch_controller]: unexpected error [Errno 4] Interrupted system call
shutting down processing monitor...
... shutting down processing monitor complete

According to this answer the controller should stop controller in SIGINT. Since the plugin is derived from controller_interface::Controller, I assume it should implement the stop action properly, not my plugin. In fact, the method void GPSURPlugin::stopping(const ros::Time& time) is called on Ctrl+C, so it leaves the GPSURPlugin::update(...) loop.

Since I claim control over joints, I even release these claims as follows, but it does not help.

void GPSURPlugin::stopping(const ros::Time& time)

Therefore, it seems to me that the spawner of the controller_manager does not stop the controller properly. Any idea of how to solve this problem?

p.s. I also tried the following launch, but it resulted in a similar warning:

<node name="controller_spawner" pkg="controller_manager" type="controller_manager" output="screen" args="spawn GPSURPlugin" />

Actually, even if I do not spawn GPSURPlugin, Gazebo itself escalates to SIGTERM. Could it be that the controller_spawner-4 problem is actually the the result of the Gazebo not exiting cleanly itself?

edit retag flag offensive close merge delete



You should try without the Gazebo GUI (it helps avoiding Gazebo escalating to SIGTERM) but yes, if Gazebo escalates to SIGTERM the signal is received by all the nodes too.

Delb gravatar imageDelb ( 2018-12-13 03:44:09 -0600 )edit