Rosjava restart node without using MasterChooser

asked 2016-07-27 12:27:14 -0600

cmayer.5d gravatar image

updated 2016-07-27 15:36:08 -0600

I am building an Android app and trying to handle cases where the device loses network connection. When that happens I would like to have my code attempt to re-connect a few times before returning to the master chooser. So far I haven't been able to successfully stop and restart a restart a node without going through the master chooser (or my own implementation of it). I'm using a class that extends RosActivity.

Things I have tried:

nodeMainExecuterService.shutdownNodeMain(node) - Doesn't seem to do anything. If the connection fails too many times and the app exits to the master chooser, it keeps trying to register the /rosout publisher in the background.

nodeMainExecuterService.shutdown() - asks the user for confirmation, then still doesn't seem to do anything

nodeMainExecutorService.getScheduledExecutorService().shutdown() - so far the only thing that works, but when the master chooser selects a new master and returns to the RosActivity it will not execute the node. Throws a java.util.concurrent.RejectedExecutionException

Any suggestions would be appreciated.

edit retag flag offensive close merge delete