jagennath-hari/CUDA-Accelerated-Visual-Inertial-Odometry-Fusion

Output at IMU rate?

Closed this issue · 3 comments

Hi, and thanks for making this code available.

It looks like it takes odometry and IMU data at the same rate, is that right?

Is it possible to run input at both camera odometry (rg, 30hz) and IMU (200 Hz), and output at the IMU rate?

Also, my use case involves using just IMU data to calculate output for small times if camera odometry tracking is momentarily lost, can I do that here?

Thanks!

Hello,

It is definitely possible to extend this for your use case. Ideally for your application you would want to remove the message filter which creates a common callback and which takes both at the same rate. You can have separate callbacks for the IMU and odometry, to achieve this.

The most robust alternative would be to run the UKF update step individually and separately during IMU and odometry data. Alternatively, if you wish to produce output even faster you can create a timer callback at 300Hz which outputs the data using predictions only and when IMU (200Hz) is available it updates the UKF, similarly done for the odometry (30Hz).

Check out http://wiki.ros.org/message_filters, http://wiki.ros.org/roscpp/Overview/Timers, https://docs.ros.org/en/humble/How-To-Guides/Using-callback-groups.html and https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Cpp-Publisher-And-Subscriber.html to get a better understanding. Keep in mind achieving this will require significant changes to the code base's architecture. Take a look at https://docs.ros.org/en/humble/Concepts/Intermediate/About-Executors.html also as running callback this fast may need multi-threading to compensate for high frequency (200Hz).

Feel free to ask any other questions.

Thanks! To make it even more difficult, I need to move it out of Ros as well. Will the core code run without Ros if I swap out the types?

Yes, you need to refactor code and switch a few types like sensor_msgs etc, in the .cuh and .cu files which has a few ROS depends. The core node is primarily written for a ROS 2 system so you would need to significantly refactor the code and make those callback manually if you want to use it for a real-time system, else you can use a dataset and load it accordingly. Make the .cuh and .cu files into a library after refactoring them, you then need to make a new ROS free node which imports your new refactored library into your system and application.

You can start looking for includes like:-
#include <rclcpp/rclcpp.hpp>
#include <rclcpp/logging.hpp>
#include <nav_msgs/msg/odometry.hpp>
#include <sensor_msgs/msg/imu.hpp>

and similarly data types used in the code and refactor them accordingly for your types. Remember to pay close attention to the CMakeLists.txt file and notice how CUDA was linked, you need to make it similarly for your application.