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

Cannot read 6DOF body with residuals #55

Open
mihaelapopescu opened this issue Dec 2, 2024 · 3 comments
Open

Cannot read 6DOF body with residuals #55

mihaelapopescu opened this issue Dec 2, 2024 · 3 comments

Comments

@mihaelapopescu
Copy link

I am able to read the 6DOF rigid bodies using Get6DOFBodyCount() and Get6DOFBody(). However, when I want to access the 6DOF with residuals using Get6DOFResidualBodyCount() and Get6DOFResidualBody(), the count of rigid bodies is zero and there is no rigid body data streamed. I followed the minimal example from RigidBodyStreaming.cpp. Is there something else that should be done in order to enable the residual streaming? As a remark, I can see the residuals for all rigid bodies in QTM. Thanks!

@OliverGlandberger
Copy link
Contributor

OliverGlandberger commented Jan 8, 2025

TL;DR - Could it be that you didn't use "Play with Real-time Output"?

It seems to be working for me. Here's a list of the steps I took / the test code I wrote.

I started QTM and opened a file with one 6DOF rigid body and pressed "Play with Real-time Output" (found in the "Play" menu). I started the RTClientExample and used the following operations: Enter(x4) --> 8 (6D with residuals) --> 3 (frame by frame) --> 1 (show current frame). Calling that will execute the code in the else-statement found in RTClientExample/Output.cpp on line 140.

Prior to running RTClientExample, I commented out all the code in that else-statement (starting on line 140) and replaced it with the following:

        auto resBodCount = poRTPacket->Get6DOFResidualBodyCount();
        float fX = 0.0f;
        float fY = 0.0f;
        float fZ = 0.0f;
        float fResidual = 0.0f;
        float afRotMatrix[9] = { 0 };

        printf("\n\n");

        for (int i = 0; i < resBodCount; i++)
        {
            auto temp = poRTPacket->Get6DOFResidualBody(i, fX, fY, fZ, afRotMatrix, fResidual);

            std::cout << "i = " << std::to_string(i + 1) << "\n\n";
            std::cout << "fX = " << std::to_string(fX) << "\n\n";
            std::cout << "fY = " << std::to_string(fY) << "\n\n";
            std::cout << "fZ = " << std::to_string(fZ) << "\n\n";

            for (int i_rot = 0; i_rot < 9; i_rot++)
            {
                std::cout << "afRotMatrix[" << std::to_string(i_rot) << "] = " << std::to_string(afRotMatrix[i_rot]) << "\n\n";
            }

            std::cout << "fResidual = " << std::to_string(fResidual) << "\n\n";
        }

This gives me the following output:
image

@OliverGlandberger
Copy link
Contributor

@mihaelapopescu If I misunderstood something, or if you have any more questions, don't hesitate to let me know / ask. :)

@mihaelapopescu
Copy link
Author

mihaelapopescu commented Feb 7, 2025

Thank you very much and sorry for the delayed reply. In my case I am streaming live data instead of recorded data. Is there anything else I should enable in QTM to get the residuals as well? I used a similar approach to yours to get the residual rigid body data, but Get6DOFResidualBodyCount() returns zero while Get6DOFBodyCount() without residuals works fine.

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

2 participants