hyye / lio-mapping

Implementation of Tightly Coupled 3D Lidar Inertial Odometry and Mapping (LIO-mapping)
https://sites.google.com/view/lio-mapping
GNU General Public License v3.0
897 stars 320 forks source link

prior factor jacobian #70

Closed narutojxl closed 4 years ago

narutojxl commented 4 years ago

Hi @hyye ,

hyye commented 4 years ago

Hi @narutojxl, the prior factor is aimed at constraining the extrinsic parameters to the prior values. It is helpful when the translation is large and cannot be well-constrained under some motion patterns, e.g. planar motion.

narutojxl commented 4 years ago

Yes, it is for extrinsic between laser and body(imu). I mean how you calculate the jacobian of Log({Rm}^-1 * R) to R. I think the result should be identity matrix, but in code it is LeftQuatMatrix(Q.inverse() * rot_).topLeftCorner<3, 3>(), what's your reference material?

hyye commented 4 years ago

By applying quaternion multiplication with delta value and minus the original one, the Jacobian can be obtained. I found it might be a bug since it should be

jaco_prior.bottomRightCorner<3, 3>() = LeftQuatMatrix(rot_.inverse() * Q).topLeftCorner<3, 3>();

You can verify it by the Check function. https://github.com/hyye/lio-mapping/blob/8485a4d9c359b7e486ad019a10815ecb8fd1257f/src/factor/PriorFactor.cc#L69-L118

narutojxl commented 4 years ago

sorry, the jacobian of Log({Rm}^-1 * R) wrt R is not identity. My above result is not correct. It should be like this: 3 I not sure whether we match the same result. I see your result isq_L(q.inverse() * qm ).topLeftCorner<3, 3>()

hyye commented 4 years ago

By applying quaternion multiplication with delta value and minus the original one, the Jacobian can be obtained. I found it might be a bug since it should be

jaco_prior.bottomRightCorner<3, 3>() = LeftQuatMatrix(rot_.inverse() * Q).topLeftCorner<3, 3>();

I think the final result is almost the same if the higher-order term is omitted. This can be verified by the Check function as I mentioned. I put forgot to put the Jacobian in my previous comment; now I corrected it.

narutojxl commented 4 years ago

Thank you very much :) I think my problem is solved, closed it now.