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


Python InteractiveMarkerControl.name方法代碼示例

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


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

示例1: _CreateMarkerControl

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

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

示例3: add_menu_handler

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

示例4: CreatePrimitiveControl

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

示例5: ScaleMarker

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

示例6: __init__

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

示例7: _make_6dof_control

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

示例8: __init__

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import name [as 別名]
 def __init__(self):
     rospy.sleep(1.0)
     self.items = [
         'pinger1', 'pinger2', 'dice', 'start_gate1', 'start_gate2'
     ]
     self.guess_service = rospy.Service('guess_location', GuessRequest,
                                        self.request_location)
     self.markers_subscribers = []
     self.markers_locations = dict.fromkeys(self.items)
     self.markers_servers = []
     self.markers = []
     box_marker = Marker()
     box_marker.type = Marker.CUBE
     box_marker.scale.x = 0.45
     box_marker.scale.y = 0.45
     box_marker.scale.z = 0.45
     box_marker.color.r = 0.0
     box_marker.color.g = 0.5
     box_marker.color.b = 0.5
     box_marker.color.a = 1.0
     box_control = InteractiveMarkerControl()
     box_control.always_visible = True
     box_control.markers.append(box_marker)
     rotate_control = InteractiveMarkerControl()
     rotate_control.name = "move_x"
     rotate_control.orientation.w = 0.707
     rotate_control.orientation.x = 0
     rotate_control.orientation.y = 0.707
     rotate_control.orientation.z = 0
     rotate_control.interaction_mode = InteractiveMarkerControl.MOVE_PLANE
     spacer = 0
     for i in self.items:
         self.markers.append(InteractiveMarker())
         self.markers[spacer].header.frame_id = "map"
         self.markers[spacer].name = i
         self.markers[spacer].description = i
         self.markers[spacer].controls.append(box_control)
         self.markers[spacer].controls.append(rotate_control)
         self.markers[spacer].pose.position.x = spacer
         self.markers[spacer].pose.position.y = 0
         self.markers[spacer].pose.position.z = 0
         spacer = spacer + 1
開發者ID:uf-mil,項目名稱:SubjuGator,代碼行數:44,代碼來源:guess_server.py

示例9: talker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import name [as 別名]
def talker():
	pub = rospy.Publisher("/rviz_moveit_motion_planning_display/robot_interaction_interactive_marker_topic/update", InteractiveMarkerUpdate)
	rospy.init_node('talker', anonymous=True)
	r = rospy.Rate(1)
	int_marker = InteractiveMarker()
	int_marker.name = "EE:goal_link_t"
	
	controller = InteractiveMarkerControl()
	controller.name = '_u1'
	
	int_marker.controls = controller
	
	p = InteractiveMarkerPose()
	updater = InteractiveMarkerUpdate()
	while not rospy.is_shutdown():
		p.pose.position.x += 0.5
		updater.markers = int_marker
		updater.poses = p
		print updater
		pub.publish(updater)
		r.sleep()
開發者ID:clintP,項目名稱:Workspace,代碼行數:23,代碼來源:updater.py

示例10: init_marker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import name [as 別名]
    def init_marker(self):

        control_marker = InteractiveMarker()
        control_marker.header.frame_id = "/world_link"
        control_marker.name = "cg_marker"

        move_control = InteractiveMarkerControl()
        move_control.name = "move_x"
        move_control.orientation.w = 1
        move_control.orientation.x = 1
        move_control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        control_marker.controls.append(move_control)
        move_control = InteractiveMarkerControl()
        move_control.name = "move_y"
        move_control.orientation.w = 1
        move_control.orientation.y = 1
        move_control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        control_marker.controls.append(move_control)
        move_control = InteractiveMarkerControl()
        move_control.name = "move_z"
        move_control.orientation.w = 1
        move_control.orientation.z = 1
        move_control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        control_marker.controls.append(move_control)

        move_control = InteractiveMarkerControl()
        move_control.name = "rotate_x"
        move_control.orientation.w = 1
        move_control.orientation.x = 1
        move_control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        control_marker.controls.append(move_control)
        move_control = InteractiveMarkerControl()
        move_control.name = "rotate_y"
        move_control.orientation.w = 1
        move_control.orientation.z = 1
        move_control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        control_marker.controls.append(move_control)
        move_control = InteractiveMarkerControl()
        move_control.name = "rotate_z"
        move_control.orientation.w = 1
        move_control.orientation.y = 1
        move_control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        control_marker.controls.append(move_control)

        control_marker.scale = 0.25
        self.server.insert(control_marker, self.control_marker_feedback)

        self.server.applyChanges()
開發者ID:xunilrj,項目名稱:sandbox,代碼行數:50,代碼來源:grader.py

