Revision 6304bfc1 client/python/hlrc_client/RobotController.py

View differences:

client/python/hlrc_client/RobotController.py
30 30
import errno
31 31

  
32 32
class RobotController:
33
    def __init__(self, mw_name, scope, loglevel=logging.WARNING):
33
    def __init__(self, mw_name, scope, loglevel=logging.WARNING, timeout=None):
34 34
        """initialise
35 35
        :param mw_name: which mw to use, currentyl ROS and RSB are supported
36 36
        :param scope: base scope we want to listen on
......
67 67
                self.logger.error("failed to import ROS or the necessary data types: {}".format(e))
68 68
                sys.exit(errno.EINVAL)
69 69

  
70
            # import worked, safe to intantiate RSB mw now
71
            self.middleware = MiddlewareROS(self.scope, self.loglevel)
70
            # import worked, safe to instantiate RSB mw now
71
            self.middleware = MiddlewareROS(self.scope, self.loglevel, timeout)
72 72
        else:
73 73
            self.logger.error("invalid middleware requested (%s). supported: {ROS, RSB}\n\n" % (self.mw))
74 74
            sys.exit(errno.EINVAL)
......
76 76
    def __del__(self):
77 77
        """destructor
78 78
        """
79
        self.logger.debug("destructor of RobotController called")
79
        try: # if constructor failed, logger attribute might be missing
80
            self.logger.debug("destructor of RobotController called")
81
        except AttributeError:
82
            pass
80 83

  
81 84
    def is_running(self):
82 85
        return self.middleware.is_running()

Also available in: Unified diff