8 import tf.transformations
as tft
16 from geometry_msgs.msg
import Pose
18 from visualization_msgs.msg
import InteractiveMarkerControl, Marker
30 def __init__(self, name, position=(0,0,0), orientation=(0,0,0,1), parent=
"world", style=
"none"):
36 self.
color = (0.0, 0.5, 0.5, 0.75)
43 if Frame.tf_buffer
is None:
77 if symbol
in [
'x',
'y',
'z']:
87 rpy = list(tft.euler_from_quaternion(self.
orientation))
94 self.
orientation = tuple(tft.quaternion_from_euler(*rpy))
98 return utils_tf.can_transform(
99 Frame.tf_buffer, target_frame, source_frame, time_)
103 return utils_tf.wait_for_transform(
104 Frame.tf_buffer, target_frame, source_frame, timeout)
109 def __init__(self, name, position, orientation, parent, style):
111 super(Object_Geometry, self).
__init__(name, position, orientation, parent, style)
116 self.marker.pose = Pose()
118 self.marker.id = Frame.create_new_id()
123 self.marker.header.frame_id = self.
name 124 self.marker.header.stamp = rospy.Time.now()
128 self.marker.color =
NewColor(color[0], color[1], color[2], color[3])
135 def __init__(self, name, position, orientation, parent, length=1.0, width=1.0):
140 super(Object_Plane, self).
__init__(name, position, orientation, parent,
"plane")
148 self.marker.type = Marker.TRIANGLE_LIST
149 self.marker.points = [
157 def __init__(self, name, position, orientation, parent, length=1.0, width=1.0, height=1.0):
163 super(Object_Cube, self).
__init__(name, position, orientation, parent,
"cube")
168 self.marker.type = Marker.CUBE
174 def __init__(self, name, position, orientation, parent, diameter=1.0):
178 super(Object_Sphere, self).
__init__(name, position, orientation, parent,
"sphere")
183 self.marker.type = Marker.SPHERE
189 def __init__(self, name, position, orientation, parent, length=1.0, width=0.05):
194 super(Object_Axis, self).
__init__(name, position, orientation, parent,
"axis")
199 self.marker.type = Marker.ARROW
205 def __init__(self, name, position, orientation, parent, package=None, mesh_path="", scale=1.0):
211 super(Object_Mesh, self).
__init__(name, position, orientation, parent,
"mesh")
216 self.marker.type = Marker.MESH_RESOURCE
218 self.marker.mesh_resource =
"file:"+self.
path 220 self.marker.mesh_resource =
"file:"+rospkg.RosPack().get_path(self.
package)+
"/"+self.
path def __init__(self, name, position, orientation, parent, length=1.0, width=1.0, height=1.0)
def __init__(self, name, position, orientation, parent, length=1.0, width=1.0)
def set_value(self, symbol, value)
def wait_for_transform(target_frame, source_frame, timeout)
def __init__(self, name, position, orientation, parent, diameter=1.0)
def can_transform(target_frame, source_frame, time_)
def __init__(self, name, position=(0, 0, 0), orientation=(0, 0, 0, 1), parent="world", style="none")
def __init__(self, name, position, orientation, parent, style)
def __init__(self, name, position, orientation, parent, length=1.0, width=0.05)
def NewPoint(x, y, z)
Point ##.
def NewVector3(x, y, z)
Vector3 ##.
def set_color(self, color)
def __init__(self, name, position, orientation, parent, package=None, mesh_path="", scale=1.0)
def NewColor(r, g, b, a=1.0)
Color ##.