How do I reconstruct a TF tree from a rosbag?

17 ビュー (過去 30 日間)
David Rohr
David Rohr 2016 年 2 月 15 日
回答済み: Josh Chen 2023 年 8 月 18 日
If I play a rosbag in a terminal and then run
tree = rostf;
I can view the TF tree and access the transforms between frames. What I would like to do is extract the TF tree from the rosbag directly. This should be possible as I have direct access to the '/tf' topic.
A possible acceptable hack would be a way to execute 'rosbag play filename.bag' from the MATLAB script directly.
Ideally, there would be functionality that could work something like the following:
bag = rosbag(filepath);
selectOptions = {'Topic', '/tf'};
bagselect = select(bag, selectOptions{:});
tf = getTransform(bagselect, 'map', 'odom', timestep);
  1 件のコメント
Kyle Stanhouse
Kyle Stanhouse 2016 年 8 月 16 日
It sounds like you might have been trying to do the same thing I was - use the Matlab ROS functions to access rosbag files and apply tf's to certain entities, possibly using 'waitforTransform()'? Did you ever find a resolution?

サインインしてコメントする。

回答 (1 件)

Josh Chen
Josh Chen 2023 年 8 月 18 日
Hello David,
Yes! You may consider to use the getTransform function in BagSelection Object or rosbagreader Object to get the transformation between two frames in a specific rosbag.
This example shows how to access the transformation from a bag file.
Hope that helps,
Thanks,
Josh

カテゴリ

Help Center および File ExchangeROS Log Files and Transformations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by