Persistent Service reconnection
I'm using ros hydro.
I call a persistence service in this way:
connectToClassificationServer()
{
classificationService = n.serviceClient<c_fuzzy::Classification>("classification", true);
}
then I use my service:
if (classificationService.isValid())
{
classificationService.call(serviceCall);
}
else
{
ROS_ERROR("Service down, waiting reconnection...");
classificationService.waitForExistence();
connectToClassificationServer(); //Why this??
}
the method isValid return always false if I don't re-create the service handler. And apparently there's no way to restart a persistent service (such as a 'reconnect' method).
it is correct to always recreate the ServiceClient? why I need to use the nodeHandler if I've already all the information needed inside the ServiceClient object?