I ended up searching alternative to native tf library functions to solve my problem.
The reason was that after getting allFramesAsYAML()
(or in Python tfBuffer_ros.all_frames_as_yaml()
) to work i found out that it will return all frames that have been in the tf buffer, regardless of whether the frame is in the current tf topic or not. The output was:
marker1:
parent: 'camera'
broadcaster: '/marker_tracker'
rate: 30.401
most_recent_transform: 1585572193.003
oldest_transform: 1585572190.503
buffer_length: 2.500
marker2:
parent: 'camera'
broadcaster: '/marker_tracker'
rate: 30.457
most_recent_transform: 1585572192.703
oldest_transform: 1585572190.503
buffer_length: 2.200
marker3:
parent: 'camera'
broadcaster: '/marker_tracker'
rate: 27.709
most_recent_transform: 1585572195.538
oldest_transform: 1585572191.568
buffer_length: 3.970
I occluded marker2 after a while, and it still appeared in the output. The only difference is that "most_recent_transform" stopped updating.
Originally posted by rfn123 with karma: 146 on 2020-03-30
This answer was NOT ACCEPTED on the original site
Post score: 2
Original comments
Comment by gvdhoorn on 2020-03-30:\
The only difference is that "most_recent_transform" stopped updating.
doesn't that align with what you were trying to achieve? You wrote:
I want to know which of these markers are detected by looking at the existing tf frames
Thing is: TF frames "don't exist", so seeing whether they "still exist" is not really something you can do.
Even TF itself (ie: the internals of the provided libraries) will look at most_recent_transform
to determine whether a transform is still up-to-date and relevant.
In your case you could see how long ago the transform was updated and determine -- based on some threshold -- whether the last detected pose for a marker is "too old".
Comment by rfn123 on 2020-03-30:
You are right, by looking at the update time I can filter the tfs. I was just rather looking for sth. simpler (e.g. boolean) that shows if a certain tf frame is updated or not, i.e. "existing", but I was not aware that the internal libraries use the mechanics of update time. Thanks for clarifying that!
Comment by gvdhoorn on 2020-03-30:\
I was just rather looking for sth. simpler (e.g. boolean) that shows if a certain tf frame is updated or not
well, think about it: what would it mean for a frame to "be updated or not"? How would TF determine this to set that boolean true
or false
?
Probably be comparing the time at which a frame was last updated to some sort of maximum allowable age .. :)