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. 26 import dynamic_reconfigure.client
28 from asr_msgs.msg
import AsrAttributedPointCloud, AsrAttributedPoint
29 from geometry_msgs.msg
import Pose, Point, Quaternion
30 from nav_msgs.msg
import OccupancyGrid
32 from common.evaluation_decorators
import *
33 from asr_world_model.srv
import GetIntermediateObjectWeight, GetRecognizerName
37 Please enter some comments here! 43 outcomes=[
'succeeded',
'aborted'],
44 output_keys=[
'object_pointcloud'])
52 rospy.loginfo(
'Init CROP_BOX_GENERATION')
56 rospy.Subscriber(
"map", OccupancyGrid, self.
mapCallback)
60 self.
objectType = rospy.get_param(
'/scene_exploration_sm/PlaceholderObjectTypeInCropboxSearch')
61 self.
identifier = rospy.get_param(
'/scene_exploration_sm/PlaceholderIdentifierInCropboxSearch')
62 rospy.loginfo(str(self.
objectType) +
" with identifier " + str(self.
identifier) +
" will be used for CropBoxGeneration.")
65 rospy.loginfo(
'Wait for callback from map and reconfiguration of NBV')
70 self.
width = (data.info.width * data.info.resolution) / 2 + 0.48
71 self.
length = (data.info.height * data.info.resolution) / 2 + 0.35
72 self.
height = rospy.get_param(
"/scene_exploration_sm/RoomHeight")
73 rospy.loginfo(
'Points in point_cloud are generated between width: ' + str(-self.
width) +
' x ' + str(self.
width)
74 +
', length: ' + str(-self.
length) +
' x ' + str(self.
length) +
' and height: ' + str(0) +
' x ' + str(self.
height))
78 fcp = rospy.get_param(
"/nbv/fcp")
79 ncp = rospy.get_param(
"/nbv/ncp")
81 distToMiddleOfFrustum = (fcp + ncp) / 2.0
82 fovx = rospy.get_param(
"/nbv/fovx")
83 self.
groudStep = min(distToMiddleOfFrustum * math.tan(math.radians(fovx) / 2.0), (fcp - ncp))
85 fovy = rospy.get_param(
"/nbv/fovy")
86 self.
heightStep = distToMiddleOfFrustum * math.tan(math.radians(fovy) / 2.0)
87 rospy.loginfo(
"Interval of points in point_cloud on groud: " + str(self.
groudStep) +
" and in height: " + str(self.
heightStep))
93 config.groups.groups.Other.enableCropBoxFiltering ==
True and 94 config.groups.groups.Other.enableIntermediateObjectWeighting ==
False):
95 rospy.loginfo(
"Dynamic reconfiguration of NBV done.")
99 mapToSet = {
"enableCropBoxFiltering":
True,
"enableIntermediateObjectWeighting":
False}
100 rospy.loginfo(
"Dynamic reconfigure of NBV: enableCropBoxFiltering=True and enableIntermediateObjectWeighting=False")
103 rospy.loginfo(
"Dynamic reconfigure of NBV: mOmegaUtility=" + str(self.
newMOmegaUtility))
106 rospy.loginfo(
"Dynamic reconfigure of NBV: mOmegaBase=" + str(self.
newMOmegaBase))
109 client = dynamic_reconfigure.client.Client(
"nbv", timeout=30, config_callback=self.
reconfigureNBVCallback)
110 client.update_configuration(mapToSet)
117 rospy.loginfo(
'Executing CROP_BOX_GENERATION')
122 point_cloud = AsrAttributedPointCloud()
127 point = AsrAttributedPoint()
128 point.pose.position = Point(*[x, y, z])
129 point.pose.orientation = Quaternion(*tf.transformations.quaternion_from_euler(-1.57,0,0))
132 point_cloud.elements.append(point)
133 userdata.object_pointcloud = point_cloud
def frange(self, start, stop, step)
def reconfigureNBVCallback(self, config)
def mapCallback(self, data)
def execute(self, userdata)