ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Building off the other answers, here's a snipped of runnable code that I wound up with:

import rospy
import tf2_ros
import time
import yaml

rospy.init_node('ipython')

tf_buffer = tf2_ros.Buffer()
tf_listener = tf2_ros.TransformListener(tf_buffer)
time.sleep(5.0)

frames_dict = yaml.safe_load(tf_buffer.all_frames_as_yaml())
frames_list = list(frames_dict.keys())

Building off the other answers, here's a snipped snippet of runnable code that I wound up with:

import rospy
import tf2_ros
import time
import yaml

rospy.init_node('ipython')

tf_buffer = tf2_ros.Buffer()
tf_listener = tf2_ros.TransformListener(tf_buffer)
time.sleep(5.0)

frames_dict = yaml.safe_load(tf_buffer.all_frames_as_yaml())
frames_list = list(frames_dict.keys())

(Tested on Ubuntu 20.04, running noetic)