Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BNO still not working in Linux? #13

Open
ckemere opened this issue Aug 8, 2023 · 8 comments
Open

BNO still not working in Linux? #13

ckemere opened this issue Aug 8, 2023 · 8 comments

Comments

@ckemere
Copy link

ckemere commented Aug 8, 2023

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
Copy link
Contributor

ximion commented Aug 9, 2023

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
Copy link

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:

bothlab/pomidaq@d1fc57d

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
Copy link
Contributor

ximion commented Aug 30, 2023

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
Copy link

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
Copy link
Contributor

ximion commented Aug 30, 2023

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
Copy link

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
Copy link
Contributor

ximion commented Aug 30, 2023

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).

@ximion
Copy link
Contributor

ximion commented Nov 5, 2024

I everyone! I think I may have fixed that issue now, after a bunch of systems upgraded to newer kernels and showed the same behavior you describe... If you flash the changes from #19 you may get this to work again :-)

ximion added a commit to ximion/Miniscope-DAQ-Cypress-firmware that referenced this issue Nov 5, 2024
The Linux kernel added some more input sanitization with kernel 6.10.3
(specifically patch
torvalds/linux@8641968).
We could add a quirk fix to the kernel, but it's a bit easier to update
the hardware as well to behave more correctly.

This will permit reading position data from the BNO on Linux once again.
Resolves: Aharoni-Lab#13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants