object_detection_test.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 pose_sampling import *
25 
26 # To import files from parten directories
27 if __name__ == '__main__' and __package__ is None:
28  from os import sys, path
29  sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
30 
31 from common.move import *
32 from indirect_search.ism import *
33 from indirect_search.nbv import *
34 from common.object_detection import *
35 from common.init import *
36 
37 
38 class ObjectDetectionInit(smach.State):
39  def __init__(self):
40  smach.State.__init__(
41  self,
42  outcomes=['succeeded', 'aborted'],
43  output_keys=['searched_object_types'])
44 
45  def execute(self, userdata):
46  userdata.searched_object_types = ['Smacks', 'Amicelli', 'Marker1']
47  return 'succeeded'
48 
49 def main():
50  rospy.init_node('object_detection_sm')
51 
52  sm_object_detection = smach.StateMachine(outcomes=['succeeded', 'aborted',
53  'no_objects_found'])
54 
55  with sm_object_detection:
56  smach.StateMachine.add("INIT",
58  transitions={'succeeded': 'OBJECT_DETECTION'})
59 
60  smach.StateMachine.add('OBJECT_DETECTION',
62  transitions={'no_objects_found':'no_objects_found',
63  'found_objects':'succeeded',
64  'aborted':'aborted'},
65  remapping={'searched_object_types':'searched_object_types',
66  'detected_objects':'detected_objects'})
67 
68  server = smach_ros.IntrospectionServer(
69  'object_detection_test_sm',
70  sm_object_detection,
71  '/OBJECT_DETECTION_TEST_SOBJECT_DETECTION_TEST_SM')
72  server.start()
73  # smach.set_preempt_hanlder(sm_main)
74  smach_thread = threading.Thread(target = sm_object_detection.execute)
75  smach_thread.start()
76  rospy.spin()
77  server.stop()
78  rospy.signal_shutdown('All done.')
79 
80 if __name__ == '__main__':
81  try:
82  main()
83  except rospy.ROSInterruptException: pass


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