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

Advanced PUB/SUB example with multithreaded fast subscribers for realtime processing #34

Merged

Conversation

philipp-schmidt
Copy link
Contributor

Implemented publisher and subscriber examples.

I used OpenCV, as I don't have a PiCam here right now. Should be easy to implement for Pi though.

Let me know if it works and feel free to change the docu.

@jeffbass
Copy link
Owner

Thank you very much for your pull request @philipp-schmidt! It looks great. Let me take a few days to look at it and test it and I'll post my feedback and test results in this thread. Should be able to merge in in less than a week. Well done.

@jeffbass jeffbass merged commit e7bc093 into jeffbass:pub-sub-broadcast Apr 22, 2020
@jeffbass
Copy link
Owner

Thanks again for you pull request @philipp-schmidt. I have merged it into the pub-sub-broadcast branch. There were only minor merge conflicts, nothing significant. Next steps:

  1. I will test your Python program example on multiple machines in my own project space
  2. I will get back to you with questions (2 -4 days).
  3. We will work together to resolve any questions (in this thread).
  4. I will merge with the main imageZMQ branch.

Thanks again for your great example. Great piece of code. I really appreciate your contribution.
Jeff

@jeffbass
Copy link
Owner

jeffbass commented Apr 27, 2020

Hi @philipp-schmidt,
I have been testing your pull request and your example programs work well. I added code for reading from a PiCamera into your pub_sub_broadcast.py program example. Then I tested across multiple kinds of Macs and Raspberry Pi computers, your code works fine in the newest "Buster" version of Raspbian. But, in other recent versions of Raspbian OS (e.g. "Stretch") , Python 3.5 is the newest version of Python. I want to continue to support Python 3.5 with imageZMQ for PiCamera users who are still using "Stretch". Python 3.5 does not have f-string formatting, so I am going to change your examples to use str.format() instead. It is a minor change. When I have made the change and done further testing, I'll finish the merge into Master.
Jeff

@jeffbass
Copy link
Owner

jeffbass commented Apr 28, 2020

I tested your example programs with multiple combinations of Raspberry Pi's and Macs and multiple combinations of Webcams and PiCameras. Your programs work very well. I did make some changes to make it more PiCamera friendly (like adding a 2 second warmup delay for PiCameras). I will leave the pub-sub-broadcast branch active for a while for reference, but Master contains your example code and documentation and, of course, lists you as a contributor. Thanks again for your contribution...I think your examples will solve the "slow subscriber" problem for the folks in issue #27 . I will put a note in that issue pointing folks to your examples.

@jeffbass
Copy link
Owner

Also, I saw your comment in pub_sub_receive.py where you pointed out the lack of a zmq_socket.close() function in ImageHub(). Thanks for that; I'm adding that next. I'm also adding an __exit__() function so that with ... context manager code will work. Once that's in place, I'll edit your pub_sub_receive.py example program to include the socket.close().

@philipp-schmidt
Copy link
Contributor Author

Hi Jeff, looks good to me. Thanks for all the time and work you put into this repository, very much appreciated. Glad I could help!

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.

None yet

2 participants