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

programmatically killing Subscriber in another thread (ROSJAVA)

asked 2011-11-01 09:20:10 -0500

morrowsend gravatar image

The title says it all. I have a subscriber in a separate runnable thread from my main program. When I close my main program, I want to kill the subscriber thread, but calling the stop() method below doesn't work. Any ideas?

        public void stop() {
        node.shutdown();
        node = null;
    }
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2011-11-10 22:38:01 -0500

damonkohler gravatar image

All subscribers run in separate threads. Shutting down the node used to create the subscriber will also shutdown the subscriber. Are you shutting down the correct node? If so, why do you believe the subscriber is still running? Are there any interesting log messages?

edit flag offensive delete link more

Comments

After further testing, the node itself does seem to shutdown (no longer listed in rostopic list -v. The runnable thread containting that node should then die, but doesn't. so I guess my question is not ROSJAVA specific, but do you have any tips on how to kill that Runnable?
morrowsend gravatar image morrowsend  ( 2011-11-22 03:39:55 -0500 )edit
This question is a bit outdated, but currently the correct way to have an arbitrary thread shutdown with the Node is to use Node.executeCancellableLoop()
damonkohler gravatar image damonkohler  ( 2012-01-27 04:04:23 -0500 )edit

Question Tools

Stats

Asked: 2011-11-01 09:20:10 -0500

Seen: 659 times

Last updated: Nov 10 '11