當前位置: 首頁>>代碼示例>>Python>>正文


Python InteractiveMarkerControl.interaction_mode方法代碼示例

本文整理匯總了Python中visualization_msgs.msg.InteractiveMarkerControl.interaction_mode方法的典型用法代碼示例。如果您正苦於以下問題:Python InteractiveMarkerControl.interaction_mode方法的具體用法?Python InteractiveMarkerControl.interaction_mode怎麽用?Python InteractiveMarkerControl.interaction_mode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在visualization_msgs.msg.InteractiveMarkerControl的用法示例。


在下文中一共展示了InteractiveMarkerControl.interaction_mode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_object_marker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
    def create_object_marker(self, soma_obj, soma_type, pose):
        # create an interactive marker for our server
        int_marker = InteractiveMarker()
        int_marker.header.frame_id = "map"
        int_marker.name = soma_obj
        int_marker.description = "id" + soma_obj
        int_marker.pose = pose
        int_marker.pose.position.z = 0.01 
        
        mesh_marker = Marker()
        mesh_marker.type = Marker.MESH_RESOURCE
        mesh_marker.scale.x = 1
        mesh_marker.scale.y = 1
        mesh_marker.scale.z = 1

        random.seed(soma_type)
        val = random.random()
        mesh_marker.color.r = r_func(val)
        mesh_marker.color.g = g_func(val)
        mesh_marker.color.b = b_func(val)
        mesh_marker.color.a = 1.0
        #mesh_marker.pose = pose
        mesh_marker.mesh_resource = self.mesh[soma_type]

        # create a control which will move the box
        # this control does not contain any markers,
        # which will cause RViz to insert two arrows
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 0
        control.orientation.y = 1
        control.orientation.z = 0
        control.interaction_mode = InteractiveMarkerControl.MOVE_ROTATE

        
        if self._interactive:
            int_marker.controls.append(copy.deepcopy(control))
            # add the control to the interactive marker
            if self.marker[soma_type] == '3D':
                control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
                int_marker.controls.append(control)

        # add menu control
        menu_control = InteractiveMarkerControl()

        menu_control.interaction_mode = InteractiveMarkerControl.BUTTON
        menu_control.always_visible = True
        
        menu_control.markers.append( mesh_marker) #makeBox(int_marker) )
        int_marker.controls.append(menu_control)

        return int_marker
開發者ID:abyssxsy,項目名稱:soma,代碼行數:54,代碼來源:soma.py

示例2: _make_6dof_control

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
 def _make_6dof_control(self, name, orientation, is_move, is_fixed):
     control = InteractiveMarkerControl()
     control.name = name
     control.orientation = orientation
     control.always_visible = False
     if (self.is_control_visible):
         if is_move:
             control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
         else:
             control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
     else:
         control.interaction_mode = InteractiveMarkerControl.NONE
     if is_fixed:
         control.orientation_mode = InteractiveMarkerControl.FIXED
     return control
開發者ID:christophersu,項目名稱:LearningRos,代碼行數:17,代碼來源:gripper_markers.py

示例3: create_object_marker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
    def create_object_marker(self, soma_obj, roi, soma_type, pose):
        # create an interactive marker for our server
        int_marker = InteractiveMarker()
        int_marker.header.frame_id = "map"
        int_marker.name = soma_obj
        int_marker.description = soma_type + ' (' + roi +  ')'
        int_marker.pose = pose
        int_marker.pose.position.z = 0.01
        
        marker = Marker()
        marker.type = Marker.SPHERE
        marker.scale.x = 0.25
        marker.scale.y = 0.25
        marker.scale.z = 0.25
        int_marker.pose.position.z = (marker.scale.z / 2)
        
        random.seed(soma_type)
        val = random.random()
        marker.color.r = r_func(val)
        marker.color.g = g_func(val)
        marker.color.b = b_func(val)
        marker.color.a = 1.0
        #marker.pose = pose
        # create a control which will move the box
        # this control does not contain any markers,
        # which will cause RViz to insert two arrows
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 0
        control.orientation.y = 1
        control.orientation.z = 0
        control.interaction_mode = InteractiveMarkerControl.MOVE_PLANE

        if self._interactive:
            int_marker.controls.append(copy.deepcopy(control))
            # add the control to the interactive marker
            int_marker.controls.append(control);

        # add menu control
        menu_control = InteractiveMarkerControl()

        menu_control.interaction_mode = InteractiveMarkerControl.BUTTON
        menu_control.always_visible = True
        
        menu_control.markers.append( marker) #makeBox(int_marker) )
        int_marker.controls.append(menu_control)

        return int_marker
