Working with ZMQ in MATLAB for communicating with eye tracker device

62 visualizaciones (últimos 30 días)
Sara Omranian
Sara Omranian el 21 de En. de 2021
Comentada: Rick Howard el 24 de Ag. de 2021
I have to install and work with these two packages:
My system information:
Windows 10 Pro
MATLAB R2020b
ZMQ libzmq-v141-mt-4_3_2
make.m ran successfully, as shown here:
...
...
...
Building with 'MinGW64 Compiler (C)'.
MEX completed successfully.
Succesful build for:
ZMQ_INCLUDE_PATH = C:\...\libzmq
ZMQ_LIB_PATH = C:\...\libzmq
ZMQ_COMPILED_LIB = libzmq-v141-mt-4_3_2.lib
ans =
logical
1
but the script where I try to communicate with my device still gives an error.
Here's the script:
% pupil_remote_control.m
% (*)~----------------------------------------------------------------------------------
% Pupil Helpers
% Copyright (C) 2012-2016 Pupil Labs
%
% Distributed under the terms of the GNU Lesser General Public License (LGPL v3.0).
% License details are in the file license.txt, distributed as part of this software.
% ----------------------------------------------------------------------------------~(*)
% Pupil Remote address
endpoint = 'tcp://127.0.0.1:50020';
% Setup zmq context and remote helper
ctx = zmq.core.ctx_new();
socket = zmq.core.socket(ctx, 'ZMQ_REQ');
% set timeout to 1000ms in order to not get stuck in a blocking
% mex-call if server is not reachable, see
% http://api.zeromq.org/4-0:zmq-setsockopt#toc19
zmq.core.setsockopt(socket, 'ZMQ_RCVTIMEO', 1000);
fprintf('Connecting to %s\n', endpoint);
zmq.core.connect(socket, endpoint);
tic; % Measure round trip delay
zmq.core.send(socket, uint8('t'));
result = zmq.core.recv(socket);
fprintf('%s\n', char(result));
fprintf('Round trip command delay: %s\n', toc);
% set current Pupil time to 0.0
zmq.core.send(socket, uint8('T 0.0'));
result = zmq.core.recv(socket);
fprintf('%s\n', char(result));
% start recording
pause(1.0);
zmq.core.send(socket, uint8('R'));
result = zmq.core.recv(socket);
fprintf('Recording should start: %s\n', char(result));
pause(5.0);
zmq.core.send(socket, uint8('r'));
result = zmq.core.recv(socket);
fprintf('Recording stopped: %s\n', char(result));
% test notification, note that you need to listen on the IPC to receive notifications!
send_notification(socket, containers.Map({'subject'}, {'calibration.should_start'}))
result = zmq.core.recv(socket);
fprintf('Notification received: %s\n', char(result));
send_notification(socket, containers.Map({'subject'}, {'calibration.should_stop'}))
result = zmq.core.recv(socket);
fprintf('Notification received: %s\n', char(result));
zmq.core.disconnect(socket, endpoint);
zmq.core.close(socket);
zmq.core.ctx_shutdown(ctx);
zmq.core.ctx_term(ctx);
and the error is:
Error using zmq.core.ctx_new
Invalid MEX-file 'C:\...\matlab-zmq-master\lib\+zmq\+core\ctx_new.mexw64': The specified module could not be found.
Error in practice_run (line 23)
ctx = zmq.core.ctx_new();
while the module exists exactly where it's looking for it.
List of all the relevant softwars I have is attached.
  1 comentario
Rick Howard
Rick Howard el 24 de Ag. de 2021
It has been awhile, but I was curious if you were able to solve this?
Also, are you sure that the libzmq.dll file is also in the same folder as your MEX file?
Regards,
Rick

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by