I found that the member PoseEstimator::last_correction_stamp is not explicitly initialized in the constructor of PoseEstimator, and the default constructor of rclcpp::Time will sets its type to RCL_SYSTEM_TIME. Therefore, when the program first comes to line 261, the last_correction_time is of type RCL_SYSTEM_TIME while the right side of the comparison is of type RCL_ROS_TIME, leading to the error.
I think PoseEstimator::last_correction_stamp might need an initialization similar to that of PoseEstimator::prev_stamp, for example:
I launched the node
HdlLocalizationNodelet
with robot odometry prediction enabled. It died and reported:After some debugging, I found that this error was directly come from line 261 of the file _hdl_localization_nodelet.cpp_:
https://github.com/pyc5714/hdl-localization-ROS2/blob/35de917029371c4de93fc8107ad25a09cca7b238/hdl_localization/apps/hdl_localization_nodelet.cpp#L260-L261
I found that the member
PoseEstimator::last_correction_stamp
is not explicitly initialized in the constructor ofPoseEstimator
, and the default constructor ofrclcpp::Time
will sets its type toRCL_SYSTEM_TIME
. Therefore, when the program first comes to line 261, thelast_correction_time
is of typeRCL_SYSTEM_TIME
while the right side of the comparison is of typeRCL_ROS_TIME
, leading to the error.I think
PoseEstimator::last_correction_stamp
might need an initialization similar to that ofPoseEstimator::prev_stamp
, for example:The program did work after adding this line in the constructor.