Emlid

Community Forum

C++ sample code that access both GPS and IMU data?


(John Mann) #1

I am new to Raspberry Pi and Navio2. I have successfully built and run most of the sample code documented here:

https://docs.emlid.com/navio2/common/dev/

My project requires that I send both GPS data (Lat, Long, Altitude, Velocity, Track angle, etc…) and IMU data (pitch, roll, heading) over TCP to another piece of hardware on the network. The AHRS example sends IMU data over TCP, and the GPS w/uCenter example sends GPS data over TCP. Is it possible to access both sets of data from the same C++ code? It’s not obvious to me how the two sets of code could be combined to put everything I need into a single executable. If anybody has done something similar, I would love to see some sample code.


(Tatiana Andreeva) #3

Hi John,

Yes, you surely can rewrite these examples to transmit both GNSS and IMU data over TCP. However, we don’t have a ready solution for what you’re trying to accomplish, so the implementation requires some research and programming skills from you.

Maybe somebody from our users will share the ready code.


(John Mann) #4

Thank you for the encouraging comment. I am currently trying to merge the AHRS and GPS examples. I am not very confident that I will be successful, but if it actually works, I will post the results here on the forum.


(John Mann) #6

I was able to merge the two pieces of code (AHRS and GPS examples) and have the GPS and IMU data updating at around 5 Hz. Now I just need to figure out how to calibrate the magnetometer so the yaw will stop drifting.


(Tatiana Andreeva) #8

Hi John,

You can examine calibration algorithms, such as soft-iron or hard-iron, and implement something. It’s also possible you can find ready examples in ROS.


(system) closed #10

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.