当前位置: 首页>>代码示例>>Python>>正文


Python Marker.mesh_use_embedded_materials方法代码示例

本文整理汇总了Python中visualization_msgs.msg.Marker.mesh_use_embedded_materials方法的典型用法代码示例。如果您正苦于以下问题:Python Marker.mesh_use_embedded_materials方法的具体用法?Python Marker.mesh_use_embedded_materials怎么用?Python Marker.mesh_use_embedded_materials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在visualization_msgs.msg.Marker的用法示例。


在下文中一共展示了Marker.mesh_use_embedded_materials方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: publishPositions

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
    def publishPositions(self):
        if not self.initialized:
            return
        nr = 0
        markerArray = MarkerArray()
        marker = Marker()
        marker.header.frame_id = "/map"
        marker.type = marker.MESH_RESOURCE
        marker.action = marker.ADD
        marker.scale.x = 0.2
        marker.scale.y = 0.2
        marker.scale.z = 0.2

        marker.mesh_use_embedded_materials = True
        marker.mesh_resource = "package://pacman_controller/meshes/pacman.dae"

        marker.color.a = 1.0
        marker.color.r = 0.0
        marker.color.g = 1.0
        marker.color.b = 0.0
        marker.pose.orientation = self.pacman["orientation"]
        marker.pose.position.x = self.pacman["x"]
        marker.pose.position.y = self.pacman["y"]
        marker.pose.position.z = 0.0
        marker.id = nr
        markerArray.markers.append(marker)

        for ghost in self.ghosts:
            curGhost = self.ghosts[ghost]
            if not curGhost["initialized"]:
                continue
            nr += 1
            marker = Marker()
            marker.header.frame_id = "/map"
            marker.type = marker.MESH_RESOURCE
            marker.action = marker.ADD
            marker.scale.x = 0.3
            marker.scale.y = 0.3
            marker.scale.z = 0.3

            marker.mesh_use_embedded_materials = True
            if curGhost["eaten"]:
                marker.mesh_resource = "package://pacman_controller/meshes/dead.dae"
            elif self.state == State.FLEEING:
                marker.mesh_resource = "package://pacman_controller/meshes/ghost_catchable.dae"
            else:
                marker.mesh_resource = "package://pacman_controller/meshes/%s.dae" % ghost
            marker.color.a = 1.0
            marker.color.r = 0.0
            marker.color.g = 1.0
            marker.color.b = 0.0
            marker.pose.orientation = curGhost["orientation"]
            marker.pose.position.x = curGhost["x"]
            marker.pose.position.y = curGhost["y"]
            marker.pose.position.z = 0.0
            marker.id = nr
            markerArray.markers.append(marker)

        self.pubPositions.publish(markerArray)
        return
开发者ID:pxlong,项目名称:collvoid,代码行数:62,代码来源:game_engine.py

示例2: draw_quad_base

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
    def draw_quad_base(self, quad):
        quad_id = self.hash32(quad)
        if not rospy.is_shutdown():
            marker = Marker()
            marker.header.frame_id = "/my_frame"
            marker.lifetime = rospy.Duration(self.duration)
            marker.type = marker.MESH_RESOURCE
            marker.mesh_resource = "package://hector_quadrotor_description/"\
                + "meshes/quadrotor/quadrotor_base.dae"
            marker.action = marker.ADD
            marker.scale.x = 80
            marker.scale.y = 80
            marker.scale.z = 80
            marker.mesh_use_embedded_materials = True

            marker.pose.orientation.w = math.cos(
                math.radians(quad.get_orientation() / 2)
            )
            marker.pose.orientation.x = 0
            marker.pose.orientation.y = 0
            marker.pose.orientation.z = math.sin(
                math.radians(quad.get_orientation() / 2)
            )

            marker.pose.position.x = quad.get_x()
            marker.pose.position.y = quad.get_y()
            marker.pose.position.z = quad.get_z()
            marker.id = quad_id
            self.markers.append(marker)
开发者ID:wallarelvo,项目名称:rover,代码行数:31,代码来源:rosdrawer.py

示例3: draw_grasps

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
def draw_grasps(grasps):
    """
    Draws grasps in RVIZ

    Parameters:
    grasps: a list of grasps
    """
    # TODO: add fingers to gripper
    publisher = rospy.Publisher("visualization_marker", Marker)
    for i, g in enumerate(grasps):
        marker = Marker()
        marker.header.frame_id = "base_link"
        marker.header.stamp = rospy.Time.now()
        marker.ns = "grasps"
        marker.type = Marker.MESH_RESOURCE
        marker.mesh_resource = "package://pr2_description/meshes/gripper_v0/gripper_palm.dae"
        marker.action = marker.ADD
        marker.id = i
        marker.pose.position = g.grasp_pose.position
        marker.pose.orientation = g.grasp_pose.orientation
        marker.scale.x = 1.0
        marker.scale.y = 1.0
        marker.scale.z = 1.0
        marker.mesh_use_embedded_materials = True
        publisher.publish(marker)
开发者ID:ronuchit,项目名称:rohan_perception_manipulation,代码行数:27,代码来源:grasp_generator.py

示例4: publish_shelf

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
def publish_shelf(publisher, pose_stamped):
    """Publishes a shelf marker at a given pose.

    The pose is assumed to represent the bottom center of the shelf, with the
    +x direction pointing along the depth axis of the bins and +z pointing up.

    Args:
      publisher: A visualization_msgs/Marker publisher
      pose_stamped: A PoseStamped message with the location, orientation, and
        reference frame of the shelf.
    """
    marker = Marker()
    marker.header.frame_id = pose_stamped.header.frame_id
    marker.header.stamp = rospy.Time().now()
    marker.ns = 'shelf'
    marker.id = 0
    marker.type = Marker.MESH_RESOURCE
    marker.mesh_resource = 'package://pr2_pick_perception/models/shelf/shelf.ply'
    marker.mesh_use_embedded_materials = True
    marker.action = Marker.ADD
    marker.pose = pose_stamped.pose
    marker.scale.x = 1
    marker.scale.y = 1
    marker.scale.z = 1
    marker.lifetime = rospy.Duration()
    _publish(publisher, marker, "shelf")
开发者ID:hcrlab,项目名称:push_pull,代码行数:28,代码来源:visualization.py

示例5: get_current_position_marker

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
    def get_current_position_marker(self, link, offset=None, root="", scale=1, color=(0,1,0,1), idx=0):
        (mesh, pose) = self.get_link_data(link)

        marker = Marker()

        if offset==None :
            marker.pose = pose
        else :
            marker.pose = toMsg(fromMsg(offset)*fromMsg(pose))

        marker.header.frame_id = root
        marker.header.stamp = rospy.get_rostime()
        marker.ns = self.robot_name
        marker.mesh_resource = mesh
        marker.type = Marker.MESH_RESOURCE
        marker.action = Marker.MODIFY
        marker.scale.x = scale
        marker.scale.y = scale
        marker.scale.z = scale
        marker.color.r = color[0]
        marker.color.g = color[1]
        marker.color.b = color[2]
        marker.color.a = color[3]
        marker.text = link
        marker.id = idx
        marker.mesh_use_embedded_materials = True
        return marker
开发者ID:DLu,项目名称:nasa_robot_teleop,代码行数:29,代码来源:end_effector_helper.py

