UTS-RI / ugpm

Continuous preintegration
Other
113 stars 27 forks source link

how can i use this model in imu/gnss navigation? #7

Open JiangWeiHn opened 1 day ago

JiangWeiHn commented 1 day ago

I want use this ugpm to replace the normal preintegration in the imu/gnss Graph optimization system. I want know every imu time the body’s position, velocity and attitude。so i set the start_t is the first imu time,and infer_t is the second imu time .and the preintopt is : opt.type = ugpm::PreintType::UGPM; opt_.minfreq = 500; opt.statefreq = 400; opt.quantum = -1.0; my imu frequency is 400Hz.

and this is the code to create the preintegration class: imu_forpreint.acc.push_back(imudata.acc.at(imu_id-1)); imu_forpreint.acc.push_back(imudata.acc.at(imu_id)); imu_forpreint.gyr.push_back(imudata.gyr.at(imu_id-1)); imu_forpreint.gyr.push_back(imudata.gyr.at(imu_id)); double start_t = imu_forpreint.acc[0].t; double infer_t = imu_forpreint.acc[1].t; ugpm::ImuPreintegration preint(imu_forpreint,start_t,infert,opt,prior_bias);

and I got: start_t:350110.3100683689 infer_t:350110.3121600151,this is the create the preint class ,the start_t value,and the infer_t value. at the IterativeIntegrator,in the function velPosPreintLPMPartial,i change the code as follow:

while(acctime[data_ptr+1] < startt){ data_ptr++; if(data_ptr == (nbacc-1)){ std::cout<<std::fixed<<std::setprecision(10)<< "start_t::"<<startt<<std::endl; std::cout<< std::fixed<<std::setprecision(10)<<"acctime[data_ptr+1]::"<<acctime[data_ptr]<<std::endl; throw std::range_error("LPM Partial: the start_time is not in the data domain"); } }

and got:

start_t::350110.2933351994 acctime[data_ptr+1]::350110.2921600151 terminate called after throwing an instance of 'std::range_error' what(): LPM Partial: the start_time is not in the data domain [ob_gins_node-2] process has died [pid 4549, exit code -6, cmd /home/slamer/workspace/ugpm_ob_gins/devel/lib/ob_gins/ob_gins_ros name:=ob_gins_node log:=/home/slamer/.ros/log/8fdefe88-8c37-11ef-8357-dfe18a224d4d/ob_gins_node-2.log]. I noticed that there are two startt times,one is in the ImuPreintegration,and other in the class IterativeIntegrator, they have different value,why this happen? and how can i fixed this bug? look forward to your reply,thanks a lot!!

clegenti commented 1 day ago

Did you try to provide more data to the imu data structure (like a bigger overlap before and after the start and end times)?

One thing that I don't fully get is why you try to generate preintegration between consecutive IMU measurements? The idea of preintegration is to combined IMU measurements together to create pseudo measurements. What is the delta t between consecutive states of your imu/gnss factor graph?

JiangWeiHn commented 21 hours ago

The program ran for less than 1 second before reporting this bug. the gnss signal is 1Hz。If the navigation outputs navigation results in 1 second, it cannot meet the requirements for SLAM。so I referred to this project,https://github.com/i2Nav-WHU/OB_GINS. And in this project,when gnss signal comes.It combined the marginalization,imu residual,gnss residual in the graph optimize。In other cases, when IMU data is available, navigation results are produced using normal preintegration.