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


Python InteractiveMarkerControl.orientation方法代碼示例

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


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

示例1: _CreateMarkerControl

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import orientation [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

示例2: ScaleMarker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import orientation [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

示例3: _make_6dof_control

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import orientation [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

示例4: make_marker_flexible

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import orientation [as 別名]
def make_marker_flexible(fixed, ps, scale, color, mtype,
                         ignore_rotation, ignore_x=False,
                         ignore_y=False, ignore_z=False):
    int_marker = InteractiveMarker()
    int_marker.header.frame_id = ps.header.frame_id
    int_marker.pose = ps.pose
    int_marker.scale = scale

    int_marker.name = 'simple_6dof'
    int_marker.description = ''

    # insert a marker
    control =  InteractiveMarkerControl()
    control.always_visible = True
    control.markers.append(make_marker(scale, color, mtype))
    int_marker.controls.append(control)

    if fixed:
        int_marker.name += '_fixed'
        int_marker.description += '\n(fixed orientation)'

    if not ignore_x:
        control = InteractiveMarkerControl()
        control.orientation = Quaternion(1,0,0,1)
        control.name = 'move_x'
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

    if not ignore_y:
        control = InteractiveMarkerControl()
        control.orientation = Quaternion(0,0,1,1)
        control.name = 'move_y'
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

    if not ignore_z:
        control = InteractiveMarkerControl()
        control.orientation = Quaternion(0,1,0,1)
        control.name = 'move_z'
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

    if not ignore_rotation:
        control = InteractiveMarkerControl()
        control.orientation = Quaternion(1,0,0,1)
        control.name = 'rotate_x'
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

        control = InteractiveMarkerControl()
        control.orientation = Quaternion(0,0,1,1)
        control.name = 'rotate_y'
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

        control = InteractiveMarkerControl()
        control.orientation = Quaternion(0,1,0,1)
        control.name = 'rotate_z'
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

    return int_marker
開發者ID:gt-ros-pkg,項目名稱:hrl-haptic-manip,代碼行數:76,代碼來源:interactive_marker_util.py

示例5: make_6dof_gripper

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import orientation [as 別名]
def make_6dof_gripper(fixed, ps, scale, color, robot_type = "pr2",
                      ignore_rotation = False, ignore_x=False,
                      ignore_y=False, ignore_z=False):
    int_marker = InteractiveMarker()
    int_marker.header.frame_id = ps.header.frame_id
    int_marker.pose = ps.pose
    int_marker.scale = scale

    int_marker.name = 'gripper_6dof'

    control =  InteractiveMarkerControl()
    control.always_visible = True
    control.name = 'pr2_gripper_control'
    if robot_type == "pr2":
        control = make_pr2_gripper_marker(ps, [0.3, 0.3, 0.3, 0.7], control=control) 
        int_marker.description = 'pr2_gripper_control'
    elif robot_type == "cody":
        control = make_cody_ee_marker(ps, [1, 1, 1, 0.4], control=control) 
        int_marker.description = 'cody_ee_control'
    elif robot_type == "darci":
        control = make_darci_ee_marker(ps, [1, 1, 1, 0.4], control=control) 
        int_marker.description = 'darci_ee_control'
    int_marker.controls.append( control )

    if not ignore_x:
        control = InteractiveMarkerControl()
        control.orientation = Quaternion(1,0,0,1)
        control.name = 'move_x'
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

    if not ignore_y:
        control = InteractiveMarkerControl()
        control.orientation = Quaternion(0,0,1,1)
        control.name = 'move_y'
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

    if not ignore_z:
        control = InteractiveMarkerControl()
        control.orientation = Quaternion(0,1,0,1)
        control.name = 'move_z'
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

    if not ignore_rotation:
        control = InteractiveMarkerControl()
        control.orientation = Quaternion(1,0,0,1)
        control.name = 'rotate_x'
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

        control = InteractiveMarkerControl()
        control.orientation = Quaternion(0,0,1,1)
        control.name = 'rotate_y'
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

        control = InteractiveMarkerControl()
        control.orientation = Quaternion(0,1,0,1)
        control.name = 'rotate_z'
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        if fixed:
            control.orientation_mode = InteractiveMarkerControl.FIXED
        int_marker.controls.append(control)

    return int_marker
開發者ID:gt-ros-pkg,項目名稱:hrl-haptic-manip,代碼行數:79,代碼來源:interactive_marker_util.py


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