00001 """autogenerated by genpy from openraveros/BodyInfo.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import openraveros.msg
00008
00009 class BodyInfo(genpy.Message):
00010 _md5sum = "b652d9c93c7dc0f74ae76568b2ba8a27"
00011 _type = "openraveros/BodyInfo"
00012 _has_header = False
00013 _full_text = """# information about a body
00014 int32 bodyid
00015
00016 # current transformation
00017 AffineTransformMatrix transform
00018
00019 # degrees of freedom (number of joints)
00020 uint8 dof
00021
00022 # enabled status
00023 uint8 enabled
00024
00025
00026 # filename used to create body geometry
00027 string filename
00028
00029 # name of the body
00030 string name
00031
00032 # type of body
00033 string type
00034
00035 float32[] jointvalues
00036 AffineTransformMatrix[] links
00037 string[] linknames
00038 string[] jointnames
00039
00040 # joint limits
00041 float32[] lowerlimit
00042 float32[] upperlimit
00043
00044 # request information bitmasks, also holds robot specific request information (lower 8 bits)
00045 uint16 Req_JointValues=1
00046 uint16 Req_Links=2
00047 uint16 Req_LinkNames=4 # fills the linknames
00048 uint16 Req_JointLimits=8
00049 uint16 Req_Names=16 # if set, fills filename, name, and type
00050 uint16 Req_JointNames=32 # fills the jointnames
00051 ================================================================================
00052 MSG: openraveros/AffineTransformMatrix
00053 # column ordered 3x4 affine transformation, ie: the arrangement in memory is:
00054 # where the upper 3x3 matrix is orthonormal
00055 # [0] [3] [6] [9]
00056 # [1] [4] [7] [10]
00057 # [2] [5] [8] [11]
00058 float32[12] m
00059
00060 """
00061
00062 Req_JointValues = 1
00063 Req_Links = 2
00064 Req_LinkNames = 4
00065 Req_JointLimits = 8
00066 Req_Names = 16
00067 Req_JointNames = 32
00068
00069 __slots__ = ['bodyid','transform','dof','enabled','filename','name','type','jointvalues','links','linknames','jointnames','lowerlimit','upperlimit']
00070 _slot_types = ['int32','openraveros/AffineTransformMatrix','uint8','uint8','string','string','string','float32[]','openraveros/AffineTransformMatrix[]','string[]','string[]','float32[]','float32[]']
00071
00072 def __init__(self, *args, **kwds):
00073 """
00074 Constructor. Any message fields that are implicitly/explicitly
00075 set to None will be assigned a default value. The recommend
00076 use is keyword arguments as this is more robust to future message
00077 changes. You cannot mix in-order arguments and keyword arguments.
00078
00079 The available fields are:
00080 bodyid,transform,dof,enabled,filename,name,type,jointvalues,links,linknames,jointnames,lowerlimit,upperlimit
00081
00082 :param args: complete set of field values, in .msg order
00083 :param kwds: use keyword arguments corresponding to message field names
00084 to set specific fields.
00085 """
00086 if args or kwds:
00087 super(BodyInfo, self).__init__(*args, **kwds)
00088
00089 if self.bodyid is None:
00090 self.bodyid = 0
00091 if self.transform is None:
00092 self.transform = openraveros.msg.AffineTransformMatrix()
00093 if self.dof is None:
00094 self.dof = 0
00095 if self.enabled is None:
00096 self.enabled = 0
00097 if self.filename is None:
00098 self.filename = ''
00099 if self.name is None:
00100 self.name = ''
00101 if self.type is None:
00102 self.type = ''
00103 if self.jointvalues is None:
00104 self.jointvalues = []
00105 if self.links is None:
00106 self.links = []
00107 if self.linknames is None:
00108 self.linknames = []
00109 if self.jointnames is None:
00110 self.jointnames = []
00111 if self.lowerlimit is None:
00112 self.lowerlimit = []
00113 if self.upperlimit is None:
00114 self.upperlimit = []
00115 else:
00116 self.bodyid = 0
00117 self.transform = openraveros.msg.AffineTransformMatrix()
00118 self.dof = 0
00119 self.enabled = 0
00120 self.filename = ''
00121 self.name = ''
00122 self.type = ''
00123 self.jointvalues = []
00124 self.links = []
00125 self.linknames = []
00126 self.jointnames = []
00127 self.lowerlimit = []
00128 self.upperlimit = []
00129
00130 def _get_types(self):
00131 """
00132 internal API method
00133 """
00134 return self._slot_types
00135
00136 def serialize(self, buff):
00137 """
00138 serialize message into buffer
00139 :param buff: buffer, ``StringIO``
00140 """
00141 try:
00142 buff.write(_struct_i.pack(self.bodyid))
00143 buff.write(_struct_12f.pack(*self.transform.m))
00144 _x = self
00145 buff.write(_struct_2B.pack(_x.dof, _x.enabled))
00146 _x = self.filename
00147 length = len(_x)
00148 if python3 or type(_x) == unicode:
00149 _x = _x.encode('utf-8')
00150 length = len(_x)
00151 buff.write(struct.pack('<I%ss'%length, length, _x))
00152 _x = self.name
00153 length = len(_x)
00154 if python3 or type(_x) == unicode:
00155 _x = _x.encode('utf-8')
00156 length = len(_x)
00157 buff.write(struct.pack('<I%ss'%length, length, _x))
00158 _x = self.type
00159 length = len(_x)
00160 if python3 or type(_x) == unicode:
00161 _x = _x.encode('utf-8')
00162 length = len(_x)
00163 buff.write(struct.pack('<I%ss'%length, length, _x))
00164 length = len(self.jointvalues)
00165 buff.write(_struct_I.pack(length))
00166 pattern = '<%sf'%length
00167 buff.write(struct.pack(pattern, *self.jointvalues))
00168 length = len(self.links)
00169 buff.write(_struct_I.pack(length))
00170 for val1 in self.links:
00171 buff.write(_struct_12f.pack(*val1.m))
00172 length = len(self.linknames)
00173 buff.write(_struct_I.pack(length))
00174 for val1 in self.linknames:
00175 length = len(val1)
00176 if python3 or type(val1) == unicode:
00177 val1 = val1.encode('utf-8')
00178 length = len(val1)
00179 buff.write(struct.pack('<I%ss'%length, length, val1))
00180 length = len(self.jointnames)
00181 buff.write(_struct_I.pack(length))
00182 for val1 in self.jointnames:
00183 length = len(val1)
00184 if python3 or type(val1) == unicode:
00185 val1 = val1.encode('utf-8')
00186 length = len(val1)
00187 buff.write(struct.pack('<I%ss'%length, length, val1))
00188 length = len(self.lowerlimit)
00189 buff.write(_struct_I.pack(length))
00190 pattern = '<%sf'%length
00191 buff.write(struct.pack(pattern, *self.lowerlimit))
00192 length = len(self.upperlimit)
00193 buff.write(_struct_I.pack(length))
00194 pattern = '<%sf'%length
00195 buff.write(struct.pack(pattern, *self.upperlimit))
00196 except struct.error as se: self._check_types(se)
00197 except TypeError as te: self._check_types(te)
00198
00199 def deserialize(self, str):
00200 """
00201 unpack serialized message in str into this message instance
00202 :param str: byte array of serialized message, ``str``
00203 """
00204 try:
00205 if self.transform is None:
00206 self.transform = openraveros.msg.AffineTransformMatrix()
00207 if self.links is None:
00208 self.links = None
00209 end = 0
00210 start = end
00211 end += 4
00212 (self.bodyid,) = _struct_i.unpack(str[start:end])
00213 start = end
00214 end += 48
00215 self.transform.m = _struct_12f.unpack(str[start:end])
00216 _x = self
00217 start = end
00218 end += 2
00219 (_x.dof, _x.enabled,) = _struct_2B.unpack(str[start:end])
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 start = end
00224 end += length
00225 if python3:
00226 self.filename = str[start:end].decode('utf-8')
00227 else:
00228 self.filename = str[start:end]
00229 start = end
00230 end += 4
00231 (length,) = _struct_I.unpack(str[start:end])
00232 start = end
00233 end += length
00234 if python3:
00235 self.name = str[start:end].decode('utf-8')
00236 else:
00237 self.name = str[start:end]
00238 start = end
00239 end += 4
00240 (length,) = _struct_I.unpack(str[start:end])
00241 start = end
00242 end += length
00243 if python3:
00244 self.type = str[start:end].decode('utf-8')
00245 else:
00246 self.type = str[start:end]
00247 start = end
00248 end += 4
00249 (length,) = _struct_I.unpack(str[start:end])
00250 pattern = '<%sf'%length
00251 start = end
00252 end += struct.calcsize(pattern)
00253 self.jointvalues = struct.unpack(pattern, str[start:end])
00254 start = end
00255 end += 4
00256 (length,) = _struct_I.unpack(str[start:end])
00257 self.links = []
00258 for i in range(0, length):
00259 val1 = openraveros.msg.AffineTransformMatrix()
00260 start = end
00261 end += 48
00262 val1.m = _struct_12f.unpack(str[start:end])
00263 self.links.append(val1)
00264 start = end
00265 end += 4
00266 (length,) = _struct_I.unpack(str[start:end])
00267 self.linknames = []
00268 for i in range(0, length):
00269 start = end
00270 end += 4
00271 (length,) = _struct_I.unpack(str[start:end])
00272 start = end
00273 end += length
00274 if python3:
00275 val1 = str[start:end].decode('utf-8')
00276 else:
00277 val1 = str[start:end]
00278 self.linknames.append(val1)
00279 start = end
00280 end += 4
00281 (length,) = _struct_I.unpack(str[start:end])
00282 self.jointnames = []
00283 for i in range(0, length):
00284 start = end
00285 end += 4
00286 (length,) = _struct_I.unpack(str[start:end])
00287 start = end
00288 end += length
00289 if python3:
00290 val1 = str[start:end].decode('utf-8')
00291 else:
00292 val1 = str[start:end]
00293 self.jointnames.append(val1)
00294 start = end
00295 end += 4
00296 (length,) = _struct_I.unpack(str[start:end])
00297 pattern = '<%sf'%length
00298 start = end
00299 end += struct.calcsize(pattern)
00300 self.lowerlimit = struct.unpack(pattern, str[start:end])
00301 start = end
00302 end += 4
00303 (length,) = _struct_I.unpack(str[start:end])
00304 pattern = '<%sf'%length
00305 start = end
00306 end += struct.calcsize(pattern)
00307 self.upperlimit = struct.unpack(pattern, str[start:end])
00308 return self
00309 except struct.error as e:
00310 raise genpy.DeserializationError(e)
00311
00312
00313 def serialize_numpy(self, buff, numpy):
00314 """
00315 serialize message with numpy array types into buffer
00316 :param buff: buffer, ``StringIO``
00317 :param numpy: numpy python module
00318 """
00319 try:
00320 buff.write(_struct_i.pack(self.bodyid))
00321 buff.write(self.transform.m.tostring())
00322 _x = self
00323 buff.write(_struct_2B.pack(_x.dof, _x.enabled))
00324 _x = self.filename
00325 length = len(_x)
00326 if python3 or type(_x) == unicode:
00327 _x = _x.encode('utf-8')
00328 length = len(_x)
00329 buff.write(struct.pack('<I%ss'%length, length, _x))
00330 _x = self.name
00331 length = len(_x)
00332 if python3 or type(_x) == unicode:
00333 _x = _x.encode('utf-8')
00334 length = len(_x)
00335 buff.write(struct.pack('<I%ss'%length, length, _x))
00336 _x = self.type
00337 length = len(_x)
00338 if python3 or type(_x) == unicode:
00339 _x = _x.encode('utf-8')
00340 length = len(_x)
00341 buff.write(struct.pack('<I%ss'%length, length, _x))
00342 length = len(self.jointvalues)
00343 buff.write(_struct_I.pack(length))
00344 pattern = '<%sf'%length
00345 buff.write(self.jointvalues.tostring())
00346 length = len(self.links)
00347 buff.write(_struct_I.pack(length))
00348 for val1 in self.links:
00349 buff.write(val1.m.tostring())
00350 length = len(self.linknames)
00351 buff.write(_struct_I.pack(length))
00352 for val1 in self.linknames:
00353 length = len(val1)
00354 if python3 or type(val1) == unicode:
00355 val1 = val1.encode('utf-8')
00356 length = len(val1)
00357 buff.write(struct.pack('<I%ss'%length, length, val1))
00358 length = len(self.jointnames)
00359 buff.write(_struct_I.pack(length))
00360 for val1 in self.jointnames:
00361 length = len(val1)
00362 if python3 or type(val1) == unicode:
00363 val1 = val1.encode('utf-8')
00364 length = len(val1)
00365 buff.write(struct.pack('<I%ss'%length, length, val1))
00366 length = len(self.lowerlimit)
00367 buff.write(_struct_I.pack(length))
00368 pattern = '<%sf'%length
00369 buff.write(self.lowerlimit.tostring())
00370 length = len(self.upperlimit)
00371 buff.write(_struct_I.pack(length))
00372 pattern = '<%sf'%length
00373 buff.write(self.upperlimit.tostring())
00374 except struct.error as se: self._check_types(se)
00375 except TypeError as te: self._check_types(te)
00376
00377 def deserialize_numpy(self, str, numpy):
00378 """
00379 unpack serialized message in str into this message instance using numpy for array types
00380 :param str: byte array of serialized message, ``str``
00381 :param numpy: numpy python module
00382 """
00383 try:
00384 if self.transform is None:
00385 self.transform = openraveros.msg.AffineTransformMatrix()
00386 if self.links is None:
00387 self.links = None
00388 end = 0
00389 start = end
00390 end += 4
00391 (self.bodyid,) = _struct_i.unpack(str[start:end])
00392 start = end
00393 end += 48
00394 self.transform.m = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=12)
00395 _x = self
00396 start = end
00397 end += 2
00398 (_x.dof, _x.enabled,) = _struct_2B.unpack(str[start:end])
00399 start = end
00400 end += 4
00401 (length,) = _struct_I.unpack(str[start:end])
00402 start = end
00403 end += length
00404 if python3:
00405 self.filename = str[start:end].decode('utf-8')
00406 else:
00407 self.filename = str[start:end]
00408 start = end
00409 end += 4
00410 (length,) = _struct_I.unpack(str[start:end])
00411 start = end
00412 end += length
00413 if python3:
00414 self.name = str[start:end].decode('utf-8')
00415 else:
00416 self.name = str[start:end]
00417 start = end
00418 end += 4
00419 (length,) = _struct_I.unpack(str[start:end])
00420 start = end
00421 end += length
00422 if python3:
00423 self.type = str[start:end].decode('utf-8')
00424 else:
00425 self.type = str[start:end]
00426 start = end
00427 end += 4
00428 (length,) = _struct_I.unpack(str[start:end])
00429 pattern = '<%sf'%length
00430 start = end
00431 end += struct.calcsize(pattern)
00432 self.jointvalues = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00433 start = end
00434 end += 4
00435 (length,) = _struct_I.unpack(str[start:end])
00436 self.links = []
00437 for i in range(0, length):
00438 val1 = openraveros.msg.AffineTransformMatrix()
00439 start = end
00440 end += 48
00441 val1.m = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=12)
00442 self.links.append(val1)
00443 start = end
00444 end += 4
00445 (length,) = _struct_I.unpack(str[start:end])
00446 self.linknames = []
00447 for i in range(0, length):
00448 start = end
00449 end += 4
00450 (length,) = _struct_I.unpack(str[start:end])
00451 start = end
00452 end += length
00453 if python3:
00454 val1 = str[start:end].decode('utf-8')
00455 else:
00456 val1 = str[start:end]
00457 self.linknames.append(val1)
00458 start = end
00459 end += 4
00460 (length,) = _struct_I.unpack(str[start:end])
00461 self.jointnames = []
00462 for i in range(0, length):
00463 start = end
00464 end += 4
00465 (length,) = _struct_I.unpack(str[start:end])
00466 start = end
00467 end += length
00468 if python3:
00469 val1 = str[start:end].decode('utf-8')
00470 else:
00471 val1 = str[start:end]
00472 self.jointnames.append(val1)
00473 start = end
00474 end += 4
00475 (length,) = _struct_I.unpack(str[start:end])
00476 pattern = '<%sf'%length
00477 start = end
00478 end += struct.calcsize(pattern)
00479 self.lowerlimit = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00480 start = end
00481 end += 4
00482 (length,) = _struct_I.unpack(str[start:end])
00483 pattern = '<%sf'%length
00484 start = end
00485 end += struct.calcsize(pattern)
00486 self.upperlimit = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00487 return self
00488 except struct.error as e:
00489 raise genpy.DeserializationError(e)
00490
00491 _struct_I = genpy.struct_I
00492 _struct_i = struct.Struct("<i")
00493 _struct_2B = struct.Struct("<2B")
00494 _struct_12f = struct.Struct("<12f")