Revision 2346dcd2 client/python/hlrc_client/RobotController.py
client/python/hlrc_client/RobotController.py | ||
---|---|---|
32 | 32 |
class RobotController: |
33 | 33 |
def __init__(self, mw_name, scope, loglevel=logging.WARNING, timeout=None): |
34 | 34 |
"""initialise |
35 |
:param mw_name: which mw to use, currentyl ROS and RSB are supported
|
|
35 |
:param mw_name: which mw to use, currentyl ROS is supported
|
|
36 | 36 |
:param scope: base scope we want to listen on |
37 | 37 |
:param loglevel: optional log level |
38 | 38 |
""" |
... | ... | |
48 | 48 |
|
49 | 49 |
self.middleware = None |
50 | 50 |
|
51 |
if (self.mw.upper() == "RSB"): |
|
52 |
self.logger.info("creating new middleware connection via RSB") |
|
53 |
try: |
|
54 |
from .MiddlewareRSB import MiddlewareRSB |
|
55 |
except ImportError as e: |
|
56 |
self.logger.error("failed to import RSB or the necessary data types: {}".format(e)) |
|
57 |
sys.exit(errno.EINVAL) |
|
58 |
|
|
59 |
# import worked, safe to intantiate RSB mw now |
|
60 |
self.middleware = MiddlewareRSB(self.scope, self.loglevel) |
|
61 |
|
|
62 |
elif (self.mw.upper() == "ROS"): |
|
51 |
if (self.mw.upper() == "ROS"): |
|
63 | 52 |
self.logger.info("creating new middleware connection via ROS") |
64 | 53 |
try: |
65 | 54 |
from .MiddlewareROS import MiddlewareROS |
... | ... | |
70 | 59 |
# import worked, safe to instantiate RSB mw now |
71 | 60 |
self.middleware = MiddlewareROS(self.scope, self.loglevel, timeout) |
72 | 61 |
else: |
73 |
self.logger.error("invalid middleware requested (%s). supported: {ROS, RSB}\n\n" % (self.mw))
|
|
62 |
self.logger.error("invalid middleware requested (%s). supported: {ROS}\n\n" % (self.mw)) |
|
74 | 63 |
sys.exit(errno.EINVAL) |
75 | 64 |
|
76 | 65 |
def __del__(self): |
Also available in: Unified diff