Announcement

Collapse
No announcement yet.

Does anyone know how to use Matlab as a trigger for Vicon to start capturing data?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does anyone know how to use Matlab as a trigger for Vicon to start capturing data?

    So basically my goal is to use Vicon to capture reaction time. I will have an audio stimulus given to a participant and they are to react to that particular stimulus and from there I'll capture their response. The one problem I am running into is figuring out how to capture when a person is given a stimulus to start reaction time measurements. I just need some way to have Vicon pick up a trigger that creates a square wave that lets me know when the stimulus was sent so I can look at the data from after that time point. From what I have figured out thus far, Nexus is able to accept UDP packets to trigger a start, but I am not sure how to do this going through Matlab. Has anyone had to do this before or is familiar with how to do this? Any help would be greatly appreciated!

  • #2
    Re: Does anyone know how to use Matlab as a trigger for Vicon to start capturing data

    If your Motion Capture System has an ADC then you could simply apply the audio stimulus to an analog channel and record it. This has the advantage that you would be recording both the motion (reaction) and the stimulus (audio) through the same system and it would be very easy to confirm that the sampling method is perfectly synchronized with minimal latency.

    Comment


    • #3
      Re: Does anyone know how to use Matlab as a trigger for Vicon to start capturing data

      I would reverse things, can you have Nexus trigger playback of an audio recording of the stimulus? This would eliminate variability in detection of the rising edge of any audio input and also ensure the delivered stimulus was identical for each trial.
      Last edited by Eric Fahlgren; November 19, 2017, 09:42 AM.

      Comment


      • #4
        Re: Does anyone know how to use Matlab as a trigger for Vicon to start capturing data

        I agree with Eddy in that I would try to record the sound along with the motion data so that it is automatically synced. Vicon has a "convert to mp4" operation (you can listen back to the recording outside Nexus), but what you see in Nexus is just the voltage signals. I'd guess this is sufficient enough to detect the time of "signal" to time of "action". I had to guess a bit to what mic/amplifier setup would work best going into our ADC but lucked out & it works for our purposes. I can share specifics if you're interested in going this route.

        Kyle Chadwick

        Comment


        • #5
          Re: Does anyone know how to use Matlab as a trigger for Vicon to start capturing data

          Few points:
          1- You want low latency while playing audio for reliable and repeatable timing. Playing sound from Matlab is easy but you need to ensure that there is minimum latency. Check http://www.lrdc.pitt.edu/maplelab/matlab_audio.html
          2- You can play a sound file from Matlab and simultaneously send a digital pulse using Matlab Data Acquisition Toolbox through a supported DAQ system's digital output port.
          3- You will need to configure Motion Capture system software to register that digital pulse being received at Digital input port of a Motion Capture system software supported DAQ system in it's data stream ("0" as absence and "1" as presence of pulse). For that, you will need a Motion Capture system software supported DAQ system with Digital input. I guess there are plug-ins available written for specific DAQ hardwares made available by Motion Capture System vendors.
          4- I am not sure if a single DAQ device can be accessed by 2 different softwares at the same time. If possible, 1 digital output port can be used for 2- above and digital input port of the same device can be used for 3- by wiring them together. If not, you will need separate DI and DO devices for 2- and 3- and wire them.
          5- There will still be some timing indeterminacy due to PC with modern processors and non-real time Windows OS.
          6- There are other and more advanced ways to do it so that you do not have issues like in 5- above but they will cost.

          Comment


          • #6
            Re: Does anyone know how to use Matlab as a trigger for Vicon to start capturing data

            If the captured data is exported as a C3D file then it will contain a frame by frame record of the subjects marker co-ordinate changes, synchronized, frame by frame, with the recorded analog data so latency and synchronization should not be an issue. Assuming that you connect the audio output signal to the Motion Capture ADC then you should be recording a signal around a volt which would be easy to see in the analog data. If you are just looking for the relative timing between the recorded audio stimulus and recorded movement then the ADC sample rate is not too critical - I'd suggest about 10x the 3D frame rate.

            Comment


            • #7
              Re: Does anyone know how to use Matlab as a trigger for Vicon to start capturing data

              On modern consumer multi-core, multi-processing processor architectures, running under Standard Windows OS, there is always latency, if timing determinacy is critical for your experiments, like reaction time measurements. When you send a command from a software on such computer, there is no way to predict with confidence when this command will actually start executing and will actually finish processing. Then, there are uncertain delays associated with data transfers.
              Using analog signals for time synchronization is not a good idea. There may be many false sources of analog signals (noise) that can be captured during experiments. Digital pulse is always a preferred way.

              Comment


              • #8
                Re: Does anyone know how to use Matlab as a trigger for Vicon to start capturing data

                While I agree that latency is a significant issue, I think that the experimental setup can eliminate latency as a source of error by having the Motion Capture system collect both the subject motion (as 3D marker co-ordinates) and the audio stimulus (as an analog signal). The exact timing of the audio stimulus would be recorded by connecting the loudspeaker signal in parallel with an ADC input, thus placing the synchronization between stimulus and motion, entirely under control of a single Motion Capture system.

                Assuming that the Motion Capture system is synchronizing its data streams (something that they generally do very well), I think that the only latency in this setup would be the mechanical motion of the loudspeaker cone, and the distance between the loudspeaker and the subject (speed of sound) as Courtney is recording both events with the same system. The measurement resolution of the subject motion would be determined by the video frame rate, and the resolution of the audio stimulus by the analog sample rate.

                Update: My view is that this type of data collection is best done by using a single system to collect all of the data and thus eliminating the requirement to synchronize triggers and event streams. This simplifies the data collection process and makes the post collection analysis of the data easy. Once the test is set up, you simply start collecting data (3D marker positions and the analog event channel), apply the stimulus and then you have a single data file with everything you need.
                Last edited by Edmund Cramp; November 22, 2017, 09:13 AM.

                Comment


                • #9
                  Re: Does anyone know how to use Matlab as a trigger for Vicon to start capturing data

                  Thank you all for the advice, based on the information we are now able to move ahead on this project and capture the data we want. I appreciate it!

                  Comment

                  Working...
                  X