ClientBase Class

The ClientBase class provides a common ROS service abstraction. More...

Ros1 Package: ontologenius
Ros2 Package: ontopy
Inherited By: OntologyClient, ActionClient, ManagerClient, ReasonerClient

Methods

__init__(self, name)
int nb(self)
resetNb(self)
setVerbose(self, verbose)
str[] call(self, action, param)
str callStr(self, action, param)
bool callNR(self, action, param)
bool callBool(self, action, param)

Detailed Description

The ClientBase class provides an abstraction for any ROS services.

This class ensures a persistent connection with the service based on. The persistent connection ensures a minimal response time. A reconnection logic is implemented in the event that the persistent connection fails.

Methods Documentation

__init__(self, name)

Constructs a ROS client linked to the service name(str).

nb(self)

Gives the total number (int) of service calls from all ClientBase instances since the last reset.

resetNb(self)

Reset Call Counter for all instances of ClientBase.

setVerbose(self, verbose)

If verbose(bool) is set to True, the clients will post messages about the failure to call the services and about their restoration.

call(self, action, param)

Call the service set up in the constructor of ClientBase with the request defined with action(str) and param(str) and returns all the results (str[]).

If the service call fails, the function returns None

callStr(self, action, param)

Call the service set up in the constructor of ClientBase with the request defined with action(str) and param(str) and returns all the first result (str).

If the service call fails, the function returns None

callNR(self, action, param)

Call the service set up in the constructor of ClientBase with the request defined with action(str) and param(str).

If the service call fails, the function returns False

callBool(self, action, param)

Call the service set up in the constructor of ClientBase with the request defined with action(str) and param(str).

Returns False if the service call fails or the result code of the service is different from SUCCESS.