Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions pyros_interfaces_common/basenode.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class PyrosBase(pyzmp.Node):

def __init__(self,
name=None,
interface_class=None,
socket_bind=None,
context_manager=None,
interface_class=None,
args=None,
kwargs=None,
instance_path=None,
Expand All @@ -30,6 +31,8 @@ def __init__(self,
default_config=None):
"""
:param name: name of the node
:param socket_bind: the url string to be passed to underlying network system so that the node is binding to this socket.
It will allow a client starting later to communicate with that node.
:param interface_class: the class of the interface to instantiate (in child process)
OR a tuple (module_name, class_name), useful if the module should be imported only in child process
OR a tuple (package_name, module_name, class_name), usseful if the module name is relative
Expand All @@ -46,11 +49,6 @@ def __init__(self,
:param default_config: a dict containing the values to use as default configuration values
:return:
"""
super(PyrosBase, self).__init__(name or 'pyros', context_manager=context_manager, args=args or (), kwargs=kwargs or {})

self.last_update = 0
self.update_interval = 1 # seconds to wait between each update

# we delegate config related behavior (including defaults)
self.config_handler = ConfigHandler(
name or 'pyros',
Expand All @@ -60,6 +58,19 @@ def __init__(self,
default_config=default_config,
)

# TODO : get socket_bind address from config file

super(PyrosBase, self).__init__(
name or 'pyros',
socket_bind=socket_bind or "ipc:///tmp/pyros/zmp-services.pipe", # for now defaults to IPC for ZMQ (only works locally)
context_manager=context_manager,
args=args or (),
kwargs=kwargs or {}
)

self.last_update = 0
self.update_interval = 1 # seconds to wait between each update

self.provides(self.msg_build)
# BWCOMPAT
self.provides(self.topic)
Expand All @@ -75,7 +86,6 @@ def __init__(self,
self.provides(self.params)
self.provides(self.setup)


if not isinstance(interface_class, tuple) and not (
# TODO : we should pre check all the used members are present...
hasattr(interface_class, 'services')
Expand Down Expand Up @@ -175,9 +185,7 @@ def start(self, timeout=None):
:return: None
"""

super(PyrosBase, self).start(timeout=timeout)
# Because we currently use this to setup connection
return self.name
return super(PyrosBase, self).start(timeout=timeout)

@abc.abstractmethod
def setup(self, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions pyros_interfaces_mock/tests/test_pyros_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ def test_echo_service():


class TestPyrosMockProcess(object):
def setUp(self):
def setup_class(self):
self.mockInstance = PyrosMock()
self.mockInstance.start()

def tearDown(self):
def teardown_class(self):
self.mockInstance.shutdown()

def test_msg_build(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def run(self):
'tblib', # this might not always install six (latest version does not)
'six',
'pyzmq',
'pyzmp>=0.0.14', # lets match the requirement in package.xml (greater than)
'pyzmp>0.0.15', # lets match the requirement in package.xml (greater than)
'pyros_setup>=0.1.5', # Careful : pyros-setup < 0.0.8 might already be installed as a deb in /opt/ros/indigo/lib/python2.7/dist-packages/ => we still need to force hte install in the venv to have permissions to create hte configuration file...
'pyros_config>=0.1.4',
'nose>=1.3.7',
Expand Down