# openIMU300RI how to get linear acceleration

Hi,
I plan to use the openIMU300RI in a car application. Therefore i need the linear acceleration.
I already installed the VG_AHRS framework and mapped the EKF data to the CAN output.
Unfortunately I don't know how to access the linear acceleration or how to activate the correction.

I can process the data received via CAN Bus but this is only 100 Hz. I would prefer the sensor to pre-process and output the data.

I hope somebody can help me.

Hi @SeppW ,
Linear acceleration is calculated in INS but not VG_AHRS framework, as linear acceleration is not necessary for VG/AHRS algorithm. If you need linear acceleration in your application, you can follow and implement below approach in your VG_AHRS framework:

@ysong Thank you for you reply.

I'm aware of the math. My easy approach would be to use the rotationmatrix form the quatanionsystem and tranform the acceleration to the world frame acceleration. Then I would simply remove the gravity and retransform it to body frame by using the inverse.
However I just wanted to make sure, that I'm not missing something.

Is it possible to install the INS app without gps and use the linear acceleration?

No, because if INS app doesn't receive GPS data, it also will not calculate linear acceleration.
So you can use your approach to calculate linear acceleration in VG_AHRS app, I think it should work.

I was able to use generated matlab code to filter the gravity from the body acceleration.
It worked pretty flawless, but I'm wondering how to set the call cycle. My algorithm has a void step function which has to be called every 5ms.
Further I'm wondering whether the mag data are already corrected. I think the sensor I factory calibrated but I'm getting strange values by doing for example a 90 deg turn. The measured angle is like 60 deg and the integration of the filtered gyro gives me about 90 deg.
The 60 deg result in using a ahrs framework. I'm not sure why this is happening... I'm wondering if this is due to not using the calibration.
Also what does the soft iron values mean and how to use them?

Short update:
I calibrated the sensor using recorded raw data.
Further I read the ?factory calibration? parameter with the nav-view tool.

I entered these values in the user_configuration.c but I'm not sure, if they are actually used.
Further I did a calibration on my own and now the matlab ahrs gives reliable heading estimation using the mag.

I'm wondering why the mag alignment using the NAV-View Software ist not working. This could be an easy why to calibrate the sensor when it is mounted in the car. -> When I start the app in NAV-View it just does nothing.

Glad to know you have got the linear acceleration!

Do you mean you need a 200 Hz output data rate via CAN? I just know how to modify source code to get 200Hz data output via serial port but not CAN, maybe you need to read and modify the open source code to find a way to achieve that, or post a new topic of this question, maybe other guys knows.

Please run OpenIMU python driver and run mag alignment here: https://developers.aceinna.com/devices/record-next

@ysong I would love to get the data via CAN with 200 Hz but since I can deploy matlabcode via codegen on the IMU itself there is no need to.

I'm not to familiar with RTOS so i don't know how to set the user algorithm to run with 200 Hz.
My code needs to be called every 5ms with new data. I just added my algorithm call in the same function as the ahrs function call.
Like so:

I'll try the calibration tomorrow. But I have not been able to calibrate the sensor. Python drivers is running, at least I think so. Is there a way to check that?

Hi @SeppW,

Function "RunUserNavAlgorithm" is invoked at 200 Hz indeed, just output results data via CAN with 100Hz, so I think this should be okay for you.

I think the "mag alignment" is your requirement of "calibrate the sensor", you could have a look at:

BTW, magnetic sensor is sensitive, so for your car application, I think the iron part (such as engine, car frame) of your car maybe interference for magnetic sensor, so it it necessary to evaluate only use magnetic sensor to get heading is stable enough for your car application.

BTW, magnetic sensor is sensitive, so for your car application, I think the iron part (such as engine, car frame) of your car maybe interference for magnetic sensor, so it it necessary to evaluate only use magnetic sensor to get heading is stable enough for your car application.

I'm aware of the problems which can occur due to iron effects. We just need the magnetic field to get an rough estimation of the direction of the car.
The more precise measurement will be done after identifying some characteristic landmarks. The IMU will be used to initialize this procedure.

@ysong when doing the mag aligment I'm stuck in this screen.

Do you have any idea how to fix that?

Hi @SeppW ,
We are in holiday this days, I will back to office this Sunday and find a 300RI to try by then. If this is urgent for you, you also can post a new topic of this question to see if other guys knows how to fix it.

Hi @SeppW ,

I find 300RI can't do mag align via serial port in current version, but can do mag align via CAN, so I have 2 suggestions(ways) for you:

1. Implement 'mag align via serial port' function for 300RI. You can find how 300ZI to implement 'mag align via serial port' by searching key word 'ProcessMagAlignCmds' in 300ZI VG_AHRS project source code, and follow the steps of the implementation in 300ZI VG_AHRS. This is a 'DIY' way that play with 300RI. Welcome your coming contribution!