Can I get IMU 1044 output with external tick method ?

Comments & issues
Post Reply
Planktos
Fresh meat
Posts: 1
Joined: Thu Aug 06, 2020 4:42 pm
Contact:

Can I get IMU 1044 output with external tick method ?

Post by Planktos »

Hello,
I am using a 1044 IMU for years and I need a way to get the output in C without the use of CPhidgetSpatial_setDataRate(spatial,WaitTime); so I can be able to call SpatialDataHandler when I want. This issue is very important for me because I would need to implement a complex IPC system if there is no way to do that.

This is the main part of my code which I would run without the CPhidgetSpatial_setDataRate(spatial,WaitTime); ticking method

Code: Select all

int CCONV SpatialDataHandler(CPhidgetSpatialHandle spatial, void *userptr, CPhidgetSpatial_SpatialEventDataHandle *data, int count)
{
		raw[0][0] =  data[0]->acceleration[0];raw[0][1] =  data[0]->acceleration[1];raw[0][2] =  data[0]->acceleration[2];
		raw[1][0] =  data[0]->angularRate[0];raw[1][1] =  data[0]->angularRate[1];raw[1][2] =  data[0]->angularRate[2];
		raw[2][0] =  data[0]->magneticField[0];raw[2][1] =  data[0]->magneticField[1];raw[2][2] =  data[0]->magneticField[2];
Thank you very much,
regards,
Planktos
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Can I get IMU 1044 output with external tick method ?

Post by mparadis »

Instead of using the CPhidgetSpatial object, you can use individual objects for the accelerometer, magnetometer and gyroscope. These objects have "get" functions that let you get their data on demand (e.g. getAcceleration).

The downside with using the objects separately is that the data from the three different objects will all have slightly different timestamps which could complicate your calculations.

I think it would still be better to continue using the Spatial object, but in the event handler just store the most recent data in a global variable and then when you want to grab the data, just access the global variable. Functionally this is the same as using the "get" functions for the separate objects since you'd just be getting the most recent value the IMU has sent to your computer in either case.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest