@@ -80,11 +80,14 @@ enum FilterFailureReason
8080 // / The message buffer overflowed, and this message was pushed off the back of the queue, but the
8181 // reason it was unable to be transformed is unknown.
8282 Unknown,
83- // / The timestamp on the message is more than the cache length earlier than the newest data in
84- // the transform cache
83+ // / The timestamp on the message is earlier than all the data in the transform cache
8584 OutTheBack,
8685 // / The frame_id on the message is empty
8786 EmptyFrameID,
87+ // / No transform found
88+ NoTransformFound,
89+ // / Queue size full
90+ QueueFull,
8891 // / Max enum value for iteration, keep it at the end of the enum
8992 FilterFailureReasonCount,
9093};
@@ -95,14 +98,18 @@ static std::string get_filter_failure_reason_string(
9598 filter_failure_reasons::FilterFailureReason reason)
9699{
97100 switch (reason) {
98- case filter_failure_reasons::Unknown:
99- return " Unknown" ;
100101 case filter_failure_reasons::OutTheBack:
101- return " OutTheBack" ;
102+ return
103+ " the timestamp on the message is earlier than all the data in the transform cache" ;
102104 case filter_failure_reasons::EmptyFrameID:
103- return " EmptyFrameID" ;
105+ return " the frame id of the message is empty" ;
106+ case filter_failure_reasons::NoTransformFound:
107+ return " did not find a valid transform, this usually happens at startup ..." ;
108+ case filter_failure_reasons::QueueFull:
109+ return " discarding message because the queue is full" ;
110+ case filter_failure_reasons::Unknown: // fallthrough
104111 default :
105- return " Invalid Failure Reason " ;
112+ return " unknown " ;
106113 }
107114}
108115
@@ -397,7 +404,7 @@ class MessageFilter : public MessageFilterBase, public message_filters::SimpleFi
397404 (mt::FrameId<M>::value (*front.event .getMessage ())).c_str (),
398405 mt::TimeStamp<M>::value (*front.event .getMessage ()).seconds ());
399406
400- messageDropped (front.event , filter_failure_reasons::Unknown );
407+ messageDropped (front.event , filter_failure_reasons::QueueFull );
401408
402409 messages_.pop_front ();
403410 }
@@ -512,10 +519,12 @@ class MessageFilter : public MessageFilterBase, public message_filters::SimpleFi
512519 rclcpp::Time stamp = mt::TimeStamp<M>::value (*message);
513520
514521 bool transform_available = true ;
522+ FilterFailureReason error = filter_failure_reasons::Unknown;
515523 try {
516524 future.get ();
517525 } catch (...) {
518526 transform_available = false ;
527+ error = filter_failure_reasons::OutTheBack;
519528 }
520529
521530 if (transform_available) {
@@ -557,7 +566,7 @@ class MessageFilter : public MessageFilterBase, public message_filters::SimpleFi
557566 TF2_ROS_MESSAGEFILTER_DEBUG (
558567 " Discarding message in frame %s at time %.3f, count now %d" ,
559568 frame_id.c_str (), stamp.seconds (), messages_.size ());
560- messageDropped (saved_event, filter_failure_reasons::Unknown );
569+ messageDropped (saved_event, error );
561570 }
562571 }
563572
0 commit comments