Skip to content

Commit e359aae

Browse files
author
Taylor Kessler Faulkner
committed
Reject faces if the depth message has inconsistent timestamps
1 parent 86ff341 commit e359aae

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ada_feeding_perception/ada_feeding_perception/face_detection.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,15 +583,16 @@ def get_mouth_depth(
583583
"No depth image message received.", throttle_duration_sec=1
584584
)
585585
return False, 0
586-
if (
587-
np.abs(closest_depth_msg.header.stamp.sec - rgb_msg.header.stamp.sec)
588-
>= 1.0
589-
):
586+
elapsed_time = np.abs(
587+
closest_depth_msg.header.stamp.sec - rgb_msg.header.stamp.sec
588+
)
589+
if elapsed_time >= 1.0:
590590
self.get_logger().warn(
591-
"Incosistent messages. Depth image message received at "
591+
"Inconsistent messages. Depth image message received at "
592592
f"{closest_depth_msg.header.stamp}. RGB image message received "
593593
f"at {rgb_msg.header.stamp}. Time difference: {min_time_diff} secs."
594594
)
595+
return False, 0
595596
image_depth = ros_msg_to_cv2_image(closest_depth_msg, self.bridge)
596597

597598
# Compute the depth of the mouth. Use the first method that works.

0 commit comments

Comments
 (0)