Aharoni-Lab / Miniscope-DAQ-Cypress-firmware

DAQ firmware for V3 and V4 Miniscope platforms
14 stars 8 forks source link

BNO still not working in Linux? #13

Open ckemere opened 1 year ago

ckemere commented 1 year ago

I know that @ximion's new firmware is working for us in Pomidaq, but in the Miniscope software, I don't get the nice yellow symbol of the BNO connecting. Any thoughts on this?

ximion commented 1 year ago

Depends: Is this not working with the original Miniscope software on Windows anymore when it worked before (that would be a regression), or is it not working on Linux with the original software while it also hasn't worked before there? If it's the latter, then this is no surprise, as the client software needs to be adjusted too in order to make use of the new protocol that the updated firmware provides.

kemerelab commented 1 year ago

Hey Mathias - quick question: I was going to look to update the original Miniscope software to interact with your new firmware. I've been looking through pomidaq commits, starting with this one:

https://github.com/bothlab/pomidaq/commit/d1fc57d59142a84eb3090e38e3bbc5dd7234269f

and it looks like the main change is that rather than storing the data in 4 separate properties, you've packed it into two. From:

            double w = static_cast<qint16>(d->cam.get(cv::CAP_PROP_SATURATION));
            double x = static_cast<qint16>(d->cam.get(cv::CAP_PROP_HUE));
            double y = static_cast<qint16>(d->cam.get(cv::CAP_PROP_GAIN));
            double z = static_cast<qint16>(d->cam.get(cv::CAP_PROP_BRIGHTNESS));

To:

            auto wx = static_cast<quint32>(d->cam.get(cv::CAP_PROP_PAN));
            auto yz = static_cast<quint32>(d->cam.get(cv::CAP_PROP_TILT));
            double w = (qint16)(wx & 0xFFFF);
            double x = (qint16)((wx >> 16) & 0xFFFF);
            double y = (qint16)(yz & 0xFFFF);
            double z = (qint16)((yz >> 16) & 0xFFFF);

Am I missing anything else important?

thanks! Caleb

ximion commented 1 year ago

No, that's basically it (and the different properties, of course). Let me know it t works! (it will for sure on Linux, but I used PoMiDAQ briefly on Windows, and the BNO stuff didn't work there, which is really odd and probably needs some debugging).

Another useful change the new firmware brings is the ability to fetch longer frame-counts via static_cast<long>(d->cam.get(cv::CAP_PROP_EXPOSURE)), you might want that too :-)

kemerelab commented 1 year ago

Awesome. I just verified that this change gives me functional BNO data! Thanks Matthias!

                    // w = static_cast<qint16>(cam->get(cv::CAP_PROP_SATURATION));
                    // x = static_cast<qint16>(cam->get(cv::CAP_PROP_HUE));
                    // y = static_cast<qint16>(cam->get(cv::CAP_PROP_GAIN));
                    // z = static_cast<qint16>(cam->get(cv::CAP_PROP_BRIGHTNESS));
                    auto wx = static_cast<quint32>(cam->get(cv::CAP_PROP_PAN));
                    auto yz = static_cast<quint32>(cam->get(cv::CAP_PROP_TILT));
                    w = (qint16)(wx & 0xFFFF);
                    x = (qint16)((wx >> 16) & 0xFFFF);
                    y = (qint16)(yz & 0xFFFF);
                    z = (qint16)((yz >> 16) & 0xFFFF);     
ximion commented 1 year ago

Awesome! Did you try that on Linux or Windows? (It's working flawlessly here on Linux for a few weeks, even with Syntalos for DAQ)

kemerelab commented 1 year ago

This is the Miniscope DAQ QT Software running in Ubuntu 22.04. We already had verified that Pomidaq was working for us, but we want the ease of the synchronous acquisition of the webcam video for behavior.

ximion commented 1 year ago

Nice, that means Windows support still needs some testing though.

Extremely shameless plug: You may find Syntalos (GitHub|Docs|Flathub) useful as well, it's designed for data acquisition from a massive number of data sources on Linux and ensures time synchronization between devices. It also supports the UCLA Miniscope fully (via PoMiDAQ's libminiscope).