示例11: make6DOFControls

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import name [as 別名]
def make6DOFControls():
    translation_x_control = InteractiveMarkerControl()
    translation_x_control.name = "move_x"
    translation_x_control.orientation.w = 1
    translation_x_control.orientation.x = 1
    translation_x_control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
    translation_y_control = InteractiveMarkerControl()
    translation_y_control.name = "move_y"
    translation_y_control.orientation.w = 1
    translation_y_control.orientation.y = 1
    translation_y_control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
    translation_z_control = InteractiveMarkerControl()
    translation_z_control.name = "move_z"
    translation_z_control.orientation.w = 1
    translation_z_control.orientation.z = 1
    translation_z_control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS

    rotation_x_control = InteractiveMarkerControl()
    rotation_x_control.name = "rotate_x"
    rotation_x_control.orientation.w = 1
    rotation_x_control.orientation.x = 1
    rotation_x_control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
    rotation_y_control = InteractiveMarkerControl()
    rotation_y_control.name = "rotate_y"
    rotation_y_control.orientation.w = 1
    rotation_y_control.orientation.y = 1
    rotation_y_control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
    rotation_z_control = InteractiveMarkerControl()
    rotation_z_control.name = "rotate_z"
    rotation_z_control.orientation.w = 1
    rotation_z_control.orientation.z = 1
    rotation_z_control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
    
    return [translation_x_control, translation_y_control,
            translation_z_control,
            rotation_x_control, rotation_y_control,
            rotation_z_control]
開發者ID:iory,項目名稱:jsk_demos,代碼行數:39,代碼來源:stair_marker.py

示例12: make6DofMarker

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import name [as 別名]
def make6DofMarker( fixed = False ):
    int_marker = InteractiveMarker()
    int_marker.header.frame_id = "/map"
    int_marker.scale = 0.05

    int_marker.pose.position.x =  -0.100988589227
    int_marker.pose.position.y =   0.035845387727
    int_marker.pose.position.z =   0.266128748655

    int_marker.name = "paper_sheet"
    int_marker.description = "Place the sheet of paper"

    # create a grey box marker
    box_marker = Marker()
    box_marker.type = Marker.CUBE
    box_marker.scale.x = 0.21
    box_marker.scale.y = 0.297
    box_marker.scale.z = 0.001
    box_marker.color.r = 1.0
    box_marker.color.g = 1.0
    box_marker.color.b = 1.0
    box_marker.color.a = 1.0

    # create a non-interactive control which contains the box
    box_control = InteractiveMarkerControl()
    box_control.always_visible = True
    box_control.markers.append( a4_sheet() )

    # add the control to the interactive marker
    int_marker.controls.append( box_control )

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

    control = InteractiveMarkerControl()
    control.orientation.w = 1
    control.orientation.x = 1
    control.orientation.y = 0
    control.orientation.z = 0
    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.w = 1
    control.orientation.x = 1
    control.orientation.y = 0
    control.orientation.z = 0
    control.name = "move_x"
    control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
    if fixed:
        control.orientation_mode = InteractiveMarkerControl.FIXED
    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
    if fixed:
        control.orientation_mode = InteractiveMarkerControl.FIXED
    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 = "move_z"
    control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
    if fixed:
        control.orientation_mode = InteractiveMarkerControl.FIXED
    int_marker.controls.append(control)

    control = InteractiveMarkerControl()
    control.orientation.w = 1
    control.orientation.x = 0
    control.orientation.y = 0
    control.orientation.z = 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.w = 1
    control.orientation.x = 0
    control.orientation.y = 0
    control.orientation.z = 1
    control.name = "move_y"
    control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
    if fixed:
        control.orientation_mode = InteractiveMarkerControl.FIXED
    int_marker.controls.append(control)
#.........這裏部分代碼省略.........
開發者ID:chili-epfl,項目名稱:hoap3_write,代碼行數:103,代碼來源:place_paper.py

示例13: InteractiveMarkerControl

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import name [as 別名]
    box_marker.color.b = 0.5
    box_marker.color.a = 1.0

    # create a non-interactive control which contains the box
    box_control = InteractiveMarkerControl()
    box_control.always_visible = True
    box_control.markers.append( box_marker )

    # add the control to the interactive marker
    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
    rotate_control = InteractiveMarkerControl()
    rotate_control.name = "move_x"
    rotate_control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS

    # add the control to the interactive marker
    int_marker.controls.append(rotate_control);

    # add the interactive marker to our collection &
    # tell the server to call processFeedback() when feedback arrives for it
    server.insert(int_marker, processFeedback)

    # 'commit' changes and send to all clients
    server.applyChanges()

    rospy.spin()

開發者ID:awesomebytes,項目名稱:move_joints_interactive,代碼行數:31,代碼來源:simple_marker_example.py

