$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 unittest 00009 00010 from mapping_states import * 00011 from detection_states import * 00012 00013 class TestStates: 00014 def __init__(self, *args): 00015 rospy.init_node('test_states') 00016 00017 def test_update_map(self): 00018 # create a SMACH state machine 00019 SM = smach.StateMachine(outcomes=['overall_succeeded','overall_failed']) 00020 #SM.userdata.pose = "home" 00021 SM.userdata.angle_range = 0.6 00022 #SM.userdata.scan_pose = [-1.3, -1.0, 3.14] 00023 SM.userdata.scan_pose = [0.0, 0.0, 0.0] 00024 SM.userdata.object_name ='IkeaShelfMilan' 00025 00026 # open the container 00027 with SM: 00028 smach.StateMachine.add('APPROACH', ApproachScanPose(), 00029 transitions={'succeeded':'UPDATE', 'failed':'overall_failed'}) 00030 smach.StateMachine.add('UPDATE', UpdateEnvMap(), 00031 transitions={'succeeded':'VERIFY', 'failed':'overall_failed', 'preempted':'overall_failed'}) 00032 smach.StateMachine.add('VERIFY', VerifyObjectByName(), 00033 transitions={'succeeded':'overall_succeeded', 'failed':'overall_failed', 'not_completed':'overall_failed', 'preempted':'overall_failed'}) 00034 #smach.StateMachine.add('UPDATE', Map360(), 00035 # transitions={'succeeded':'overall_succeeded', 'failed':'overall_failed'}) 00036 try: 00037 SM.execute() 00038 except: 00039 error_message = "Unexpected error:", sys.exc_info()[0] 00040 print error_message 00041 #self.fail(error_message) 00042 00043 # main 00044 if __name__ == '__main__': 00045 test = TestStates() 00046 test.test_update_map()