Package: pdcom5
This is the README file of the PdCom library, that is part of the EtherLab
project (http://etherlab.org/en). The home of PdCom ishttp://etherlab.org/en/pdcom. The Library is released under the terms and
conditions of the GNU Lesser General Public License (LGPL), version 3 or (at
your option) any later version.DocumentationYou can find the documentation onlinehere
(C++)andhere
(Python).The library documentation resides in the header files and can be brought to
HTML, LaTeX and man format with the doxygen tool. To generate the
documentation, make sure that doxygen is installed and then call:gitsubmoduleupdate--initmkdirbuildcdbuildcmake..makedocThen point your favourite browser to doc/html/index.html.Building and InstallingTo just build and install the library, call:mkdirbuildcdbuildcmake-DCMAKE_BUILD_TYPE=Release..makemakeinstallYou'll need the following packages:libexpat-devellibgnutls-develcyrus-sasl-develFor running the unit tests, the GTest library is required.Python APIIn the python subdirectory, anasynciobased Python API is provided.
It requires Python >= 3.6, numpy and pybind11 >= 2.6.0.
Please note thatmake installdoes not install this Python module.
Instead, please navigate to the python subdirectory after installing the C++ library
and install the pdcom5 python module usingpip3 install ..There are also some pre-built wheel packages available.
Usepip3 install pdcom5to install pdcom5 from PyPI.The starting point for almost everything is theProcessclass
which is in charge of handling the communication.
You can use it to find variables, to set parameters and to subscribe to signals.
Most of the functions in this API are coroutines,
which have to beawaited.In this snippet, a connection is made to the oscillator example in PdServ.
Its cosine output is subscribed to with a period of one second.
The value is printed five times, then theenableParameter is set to False.
After that, the cosine output is polled twice.
Note that for the interactive asyncio REPL (python3 -m asyncio), Python >= 3.8 is required.>>>importpdcom5>>>process=pdcom5.Process()>>>awaitprocess.connect("msr://localhost:2345")>>>variable=awaitprocess.find("/osc/cos")>>>variable.shape(1,)>>>sub=awaitprocess.subscribe(1.0,variable)>>>foriinrange(5):...awaitsub.read()...(8.78446130364271,datetime.timedelta(days=19459,seconds=29086,microseconds=437320))(7.851994244479773,datetime.timedelta(days=19459,seconds=29087,microseconds=437407))(-3.094420865989016,datetime.timedelta(days=19459,seconds=29088,microseconds=437398))(-10.094402900214018,datetime.timedelta(days=19459,seconds=29089,microseconds=437408))(-4.220607508690086,datetime.timedelta(days=19459,seconds=29090,microseconds=437397))>>>awaitprocess.setVariableValue("/osc/enable",False)>>>awaitvariable.poll()(-2.7455815235765124,datetime.timedelta(days=19459,seconds=29159,microseconds=877336))>>>awaitvariable.poll()(-2.7455815235765124,datetime.timedelta(days=19459,seconds=29160,microseconds=817388))There is alsoTransmission.event_modeandTransmission.poll_modefor creating non-periodical subscriptionsFurther InformationFor questions of any kind, subscribe to the etherlab-users mailing list athttp://etherlab.org/en.Have fun with PdCom!