Knifa / led-matrix-zmq-server

A tool for streaming frames to rpi-rgb-led-matrix over ZeroMQ.
GNU General Public License v3.0
28 stars 1 forks source link

Example request for sending frames #1

Open iamalexriley opened 4 years ago

iamalexriley commented 4 years ago

Hi @Knifa

Thank you for your work on this. I'm new to everything here, but I think I am close to understanding zeroMq w/ rpi-rgb-led-matrix.

I'm not sure how the server is sending the frames. Could you please show example of server API and how you send the byte frame from another rpi?

Cheers!

Knifa commented 4 years ago

Hello! Yes, I can put together a better example soon. If you're looking for a quick example to grab you can take a look at this repository here: https://github.com/Knifa/matryx-gl.

These files in particular will be of interest:

https://github.com/Knifa/matryx-gl/blob/master/src/Matrix.hpp https://github.com/Knifa/matryx-gl/blob/master/src/Canvas.cpp

The summary though is:

aidanlincolnn commented 3 years ago

@Knifa thanks for implementing this, feel like I am almost there but would love for a more dumbed down example coming from an art background and trying to hack a live display together.

aidanlincolnn commented 3 years ago

@Knifa I have successfully implemented a REQ-REP server + client in python on port 42024 (can see hello world on the pi and my desktop) and am now trying to send gif frames to your server from a python client (as far as I can tell there should be no issue sending from python to C++). There doesn't seem to be an issue running the docker instance but there is no indication that anything is being received. Any help would be greatly appreciated, I would love to avoid redoing the matrix link in python and don't know C++.

Rpi sudo bash zmqMatrixServer.sh (contains matrix parameters) Listening on tcp://*:42024 @ 24BPP Frame dimensions: 64x32 Expected frame size: 6144 bytes

Desktop Client: Connecting to matrix server expected frame size:6144, actual frame size: 6144 sending frame sent frame

Python client:

from PIL import Image import zmq tcp = "tcp://192.168.10.2:42024"

print("Connecting to matrix server") context = zmq.Context() socket = context.socket(zmq.REQ) socket.connect(tcp)

try: im = Image.open("./gradient2.gif") for frame in range(0,im.n_frames): im.seek(frame) im = im.convert("RGB") frameToSend = im.tobytes("raw") print("expected frame size:6144, actual frame size:",len(frameToSend)) print("sending frame") socket.send(frameToSend) print("sent frame") message = socket.recv() print("Received reply [ %s ]" % (message)) except EOFError: print("done") pass

Knifa commented 3 years ago

@aidanfowler are you running your Python client on a different machine? You might need to do some fiddling with Docker to get it to allow external connections, e.g. pass -p 42024:42024 to Docker to forward the port from the container to your machine properly --- bit of a guess! I haven't looked at this project for a little while but you should at least get some output even if you're sending the wrong data.