TUC-ProAut / libRSF

A robust sensor fusion library for online localization.
https://mytuc.org/libRSF
GNU General Public License v3.0
304 stars 65 forks source link

IMU and Pose sensor fusion #12

Closed antithing closed 1 year ago

antithing commented 1 year ago

Hi, and thank you for making this code available.

I need to add IMU data into existing pose data (xyz / xyzw) from a SLAM system.

The goal is to smooth and predict data when tracking is lost.

Is this code suitable for that purpose? Is there an example that might help me get started?

Thanks!

tipf commented 1 year ago

Hi and thanks for your interest on the libRSF.

I think that your application could be implemented with different parts of this lib. For the IMU part the IMU pre-integration factor is made for such a use case. It allows integrating over multiple IMU measurements, so that you need only one factor between consecutive poses. I would recommend to start with this example how it can be used: Example_IMU_Single.cpp

To get a better "feeling" of the libRSF syntax, you can also have a look at simple examples like: Example_FG_Range.cpp

I have one question regarding the output of the SLAM system. Do you want to use relative transformations from this system or absolute poses? (The libRSF has factors for both.)

antithing commented 1 year ago

Hi, thanks for getting back to me.

I am planning to do it like this:

input:

  1. Position xyz, rotation xyzw (in world space) at 24 HZ
  2. Accelerometer and gyro data at 400 Hz

Output:

Smoothed pose (in world space) when input 1 is valid, predicted pose (in world space) when input 1 is lost (and between measurements)

I don't suppose there is a pre-built example that i can just feed this data into? Or would that be too easy? :)

tipf commented 1 year ago

I think it is perfectly doable, but there is no example that matches this use case directly. Implementing such a factor graph should be easy, but requires a bit of knowledge about factor graphs in general. The required effort also depends on the circumstances... if it is solved online or offline, if the data stream starts with a static sequence or in motion, if the IMU and the SLAM system are synchronized, and so on.

The following steps would be required in general:

  1. Read the data from some file
  2. Initialize the first state variables
  3. Loop through all measurements (IMU + pose) a. add relative IMU factors b. add absolute Pose Factors
  4. Solve the Graph
  5. Export the resulting poses into a file

But I think it is a very basic task and can be achieved with many different frameworks.

tipf commented 1 year ago

I close this now, but feel free to reopen it if you have further questions.