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