Software Archive
Read-only legacy content
17061 Discussions

RealSense + Accelerometer in VS 2015

Nikolay_I_
Beginner
361 Views

I am trying to start developing a Windows Phone/Tablet App on Visual Studio 2015 (Community Edition) that makes use of both an accelerometer and a depth image from a RealSense camera. However, I'm stuck at the very beginning, when choosing the project template. A Windows Forms project already has all the sensors libraries, but when I try to import the specific RealSense library libpxccpp2c.dll, I get a message:

"A reference to '---' could not be found. Please make sure that the file is accesible, and that it is a valid assembly or COM component".

When, on the other hand, I'm creating a WPF project as it is suggested in RealSense tutorials, then the Windows.Devices.Sensors library containing the accelerometer class becomes unavailable, the library may not be seen in the "add reference" menu. The only tutorial I was able to find solves this by including projects from WindowsAPI code Pack, which is by now also unavailable.

A noob-level explanation needed.

0 Kudos
5 Replies
jb455
Valued Contributor II
361 Views

The latest version of the SDK included an early version of the RealSense DLLs built for the Universal app platform. Perhaps you could try using those and building it as a universal app (which is supposed to be better for phones & tablets anyway so may make it easier to deal with accelerometers)? 

On my filesystem, they're stored in C:\Program Files (x86)\Intel\RSSDK\UWP\ExtensionSDKs\Intel.RealSense\7.0.23.8048\redist\CommonConfiguration\x86

This article has more information: https://software.intel.com/en-us/articles/get-ready-for-intel-realsense-sdk-universal-windows-platform-apps

Good luck!

0 Kudos
Bryan_B_Intel1
Employee
361 Views

This article explains how to access the sensors from a desktop app: https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-applications

The libpxccpp2c.dll is an unmanaged DLL that needs to be in the output folder when you build and run your app. You need to reference the managed DLL (libpxcclr.cs.dll) in your project. There are a few different ways to set this up, which are explained in this article: https://software.intel.com/en-us/articles/using-the-intel-realsense-sdk-to-create-hello-world-project

Hope this helps!

0 Kudos
Nikolay_I_
Beginner
361 Views

Thanks James, thanks Brian, still working on that...

I'm really sorry for asking such basic questions, but it looks somewhat strange. I mean, R200 is supposed to be used with smartphones/tablets, so I really supposed that running RealSense with accelerometers and stuff alike will be a piece of cake even for a novice. Yet I find myself completely screwed up in my attempts to include all the necessary libraries to handle accelerometer, RealSense, async and who knows what comes up next at the same time. I did try the code from the tutorial on accessing sensors, and it does work, but only until I try to use some of the methods like ReadingChanged or Dispatcher.RunAsync. For that, further libraries like Windows.UI.Core are needed, and I was unable to find relevant articles on MSDN, explaining how to integrate these libraries into a WPF project.

Just frankly, was the RealSense project that much aimed at F200, with an assumption that people will have it as a separate webcam on their stationary monitor? Why then teasing the folks with things like ToyZ which definitely uses both depthcam and accelerometer and probably more than that?

I don't mean to be harsh, I have no moral justification to blame either Intel or Microsoft, and in the end it's developers' obligation to figure things out. But I would really REALLY appreciate a small tutorial on the Intel's webpage that will just explain how to bring R200 and sensors and Windows Core together. I may be the first, but there surely are lots of folks around that will wish to do the same from scratch.

Sorry for a lengthy text :( I'll try my best!

0 Kudos
Bryan_B_Intel1
Employee
361 Views

Hello,

I have attached a document that should help you add accelerometer readings (x, y, and z) to a R200 project. The document contains a link to a R200 C#/XAML code sample that streams color, depth and left/right IR from a R200 camera. The document then shows the modifications to the source code (both .cs and XAML) that I made to add the accelerometer data. I put this together rather quickly, so there is room for improvements, refactoring, etc. The main purpose is to demonstrate it can be done. Note that I did this on a Win10 Yoga 15 laptop using Visual Studio 2015. Let me know if you run into any problems.

-Bryan

0 Kudos
Nikolay_I_
Beginner
361 Views

Thousand times thanks, Brian!!!

In Your code, the accelerometer itself seems not to be initialized, but was not a big deal to figure it out even for a noob like me. This aside, the program functions perfectly on my Lenovo Miix, Windows 10, VS 2015. Actually I was able to put all the libraries together later yesterday, it was just that I've tried to copy the code from an MSDN example working with accelerometers that made use of async, and therefore further libraries.But alas, as You've said, this is only a matter of further improvement and cleaning of the code.

Once again, many thanks!

0 Kudos
Reply