本文整理汇总了Python中tf2_ros.TransformListener方法的典型用法代码示例。如果您正苦于以下问题:Python tf2_ros.TransformListener方法的具体用法?Python tf2_ros.TransformListener怎么用?Python tf2_ros.TransformListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tf2_ros
的用法示例。
在下文中一共展示了tf2_ros.TransformListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_tf
# 需要导入模块: import tf2_ros [as 别名]
# 或者: from tf2_ros import TransformListener [as 别名]
def _init_tf():
# Create buffer and listener
# Something has changed in tf that means this must happen after init_node
global tfBuffer, listener
tfBuffer = tf2_ros.Buffer()
listener = tf2_ros.TransformListener(tfBuffer)
示例2: __init__
# 需要导入模块: import tf2_ros [as 别名]
# 或者: from tf2_ros import TransformListener [as 别名]
def __init__(self, world, task, detect_srv, topic,
tf_buffer=None,
tf_listener=None,
verbose=0,
update_rate=10):
'''
Create an observer. This will take a world and other information and
use it to provide updated worlds.
update_rate: data update rate in hz
'''
self.world = world
self.task = task
self.detect_srv = detect_srv
self.detected_objects_topic = topic
self.msg = None
if tf_buffer is None:
self.tf_buffer = tf2.Buffer()
else:
self.tf_buffer = tf_buffer
if tf_listener is None:
self.tf_listener = tf2.TransformListener(self.tf_buffer)
else:
self.tf_listener = tf_listener
self._detected_objects_sub = rospy.Subscriber(
self.detected_objects_topic,
DetectedObjectList,
self._detected_objects_cb)
self.verbose = verbose
self.update_rate = rospy.Rate(update_rate)
示例3: __init__
# 需要导入模块: import tf2_ros [as 别名]
# 或者: from tf2_ros import TransformListener [as 别名]
def __init__(self, parent_frame, child_frame, lookup_frequency, bagfile,
output_topic, append):
self.parent_frame = parent_frame
self.child_frame = child_frame
self.bagfile = bagfile
self.tf_buffer = tf2_ros.Buffer()
self.tf_listener = tf2_ros.TransformListener(self.tf_buffer)
self.lookup_frequency = lookup_frequency
self.output_topic = output_topic
self.append = append
示例4: _initialize_ros
# 需要导入模块: import tf2_ros [as 别名]
# 或者: from tf2_ros import TransformListener [as 别名]
def _initialize_ros(self, robot_config, tf_buffer, tf_listener):
if tf_buffer is None:
self.tf_buffer = tf2.Buffer(rospy.Duration(120))
else:
self.tf_buffer = tf_buffer
if tf_listener is None:
self.tf_listener = tf2.TransformListener(self.tf_buffer)
else:
self.tf_listener = tf_listener
# http://wiki.ros.org/depth_image_proc
# http://www.ros.org/reps/rep-0118.html
# http://wiki.ros.org/rgbd_launch
# we will be getting 16 bit integer values in millimeters
self.rgb_topic = "/camera/rgb/image_rect_color"
# raw means it is in the format provided by the openi drivers, 16 bit int
self.depth_topic = "/camera/depth_registered/hw_registered/image_rect"
self._rgb_sub = rospy.Subscriber(self.rgb_topic, Image, self._rgbCb)
self._bridge = CvBridge()
self.base_link = "base_link"
self.rgb_time = None
self.ee_frame = robot_config['end_link']
self.labels_topic = '/costar/action_labels'
self._labels_sub = rospy.Subscriber(
self.labels_topic,
String,
self._labels_Cb)
self.current_label_topic = '/costar/action_label_current'
self._current_label_sub = rospy.Subscriber(
self.current_label_topic,
String,
self._current_label_Cb)
self.info_topic = '/costar/info'
self._info_sub = rospy.Subscriber(
self.info_topic,
String,
self._info_CB)
self.info_topic = '/costar/clear_view'
self._info_sub = rospy.Subscriber(
self.info_topic,
String,
self._clear_view_CB)
# we sleep for 1 second so that
# the buffer can collect some transforms
rospy.sleep(1)
# make sure we can get the transforms we will need to run
self.get_latest_transform()