bothlab / pomidaq

Portable Miniscope Data Acquisition
GNU Lesser General Public License v3.0
20 stars 7 forks source link

Miniscope v4 Head Orientation Sensor #10

Closed ckemere closed 1 year ago

ckemere commented 1 year ago

I haven't looked into the Miniscope software too deeply yet to see how this data stream arrives, but I'm curious about whether there's a plan to record it in Pomidaq?

ximion commented 1 year ago

It is on my todo list, but so far has been very low priority - there is a chance though that this might change soon...

ckemere commented 1 year ago

Sounds good!

ximion commented 1 year ago

Looks like I'll have to write a paper first, so this feature will need to wait a bit ;-)

(We are tracking the animal using DeepLabCut, so the Miniscope sensor isn't as important, even though it would be more accurate and nice to have)

ximion commented 1 year ago

So, the problem is that due to firmware bugs, we can't read proper BNO data on Linux. I am looking into that, but this issue may take some time to resolve.

ckemere commented 1 year ago

Oddly, I just discovered yesterday that this goes for the official Miniscope software as well (the BNO sensor works on windows but not Linux). Any more details why?

ximion commented 1 year ago

Past issues were due to Linux adhering to the UVC spec better, sanitizing values, while Windows just didn't care. This issue looks different though - I can transmit values, but something seems to set some BNO quaternions to zero in the firmware. I'll have another look at this tomorrow, this is very strange (potentially this is related to the firmware incorrectly determining the end of a frame, but that would still be odd, and I also don't see why using Linux would change any of that behavior...)

ximion commented 1 year ago

I found the issue and prepared some new firmware - unfortunately there's no other way to do this than to fix the firmware. It's once again an issue of Windows allowing more non-spec-compliant stuff for devices, while Linux is ensuring devices adhere to the UVC specification, whether they want to or not. I imagine this is good for misbehaving cameras, but for the Miniscope device it's of course not ideal...

Fortunately, we can work around that. I'll submit another patch to the firmware repository @ https://github.com/Aharoni-Lab/Miniscope-DAQ-Cypress-firmware next week :-)

ckemere commented 1 year ago

Nice!

ximion commented 1 year ago

I am currently waiting on the https://github.com/Aharoni-Lab/Miniscope-DAQ-Cypress-firmware/pull/11 boilerplate patch to be merged or rejected first, then I'll submit the other changes for review. The BNO works very well on Linux and with the current development version of PoMiDAQ (and the firmware changes should be backwards-compatible with Windows too).

ximion commented 1 year ago

This is working well now - you will need a DAQ box which has a firmware with patches from https://github.com/Aharoni-Lab/Miniscope-DAQ-Cypress-firmware/pull/12 flashed though, otherwise we can not read the data on Linux. You will also require the current Git master version (upcoming version 0.5.0) of PoMiDAQ to test this.

ckemere commented 1 year ago

Thanks! Will do some testing and will let you know if there are any issues.