本文整理匯總了Python中tf2_ros.Buffer方法的典型用法代碼示例。如果您正苦於以下問題:Python tf2_ros.Buffer方法的具體用法?Python tf2_ros.Buffer怎麽用?Python tf2_ros.Buffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tf2_ros
的用法示例。
在下文中一共展示了tf2_ros.Buffer方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import tf2_ros [as 別名]
# 或者: from tf2_ros import Buffer [as 別名]
def __init__(self):
self.__tf_buffer = tf2_ros.Buffer()
self.__debug_stop_event = threading.Event()
self.__debug_thread = None
self.__debug_current_ws = None # only for debugging purposes
示例2: _init_tf
# 需要導入模塊: import tf2_ros [as 別名]
# 或者: from tf2_ros import Buffer [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)
示例3: __init__
# 需要導入模塊: import tf2_ros [as 別名]
# 或者: from tf2_ros import Buffer [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)
示例4: __init__
# 需要導入模塊: import tf2_ros [as 別名]
# 或者: from tf2_ros import Buffer [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
示例5: _initialize_ros
# 需要導入模塊: import tf2_ros [as 別名]
# 或者: from tf2_ros import Buffer [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()