indirect_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 GetRelationBasedSearchStateMachine
25 from ism import SceneRecognition, PosePrediction
26 from nbv import NBVSetPointCloud
27 from common.object_detection import ObjectDetection
28 from common.init import SearchInit
29 from common.visualize_waypoints import VisualizeWaypoints
30 
32 
33  def get_indirect_sm_as_stand_alone(self, initial_objects):
34 
35  sm_indirect_serach_init = smach.StateMachine(outcomes=['succeeded',
36  'aborted'])
37  with sm_indirect_serach_init:
38  smach.StateMachine.add('SEARCH_INIT',
39  SearchInit(initial_objects),
40  transitions={'succeeded':'OBJECT_DETECTION',
41  'aborted':'aborted'},
42  remapping={'searched_object_types':'searched_object_types'})
43 
44  smach.StateMachine.add('OBJECT_DETECTION',
46  transitions={'found_objects':'VISUALIZE_WAYPOINT',
47  'no_objects_found':'aborted',
48  'aborted':'aborted'},
49  remapping={'searched_object_types':'searched_object_types',
50  'detected_objects':'detected_objects'})
51 
52  smach.StateMachine.add('VISUALIZE_WAYPOINT',
54  transitions={'succeeded':'succeeded'})
55 
56 
57 
58  sm_indirect_search = smach.StateMachine(outcomes=['aborted',
59  'found_all_objects',
60  'found_all_required_scenes',
61  'no_predictions_left'])
62 
63  with sm_indirect_search:
64  smach.StateMachine.add('INDIRECT_SEARCH_INIT',
65  sm_indirect_serach_init,
66  transitions={'succeeded':'INDIRECT_SEARCH',
67  'aborted':'aborted'})
68 
69  smach.StateMachine.add('INDIRECT_SEARCH',
71  transitions={'found_all_objects':'found_all_objects',
72  'found_all_required_scenes':'found_all_required_scenes',
73  'no_predictions_left':'no_predictions_left',
74  'aborted':'aborted'})
75 
76  return sm_indirect_search
77 
78 
79 
80 
82 
83 
84  sm_indirect_search = smach.StateMachine(outcomes=['aborted',
85  'found_all_objects',
86  'found_all_required_scenes',
87  'no_predictions_left'])
88 
89  with sm_indirect_search:
90  smach.StateMachine.add('SCENE_RECOGNITION',
92  transitions={'found_scenes':'OBJECT_POSE_PREDICTION',
93  'found_all_required_scenes':'found_all_required_scenes',
94  'found_all_objects':'found_all_objects',
95  'aborted':'aborted'})
96 
97  smach.StateMachine.add('OBJECT_POSE_PREDICTION',
99  transitions={'succeeded':'NBV_SET_POINT_CLOUD',
100  'aborted':'aborted',
101  'no_predictions_left':'no_predictions_left'},
102  remapping={'object_pointcloud':'object_pointcloud'})
103 
104  smach.StateMachine.add('NBV_SET_POINT_CLOUD',
106  transitions={'succeeded':'RELATION_BASED_SEARCH',
107  'aborted':'aborted',
108  'too_many_deactivated_normals':'OBJECT_POSE_PREDICTION'},
109  remapping={'object_pointcloud':'object_pointcloud'})
110 
111 
112  smach.StateMachine.add('RELATION_BASED_SEARCH',
114  transitions={'found_objects':'SCENE_RECOGNITION',
115  'aborted':'aborted',
116  'no_nbv_found':'OBJECT_POSE_PREDICTION'})
117 
118  return sm_indirect_search
def GetRelationBasedSearchStateMachine()
Definition: common_sm.py:55


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