示例6: make_kin_tree_from_link

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
def make_kin_tree_from_link(ps,linkname, ns='default_ns',valuedict=None):
    markers = []
    U = get_pr2_urdf()
    link = U.links[linkname]
    
    if link.visual and link.visual.geometry and isinstance(link.visual.geometry,urdf.Mesh):
        rospy.logdebug("%s is a mesh. drawing it.", linkname)
        marker = Marker(type = Marker.MESH_RESOURCE, action = Marker.ADD)
        marker.ns = ns
        marker.header = ps.header        
        
        linkFromGeom = conversions.trans_rot_to_hmat(link.visual.origin.position, transformations.quaternion_from_euler(*link.visual.origin.rotation))
        origFromLink = conversions.pose_to_hmat(ps.pose)
        origFromGeom = np.dot(origFromLink, linkFromGeom)
        
        marker.pose = conversions.hmat_to_pose(origFromGeom)           
        marker.scale = gm.Vector3(1,1,1)
        marker.color = stdm.ColorRGBA(1,1,0,.5)
        marker.id = 0
        marker.lifetime = rospy.Duration()
        marker.mesh_resource = str(link.visual.geometry.filename)
        marker.mesh_use_embedded_materials = False
        markers.append(marker)
    else:
        rospy.logdebug("%s is not a mesh", linkname)
        
    if U.child_map.has_key(linkname):
        for (cjoint,clink) in U.child_map[linkname]:
            markers.extend(make_kin_tree_from_joint(ps,cjoint,ns=ns,valuedict=valuedict))
            
    return markers    
开发者ID:cameronlee,项目名称:python,代码行数:33,代码来源:ros_utils.py

示例7: _make_mesh_marker

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
    def _make_mesh_marker(self):
        '''Creates a mesh marker'''
        mesh = Marker()
        mesh.mesh_use_embedded_materials = False
        mesh.type = Marker.MESH_RESOURCE
        mesh.scale.x = 1.0
        mesh.scale.y = 1.0
        mesh.scale.z = 1.0
        alpha = 0.6
        if self.is_dimmed:
            alpha = 0.1
        if self.is_fake:
            alpha = 0.4
            mesh.color = ColorRGBA(0.3, 0.3, 0.3, alpha)
            return mesh
        if self._is_reachable():
            # Original: some kinda orange
            # r,g,b = 1.0, 0.5, 0.0

            # New: rainbow! See method comment for details.
            r,g,b = self.get_marker_color()

            mesh.color = ColorRGBA(r, g, b, alpha)
        else:
            mesh.color = ColorRGBA(0.5, 0.5, 0.5, alpha)
        return mesh
开发者ID:hcrlab,项目名称:pr2_pbd_app,代码行数:28,代码来源:ArmStepMarker.py

示例8: add_marker

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
  def add_marker(self, mesh_frame, marker_name, mesh_file, use_materials=False, color=None):
    marker_msg = Marker()
    marker_msg.frame_locked = True
    marker_msg.id = 0
    marker_msg.action = Marker.ADD
    marker_msg.mesh_use_embedded_materials = use_materials
    if marker_msg.mesh_use_embedded_materials:
      marker_msg.color.r = 0
      marker_msg.color.g = 0
      marker_msg.color.b = 0
      marker_msg.color.a = 0
    elif color:
      marker_msg.color = color
    else:
      marker_msg.color.r = 0.6
      marker_msg.color.g = 0.6
      marker_msg.color.b = 0.6
      marker_msg.color.a = 1.0
    marker_msg.header.stamp = rospy.get_rostime()
    #marker_msg.lifetime =
    #marker_msg.pose =
    marker_msg.type = Marker.MESH_RESOURCE
    marker_msg.header.frame_id = mesh_frame
    marker_msg.ns = marker_name
    marker_msg.mesh_resource = 'file://%s' % (os.path.abspath(mesh_file))
    scale = 1.0
    marker_msg.scale.x, marker_msg.scale.y, marker_msg.scale.z = scale, scale, scale
    marker_msg.pose.position.x, marker_msg.pose.position.y, marker_msg.pose.position.z = 0, 0, 0
    marker_msg.pose.orientation.x, marker_msg.pose.orientation.y, marker_msg.pose.orientation.z, marker_msg.pose.orientation.w = 0, 0, 0, 1
    self.pub_marker_sync(marker_msg)

    if not self.marker_thread:
      self.marker_thread = thread.start_new_thread(MarkerPublisher.publish_markers, (self,))
开发者ID:andreasBihlmaier,项目名称:ahbros,代码行数:35,代码来源:pub_mesh_marker.py

示例9: pub_at_position

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
 def pub_at_position(self, odom_msg):
     """
     Handles necessary information for displaying things at 
                             ACCEPTED (NOVATEL) POSITION SOLUTION:
         -vehicle mesh 
     !!!this should only be invoked when the accepted (novatel) position 
     is updated
     """
     ### G35 Mesh #############################################################
     marker = Marker()
     pub = self.curpos_publisher
     marker.header = odom_msg.header
     marker.id = 0 # enumerate subsequent markers here
     marker.action = Marker.MODIFY # can be ADD, REMOVE, or MODIFY
     marker.pose = odom_msg.pose.pose
     marker.pose.position.z = 1.55
     marker.lifetime = rospy.Duration() # will last forever unless modified
     marker.ns = "vehicle_model"
     marker.type = Marker.MESH_RESOURCE
     marker.scale.x = 0.0254 # artifact of sketchup export
     marker.scale.y = 0.0254 # artifact of sketchup export
     marker.scale.z = 0.0254 # artifact of sketchup export
     marker.color.r = .05
     marker.color.g = .05
     marker.color.b = .05
     marker.color.a = .2
     marker.mesh_resource = self.veh_mesh_resource
     marker.mesh_use_embedded_materials = False
     pub.publish(marker)
开发者ID:GAVLab,项目名称:fhwa2_viz,代码行数:31,代码来源:liveBridge.py

示例10: test

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
def test():
    rospy.init_node('intersect_plane_test')
    marker_pub = rospy.Publisher('table_marker', Marker)
    pose_pub = rospy.Publisher('pose', PoseStamped)
    int_pub = rospy.Publisher('intersected_points', PointCloud2)
    tfl = tf.TransformListener()
    
    # Test table
    table = Table()
    table.pose.header.frame_id = 'base_link'
    table.pose.pose.orientation.x, table.pose.pose.orientation.y, table.pose.pose.orientation.z, table.pose.pose.orientation.w = (0,0,0,1)
    table.x_min = -0.5
    table.x_max =  0.5
    table.y_min = -0.5
    table.y_max =  0.5

    # A marker for that table
    marker = Marker()
    marker.header.frame_id = table.pose.header.frame_id
    marker.id = 1
    marker.type = Marker.LINE_STRIP
    marker.action = 0
    marker.pose = table.pose.pose
    marker.scale.x, marker.scale.y, marker.scale.z = (0.005,0.005,0.005)
    marker.color.r, marker.color.g, marker.color.b, marker.color.a = (0.0,1.0,1.0,1.0) 
    marker.frame_locked = False
    marker.ns = 'table'
    marker.points = [
        Point(table.x_min,table.y_min, table.pose.pose.position.z),
        Point(table.x_min,table.y_max, table.pose.pose.position.z),
        Point(table.x_max,table.y_max, table.pose.pose.position.z),
        Point(table.x_max,table.y_min, table.pose.pose.position.z),
        Point(table.x_min,table.y_min, table.pose.pose.position.z),
    ]
    marker.colors = []
    marker.text = ''
    # marker.mesh_resource = ''
    marker.mesh_use_embedded_materials = False
    marker.header.stamp = rospy.Time.now()

    # A test pose
    pose = PoseStamped()
    pose.header = table.pose.header
    pose.pose.position.x, pose.pose.position.y, pose.pose.position.z = (0,0,0.5)
    pose.pose.orientation.x, pose.pose.orientation.y, pose.pose.orientation.z, pose.pose.orientation.w = quaternion_from_euler(0,-pi/5,pi/5)
    
    intersection = cast_ray(pose, table, tfl)
    cloud = xyz_array_to_pointcloud2(np.array([[intersection.point.x, intersection.point.y, intersection.point.z]]))
    cloud.header = pose.header
    
    while not rospy.is_shutdown():
        marker_pub.publish(marker)
        pose_pub.publish(pose)
        int_pub.publish(cloud)
        rospy.loginfo('published')
        rospy.sleep(0.1)
开发者ID:OSUrobotics,项目名称:ros-3d-interaction,代码行数:58,代码来源:intersect_plane.py

