qualisys_cpp_sdk icon indicating copy to clipboard operation
qualisys_cpp_sdk copied to clipboard

Cannot read 6DOF body with residuals

Open mihaelapopescu opened this issue 1 year ago • 3 comments

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!

mihaelapopescu avatar Dec 02 '24 14:12 mihaelapopescu

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 avatar Jan 08 '25 11:01 OliverGlandberger

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

OliverGlandberger avatar Jan 08 '25 11:01 OliverGlandberger

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.

mihaelapopescu avatar Feb 07 '25 11:02 mihaelapopescu