-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
D455 motion frame is slow in C# #11111
Comments
Hi @choe-hyun-ho It is a known issue that if depth, RGB and IMU are enabled simultaneously in the RealSense Viewer or a self-created script then problems can occur for some RealSense users (not all), most commonly a 'No Frames Received' error on one of the streams. It does not matter which order the three streams are enabled in, as it is the enabling of the IMU (Motion Module) that is the trigger for the issue. I note though that you are not experiencing problems with three streams enabled in the Viewer. The C++ rs-capture and rs-multicam programs are not affected by the issue and can stream depth, RGB and IMU simultaneously. A workaround for RealSense users affected by the depth-RGB-IMU issue in C++ is to use callbacks. Information about accessing the IMU with callbacks in C# can be found at #8746 In Python the most successful workaround is to create two separate pipelines - IMU alone on one pipeline and depth / RGB on the other pipeline - as described by the Python script at #5628 (comment) #10858 discusses accessing the IMU with C# in Unity. It may be worth exploring creating multiple pipelines in the RealSense Unity wrapper and putting the IMU on a separate one by modifying a technique at the link below for defining multiple instances of RsDevice for multiple cameras. Instead though, use a single camera serial number with profiles for depth + RGB on one RsDevice instance and an IMU profile on the other RsDevice. If you are not already using the RealSense Unity wrapper for your Unity project, details are here: https://github.com/IntelRealSense/librealsense/tree/master/wrappers/unity |
Thanks, MartyG. With your advice, I managed to get successful result in my test C# code. It works fine, but is seems to be bug in typecasting Frame to MotionFrame.
My code is wrong, or bug in typecaster?
|
If a script uses callbacks then it should include the word callback in the brackets of the pipe start instruction so that the SDK knows that it is a callback script. Does performance improve if you write the pipe start line like this:
|
Hmmm... Anyway, my last question is why the following statement is not woring properly.
|
Looking at the overall code, it may be better to simplify the Else instructions from two down to one by having only Format.MotionXyz32f as the Else condition and the Accel and Gyro checks nested within it as If conditions. So the program will not check that the stream is Accel or Gyro unless the stream format is MotionXyz32f
|
OK, MartyG. Can you run my code yourself?
The result is as follows:
But the following code is used:
The result is as follows:
Why this drastic difference is made? Thanks. |
My computer is not equipped with a development environment to compile scripts, unfortunately. Does it work if you use |
There is no property like MotionFrame in Frame class. I want to check the above symptom is only happening in my environment, or generic. I am curious that this code causing problem only for me, or treated as bug. |
The MotionFrame error may have occurred because you changed from
However, another RealSense user reported in #4418 (comment) that MotionFrame was not supported in C#, so using the WaitForFrames approach may not have resolved the problem anyway. It was also confirmed at #2996 (comment) that MotionFrame was not supported in C#, and it was suggested that the IMU be accessed via |
Hi @choe-hyun-ho Do you require further assistance with this case, please? Thanks! |
The issue I reported is that the following code is not working as expected.
And after all the following discussion, I think C# wrapper lacks of some features/functions for IMU like this. I hope this fixed in the next release of SDK, And there is no more assistance needed about this issue. Thx. |
I followed up about the |
Case closed due to no further assistance required. |
Hi Teams,
I am trying to use D455 with C#/Unity.
After reviewing several examples including rs-motion(C++) and rs-capture(C#), I managed to build simple C# application using both cameras & IMU simultaneously.
If I enable motion stream only, it works fine, and enoughly fast.
But if I enable motion stream and RGB/depth camera stream simultaneously, motion frame rate becomes much slow (about 5~6 frame per second), even if I don't add any video frame handling codes.
Please see the below C# code.
This is a very simple .NET console application which is reading several streams from D455, and measure/print frame rate every second.
When I enabled only accelerometer and gyroscope, it can read hundreds of frames per each second, but with Color/Depth camera stream altogether, only 5~6 frames received for IMU.
I also checked USB connection status via RS viewer. It says connected to USB 3.2.
In C example codes, and In RealSense Viewer, this problem doesn't happen.
The text was updated successfully, but these errors were encountered: