sccn / lsl_archived

Multi-modal time-synched data transmission over local network
242 stars 133 forks source link

LSL Mouse & Keyboard Issues #230

Open russoen opened 7 years ago

russoen commented 7 years ago

I am writing about some issues I am having with the keyboard and mouse in lab streaming layer. I can successfully link the mouse and keyboard apps. I open LabRecorder and successfully start recording Keyboard, MouseButtons, and MousePosition. I open Matlab, add the 'MATLAB Importer' to my path, and run vis_stream - I leave all the default settings (seen below). image

  1. When LSL stream that should be displayed is Keyboard or MouseButtons, I get the following Matlab feedback:

    Looking for a stream with name=Keyboard ... / Looking for a stream with name=MouseButtons ... Opening an inlet... The number of channels in the steam does not match the number of labeled channel records. Using numbered labels.

When any keyboard or mouse button is clicked I get the following error in Matlab

An error occurred during the stream viewer update: An internal error occurred.

  1. When LSL stream that should be displayed is MousePosition, I get the following Matlab feedback:

    Looking for a stream with name=MousePosition ... Opening an inlet...

Then, an empty figure is displayed. Both the x and y the axes default to 0:1, but I have changed this to view up to 1000 units and no data is displayed. I have also tried to add a legend, but nothing appears because there are no lines or data points on the plot.

Any help resolving these issues would be greatly appreciated!

cboulay commented 7 years ago

vis_stream() hasn't aged well. It needs some work. I've had the same problems you're having and I didn't bother to fix them.

I have a little Python utility that I use instead, but I don't really want to share it because it crashes, a lot, and it depends on a package that I no longer maintain. I just use it when I need a quick test that I have streams that are sending data that seem to make sense.

Are you planning on using vis_stream a lot, or was it just for a quick test? If all you need is a quick test that the streams are working etc., and if you don't want to fix vis_stream (though we'd really appreciate that!), then I suggest using LabRecorder to record your streams for a few seconds to an xdf file, then load the xdf file and plot the data offline.

russoen commented 7 years ago

Chadwick, Thanks for the quick response! I am ultimately trying to use LSL with Tobii eye tracking, which would be used a lot. Currently, I am just running tests to see if this is even feasible. I assume that if I use LabRecorder then load to an xdf, I will not have access to a live stream of recorded data, is that correct?

cboulay commented 7 years ago

The outlet can broadcast to multiple inlets simultaneously. In other words, you can have LabRecorder saving data to an xdf and also have another app doing something with the data at the same time.

But when you're viewing the xdf file after it's recorded, you're right that the presence of the stream is no longer relevant. I was just saying that this is the easiest way to see if the data in the stream are being transmitted correctly. I assumed that's what you wanted to do with vis_stream.

If you want to visualize the eye tracker data in real time in every experiment, then you'll need a tool to do that. I don't recommend using Matlab for this. Matlab plotting is slow and it has a lot of unnecessary overhead for something you want to be lightweight. I've had much better success doing real-time plotting with pyqtgraph.

clementlee2000 commented 7 years ago

vis_stream() should work for Tobii eye tracking. The reason it does not work for keyboard and mouse apps is because vis_stream() does not support streams with irregular sampling rates. You may want to test out vis_stream() with a send_data example code in the environment of your choice.

russoen commented 7 years ago

We have Tobii studio eye tracking software, but unfortunately, this does not work with Presentation Neurobs (we tried an extension, but it isn't compatible with our version of Tobii). Since Matlab can communicate both with Tobii and presentation, I was going to try to implement a work-around that uses Matlab & LSL to send a trigger to Presentation when the user looks at certain area on the screen. Does anyone have a suggestion to implement this?

I tried using Presentation Neurobs to send event data to LSL but didn't get anything (a blank graph shows up)

mgrivich commented 7 years ago

At the this time, Presentation can only send LSL events, not receive them. You say you want Presentation to receive events, but then you say you can't send them from Presentation. Which direction do you care about? Or do you care about both?

If you are trying to send LSL events from Presentation, we get that working.

If you need to trigger Presentation from Matlab, you can use a TCP/IP socket. https://www.neurobs.com/pres_docs/html/04_reference/03_pcl_reference/07_other_pcl_types/19_socket.htm

On 10/2/2017 11:13 AM, russoen wrote:

We have Tobii studio eye tracking software, but unfortunately, this does not work with Presentation Neurobs (we tried an extension, but it isn't compatible with our version of Tobii). Since Matlab can communicate both with Tobii and presentation, I was going to try to implement a work-around that uses Matlab & LSL to send a trigger to Presentation when the user looks at certain area on the screen. Does anyone have a suggestion to implement this?

I tried using Presentation Neurobs to send event data to LSL but didn't get anything (a blank graph shows up)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sccn/labstreaminglayer/issues/230#issuecomment-333618450, or mute the thread https://github.com/notifications/unsubscribe-auth/AFC33TLGKJ-9JWdllXgN1Rv8qgrlw4khks5soSfCgaJpZM4Pq9CW.

russoen commented 7 years ago

Ideally, I want Presentation to receive events. I tried to see if I could get Presentation to send events just to see how the connection between Presentation and LSL works. I will look into TCP/IP sockets.