示例14: add_6DOF

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import name [as 別名]
    def add_6DOF(self, init_position = Point( 0.0, 0.0, 0.0), frame_id = 'map'):
        marker = InteractiveMarker()
        marker.header.frame_id = frame_id
        marker.pose.position = init_position
        marker.scale = 0.3

        marker.name = 'camera_marker'
        marker.description = 'Camera 6-DOF pose control'

        # X axis rotation
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 1
        control.orientation.y = 0
        control.orientation.z = 0
        control.name = "rotate_x"
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        marker.controls.append(control)
        # X axis traslation
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 1
        control.orientation.y = 0
        control.orientation.z = 0
        control.name = "move_x"
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        marker.controls.append(control)
        # Y axis rotation
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 0
        control.orientation.y = 1
        control.orientation.z = 0
        control.name = "rotate_y"
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        marker.controls.append(control)
        # Y axis traslation
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 0
        control.orientation.y = 1
        control.orientation.z = 0
        control.name = "move_y"
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        marker.controls.append(control)
        # Z axis rotation
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 0
        control.orientation.y = 0
        control.orientation.z = 1
        control.name = "rotate_z"
        control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
        marker.controls.append(control)
        # Z axis traslation
        control = InteractiveMarkerControl()
        control.orientation.w = 1
        control.orientation.x = 0
        control.orientation.y = 0
        control.orientation.z = 1
        control.name = "move_z"
        control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
        marker.controls.append(control)
        # Add marker to server
        self.server.insert(marker, self.marker_feedback)
        self.server.applyChanges()
開發者ID:rorromr,項目名稱:rgbd_camera_util,代碼行數:68,代碼來源:tf_marker.py

示例15: __init__

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import name [as 別名]
    def __init__(self):
        rospy.init_node('revisualizer')
        self.rviz_pub = rospy.Publisher("visualization/state", visualization_msgs.Marker, queue_size=2)
        self.rviz_pub_t = rospy.Publisher("visualization/state_t", visualization_msgs.Marker, queue_size=2)
        self.rviz_pub_utils = rospy.Publisher("visualization/bus_voltage", visualization_msgs.Marker, queue_size=2)
        self.kill_server = InteractiveMarkerServer("interactive_kill")

        # text marker
        # TODO: Clean this up, there should be a way to set all of this inline
        self.surface_marker = visualization_msgs.Marker()
        self.surface_marker.type = self.surface_marker.TEXT_VIEW_FACING
        self.surface_marker.color = ColorRGBA(1, 1, 1, 1)
        self.surface_marker.scale.z = 0.1

        self.depth_marker = visualization_msgs.Marker()
        self.depth_marker.type = self.depth_marker.TEXT_VIEW_FACING
        self.depth_marker.color = ColorRGBA(1.0, 1.0, 1.0, 1.0)
        self.depth_marker.scale.z = 0.1

        # create marker for displaying current battery voltage
        self.low_battery_threshold = rospy.get_param('/battery/kill_voltage', 44.0)
        self.warn_battery_threshold = rospy.get_param('/battery/warn_voltage', 44.5)
        self.voltage_marker = visualization_msgs.Marker()
        self.voltage_marker.header.frame_id = "base_link"
        self.voltage_marker.lifetime = rospy.Duration(5)
        self.voltage_marker.ns = 'sub'
        self.voltage_marker.id = 22
        self.voltage_marker.pose.position.x = -2.0
        self.voltage_marker.scale.z = 0.2
        self.voltage_marker.color.a = 1
        self.voltage_marker.type = visualization_msgs.Marker.TEXT_VIEW_FACING

        # create an interactive marker to display kill status and change it
        self.need_kill_update = True
        self.kill_marker = InteractiveMarker()
        self.kill_marker.header.frame_id = "base_link"
        self.kill_marker.pose.position.x = -2.3
        self.kill_marker.name = "kill button"
        kill_status_marker = Marker()
        kill_status_marker.type = Marker.TEXT_VIEW_FACING
        kill_status_marker.text = "UNKILLED"
        kill_status_marker.id = 55
        kill_status_marker.scale.z = 0.2
        kill_status_marker.color.a = 1.0
        kill_button_control = InteractiveMarkerControl()
        kill_button_control.name = "kill button"
        kill_button_control.interaction_mode = InteractiveMarkerControl.BUTTON
        kill_button_control.markers.append(kill_status_marker)
        self.kill_server.insert(self.kill_marker, self.kill_buttton_callback)
        self.kill_marker.controls.append(kill_button_control)
        self.killed = False

        # connect kill marker to kill alarm
        self.kill_listener = AlarmListener("kill")
        self.kill_listener.add_callback(self.kill_alarm_callback)
        self.kill_alarm = AlarmBroadcaster("kill")

        # distance to bottom
        self.range_sub = rospy.Subscriber("dvl/range", RangeStamped, self.range_callback)
        # distance to surface
        self.depth_sub = rospy.Subscriber("depth", DepthStamped, self.depth_callback)
        # battery voltage
        self.voltage_sub = rospy.Subscriber("/bus_voltage", Float64, self.voltage_callback)
開發者ID:DSsoto,項目名稱:Sub8,代碼行數:65,代碼來源:rviz_visualizer.py


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