interface_tf.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 
5 from frame_editor.constructors_geometry import ToTransformStamped
6 from frame_editor.interface import Interface
7 from frame_editor.objects import Frame
8 
9 
11 
12  def __init__(self, frame_editor):
13  self.editor = frame_editor
14  self.editor.observers.append(self)
15 
16  def update(self, editor, level, elements):
17  now = rospy.Time.now()
18 
19  # change if there is a pose change
20  change = False
21  for element in elements:
22  if element is not None and (level & 1 == 1 or level & 4 == 4):
23  change = True
24 
25  # publish all transforms if any changed (required for tf2 static)
26  if change:
27  transforms = [
29  f.position, f.orientation, now, f.name, f.parent)
30  for f in editor.frames.values()]
31  Frame.tf_broadcaster.sendTransform(transforms)
32 
33  def broadcast(self, editor):
34  if editor.static:
35  return
36  now = rospy.Time.now()
37  transforms = [
39  f.position, f.orientation, now, f.name, f.parent)
40  for f in editor.frames.values()]
41  Frame.tf_broadcaster.sendTransform(transforms)
42 
43 # eof
frame_editor.interface
Definition: interface.py:1
frame_editor.interface_tf.FrameEditor_TF.__init__
def __init__(self, frame_editor)
Definition: interface_tf.py:12
frame_editor.interface_tf.FrameEditor_TF.editor
editor
Definition: interface_tf.py:13
frame_editor.interface_tf.FrameEditor_TF.broadcast
def broadcast(self, editor)
Definition: interface_tf.py:33
frame_editor.constructors_geometry.ToTransformStamped
def ToTransformStamped(translation, rotation, stamp, child, parent)
Definition: constructors_geometry.py:62
frame_editor.objects
Definition: objects.py:1
frame_editor.interface_tf.FrameEditor_TF
Definition: interface_tf.py:10
frame_editor.constructors_geometry
Definition: constructors_geometry.py:1
frame_editor.interface_tf.FrameEditor_TF.update
def update(self, editor, level, elements)
Definition: interface_tf.py:16
frame_editor.interface.Interface
Definition: interface.py:5


frame_editor
Author(s): ipa-lth , ipa-frn
autogenerated on Thu May 15 2025 02:17:25