random_search_sm.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 '''
4 Copyright (c) 2016, Allgeyer Tobias, Aumann Florian, Borella Jocelyn, Hutmacher Robin, Karrenbauer Oliver, Marek Felix, Meissner Pascal, Trautmann Jeremias, Wittenbeck Valerij
5 
6 All rights reserved.
7 
8 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11 
12 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 '''
18 
19 import roslib
20 import rospy
21 import smach
22 import smach_ros
23 
24 from common.common_sm import GetMoveRobotSateMachine
25 from common.init import SearchInit
26 from common.object_detection import ObjectDetection
27 from indirect_search.ism import SceneRecognition
28 from random_search_states import GenerateRandomPose
29 from common.visualize_waypoints import VisualizeWaypoints
30 
31 
33 
34  sm_random_search = smach.StateMachine(outcomes=['aborted',
35  'found_all_objects',
36  'found_all_required_scenes'])
37 
38  with sm_random_search:
39  smach.StateMachine.add('RANDOM_SEARCH_INIT',
40  SearchInit(),
41  transitions={'succeeded':'GENERATE_RANDOM_POSE',
42  'aborted':'aborted'},
43  remapping={'searched_object_types':'searched_object_types'})
44 
45  smach.StateMachine.add('GENERATE_RANDOM_POSE',
47  transitions={'succeeded':'MOVE_ROBOT'},
48  remapping={'goal_robot_pose':'goal_robot_pose',
49  'goal_ptu_position':'goal_ptu_position'})
50 
51  smach.StateMachine.add('MOVE_ROBOT',
53  transitions={'succeeded':'VISUALIZE_WAYPOINT',
54  'aborted':'GENERATE_RANDOM_POSE'},
55  remapping={'goal_robot_pose':'goal_robot_pose',
56  'goal_ptu_position':'goal_ptu_position'})
57 
58  smach.StateMachine.add('VISUALIZE_WAYPOINT',
60  transitions={'succeeded':'OBJECT_DETECTION'})
61 
62  smach.StateMachine.add('OBJECT_DETECTION',
64  transitions={'found_objects':'SCENE_RECOGNITION',
65  'no_objects_found':'GENERATE_RANDOM_POSE',
66  'aborted':'aborted'},
67  remapping={'searched_object_types':'searched_object_types',
68  'detected_objects':'detected_objects'})
69 
70  smach.StateMachine.add('SCENE_RECOGNITION',
72  transitions={'found_scenes':'GENERATE_RANDOM_POSE',
73  'found_all_required_scenes':'found_all_required_scenes',
74  'found_all_objects':'found_all_objects',
75  'aborted':'aborted'})
76 
77 
def GetMoveRobotSateMachine()
Definition: common_sm.py:29


asr_state_machine
Author(s): Allgeyer Tobias, Aumann Florian, Borella Jocelyn, Hutmacher Robin, Karrenbauer Oliver, Marek Felix, Meißner Pascal, Trautmann Jeremias, Wittenbeck Valerij
autogenerated on Mon Feb 28 2022 21:53:50