5 Replies Latest reply on Feb 6, 2018 4:51 AM by MartyG

    Real Sense R200 Scene Perception Save/Load State

    nnammad

      Hi,

       

      I am working with the R200 Camera and the RealSense SDK 2016R2.

       

      In the documentation, I found that there is a SaveCurrentState/LoadState function in the Scene Perception Module.

       

      Intel® RealSense™ SDK 2016 R2 Documentation

       

      Now I am wondering what exactly is saved in this state. To be more specific I would like to now, if the BlockMeshingData of the module is saved in the state file.

      Also when I try to load a saved state file, the status returns STATUS_ITEM_UNAVAILABLE and my program crashes.

        • 1. Re: Real Sense R200 Scene Perception Save/Load State
          MartyG

          I could find little useful documentation on these save and load functions.  I think that when the term 'state' is used, it is referring to saving everything rather than just parts of the data.

           

          Regarding your loading error: in the one script reference I could find that mentioned these functions, it says about the loading function:

           

          "This function is only available before calling  PXCSenseManager::Init().  The PXCSenseManager::Init() would fail [when loading] If you use a different camera than what was used when SaveCurrentState was called."

           

          Its commentary about the save function is:

           

          "Allows user to Save the current scene perception's state to a file and later supply the file to LoadState() to restore Scene  Perception to the saved state."

           

          This information is sourced from the long scene perception script linked below:

           

          realsense-ue4/pxcsceneperception.h at master · getnamo/realsense-ue4 · GitHub

          1 of 1 people found this helpful
          • 2. Re: Real Sense R200 Scene Perception Save/Load State
            nnammad

            Hello MartyG,

             

            thanks for your response. I rearranged my script, so that the LoadState function is called before PXCSenseManager::Init().

            Now my application does not crash anymore, but I still get get the same Status Error Code when I execute the LoadState() function.

             

            As you said, documentation on these functions is rare. It is not stated in which fileformat the state is saved.

            Maybe the LoadState function does only accept files with the right ending?

            • 3. Re: Real Sense R200 Scene Perception Save/Load State
              MartyG

              If the program works until the point when you use the load-file control, I would tend to suspect too that there is a problem in the file path (folder name and file name) that is stopping the file from being found.

               

              Bear in mind that the LoadState instruction may be formatted differently dpeending on whether you are using C++ or C#.

               

              In C++ it might be something like:

               

              pxcStatus PXCAPI LoadState(const pxcCHAR* file) = 0;

               

              And in C# it may be something like:

               

              pxcmStatus PXCAPI  LoadState(String file) = 0;

               

              The SaveState instruction would similarly have to be formatted for the language being used.

              1 of 1 people found this helpful
              • 4. Re: Real Sense R200 Scene Perception Save/Load State
                nnammad

                Thank you for your help!

                 

                I was able to load the state file by simply leaving the string in:

                 

                LoadState(String file)

                 

                without an file format ending.

                 

                When the state is succesfully loaded, I can execute the meshing function of the Scene Perception Module and get the mesh I captured before I saved the state of the module.

                 

                In this way it is possible to capture a scene with the Scene Perception Module, draw the mesh in my application, make annotations on the mesh and then save the state of the module.

                After that I can restart the application and load the saved state to restore the mesh and its annotations at the right location in the scene.

                • 5. Re: Real Sense R200 Scene Perception Save/Load State
                  MartyG

                  Awesome news!  Thanks so much for the detailed feedback.  Best of luck with the rest of your project, and please feel free to return to the forum any time that you have further questions.