locked
reading data from IMU RRS feed

  • Question

  • Hi

    I have just got a new xsense IMU and trying to read acceleration and altitude data from it.

    I'm a novice to C# and MRDS but aware of OOP terminology, I have the accompnion documents of the device along with the dll.

    however, I'm unable to run any of the funcations or do any communication with the device.

    I imported the dll called CMT, there seem to be two interfaces (Imotiontracker, motiontracker) and a class (MotionTrackerClass). 

    I tried to instantiate from the class but can not use the functions.

    Here are the list of functions that I'm interested in:

    CMTgetdeviceId, CMTopenport, CMTgetAcc and some more.

    when I try to implement CMTgetdeviceId(out deviceId), an exception is thrown saying .....has been return from a call to a com component.

    There is no specefic coding samples in the accompanying documents specially with C#

    Is there any otherway I read data from this?

    Saturday, June 23, 2012 9:42 AM

Answers

All replies

  • Sounds like a cool piece of hardware! I just looked up the company's website--which sensor did you get?

    It looks like they don't offer native .Net support (C#), but are providing a "COM" component instead (which is not uncommon), so there are several steps you're going to need to take.

    First, I'd see if you can read sensor data using plain 'ol C++ in (not in .Net) on your computer. That way, you'll know for sure that the sensor and computer can talk to each other.

    The next step will be to get .Net to call the COM object, perhaps as a simple .Net console application. Here's an overview of .Net's support for COM: http://msdn.microsoft.com/en-us/library/ms973800.aspx Again, the goal here is just to make sure you're able to read data from the sensor into .Net.

    Then, finally, if you want to use the sensor in RDS, you'll need to create an RDS service to read the sensor's data. If you haven't written an RDS service before, this will take a bit of exploration and learning. There's a chapter in the RDS "bible" which can help: http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470141077.html

    How do you intend to use the sensor--do you have a robot in mind?

    Keep us apprised of your progress--good luck!

    Saturday, June 23, 2012 8:02 PM
    Moderator
  • yeah I'm using this product: 

    http://www.xsens.com/en/general/mti-g

    the SDK provides API in C++ along with sample codes for matlab and excel vba but I can not use them in c#

    getting into interop and C++ would be abit difficult as I'm given a short deadline, what I thought I should do is to use matlab and then transfer that into C# using Matlab's .net builder. I'm not sure about this, do you have this can be a quick alternative instead of getting into C++ and COM.

    well, I dont think I would have much problem with reading data in RDS once I can read the data in C#, and indeed I'm using as a reference the book you mentioned, 

    in regards with our project, it is a student project for building an AUV robot but now surprisingly we are stuck with reading sensor data because initially we were expecting that the manufacturer would provides with C# API.

    I would definitely keep posting about our project as we are using RDS platform for the robot and run everything with dsshost in the embedded PC. 

    RDS seems to be quite helpful and easy as I have accomplished some basic tasks and also have done the simulation which at some point I will publish on youtube or somewhere else.

    I appreciate your help on instructions you pasted as above and I will definitely try those out but I was also wondering if there could be a much quicker way for me like reading data through matlab or labview or maybe even Excel and then get those into C#?

    Saturday, June 23, 2012 11:52 PM
  • by the way I already have com dll called xsens_cmt.dll , would I be able to convert this into .NET dll using tlbimport and regsvr32 as mentioned in the msdn topic? if yes, it would mean I will painlessly be able to access to all functions inside c#??
    Sunday, June 24, 2012 12:58 AM
  • I'm not sure whether that would work or not, but certainly seems worth a try. Here's how to do it in VS: http://msdn.microsoft.com/en-us/library/fwawt96c

    Arthur

    Tuesday, June 26, 2012 6:37 PM
    Moderator
  • This sounds like a cool project.  I hope Arthur's advice was helpful.
    Its been a while since this answer was proposed.  I will mark this thread answered and if you have any more questions please open a new thread as answered threads get less immediate attentions.

    Friday, July 6, 2012 6:20 PM