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


Python InteractiveMarkerControl.description方法代碼示例

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


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

示例1: add_menu_handler

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

示例2: __init__

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import description [as 別名]
    def __init__(self):
        self.br = tf.TransformBroadcaster()
        self.listener = tf.TransformListener()

        #get this from the frame_tracker parameters
        if rospy.has_param('cartesian_controller/chain_tip_link'):
            self.active_frame = rospy.get_param("cartesian_controller/chain_tip_link")
        else:
            rospy.logerr("No chain_tip_link specified. Aborting!")
            sys.exit()
        if rospy.has_param('cartesian_controller/tracking_frame'):
            self.tracking_frame = rospy.get_param("cartesian_controller/tracking_frame")
        else:
            rospy.logerr("No tracking_frame specified. Aborting!")
            sys.exit()
        if rospy.has_param('cartesian_controller/root_frame'):
            self.root_frame = rospy.get_param("cartesian_controller/root_frame")
        else:
            rospy.logerr("No root_frame specified. Setting to 'base_link'!")
            self.root_frame = "base_link"

        if rospy.has_param('cartesian_controller/movable_trans'):
            self.movable_trans = rospy.get_param("cartesian_controller/movable_trans")
        else:
            rospy.logerr("No movable_trans specified. Setting True!")
            self.movable_trans = True
        if rospy.has_param('cartesian_controller/movable_rot'):
            self.movable_rot = rospy.get_param("cartesian_controller/movable_rot")
        else:
            rospy.logerr("No movable_rot specified. Setting True!")
            self.movable_rot = True

        self.tracking = False
        print "Waiting for StartTrackingServer..."
        rospy.wait_for_service('frame_tracker/start_tracking')
        print "...done!"
        self.start_tracking_client = rospy.ServiceProxy('frame_tracker/start_tracking', SetString)

        print "Waiting for StopTrackingServer..."
        rospy.wait_for_service('frame_tracker/stop_tracking')
        print "...done!"
        self.stop_tracking_client = rospy.ServiceProxy('frame_tracker/stop_tracking', Empty)

        self.target_pose = PoseStamped()
        self.target_pose.header.stamp = rospy.Time.now()
        self.target_pose.header.frame_id = self.root_frame
        self.target_pose.pose.orientation.w = 1.0

        ##give tf_listener some time to fill cache
        #try:
            #rospy.sleep(1.0)
        #except rospy.ROSInterruptException as e:
            ##print "ROSInterruptException"
            #pass

        transform_available = False
        while not transform_available:
            try:
                (trans,rot) = self.listener.lookupTransform(self.root_frame, self.active_frame, rospy.Time(0))
            except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):
                #rospy.logwarn("Waiting for transform...")
                try:
                    rospy.sleep(0.1)
                except rospy.ROSInterruptException as e:
                    #print "ROSInterruptException"
                    pass
                continue
            transform_available = True

        self.target_pose.pose.position.x = trans[0]
        self.target_pose.pose.position.y = trans[1]
        self.target_pose.pose.position.z = trans[2]
        self.target_pose.pose.orientation.x = rot[0]
        self.target_pose.pose.orientation.y = rot[1]
        self.target_pose.pose.orientation.z = rot[2]
        self.target_pose.pose.orientation.w = rot[3]

        self.ia_server = InteractiveMarkerServer("marker_server")
        self.int_marker = InteractiveMarker()
        self.int_marker.header.frame_id = self.root_frame
        self.int_marker.pose = self.target_pose.pose
        self.int_marker.name = "interactive_target"
        self.int_marker.description = self.tracking_frame
        self.int_marker.scale = 0.8

        # create a grey box marker
        box_marker = Marker()
        box_marker.type = Marker.CUBE
        box_marker.scale.x = 0.1
        box_marker.scale.y = 0.1
        box_marker.scale.z = 0.1
        box_marker.color.r = 0.0
        box_marker.color.g = 0.5
        box_marker.color.b = 0.5
        box_marker.color.a = 1.0
        control_3d = InteractiveMarkerControl()
        control_3d.always_visible = True
        control_3d.name = "move_rotate_3D"
        control_3d.interaction_mode = InteractiveMarkerControl.MOVE_ROTATE_3D
        control_3d.markers.append( box_marker )
#.........這裏部分代碼省略.........
開發者ID:hitrobotgroup,項目名稱:release,代碼行數:103,代碼來源:interactive_frame_target.py

示例3: __init__

# 需要導入模塊: from visualization_msgs.msg import InteractiveMarkerControl [as 別名]
# 或者: from visualization_msgs.msg.InteractiveMarkerControl import description [as 別名]
	def __init__(self):
		#self.client = actionlib.SimpleActionClient('lookat_action', cob_lookat_action.msg.LookAtAction)
		#print "Waiting for Server..."
		##self.client.wait_for_server()
		#print "...done!"
		
		print "Waiting for StartTrackingServer..."
		rospy.wait_for_service('/lookat_controller/start_tracking')
		print "...done!"
		self.start_tracking_client = rospy.ServiceProxy('/lookat_controller/start_tracking', SetString)
		
		print "Waiting for StopTrackingServer..."
		rospy.wait_for_service('/lookat_controller/stop_tracking')
		print "...done!"
		self.stop_tracking_client = rospy.ServiceProxy('/lookat_controller/stop_tracking', Empty)
		
		self.target_pose = PoseStamped()
		self.target_pose.header.stamp = rospy.Time.now()
		self.target_pose.header.frame_id = "base_link"
		self.target_pose.pose.orientation.w = 1.0
		#self.viz_pub = rospy.Publisher('lookat_target', PoseStamped)
		self.br = tf.TransformBroadcaster()
		self.listener = tf.TransformListener()
		
		transform_available = False
		while not transform_available:
			try:
				(trans,rot) = self.listener.lookupTransform('/base_link', '/odometry_monitor_target', rospy.Time(0))
			except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):
				rospy.logwarn("Waiting for transform...")
				rospy.sleep(0.5)
				continue
			transform_available = True
			
		self.target_pose.pose.position.x = trans[0]
		self.target_pose.pose.position.y = trans[1]
		self.target_pose.pose.position.z = trans[2]
		
		self.ia_server = InteractiveMarkerServer("marker_server")
		self.int_marker = InteractiveMarker()
		self.int_marker.header.frame_id = "base_link"
		self.int_marker.pose = self.target_pose.pose
		self.int_marker.name = "lookat_target"
		self.int_marker.description = "virtual lookat target"
		self.int_marker.scale = 0.5

		# create a grey box marker
		#box_marker = Marker()
		#box_marker.type = Marker.CUBE
		#box_marker.scale.x = 0.1
		#box_marker.scale.y = 0.1
		#box_marker.scale.z = 0.1
		#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 )
		#self.int_marker.controls.append(box_control)

		#control = InteractiveMarkerControl()
		#control.always_visible = True
		#control.orientation.w = 1
		#control.orientation.x = 1
		#control.orientation.y = 0
		#control.orientation.z = 0
		#control.name = "move_3D"
		#control.interaction_mode = InteractiveMarkerControl.MOVE_3D
		#self.int_marker.controls.append(deepcopy(control))
		#control.name = "move_x"
		#control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
		#self.int_marker.controls.append(deepcopy(control))
		#control.name = "rotate_x"
		#control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
		#self.int_marker.controls.append(deepcopy(control))
		#control.name = "move_y"
		#control.orientation.x = 0
		#control.orientation.y = 1
		#control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
		#self.int_marker.controls.append(deepcopy(control))
		#control.name = "rotate_y"
		#control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
		#self.int_marker.controls.append(deepcopy(control))
		#control.name = "move_z"
		#control.orientation.y = 0
		#control.orientation.z = 1
		#control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
		#self.int_marker.controls.append(deepcopy(control))
		#control.name = "rotate_z"
		#control.interaction_mode = InteractiveMarkerControl.ROTATE_AXIS
		#self.int_marker.controls.append(deepcopy(control))
		#
		#self.ia_server.insert(self.int_marker, self.marker_fb)

		#create menu
		self.menu_handler = MenuHandler()
		#self.menu_handler.insert( "Lookat", callback=self.lookat )
		self.menu_handler.insert( "StartTracking", callback=self.start_tracking )
		self.menu_handler.insert( "StopTracking", callback=self.stop_tracking )
#.........這裏部分代碼省略.........
開發者ID:ipa-fmw-ce,項目名稱:cob_navigation_monitor,代碼行數:103,代碼來源:ce_monitor_lookat_target.py


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