開發者ID:abyssxsy,項目名稱:soma,代碼行數:50,代碼來源:soma_roi.py

示例4: update_viz

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
 def update_viz(self):
     
     menu_control = InteractiveMarkerControl()
     menu_control.interaction_mode = InteractiveMarkerControl.BUTTON
     menu_control.always_visible = True
     frame_id = 'base_link'
     pose = self.ee_pose
     
     menu_control = self._add_gripper_marker(menu_control)
     text_pos = Point()
     text_pos.x = pose.position.x
     text_pos.y = pose.position.y
     text_pos.z = pose.position.z + 0.1
     text = 'x=' + str(pose.position.x) + ' y=' + str(pose.position.y) + ' x=' + str(pose.position.z)
     menu_control.markers.append(Marker(type=Marker.TEXT_VIEW_FACING,
                                        id=0, scale=Vector3(0, 0, 0.03),
                                        text=text,
                                        color=ColorRGBA(0.0, 0.0, 0.0, 0.5),
                                        header=Header(frame_id=frame_id),
                                        pose=Pose(text_pos, Quaternion(0, 0, 0, 1))))
     int_marker = InteractiveMarker()
     int_marker.name = 'ik_target_marker'
     int_marker.header.frame_id = frame_id
     int_marker.pose = pose
     int_marker.scale = 0.2
     self._add_6dof_marker(int_marker)
     int_marker.controls.append(menu_control)
     self._im_server.insert(int_marker, self.marker_clicked_cb)
開發者ID:christophersu,項目名稱:LearningRos,代碼行數:30,代碼來源:gripper_markers.py

示例5: _get_surface_marker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
 def _get_surface_marker(pose, dimensions):
     ''' Function that generates a surface marker'''
     int_marker = InteractiveMarker()
     int_marker.name = 'surface'
     int_marker.header.frame_id = 'base_link'
     int_marker.pose = pose
     int_marker.scale = 1
     button_control = InteractiveMarkerControl()
     button_control.interaction_mode = InteractiveMarkerControl.BUTTON
     button_control.always_visible = True
     object_marker = Marker(type=Marker.CUBE, id=2000,
                         lifetime=rospy.Duration(2),
                         scale=dimensions,
                         header=Header(frame_id='base_link'),
                         color=ColorRGBA(0.8, 0.0, 0.4, 0.4),
                         pose=pose)
     button_control.markers.append(object_marker)
     text_pos = Point()
     position = pose.position
     dimensions = dimensions
     text_pos.x = position.x + dimensions.x / 2 - 0.06
     text_pos.y = position.y - dimensions.y / 2 + 0.06
     text_pos.z = position.z + dimensions.z / 2 + 0.06
     text_marker = Marker(type=Marker.TEXT_VIEW_FACING, id=2001,
             scale=Vector3(0, 0, 0.03), text=int_marker.name,
             color=ColorRGBA(0.0, 0.0, 0.0, 0.5),
             header=Header(frame_id='base_link'),
             pose=Pose(text_pos, Quaternion(0, 0, 0, 1)))
     button_control.markers.append(text_marker)
     int_marker.controls.append(button_control)
     return int_marker
開發者ID:mayacakmak,項目名稱:pr2_pbd,代碼行數:33,代碼來源:World.py

示例6: _get_object_marker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
    def _get_object_marker(self, index, mesh=None):
        '''Generate a marker for world objects'''
        int_marker = InteractiveMarker()
        int_marker.name = World.objects[index].get_name()
        int_marker.header.frame_id = 'base_link'
        int_marker.pose = World.objects[index].object.pose
        int_marker.scale = 1

        button_control = InteractiveMarkerControl()
        button_control.interaction_mode = InteractiveMarkerControl.BUTTON
        button_control.always_visible = True

        object_marker = Marker(type=Marker.CUBE, id=index,
                lifetime=rospy.Duration(2),
                scale=World.objects[index].object.dimensions,
                header=Header(frame_id='base_link'),
                color=ColorRGBA(0.2, 0.8, 0.0, 0.6),
                pose=World.objects[index].object.pose)

        if (mesh != None):
            object_marker = World._get_mesh_marker(object_marker, mesh)
        button_control.markers.append(object_marker)

        text_pos = Point()
        text_pos.x = World.objects[index].object.pose.position.x
        text_pos.y = World.objects[index].object.pose.position.y
        text_pos.z = (World.objects[index].object.pose.position.z +
                     World.objects[index].object.dimensions.z / 2 + 0.06)
        button_control.markers.append(Marker(type=Marker.TEXT_VIEW_FACING,
                id=index, scale=Vector3(0, 0, 0.03),
                text=int_marker.name, color=ColorRGBA(0.0, 0.0, 0.0, 0.5),
                header=Header(frame_id='base_link'),
                pose=Pose(text_pos, Quaternion(0, 0, 0, 1))))
        int_marker.controls.append(button_control)
        return int_marker
開發者ID:mayacakmak,項目名稱:pr2_pbd,代碼行數:37,代碼來源:World.py

示例7: MakeMuneObject

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
 def MakeMuneObject(self, MenuName, MenuPose):
 
  MenuInteractiveMarker = InteractiveMarker()
  MenuInteractiveMarker.name = MenuName
  MenuInteractiveMarker.header.frame_id = self.frame_id
  MenuInteractiveMarker.pose.position.z += self.MenuHight
  MenuInteractiveMarker.scale = self.MenuScale
  
  MenuControl = InteractiveMarkerControl()
  MenuControl.interaction_mode = InteractiveMarkerControl.MENU
  MenuControl.always_visible = False
  
  MenuMarker = Marker()
  
  MenuMarker.type = Marker.ARROW
  MenuMarker.scale.x = MenuInteractiveMarker.scale * 2
  MenuMarker.scale.y = MenuInteractiveMarker.scale * 0.45
  MenuMarker.scale.z = MenuInteractiveMarker.scale * 0.45
  MenuMarker.color.r = 0.5
  MenuMarker.color.g = 0.5
  MenuMarker.color.b = 0.5
  MenuMarker.color.a = 1.0
  MenuMarker.pose = MenuPose
    
  MenuControl.markers.append(MenuMarker)
  
  MenuInteractiveMarker.controls.append(MenuControl)
  
  #print '###################MenuInteractiveMarker info:\n', MenuInteractiveMarker
  
  self.server.insert(MenuInteractiveMarker)
  rospy.loginfo('insert Menu Marker Object')
開發者ID:DinnerHowe,項目名稱:cafe_robot_single,代碼行數:34,代碼來源:ModelTransform.py

示例8: MessControl

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
 def MessControl(self, unit, mode):
  control=InteractiveMarkerControl()
  control.orientation.w = 1
  control.orientation.y = 1
  control.interaction_mode= mode
  control.always_visible=True
  control.markers.append(copy.deepcopy(unit))
開發者ID:DinnerHowe,項目名稱:cafe_robot_single,代碼行數:9,代碼來源:IMlib.py

示例9: _CreateMarkerControl

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
def _CreateMarkerControl(name, orientation, marker_type):
    control = InteractiveMarkerControl()
    control.name = name
    control.orientation = orientation
    control.interaction_mode = marker_type
    control.always_visible = False
    return control
開發者ID:DLu,項目名稱:affordance_templates,代碼行數:9,代碼來源:template_utilities.py

示例10: CreateVisualControlFromMarker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
def CreateVisualControlFromMarker(marker, always_visible=True, interaction_mode=InteractiveMarkerControl.MENU):
    control = InteractiveMarkerControl()
    control.name = "visual"
    control.always_visible = always_visible
    control.interaction_mode = interaction_mode
    control.markers.append(marker)
    return control
開發者ID:DLu,項目名稱:affordance_templates,代碼行數:9,代碼來源:template_utilities.py

示例11: add_menu_handler

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
def add_menu_handler(int_marker, menu_handler, server):
    control = InteractiveMarkerControl()
    control.interaction_mode = InteractiveMarkerControl.MENU
    control.description="Options"
    control.name = "menu_only_control"
    int_marker.controls.append(control)
    menu_handler.apply(server, int_marker.name)
    server.applyChanges()
開發者ID:gt-ros-pkg,項目名稱:hrl-haptic-manip,代碼行數:10,代碼來源:interactive_marker_util.py

示例12: CreatePrimitiveControl

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
def CreatePrimitiveControl(name, scaleFactor, marker_type, id=randint(0,10000)):
    marker = CreatePrimitiveMarker(name, scaleFactor, marker_type, id)
    control = InteractiveMarkerControl()
    control.name = name
    control.always_visible = True
    control.interaction_mode = InteractiveMarkerControl.MENU
    control.markers.append(marker)
    return control
開發者ID:DLu,項目名稱:affordance_templates,代碼行數:10,代碼來源:template_utilities.py

示例13: ScaleMarker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
def ScaleMarker(marker_template, control_scale=None, visual_scale=None):
    """Scale InteractiveMarker and/or a visual Marker associated with the InteractiveMarker.

    @type marker_template: subclass of MarkerTemplate()
    @param marker_template: The template object containing InteractiveMarkers.

    @type control_scale: float
    @param control_scale: The scale factor for the InteractiveMarker.

    @type visual_scale: geometry_msgs/Vector3
    @param visual_scale: The scale factor for the visualization Marker in the template.
    """
    server = marker_template.server
    menu_handler = marker_template.menu_handler
    marker_name = marker_template.key
    if server:
        current_marker = server.get(marker_name)
        if current_marker:
            
            # rescale marker
            marker = Marker()
            marker = GetVisualMarker(current_marker)
            if visual_scale is not None:
                marker.scale = visual_scale

            # push marker into visual control
            visual = InteractiveMarkerControl()
            visual.name = "visual"
            visual.always_visible = GetVisualControl(current_marker).always_visible
            visual.interaction_mode = GetVisualControl(current_marker).interaction_mode
            visual.orientation = GetVisualControl(current_marker).orientation
            visual.markers.append(marker)

            new_marker = InteractiveMarker()
            new_marker.header.frame_id = current_marker.header.frame_id
            new_marker.name = current_marker.name
            new_marker.description = current_marker.description
            new_marker.pose = current_marker.pose
            new_marker.scale = current_marker.scale
            if control_scale is not None:
                new_marker.scale = control_scale

            new_marker.controls.append(visual)

            for control in current_marker.controls:
                if 'Translate' in control.name or 'Rotate' in control.name:
                    # todo rename Plane Translate so we don't need to do this extra check
                    if control.name not in ['TranslateXY', 'TranslateYZ','TranslateXZ']:
                        new_marker.controls.append(CreateTransRotControl(control.name))

            # insert the updated marker into the server
            server.insert(new_marker)
            menu_handler.apply(server, marker_name)
開發者ID:DLu,項目名稱:affordance_templates,代碼行數:55,代碼來源:template_utilities.py

示例14: __init__

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
    def __init__(self):
        self.int_marker = InteractiveMarker()
        self.int_marker.header.frame_id = "/world"
        self.int_marker.name = "my_marker"
        self.int_marker.description = "Simple 2-DOF Control"
        self.int_marker.scale = 0.5

        self.mesh_marker = MeshMarker()
        self.mesh_marker.set_color(color=(1.0,1.0,1.0,0.5))
       
        # create a non-interactive control which contains the box
        box_control = InteractiveMarkerControl()
        box_control.always_visible = False
        box_control.markers.append(self.mesh_marker.marker)
        # add the control to the interactive marker
        self.int_marker.controls.append(box_control)
        
        # create a control which will move the box
        # this control does not contain any markers,
        # which will cause RViz to insert two arrows
        control = InteractiveMarkerControl()
        control.name = "move_x"
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        self.int_marker.controls.append(control)
        
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 0
        control.orientation.y = 1
        control.orientation.z = 0
        control.name = "rotate_z"
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        self.int_marker.controls.append(control)

        self.set_position()
        self.set_orientation()
開發者ID:JCostas-AIMEN,項目名稱:etna,代碼行數:38,代碼來源:_simple_marker.py

示例15: create_im

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import interaction_mode [as 別名]
 def create_im(self, marker, pose, name):
     # create the new interactive marker
     int_marker = InteractiveMarker()
     int_marker.pose = copy.deepcopy(pose)
     int_marker.header.frame_id = 'base_link'
     int_marker.name = name
     # move freely on the X-Y plane
     control = InteractiveMarkerControl()
     control.orientation.w = 1
     control.orientation.x = 0
     control.orientation.y = 1
     control.orientation.z = 0
     control.interaction_mode = InteractiveMarkerControl.MOVE_PLANE
     control.markers.append(marker)
     control.always_visible = True
     int_marker.controls.append(control)
     return int_marker
開發者ID:odestcj,項目名稱:hackathon_aug2013,代碼行數:19,代碼來源:fake_object_markers.py


注:本文中的visualization_msgs.msg.InteractiveMarkerControl.interaction_mode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。