Hi Taylor,
We just zoomed with Karim and he confirmed that the problem shouldn’t be the laser.
I’m skeptical, but we can do some tests to find out.
I’ve attached a MATLAB function (timeLaserConfig
) that measures the time it takes to configure all four channels of the laser. Each channel is set to operate in sinusoidal mode with a frequency of 0.5Hz at 50% gain. The test uses MATLAB’s timeit function to send this configuration repeatedly and report the median time. To run the test, call the function with the serial port as the only argument, e.g.
timeLaserConfig /dev/cu.usbmodem23301
(FYI, the first run is sometimes slower than subsequent runs, so I recommend running it a few times.)
To determine the source of the latency in laser configuration, I suggest doing the following tests:
-
Run
timeLaserConfig
on the Mac to which you normally connect the laser.If, over a couple runs, you get a median time that is much less than 60ms, then the issue must be with MWorks.
If you get times of ~60ms or more, then clearly the issue is not with MWorks, since this test does not involve MWorks in any way. In this case, move on to test #2.
-
Connect the laser to a non-Mac (i.e. Windows or Linux) system, and run
timeLaserConfig
there. You may need to use MATLAB’s serialportlist function to determine the name of the serial port.If, over a couple runs, you get a median time that is much less than 60ms, then the issue must be with macOS.
If you get times of ~60ms or more, then the issue is independent of the operating system, meaning it must be due to the laser itself.
If you don’t have access to a non-Mac system on which to perform this test, you could ask Karim to try it. This wouldn’t be ideal, though, because he may not have a device that’s exactly identical to yours. (In particular, the firmware may be different.)
For reference, I tested timeLaserConfig
with an Arduino board running my QCUALOR simulator firmware. The simulator just receives commands over the serial port, validates them, and sends them back. In other words, it does all the serial I/O that the real device does and nothing more. After the first run, the test consistently returned a median time of about 5ms. (The equivalent test using MWorks returns a median time of about 0.8ms. MATLAB itself apparently adds a fair amount of latency, but it’s still a lot less than 60ms.)
Cheers,
Chris
timeLaserConfig.m (562 Bytes)