You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got a Sophus error in witch I got nan values in a quaternion on a run that crash it.
I search in the issues here to see if it was a reccurent problem and I found out it was (in #439 and #451 at least), and didn't find any solution here.
So I searched out in the ORB_SLAM3 code for reasons of this issue and found out that it was caused by a division by 0 in the Sim3Solver.cc file in the ComputeSim3 function at the end of the Part 4.
Eigen::Vector3f vec = evec.block<3,1>(1,maxIndex); //extract imaginary part of the quaternion (sin*axis)
// Rotation angle. sin is the norm of the imaginary part, cos is the real part
double ang=atan2(vec.norm(),evec(0,maxIndex));
vec = 2*ang*vec/vec.norm(); //Angle-axis representation. quaternion angle is the half
mR12i = Sophus::SO3f::exp(vec).matrix();
must be replaced by :
Eigen::Vector3f vec = evec.block<3,1>(1,maxIndex); //extract imaginary part of the quaternion (sin*axis)
// Rotation angle. sin is the norm of the imaginary part, cos is the real part
double ang=atan2(vec.norm(),evec(0,maxIndex));
if(vec.norm()!=0){
vec = 2*ang*vec/vec.norm(); //Angle-axis representation. quaternion angle is the half
}
mR12i = Sophus::SO3f::exp(vec).matrix();
It seems the vec vector can be full of 0 some times and with this the error no longer appear (at least for me)
Reacted by Tracy Huang, Dehao Huang, xingjing, xinsinxinsinxin, cyizhuo, Paul Kabanov, Wenzhe Tong, LiuYMUNI, Dongmyeong Lee, Tariq and 7 more
GetUpdatedDeltaVelocity returns "nan" and then the following line:
Rwg = Sophus::SO3f::exp(vzg).matrix();
reports this "sophus exp" error because vzg become "nan" too.
However, I can't figure out why now.
I made a silly mistake. I forgot to clear the IMU measurement before extracting measurements between two frames. Thus, the preintegration start from the 1st data, which leads to PreintegrateIMU() in tracking.cc gives a "nan" after some frames.
I guess nobody would make the same mistake as me. But I still paste my issue here and suggest others who have the same issue, try to check the IMU raw data and load process.
GetUpdatedDeltaVelocity returns "nan" and then the following line:
Rwg = Sophus::SO3f::exp(vzg).matrix();
reports this "sophus exp" error because vzg become "nan" too.
However, I can't figure out why now.
I made a silly mistake. I forgot to clear the IMU measurement before extracting measurements between two frames. Thus, the preintegration start from the 1st data, which leads to PreintegrateIMU() in tracking.cc gives a "nan" after some frames. I guess nobody would make the same mistake as me. But I still paste my issue here and suggest others who have the same issue, try to check the IMU raw data and load process.
Activity
WeilongXia commentedon Jul 5, 2022
I tried to do this, but it can not work for me:(
Waterfly222 commentedon Jul 5, 2022
I found out another issue of the same type after this modification too, I found out it was in the ImuTypes.cc file in the GetDeltaRotation function.
I've probably done the worst way of solvng it, but it works for me at least now.
I've added this :
If someone found out a better solution (because there surely are many), please drop it here
WeilongXia commentedon Jul 5, 2022
I've found the cause of this problem, at least for me, it is because of the confused timestamp of IMU message...Thanks~
macTracyHuang commentedon Jul 18, 2022
hi, could you describe the reason in detail? what do u mean by confused timestamp? thx
LarryDong commentedon Mar 8, 2023
I found this error happens when the IMU begin to initialize the
dirG.In
LocalMapping.cc, this line:GetUpdatedDeltaVelocityreturns "nan" and then the following line:reports this "sophus exp" error because
vzgbecome "nan" too.However, I can't figure out why now.
LarryDong commentedon Mar 14, 2023
I made a silly mistake. I forgot to clear the IMU measurement before extracting measurements between two frames. Thus, the preintegration start from the 1st data, which leads to
PreintegrateIMU()intracking.ccgives a "nan" after some frames.I guess nobody would make the same mistake as me. But I still paste my issue here and suggest others who have the same issue, try to check the IMU raw data and load process.
KOVESAN commentedon Mar 16, 2023
can you tell me details?
macTracyHuang commentedon May 22, 2023
you can check your imu data timestamp order.
Yupei-Huang commentedon Oct 25, 2023
I had the same problem, thanks for sharing!
TSoli commentedon Apr 11, 2024
#730 helped with this for me.
fix bug of Sophus nan,according issue UZ-SLAMLab#608