ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You're creating the buffer and listener inside your callback which does not give them any time to populate the buffer to run queries against. If you query the buffer immediately after creating it it will have not aggregated any data yet. You need to make sure to have the buffer and listener created and persistent outside your callback.
Please see the tutorial for an example: https://wiki.ros.org/tf2/Tutorials/Writing%20a%20tf2%20listener%20%28Python%29
A similar question is here: https://answers.ros.org/question/283739/another-question-about-extrapolation-in-the-past/
There's some good details here: https://answers.ros.org/question/326701/is-the-tf-tree-persistent-in-any-way-or-derived-from-the-flow-of-tf-topics/