$search
00001 #!/usr/bin/python 00002 00003 PKG = 'srs_states' 00004 import roslib; roslib.load_manifest(PKG) 00005 import rospy 00006 import smach 00007 import smach_ros 00008 import sys 00009 from geometry_msgs.msg import Pose 00010 00011 #import unittest 00012 00013 from detection_states import * 00014 00015 class TestStates: 00016 def __init__(self, *args): 00017 rospy.init_node('test_states') 00018 00019 def test_object_verification(self): 00020 # create a SMACH state machine 00021 SM = smach.StateMachine(outcomes=['overall_succeeded','overall_failed']) 00022 SM.userdata.object_id = 0 00023 SM.userdata.target_object_pose = Pose() 00024 SM.userdata.target_object_pose.position.x = 0.67 00025 SM.userdata.target_object_pose.position.y = 1.26 00026 SM.userdata.target_object_pose.position.z = 0.74 00027 SM.userdata.target_object_pose.orientation.w = 0 00028 SM.userdata.target_object_pose.orientation.x = 0 00029 SM.userdata.target_object_pose.orientation.y = 0 00030 SM.userdata.target_object_pose.orientation.z = 0 00031 SM.userdata.verfied_target_object_pose = Pose() 00032 00033 # open the container 00034 with SM: 00035 smach.StateMachine.add('VERIFY', VerifyObject(), 00036 transitions={'succeeded':'overall_succeeded', 'failed':'overall_failed', 'not_completed':'overall_failed', 'preempted':'overall_failed'}) 00037 #smach.StateMachine.add('UPDATE', Map360(), 00038 # transitions={'succeeded':'overall_succeeded', 'failed':'overall_failed'}) 00039 try: 00040 SM.execute() 00041 except: 00042 error_message = "Unexpected error:", sys.exc_info()[0] 00043 #self.fail(error_message) 00044 00045 # main 00046 if __name__ == '__main__': 00047 test = TestStates() 00048 test.test_object_verification()