# MSF_developed **Repository Path**: maxibooksiyi/MSF_developed ## Basic Information - **Project Name**: MSF_developed - **Description**: No description available - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-09-14 - **Last Updated**: 2024-09-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #MSF_developed --- ### An extended version which regarded the original ETH MSF (mult-sensor fusion) as the lib to import, and extracted the *msf_updates* into an independent section. This version realized fusing IMU, SLAM (ORB_SLAM2) and GNSS (or GPS) into a framework. --- Authors: [Zida Wu](https://github.com/milkytipo), [Zheng Gong](https://github.com/gauxonz), [Qiang Liu](https://github.com/LugiaLiu) MSF is a good algorithm, but obviously, the code and the theory are really not friendly to a researcher. I think that's why there are few people want to develop it further. So I just summarize my experience, hoping the later people could run it as soon as possbile. MSF is good algorithm, if you can run it well, it must give you some insightful ideas about the sensor fusion. ETH的MSF是一个非常优秀的多源传感器融合(松耦合)开源框架,尽管是松耦合,但是最终经过修改和调试后的MSF的效果依然让我觉得非常惊喜。同时由于MSF原始代码非常的不优美简洁,所以我特地将MSF源码作为一个“库”来使用,而将我们可以扩展和开发的部分单独提取出来开发成MSF_developed,这样对代码理解和使用会有更好的帮助。需要提前说明的是,由于原始MSF文章公式的错误和代码的问题,导致研究者者直接阅读代码和看文章公式推导会存在疑惑,这里我都将一一解答。此外,鉴于KITTI数据集本身的缺陷,以及跑MSF的需要等原因,要想完整跑出理想MSF效果,需要KITTI数据预处理、MSF源码修改,GPS加噪声(可选),ORBSLAM2的publish位姿的话题(topic),轨迹显示等各项操作,不过我已经全部一条龙在本Readme中进行说明和解释,Good Luck!如果觉得有用,给个star吧!hhhhhh In order to make it convenient for researcher to understand and run the *MSF_developed* framework (because the original version is a little hard to use), I have to claim something about that at first. The details about those will be discussed one by one. > * You have to preprocess the KITTI dataset, since [the KITTI dataset and its kitti to bag tools][3] have some "bugs". > * [Original MSF paper][1] has some mistakes about equations, it will probably puzzle you especially when you run the MSF algorithm at the same time. What's more, the symbols (such as *q_wv*, *q_ic*) in the MSF code don't follow the roles in his papers which also perplexs researchers. > * The code in original MSF is not concise enough, so I put the MSF as the lib and develop the *MSF_developed* to make users fully master how to run the framework. Moreover, I have fixed some bugs and time setting in MSF (if you use MSF firstly you have large probability get troubles about the timestamp), so I recommmend you use my [ethzasl_msf][2] as your MSF choice. > * You have to fully understand parameters in the [position_pose_sensor_fix.yaml][yaml], since I think it contains the core idea of the MSF design. Okay, now I will discuss the problems one bye one. I will tell you how to fix it and which tools you should use. After those a brief demo would be given to show how to run the **MSF_developed**. ## **Key Problem** ### 1.KITTI Dataset Process and Add noise into GPS data **Problems:** > * KITTI has ***synced*** and ***unsynced*** data. The synced data has low frequency but the unsynced data owns high IMU Hz. > * KITTI dataset's data (mainly about oxts(GPS+IMU) ) is not continuous, which indicates that there are many data lost in the process > * The GPS data in KITTI was obtained by RTK-fixed results, which owns high positioning quality. If we want to demonstrate the affect of the GPS in our framework, we should not induce such good results. > * The kitti to rosbag tools which officially recommended are not good, because it will lost covariance in GPS and other problems. Thus, we should find a way to synchronize the IMU-GPS-Images data, interprete the lost data to make it continous, and add some noise into the GPS data. If possible, we should directly read data from files, but not from bag just like VINS-Mono. (Actually, I realize this funcion in [read_dataset ](https://github.com/milkytipo/MSF_developed/tree/master/src/read_dataset)node. **Tools:** [KITTI-Interpre][4] After using this tool, you can transfer the unsynced data into synced data with high IMU frequency, as well as continous GPS and IMU. Besides, in the [InterpAndGnss.m](https://github.com/gauxonz/KITTI-interp/blob/master/InterpAndNoiseGnss.m) you can add noise in the GPS. Please note that, the dataset I used follows the files structure follows this tools instruction. The reason why I mentioned it is that, in my improvement I directly reading raw data from files but not through rosplay bag. ### 2. The theory imperfection in original MSF paper and MSF code **Problems:** > * The theory in [Original MSF paper][1] is insightful, but the Jacobi matrixs and other equations in papers are wrong, those in the author's PhD thesis paper are not right neither. > * As for the diffrent representation of the symbols between code and paper, you should only notice one thing: that is the *q_wv* and *p_wv* is the opposite to the original meaning in papers. The normal representation is , for example, the *q_ic* means that to project the IMU position into camera coordinates. However, the *q_wv* in code is not like that. **Solutions:** At first, the figure shown below is about the whole architecture about msf.


**debug tips**:
1. if you want to check whether the GPS sensor fusion or SLAM sensor fusion are working on well or not, you can directly cancel the annotation of the MSF_WARN_STREAM("\***GPS H Matrix is calculating***") in position_measurement.h and the MSF_WARN_STREAM("\***SLAM H Matrix is calculating***") in pose_measurement.h.
2. if you want to obtain the real time core state display, you just need to cancel the annotation of the the MSF_INFO_STREAM("the fixed pwv :"<< **xxxxxx**) in pose_measurement.h.
(I know the debug way is a little stupid... but they are simple as well as efficient.)
## **KITTI Example**
### Prerequisite
1. [ORB_SLAM2](https://github.com/milkytipo/ORB_SLAM2) which can publish the its transform (pose and position) topic. The core idea about this is add the publishment topic in ros_stereo.cc
2. Since the MSF_developed directly read data from files, so your **files structure** shoud follow the rules as [KITTI-Interpre][4]. (Actually it is the same as the *Rawdata* you download from KITTI). Of course you can use KITTI bag, if you read the source code of the [*read_dataset*](https://github.com/milkytipo/MSF_developed/tree/master/src/read_dataset) node you will find they are the same as rosplay bag.
### Run MSF_developed and Visualization
```
roslaunch ai_robot_lcsfl KITTI_start.launch
```
After the MSF and ORB_SLAM2 have all started:
```
rosrun ai_robot_lcsfl read_node /(your_root_path)/KITTI/RawDataFixed/2011_10_03/2011_10_03_drive_0027 noised-01
```
**Note:** I named the noised file as noised-01, you can change the GPS noised setting and generate your own noised data. Of course, you can use raw GPS data.
```
rosbag record /imu /gps/fix /msf_core/pose /slam/tf
```
Keep the bag files in order to plot the trajectory.
------
### **P.S. 1 A Simple Visualization Tool for SLAM/MSF/GPS trajectory - plotTrajectory**
I developed a simple tool to plot the trajectory, called [plotTrajectory](https://github.com/milkytipo/plotTrajectory)
> 1. set the file path in the loadtxt("/path") in extract_topics_from_rosbag.py
> 2. python extract_topics_from_rosbag.py
> 3. python plotTrajectory.py
Then, you can see the trajectory like this:



