-
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
IMU sample in Unity #2996
Comments
As you observed, there is not a Unity sample program for IMU data yet. A RealSense community member has contributed a non-Unity program for rotating the point cloud with the IMU though. Looking at this code may provide some useful insights. |
Thanks for the quick reply. I am currently looking through samples and actually encountered this one already. It seems that the Unity wrapper has a slightly different way of accessing frame data than the C++ examples, so I'm still not entirely sure how to proceed. I will keep searching, and if/when I have a solution I will post here. |
The C# wrapper doesn't yet contain the high-level APIs to support IMU (i.e MotionFrame\Profile), but I can point you in the right direction for low-level access (not tested). class Program
{
struct Vector3
{
public float x, y, z;
}
static void Main(string[] args)
{
var pipeline = new Pipeline();
var cfg = new Config();
cfg.EnableAllStreams();
pipeline.Start();
while (true)
{
using (var frameset = pipeline.WaitForFrames())
{
var gyroFrame = frameset.FirstOrDefault<Frame>(Stream.Gyro, Format.MotionXyz32f).DisposeWith(frameset);
var a = Marshal.PtrToStructure<Vector3>(gyroFrame.Data);
var accelFrame = frameset.FirstOrDefault<Frame>(Stream.Accel, Format.MotionXyz32f).DisposeWith(frameset);
var b = Marshal.PtrToStructure<Vector3>(accelFrame.Data);
}
}
}
} |
We are working on better IMU support across the SDK. The plans is: |
Thanks for the update. I probably won't have time to try @ogoshen's suggestion, but thanks for that, too! :) |
Hello there,
I'm sure this is being worked on, but is there an available sample using IMU data in Unity? I'd like to try a simple experiment where the point cloud is counter-rotated by IMU data to stabilize the horizon. I'm a little confused about where to start. I think I want to add a POSE profile to my stream reader, but I'm unsure what kind of format/dimensions this "frame" should be.
Thanks!
The text was updated successfully, but these errors were encountered: