本文整理汇总了Python中smach.State类的典型用法代码示例。如果您正苦于以下问题:Python State类的具体用法?Python State怎么用?Python State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了State类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,msg=None):
State.__init__(self, outcomes=['succeeded',"succeeded",'preempted'])
# self.pub=rospy.Publisher('serial_switch_model',xm_SerialSwitchMode,queue_size=5 )
# self.msg=xm_SerialSwitchMode()
# self.msg.data=msg
self.ser=rospy.ServiceProxy("serialswitchmode",xm_SerialSwitchMode)
self.msg = msg
示例2: __init__
def __init__(self, speed, goal):
State.__init__(self, outcomes=["full_rotate", "not_full_rotate"])
# Initialize the tf listener
self.tf_listener = tf.TransformListener()
# Give tf some time to fill its buffer
rospy.sleep(2)
# Set the odom frame
self.odom_frame = "/odom"
# Find out if the robot uses /base_link or /base_footprint
try:
self.tf_listener.waitForTransform(self.odom_frame, "/base_footprint", rospy.Time(), rospy.Duration(1.0))
self.base_frame = "/base_footprint"
except (tf.Exception, tf.ConnectivityException, tf.LookupException):
try:
self.tf_listener.waitForTransform(self.odom_frame, "/base_link", rospy.Time(), rospy.Duration(1.0))
self.base_frame = "/base_link"
except (tf.Exception, tf.ConnectivityException, tf.LookupException):
rospy.loginfo("Cannot find transform between /odom and /base_link or /base_footprint")
rospy.signal_shutdown("tf Exception")
self.cmd_vel = rospy.Publisher("cmd_vel", Twist)
self.r = rospy.Rate(20)
self.angular_speed = speed
self.angular_tolerance = radians(2.5)
self.goal_angle = goal
示例3: __init__
def __init__(self, room, timer):
State.__init__(self, outcomes=['succeeded','aborted','preempted'])
self.task = 'scrub_tub'
self.room = room
self.timer = timer
self.cmd_vel_pub = rospy.Publisher('cmd_vel', Twist)
示例4: __init__
def __init__(self):
self.object_detector = ObjectDetector()
self.collision_map_processing_srv = rospy.ServiceProxy('/tabletop_collision_map_processing/tabletop_collision_map_processing',
TabletopCollisionMapProcessing)
State.__init__(self,
outcomes=['found_clusters','no_clusters'],
output_keys=['segmentation_result','cluster_information'])
示例5: __init__
def __init__(self):
State.__init__(self, outcomes=['succeeded','aborted','preempted'], input_keys=['speed','distance'])
self.cmd_vel_pub = rospy.Publisher('/PETIT/cmd_vel', Twist)
self.pause_pub = rospy.Publisher('/PETIT/pause_pathwrapper', Empty)
self.resume_pub = rospy.Publisher('/PETIT/resume_pathwrapper', Empty)
pass
示例6: __init__
def __init__(self, input_keys=['arm', 'object_id']):
action_uri = 'pickup_im_object_action'
self.pickup_client = actionlib.SimpleActionClient(action_uri, PickupIMObjectAction)
rospy.loginfo("waiting for %s"%action_uri)
self.pickup_client.wait_for_server()
rospy.loginfo("%s found"%action_uri)
State.__init__(self, outcomes=['succeeded', 'failed'], input_keys = input_keys)
示例7: __init__
def __init__(self, question, resp=True):
State.__init__(self, outcomes=['yes', 'no'])
self.resp = 'yes' if resp else 'no'
if resp:
self.prompt = '%s [%s]|%s: ' % (question, 'y', 'n')
else:
self.prompt = '%s [%s]|%s: ' % (question, 'n', 'y')
示例8: __init__
def __init__(self, room, timer):
State.__init__(self, outcomes=['succeeded','aborted','preempted'])
self.task = 'mop_floor'
self.room = room
self.timer = timer
self.cmd_vel_pub = rospy.Publisher('cmd_vel', Twist, queue_size=5)
示例9: __init__
def __init__(self):
State.__init__(self, outcomes=['succeeded','aborted','preempted'])
self.move_base = actionlib.SimpleActionClient("move_base", MoveBaseAction)
# Wait up to 60 seconds for the action server to become available
self.move_base.wait_for_server(rospy.Duration(60))
rospy.loginfo("Connected to move_base action server")
示例10: __init__
def __init__(self, room, timer):
State.__init__(self, outcomes=["succeeded", "aborted", "preempted"])
self.task = "mop_floor"
self.room = room
self.timer = timer
self.cmd_vel_pub = rospy.Publisher("cmd_vel", Twist)
示例11: __init__
def __init__(self, input_keys=['arm', 'action', 'lift']):
action_uri = 'imgui_action'
self.action_client = actionlib.SimpleActionClient(action_uri, IMGUIAction)
rospy.loginfo("waiting for %s"%action_uri)
self.action_client.wait_for_server()
rospy.loginfo("%s found"%action_uri)
State.__init__(self, outcomes=['succeeded', 'failed'], input_keys = input_keys)
示例12: __init__
def __init__(self, topic, msg_type, max_checks = -1):
State.__init__(self, outcomes=['invalid','valid','preempted'])
self._topic = topic
self._msg_type = msg_type
self._cond_cb = self.execute_cb
self._max_checks = max_checks
self._n_checks = 0
self._trigger_cond = threading.Condition()
self.bridge = CvBridge()
rospy.sleep(1)
self.task = 'Face Detection'
cv.NamedWindow(self.task, cv.CV_WINDOW_NORMAL)
# cv.ResizeWindow(self.task, 640, 480)
# cv2.imshow(self.task, np.zeros((480,640), dtype = np.uint8))
rospy.loginfo("waiting for images...")
pkg_path = rospkg.RosPack().get_path('ros_project')
cascade_1 = pkg_path+"/data/haar_detectors/haarcascade_frontalface_alt.xml"
self.cascade1 = cv2.CascadeClassifier(cascade_1)
cascade_2 = pkg_path+"/data/haar_detectors/haarcascade_frontalface_alt2.xml"
self.cascade2 = cv2.CascadeClassifier(cascade_2)
cascade_3 = pkg_path+"/data/haar_detectors/haarcascade_profileface.xml"
self.cascade3 = cv2.CascadeClassifier(cascade_3)
self.haar_params = dict(scaleFactor = 1.3,minNeighbors = 3,
flags = cv.CV_HAAR_DO_CANNY_PRUNING,
minSize = (30, 30),maxSize = (150, 150))
示例13: __init__
def __init__(self, position, orientation):
State.__init__(self, outcomes=['success'])
#global pub
# Get an action client
self.client = actionlib.SimpleActionClient('move_base', MoveBaseAction)
self.client.wait_for_server()
# Define the goal
self.goal = MoveBaseGoal()
self.goal.target_pose.header.frame_id = '/map'
self.goal.target_pose.pose.position.x = position[0]
self.goal.target_pose.pose.position.y = position[1]
self.goal.target_pose.pose.position.z = 0.0
self.goal.target_pose.pose.orientation.x = orientation[0]
self.goal.target_pose.pose.orientation.y = orientation[1]
self.goal.target_pose.pose.orientation.z = orientation[2]
self.goal.target_pose.pose.orientation.w = orientation[3]
#publlish waypoint
self.target_pose = PoseStamped()
self.target_pose.header.frame_id = '/map'
self.target_pose.pose.position.x = position[0]
self.target_pose.pose.position.y = position[1]
self.target_pose.pose.position.z = 0.0
self.target_pose.pose.orientation.x = orientation[0]
self.target_pose.pose.orientation.y = orientation[1]
self.target_pose.pose.orientation.z = orientation[2]
self.target_pose.pose.orientation.w = orientation[3]
示例14: __init__
def __init__(self):
State.__init__(self, outcomes=["succeeded", "aborted", "preempted"])
self.move_base = actionlib.SimpleActionClient("move_base", MoveBaseAction)
self.pub = rospy.Publisher("speech", String)
# Wait up to 60 seconds for the action server to become available
self.move_base.wait_for_server(rospy.Duration(60))
rospy.loginfo("Connected to move_base action server")
示例15: __init__
def __init__(self, smm):
State.__init__(self,
outcomes=["clear_front",
"clear_left",
"clear_right",
"blocked",
"unknown"])
self.smm = smm