pyros-dev / pyros

Python interfacing for multiprocess software - A Python blanket for ROS to hide inside
BSD 3-Clause "New" or "Revised" License
25 stars 4 forks source link

Add client API to dynamically change the node setup #136

Closed asmodehn closed 7 years ago

asmodehn commented 7 years ago

Usecase example :

>>> subproc = pyros.PyrosROS("pyrosnode")
>>> client_conn = subproc.start()
[pyrosnode] Node started as [16657 <= ipc:///tmp/zmp-pyrosnode-IyZXtp/services.pipe]
[INFO] [WallTime: 1493179049.865000] RosInterface pyrosnode node started with args : []
[INFO] [WallTime: 1493179049.872728] [pyros.rosinterface.ros_interface] ROS Interface initialized with:
        -    services : []
        -    publishers : []
        -    subscribers : []
        -    params : []
        -    enable_cache : False

>>> 
>>> client = pyros.PyrosClient(client_conn)
>>> client.topics()
{}
>>> client.services()
{}
>>> client.params()
{}
>>> client.setup(topics=['*'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'PyrosClient' object has no attribute 'setup'
>>> vars(client)
{'msg_build_svc': <pyzmp.service.Service object at 0x7f5d951fb110>, 'service_svc': <pyzmp.service.Service object at 0x7f5d951fb190>, 'params_svc': <pyzmp.service.Service object at 0x7f5d951fb290>, 'topic_svc': <pyzmp.service.Service object at 0x7f5d951fb150>, 'services_svc': <pyzmp.service.Service object at 0x7f5d951fb250>, 'param_svc': <pyzmp.service.Service object at 0x7f5d951fb1d0>, 'node_name': 'pyrosnode', 'topics_svc': <pyzmp.service.Service object at 0x7f5d951fb210>}

It would be nice to be able to modify the setup of the node via the client. We should probably do it in a way that is compatible with dynamic_configure, so that ROS user can modify this the ROS way. Check https://github.com/asmodehn/pyros-rosinterface/issues/4

asmodehn commented 7 years ago

Note : Currently the only way is to restart the node. Although not ideal, it is a robust way to achieve dynamic reconfiguration. This issue is about being able to have the same effect, without needing to restart the node.

asmodehn commented 7 years ago

This has been addressed here : https://github.com/asmodehn/pyros/commit/5bbc47be0526bebb7f6474a7160ce45f29b9b462 and seems to work (local manual tests)