Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue1 c++ zmq reader #2

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Issue1 c++ zmq reader #2

wants to merge 8 commits into from

Conversation

MarineChap
Copy link

@MarineChap MarineChap commented Nov 16, 2020

Example - ZMQ reader project in C++

TODO:
[x] Create socket connections
[x] Parse data and filled buffer
[x] Parse event/spike message
[x ] Send heartbeat
[x ] Doc

close #1

@anjaldoshi

Example/ReadMe.md Outdated Show resolved Hide resolved
Example/ReadMe.md Outdated Show resolved Hide resolved
Example/ZMQReader.h Outdated Show resolved Hide resolved
Example/main.cpp Outdated Show resolved Hide resolved
Example/ZMQReader.h Outdated Show resolved Hide resolved
Example/ZMQReader.cpp Outdated Show resolved Hide resolved
Example/ZMQReader.cpp Outdated Show resolved Hide resolved
Example/ZMQReader.cpp Outdated Show resolved Hide resolved
Example/ZMQReader.cpp Show resolved Hide resolved
@MarineChap MarineChap marked this pull request as ready for review November 18, 2020 12:43
@MarineChap
Copy link
Author

Hello @anjaldoshi

I have some questions/suggestions about the ZMQ node in Open-Ephys.

  • I am not sure in the actual state how the heartbeat is useful to keep/use. At least, the display of connected application in the OpenEphys node could be interesting.

  • Could you give me an example where event/spikes are sent by the node please ? I could reproduce only when data are sent.

  • Similar question for the param packet. I did not implement it yet. Can you show how it would be generated by OpenEphys ?

  • I did not implement the feature to send an event from the app to OpenEphys ? Do you have an use-case on how it would work on the OpenEphys side ?

Thanks ! Have a good day.

Note: I tried to follow your style in the code but tell me if you have a favorite style/syntax that I am not following.

@anjaldoshi
Copy link
Collaborator

Hi Marine,

As I'm not the one who developed this plugin, I won't be able to answer all your questions.

  • Regarding the heartbeat protocol, it is being used for the purpose of keeping track of the clients that are connected to the ZMQInterface plugin and whether they are alive or not. The feature you mentioned regarding displaying the connected app in Open Ephys was already present initially in the original repo, but was later removed by Andris in his repo (https://github.com/aszell/ZMQInterface) to make it compatible with the newer versions of Open Ephys GUI. Our version of ZMQInterface is based on Andris' repo. I'm working to get that feature back right now, and should be ready soon.

  • The events generated in Open Ephys are relayed to the ZMQInterface, which sends it to the client via this method: https://github.com/open-ephys-plugins/ZMQInterface/blob/master/Source/ZmqInterface.cpp#L627. Currently, I don't have any examples/client which handles events sent by the ZMQInterface plugin. We even have a separate plugin for it called EventBroadcaster that can send events from Open Ephys to any external ZMQ cleint app.

  • I'm not sure whether the sendParam method is called anywhere in the plugin even though it has a definition. There are no examples available for that. It could also be a leftover from previous version of Open Ephys. I don't think you should worry about implementing that in your example.

  • Lastly, you don't have to implement the feature to send events from the app (client) to Open Ephys. We already have a separate plugin for that called NetworkEvents which handles that functionality using ZMQ.

I think the only major thing you should focus in the example is receiving continuous data from Open Ephys via ZMQInterface to your client app and then displaying/processing that data in your app. Also, regarding the current status of your example, I see that your have pyzmq as a requirement. Why is that required when you already have CPPzmq?

@MarineChap
Copy link
Author

Hello @anjaldoshi
I need to check again but yes indeed I have been maybe overkilled with the pyzmq. The build of CPPzmq is based on the PkgConfig to locate the dependencies needed. I will re-check the dependency.

For the other questions, in that case, my example is finished. I did not expect to spend time on an GUI to look at the signal.

@anjaldoshi
Copy link
Collaborator

I just added the feature to show a list of connected apps in the ZMQInterface's editor. It should show "No app connected" when you drop the plugin in the signal chain initially. As soon as you connect an app and start acquisition in Open Ephys GUI, the app name should show up in green text in the list as shown in the image below. If, for some reason, the app disconnects in between, the name of the connected app turns red after a while. You can test this feature out in the branch available here: https://github.com/open-ephys-plugins/ZMQInterface/tree/list-connected-apps
Screenshot_20201119_112910

Regarding your example, I tried running following the steps you mentioned in the Readme (except running in a conda/pip environment), but I get the following error when I run cmake:

❯ cmake ..
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Populating zmq-cpp...
-- Detected CPPZMQ Version - 4.6.0
-- CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
CMake Error at build/_deps/cppzmq-src/CMakeLists.txt:20 (message):
  ZeroMQ was not found, neither as a CMake package nor via pkg-config


-- Configuring incomplete, errors occurred!

@MarineChap
Copy link
Author

MarineChap commented Nov 20, 2020

Hello @anjaldoshi,
I know why i put pyzmq in the requirement. When using it, it will "most likely" build and install the libzmq lib in background. And in my lab they have a large preference for conda environment. Without it, you still have to install the libzmq before building.

sudo apt-get install libzmq3-dev

I will modify the requirement accordingly. Thanks for the catch.

Example/main.cpp Outdated Show resolved Hide resolved
@MarineChap
Copy link
Author

Happy new year !
What is the state of the PR ? Do I need to do something else ? :)
Thanks

@anjaldoshi
Copy link
Collaborator

Happy New Year, Marine!

The reason this PR has not been merged yet is because we want to add support for Windows & Mac for the ZMQ Reader. I'm planning to work on it soon but I have some other things that I need to finish before I can get back to this PR. If you have the time and would like to work on this then that's great, otherwise I've it on my to-do list anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup (heartbeat) communication between the ZMQInterface and Falcon (C++ software)
3 participants