00001 """autogenerated by genmsg_py from AllowedContactSpecification.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006 import geometry_msgs.msg
00007 import geometric_shapes_msgs.msg
00008
00009 class AllowedContactSpecification(roslib.message.Message):
00010 _md5sum = "81f9b47ac49a467ae008d3d9485628a3"
00011 _type = "motion_planning_msgs/AllowedContactSpecification"
00012 _has_header = False
00013 _full_text = """# The names of the regions
00014 string name
00015
00016 # The shape of the region in the environment
00017 geometric_shapes_msgs/Shape shape
00018
00019 # The pose of the space defining the region
00020 geometry_msgs/PoseStamped pose_stamped
00021
00022 # The set of links that will be allowed to have penetration contact within this region
00023 string[] link_names
00024
00025 # The maximum penetration depth allowed for every link
00026 float64 penetration_depth
00027 ================================================================================
00028 MSG: geometric_shapes_msgs/Shape
00029 byte SPHERE=0
00030 byte BOX=1
00031 byte CYLINDER=2
00032 byte MESH=3
00033
00034 byte type
00035
00036
00037 #### define sphere, box, cylinder ####
00038 # the origin of each shape is considered at the shape's center
00039
00040 # for sphere
00041 # radius := dimensions[0]
00042
00043 # for cylinder
00044 # radius := dimensions[0]
00045 # length := dimensions[1]
00046 # the length is along the Z axis
00047
00048 # for box
00049 # size_x := dimensions[0]
00050 # size_y := dimensions[1]
00051 # size_z := dimensions[2]
00052 float64[] dimensions
00053
00054
00055 #### define mesh ####
00056
00057 # list of triangles; triangle k is defined by tre vertices located
00058 # at indices triangles[3k], triangles[3k+1], triangles[3k+2]
00059 int32[] triangles
00060 geometry_msgs/Point[] vertices
00061
00062 ================================================================================
00063 MSG: geometry_msgs/Point
00064 # This contains the position of a point in free space
00065 float64 x
00066 float64 y
00067 float64 z
00068
00069 ================================================================================
00070 MSG: geometry_msgs/PoseStamped
00071 # A Pose with reference coordinate frame and timestamp
00072 Header header
00073 Pose pose
00074
00075 ================================================================================
00076 MSG: std_msgs/Header
00077 # Standard metadata for higher-level stamped data types.
00078 # This is generally used to communicate timestamped data
00079 # in a particular coordinate frame.
00080 #
00081 # sequence ID: consecutively increasing ID
00082 uint32 seq
00083 #Two-integer timestamp that is expressed as:
00084 # * stamp.secs: seconds (stamp_secs) since epoch
00085 # * stamp.nsecs: nanoseconds since stamp_secs
00086 # time-handling sugar is provided by the client library
00087 time stamp
00088 #Frame this data is associated with
00089 # 0: no frame
00090 # 1: global frame
00091 string frame_id
00092
00093 ================================================================================
00094 MSG: geometry_msgs/Pose
00095 # A representation of pose in free space, composed of postion and orientation.
00096 Point position
00097 Quaternion orientation
00098
00099 ================================================================================
00100 MSG: geometry_msgs/Quaternion
00101 # This represents an orientation in free space in quaternion form.
00102
00103 float64 x
00104 float64 y
00105 float64 z
00106 float64 w
00107
00108 """
00109 __slots__ = ['name','shape','pose_stamped','link_names','penetration_depth']
00110 _slot_types = ['string','geometric_shapes_msgs/Shape','geometry_msgs/PoseStamped','string[]','float64']
00111
00112 def __init__(self, *args, **kwds):
00113 """
00114 Constructor. Any message fields that are implicitly/explicitly
00115 set to None will be assigned a default value. The recommend
00116 use is keyword arguments as this is more robust to future message
00117 changes. You cannot mix in-order arguments and keyword arguments.
00118
00119 The available fields are:
00120 name,shape,pose_stamped,link_names,penetration_depth
00121
00122 @param args: complete set of field values, in .msg order
00123 @param kwds: use keyword arguments corresponding to message field names
00124 to set specific fields.
00125 """
00126 if args or kwds:
00127 super(AllowedContactSpecification, self).__init__(*args, **kwds)
00128
00129 if self.name is None:
00130 self.name = ''
00131 if self.shape is None:
00132 self.shape = geometric_shapes_msgs.msg.Shape()
00133 if self.pose_stamped is None:
00134 self.pose_stamped = geometry_msgs.msg.PoseStamped()
00135 if self.link_names is None:
00136 self.link_names = []
00137 if self.penetration_depth is None:
00138 self.penetration_depth = 0.
00139 else:
00140 self.name = ''
00141 self.shape = geometric_shapes_msgs.msg.Shape()
00142 self.pose_stamped = geometry_msgs.msg.PoseStamped()
00143 self.link_names = []
00144 self.penetration_depth = 0.
00145
00146 def _get_types(self):
00147 """
00148 internal API method
00149 """
00150 return self._slot_types
00151
00152 def serialize(self, buff):
00153 """
00154 serialize message into buffer
00155 @param buff: buffer
00156 @type buff: StringIO
00157 """
00158 try:
00159 _x = self.name
00160 length = len(_x)
00161 buff.write(struct.pack('<I%ss'%length, length, _x))
00162 buff.write(_struct_b.pack(self.shape.type))
00163 length = len(self.shape.dimensions)
00164 buff.write(_struct_I.pack(length))
00165 pattern = '<%sd'%length
00166 buff.write(struct.pack(pattern, *self.shape.dimensions))
00167 length = len(self.shape.triangles)
00168 buff.write(_struct_I.pack(length))
00169 pattern = '<%si'%length
00170 buff.write(struct.pack(pattern, *self.shape.triangles))
00171 length = len(self.shape.vertices)
00172 buff.write(_struct_I.pack(length))
00173 for val1 in self.shape.vertices:
00174 _x = val1
00175 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00176 _x = self
00177 buff.write(_struct_3I.pack(_x.pose_stamped.header.seq, _x.pose_stamped.header.stamp.secs, _x.pose_stamped.header.stamp.nsecs))
00178 _x = self.pose_stamped.header.frame_id
00179 length = len(_x)
00180 buff.write(struct.pack('<I%ss'%length, length, _x))
00181 _x = self
00182 buff.write(_struct_7d.pack(_x.pose_stamped.pose.position.x, _x.pose_stamped.pose.position.y, _x.pose_stamped.pose.position.z, _x.pose_stamped.pose.orientation.x, _x.pose_stamped.pose.orientation.y, _x.pose_stamped.pose.orientation.z, _x.pose_stamped.pose.orientation.w))
00183 length = len(self.link_names)
00184 buff.write(_struct_I.pack(length))
00185 for val1 in self.link_names:
00186 length = len(val1)
00187 buff.write(struct.pack('<I%ss'%length, length, val1))
00188 buff.write(_struct_d.pack(self.penetration_depth))
00189 except struct.error, se: self._check_types(se)
00190 except TypeError, te: self._check_types(te)
00191
00192 def deserialize(self, str):
00193 """
00194 unpack serialized message in str into this message instance
00195 @param str: byte array of serialized message
00196 @type str: str
00197 """
00198 try:
00199 if self.shape is None:
00200 self.shape = geometric_shapes_msgs.msg.Shape()
00201 if self.pose_stamped is None:
00202 self.pose_stamped = geometry_msgs.msg.PoseStamped()
00203 end = 0
00204 start = end
00205 end += 4
00206 (length,) = _struct_I.unpack(str[start:end])
00207 start = end
00208 end += length
00209 self.name = str[start:end]
00210 start = end
00211 end += 1
00212 (self.shape.type,) = _struct_b.unpack(str[start:end])
00213 start = end
00214 end += 4
00215 (length,) = _struct_I.unpack(str[start:end])
00216 pattern = '<%sd'%length
00217 start = end
00218 end += struct.calcsize(pattern)
00219 self.shape.dimensions = struct.unpack(pattern, str[start:end])
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 pattern = '<%si'%length
00224 start = end
00225 end += struct.calcsize(pattern)
00226 self.shape.triangles = struct.unpack(pattern, str[start:end])
00227 start = end
00228 end += 4
00229 (length,) = _struct_I.unpack(str[start:end])
00230 self.shape.vertices = []
00231 for i in xrange(0, length):
00232 val1 = geometry_msgs.msg.Point()
00233 _x = val1
00234 start = end
00235 end += 24
00236 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00237 self.shape.vertices.append(val1)
00238 _x = self
00239 start = end
00240 end += 12
00241 (_x.pose_stamped.header.seq, _x.pose_stamped.header.stamp.secs, _x.pose_stamped.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00242 start = end
00243 end += 4
00244 (length,) = _struct_I.unpack(str[start:end])
00245 start = end
00246 end += length
00247 self.pose_stamped.header.frame_id = str[start:end]
00248 _x = self
00249 start = end
00250 end += 56
00251 (_x.pose_stamped.pose.position.x, _x.pose_stamped.pose.position.y, _x.pose_stamped.pose.position.z, _x.pose_stamped.pose.orientation.x, _x.pose_stamped.pose.orientation.y, _x.pose_stamped.pose.orientation.z, _x.pose_stamped.pose.orientation.w,) = _struct_7d.unpack(str[start:end])
00252 start = end
00253 end += 4
00254 (length,) = _struct_I.unpack(str[start:end])
00255 self.link_names = []
00256 for i in xrange(0, length):
00257 start = end
00258 end += 4
00259 (length,) = _struct_I.unpack(str[start:end])
00260 start = end
00261 end += length
00262 val1 = str[start:end]
00263 self.link_names.append(val1)
00264 start = end
00265 end += 8
00266 (self.penetration_depth,) = _struct_d.unpack(str[start:end])
00267 return self
00268 except struct.error, e:
00269 raise roslib.message.DeserializationError(e)
00270
00271
00272 def serialize_numpy(self, buff, numpy):
00273 """
00274 serialize message with numpy array types into buffer
00275 @param buff: buffer
00276 @type buff: StringIO
00277 @param numpy: numpy python module
00278 @type numpy module
00279 """
00280 try:
00281 _x = self.name
00282 length = len(_x)
00283 buff.write(struct.pack('<I%ss'%length, length, _x))
00284 buff.write(_struct_b.pack(self.shape.type))
00285 length = len(self.shape.dimensions)
00286 buff.write(_struct_I.pack(length))
00287 pattern = '<%sd'%length
00288 buff.write(self.shape.dimensions.tostring())
00289 length = len(self.shape.triangles)
00290 buff.write(_struct_I.pack(length))
00291 pattern = '<%si'%length
00292 buff.write(self.shape.triangles.tostring())
00293 length = len(self.shape.vertices)
00294 buff.write(_struct_I.pack(length))
00295 for val1 in self.shape.vertices:
00296 _x = val1
00297 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00298 _x = self
00299 buff.write(_struct_3I.pack(_x.pose_stamped.header.seq, _x.pose_stamped.header.stamp.secs, _x.pose_stamped.header.stamp.nsecs))
00300 _x = self.pose_stamped.header.frame_id
00301 length = len(_x)
00302 buff.write(struct.pack('<I%ss'%length, length, _x))
00303 _x = self
00304 buff.write(_struct_7d.pack(_x.pose_stamped.pose.position.x, _x.pose_stamped.pose.position.y, _x.pose_stamped.pose.position.z, _x.pose_stamped.pose.orientation.x, _x.pose_stamped.pose.orientation.y, _x.pose_stamped.pose.orientation.z, _x.pose_stamped.pose.orientation.w))
00305 length = len(self.link_names)
00306 buff.write(_struct_I.pack(length))
00307 for val1 in self.link_names:
00308 length = len(val1)
00309 buff.write(struct.pack('<I%ss'%length, length, val1))
00310 buff.write(_struct_d.pack(self.penetration_depth))
00311 except struct.error, se: self._check_types(se)
00312 except TypeError, te: self._check_types(te)
00313
00314 def deserialize_numpy(self, str, numpy):
00315 """
00316 unpack serialized message in str into this message instance using numpy for array types
00317 @param str: byte array of serialized message
00318 @type str: str
00319 @param numpy: numpy python module
00320 @type numpy: module
00321 """
00322 try:
00323 if self.shape is None:
00324 self.shape = geometric_shapes_msgs.msg.Shape()
00325 if self.pose_stamped is None:
00326 self.pose_stamped = geometry_msgs.msg.PoseStamped()
00327 end = 0
00328 start = end
00329 end += 4
00330 (length,) = _struct_I.unpack(str[start:end])
00331 start = end
00332 end += length
00333 self.name = str[start:end]
00334 start = end
00335 end += 1
00336 (self.shape.type,) = _struct_b.unpack(str[start:end])
00337 start = end
00338 end += 4
00339 (length,) = _struct_I.unpack(str[start:end])
00340 pattern = '<%sd'%length
00341 start = end
00342 end += struct.calcsize(pattern)
00343 self.shape.dimensions = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00344 start = end
00345 end += 4
00346 (length,) = _struct_I.unpack(str[start:end])
00347 pattern = '<%si'%length
00348 start = end
00349 end += struct.calcsize(pattern)
00350 self.shape.triangles = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00351 start = end
00352 end += 4
00353 (length,) = _struct_I.unpack(str[start:end])
00354 self.shape.vertices = []
00355 for i in xrange(0, length):
00356 val1 = geometry_msgs.msg.Point()
00357 _x = val1
00358 start = end
00359 end += 24
00360 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00361 self.shape.vertices.append(val1)
00362 _x = self
00363 start = end
00364 end += 12
00365 (_x.pose_stamped.header.seq, _x.pose_stamped.header.stamp.secs, _x.pose_stamped.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00366 start = end
00367 end += 4
00368 (length,) = _struct_I.unpack(str[start:end])
00369 start = end
00370 end += length
00371 self.pose_stamped.header.frame_id = str[start:end]
00372 _x = self
00373 start = end
00374 end += 56
00375 (_x.pose_stamped.pose.position.x, _x.pose_stamped.pose.position.y, _x.pose_stamped.pose.position.z, _x.pose_stamped.pose.orientation.x, _x.pose_stamped.pose.orientation.y, _x.pose_stamped.pose.orientation.z, _x.pose_stamped.pose.orientation.w,) = _struct_7d.unpack(str[start:end])
00376 start = end
00377 end += 4
00378 (length,) = _struct_I.unpack(str[start:end])
00379 self.link_names = []
00380 for i in xrange(0, length):
00381 start = end
00382 end += 4
00383 (length,) = _struct_I.unpack(str[start:end])
00384 start = end
00385 end += length
00386 val1 = str[start:end]
00387 self.link_names.append(val1)
00388 start = end
00389 end += 8
00390 (self.penetration_depth,) = _struct_d.unpack(str[start:end])
00391 return self
00392 except struct.error, e:
00393 raise roslib.message.DeserializationError(e)
00394
00395 _struct_I = roslib.message.struct_I
00396 _struct_3I = struct.Struct("<3I")
00397 _struct_b = struct.Struct("<b")
00398 _struct_7d = struct.Struct("<7d")
00399 _struct_d = struct.Struct("<d")
00400 _struct_3d = struct.Struct("<3d")