Since version 1.0.0, reconnection to rosbridge is working very well. Thanks very much!
However there is no direct way to edit the initial and maximum delay (which can go up to 3600 seconds with Twisted) or the maximum number of retries (no limit by default with Twisted).
In this PR, I added several class methods to CliRosBridgeClientFactory and AutobahnRosBridgeClientFactory, which allows us to set the reconnection parameters before creating a Ros instance, as follows:
from roslibpy import Ros
from roslibpy.comm import RosBridgeClientFactory
RosBridgeClientFactory.set_initial_delay(5)
RosBridgeClientFactory.set_max_delay(60)
RosBridgeClientFactory.set_max_retries(10)
ros = Ros(host='127.0.0.1', port=9090)
Since version 1.0.0, reconnection to rosbridge is working very well. Thanks very much!
However there is no direct way to edit the initial and maximum delay (which can go up to 3600 seconds with Twisted) or the maximum number of retries (no limit by default with Twisted).
In this PR, I added several class methods to
CliRosBridgeClientFactory
andAutobahnRosBridgeClientFactory
, which allows us to set the reconnection parameters before creating aRos
instance, as follows:Implementing it as class methods seemed to be the only way, seeing how Twisted's
ReconnectingClientFactory
definesmaxDelay
,initialDelay
andmaxRetries
as class variables (https://github.com/twisted/twisted/blob/trunk/src/twisted/internet/protocol.py#L365).Please let me know if there's a better way to implement these settings.