示例11: CreateMeshMarker

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
def CreateMeshMarker(pose, mesh_path, alpha = 1, scaleFactor=1, id=randint(0,10000)):
    marker = Marker()
    marker.ns = "visual"
    marker.id = id
    marker.scale.x = scaleFactor
    marker.scale.y = scaleFactor
    marker.scale.z = scaleFactor
    marker.pose = pose
    marker.type = Marker.MESH_RESOURCE
    marker.mesh_use_embedded_materials = True
    marker.mesh_resource = mesh_path
    marker.frame_locked = True
    return marker
开发者ID:DLu,项目名称:affordance_templates,代码行数:15,代码来源:template_utilities.py

示例12: _make_mesh_marker

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
 def _make_mesh_marker(self):
     '''Creates a mesh marker'''
     mesh = Marker()
     mesh.mesh_use_embedded_materials = False
     mesh.type = Marker.MESH_RESOURCE
     mesh.scale.x = 1.0
     mesh.scale.y = 1.0
     mesh.scale.z = 1.0
     if self._is_reachable():
         mesh.color = ColorRGBA(1.0, 0.5, 0.0, 0.6)
     else:
         mesh.color = ColorRGBA(0.5, 0.5, 0.5, 0.6)
     return mesh
开发者ID:mayacakmak,项目名称:pr2_pbd,代码行数:15,代码来源:ActionStepMarker.py

示例13: _make_mesh_marker

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
 def _make_mesh_marker(self):
     mesh = Marker()
     mesh.mesh_use_embedded_materials = False
     mesh.type = Marker.MESH_RESOURCE
 	mesh.scale.x = 1.0
     mesh.scale.y = 1.0
     mesh.scale.z = 1.0
     mesh.color = ColorRGBA(0.0, 0.5, 1.0, 0.6)
     ik_solution = self.ik.get_ik_for_ee(self.ee_pose)
     if (ik_solution == None):
         mesh.color = ColorRGBA(1.0, 0.0, 0.0, 0.6)
     else:
         mesh.color = ColorRGBA(0.0, 1.0, 0.0, 0.6)
     return mesh
开发者ID:elimenta,项目名称:robotics_capstone_team4,代码行数:16,代码来源:gripper_markers.py

示例14: _make_mesh_marker

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
    def _make_mesh_marker(self):
        mesh = Marker()
        mesh.mesh_use_embedded_materials = False
        mesh.type = Marker.MESH_RESOURCE
    	mesh.scale.x = 1.0
        mesh.scale.y = 1.0
        mesh.scale.z = 1.0

        target_pose = GripperMarkers._offset_pose(self.ee_pose)
        ik_sol = self._ik_service.get_ik_for_ee(target_pose)
        if ik_sol == None:
            mesh.color = ColorRGBA(1.0, 0.0, 0.0, 0.6)
        else:
            mesh.color = ColorRGBA(0.0, 1.0, 0.0, 0.6)
        return mesh
开发者ID:CSE481Sputnik,项目名称:Sputnik,代码行数:17,代码来源:gripper_markers.py

示例15: _make_mesh_marker

# 需要导入模块: from visualization_msgs.msg import Marker [as 别名]
# 或者: from visualization_msgs.msg.Marker import mesh_use_embedded_materials [as 别名]
    def _make_mesh_marker(self):
        mesh = Marker()
        mesh.mesh_use_embedded_materials = False
        mesh.type = Marker.MESH_RESOURCE
    	mesh.scale.x = 1.0
        mesh.scale.y = 1.0
        mesh.scale.z = 1.0
        
        target_pose = GripperMarkers._offset_pose(self.marker_pose, GripperMarkers._offset)
        print target_pose
        ik_solution = self.ik.get_ik_for_ee(target_pose)
        
        if (ik_solution == None):
            mesh.color = ColorRGBA(1.0, 0.0, 0.0, 0.6)
        else:
            mesh.color = ColorRGBA(0.0, 1.0, 0.0, 0.6)

        return mesh
开发者ID:CSE481Sputnik,项目名称:Sputnik,代码行数:20,代码来源:gripper_markers.py


注:本文中的visualization_msgs.msg.Marker.mesh_use_embedded_materials方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。