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