librealsense: Inconsistent Accel stream in Unity C#


Required Info
Camera Model D455
Firmware Version 05.13.00.55
Operating System & Version WIN10
Platform PC
SDK Version v2.54.2 }
Language C# Unity
Segment others

Issue Description

When using the latest Realsense SDK in Unity, I can’t get the Accel data behaving correctly. I have the following snippet:


[SerializeField] RsDevice rs;
    void Start()
    {
        rs.OnNewSample += Rs_OnNewSample;
    }

    private void Rs_OnNewSample(Frame f)
    {
        if (f.IsComposite)
        {
            using (var fs = f.As<FrameSet>())
            using (var poseFrame = fs.FirstOrDefault(Stream.Accel, Format.MotionXyz32f))
                if (poseFrame != null)
                    ProcessGyro(poseFrame);
        }
        else
        {
            using (var p = f.Profile)
                if (p.Stream == Stream.Accel && p.Format == Format.MotionXyz32f)
                    ProcessGyro(f);
        }
    }

    void ProcessGyro(Frame f)
    {
        var x = f.As<MotionFrame>();
        Vector3 v = new Vector3(x.MotionData.x, x.MotionData.y, x.MotionData.z);
        Debug.Log(v);

    }

To listen to Accel data. This is the RSDevice: image

What happens is that when the device is enabled, for the first 1-5 seconds, data streams in, and then it keeps outputting the same value. So, new samples do come in via rs.OnNewSample, but the value that’s put out is stuck.

The depth and IR work just fine. In RealsenseViewer, it keeps working too.

No errors or warnings show up in Unity. What could be the problem here?

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 34

Most upvoted comments

After consulting with my colleagues, an official internal Intel bug report has been created so that this issue can be investigated further by the RealSense team, and I have added an Enhancement label to this issue to signify that it should be kept open.

You are very welcome. Thanks very much for your patience. I have communicated the urgency of the issue to my colleagues and will let you know as soon as I receive feedback.