Skip to content

Commit

Permalink
fix(localization_util): fixed rejection criteria of SmartPoseBuffer::…
Browse files Browse the repository at this point in the history
…interpolate (autowarefoundation#5818)

Fixed rejection criteria of SmartPoseBuffer::interpolate

Signed-off-by: Shintaro Sakoda <shintaro.sakoda@tier4.jp>
Signed-off-by: karishma <karishma@interpl.ai>
  • Loading branch information
SakodaShintaro authored and karishma1911 committed Dec 19, 2023
1 parent 4b28f61 commit 3d77297
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion localization/localization_util/src/smart_pose_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ std::optional<SmartPoseBuffer::InterpolateResult> SmartPoseBuffer::interpolate(
const rclcpp::Time time_first = pose_buffer_.front()->header.stamp;
const rclcpp::Time time_last = pose_buffer_.back()->header.stamp;

if (target_ros_time < time_first || time_last < target_ros_time) {
if (target_ros_time < time_first) {
return std::nullopt;
}

// [time_last < target_ros_time] is acceptable here.
// It is possible that the target_ros_time (often sensor timestamp) is newer than the latest
// timestamp of buffered pose (often EKF).
// However, if the timestamp difference is too large,
// it will later be rejected by validate_time_stamp_difference.

// get the nearest poses
result.old_pose = *pose_buffer_.front();
for (const PoseWithCovarianceStamped::ConstSharedPtr & pose_cov_msg_ptr : pose_buffer_) {
Expand Down

0 comments on commit 3d77297

Please sign in to comment.