4 Copyright (c) 2016, Allgeyer Tobias, Aumann Florian, Borella Jocelyn, Hutmacher Robin, Karrenbauer Oliver, Marek Felix, Meissner Pascal, Trautmann Jeremias, Wittenbeck Valerij 8 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 10 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 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. 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. 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. 19 import roslib; roslib.load_manifest(
'asr_state_machine')
31 from pose_sampling
import *
34 if __name__ ==
'__main__' and __package__
is None:
35 from os
import sys, path
36 sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
39 from common.common_sm
import GetMoveRobotSateMachine
40 from indirect_search.ism
import *
41 from indirect_search.nbv
import *
42 from common.object_detection
import *
43 from common.visualize_waypoints
import VisualizeWaypoints
46 Simple test implementing the same test case than Ralfs NBV test in the NBV 47 package. It samples some points and moves to them to invalidate. 51 rospy.init_node(
'nbv_test_automat')
53 log_dir = common.init.create_log_folder()
54 __builtin__.log_dir = log_dir
55 __builtin__.evaluation =
False 58 sm_object_search = smach.StateMachine(outcomes=[
'succeeded',
'aborted',
60 input_keys=[
'object_pointcloud'])
62 with sm_object_search:
64 smach.StateMachine.add(
'NBV_SET_POINT_CLOUD',
66 transitions={
'succeeded':
'NEXT_BEST_VIEW',
68 'too_many_deactivated_normals':
'aborted'},
69 remapping={
'object_pointcloud':
'object_pointcloud'})
72 smach.StateMachine.add(
'NEXT_BEST_VIEW',
74 transitions={
'found_next_best_view':
'MOVE_ROBOT_TO_VIEW',
76 'no_nbv_found':
'aborted',
77 'nbv_update_point_cloud':
'NBV_UPDATE'},
78 remapping={
'goal_camera_pose':
'goal_camera_pose',
79 'goal_robot_pose':
'goal_robot_pose',
80 'goal_ptu_position':
'goal_ptu_position',
81 'searched_object_types':
'searched_object_types'})
84 smach.StateMachine.add(
'MOVE_ROBOT_TO_VIEW',
86 transitions={
'succeeded':
'VISUALIZE_WAYPOINT',
88 remapping={
'goal_robot_pose':
'goal_robot_pose',
89 'goal_ptu_position':
'goal_ptu_position'})
91 smach.StateMachine.add(
'VISUALIZE_WAYPOINT',
93 transitions={
'succeeded':
'OBJECT_DETECTION'})
99 smach.StateMachine.add(
'OBJECT_DETECTION',
101 transitions={
'no_objects_found':
'NBV_UPDATE',
102 'found_objects':
'succeeded',
103 'aborted':
'aborted'},
104 remapping={
'searched_object_types':
'object',
105 'detected_objects':
'detected_objects'})
107 smach.StateMachine.add(
'NBV_UPDATE',
109 transitions={
'succeeded':
'NEXT_BEST_VIEW',
111 'no_nbv_found':
'aborted'},
112 remapping={
'goal_camera_pose':
'goal_camera_pose',
113 'searched_object_types':
'searched_object_types'})
117 sm_main = smach.StateMachine(outcomes=[
'succeeded',
118 'aborted',
'no_nbv_found'])
122 smach.StateMachine.add(
'INIT',
124 transitions={
'succeeded':
'VISUALIZE_WAYPOINT',
125 'aborted':
'aborted'},
126 remapping={
'searched_object_types':
'searched_object_types'})
128 smach.StateMachine.add(
'VISUALIZE_WAYPOINT',
130 transitions={
'succeeded':
'POSE_SAMPLING'})
132 smach.StateMachine.add(
'POSE_SAMPLING',
134 remapping={
'object_pointcloud':
135 'object_pointcloud'},
136 transitions={
'succeeded':
'OBJECT_SEARCH',
137 'aborted':
'aborted'})
139 smach.StateMachine.add(
'OBJECT_SEARCH',
141 transitions={
'succeeded':
'succeeded'})
143 server = smach_ros.IntrospectionServer(
149 smach_thread = threading.Thread(target = sm_main.execute)
153 rospy.signal_shutdown(
'All done.')
156 if __name__ ==
'__main__':
159 except rospy.ROSInterruptException:
pass
def GetMoveRobotSateMachine()