_env_raycollision.py
Go to the documentation of this file.
00001 """autogenerated by genpy from openraveros/env_raycollisionRequest.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 env_raycollisionRequest(genpy.Message):
00010   _md5sum = "5186c8b2846045a7cb6bd96a87ccb435"
00011   _type = "openraveros/env_raycollisionRequest"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """
00014 
00015 Ray[] rays
00016 
00017 
00018 int32 bodyid
00019 
00020 
00021 uint8 request_contacts
00022 
00023 
00024 uint8 request_bodies
00025 
00026 
00027 ================================================================================
00028 MSG: openraveros/Ray
00029 # defines a ray starting at position and going along direction
00030 float32[3] position
00031 float32[3] direction
00032 
00033 """
00034   __slots__ = ['rays','bodyid','request_contacts','request_bodies']
00035   _slot_types = ['openraveros/Ray[]','int32','uint8','uint8']
00036 
00037   def __init__(self, *args, **kwds):
00038     """
00039     Constructor. Any message fields that are implicitly/explicitly
00040     set to None will be assigned a default value. The recommend
00041     use is keyword arguments as this is more robust to future message
00042     changes.  You cannot mix in-order arguments and keyword arguments.
00043 
00044     The available fields are:
00045        rays,bodyid,request_contacts,request_bodies
00046 
00047     :param args: complete set of field values, in .msg order
00048     :param kwds: use keyword arguments corresponding to message field names
00049     to set specific fields.
00050     """
00051     if args or kwds:
00052       super(env_raycollisionRequest, self).__init__(*args, **kwds)
00053       #message fields cannot be None, assign default values for those that are
00054       if self.rays is None:
00055         self.rays = []
00056       if self.bodyid is None:
00057         self.bodyid = 0
00058       if self.request_contacts is None:
00059         self.request_contacts = 0
00060       if self.request_bodies is None:
00061         self.request_bodies = 0
00062     else:
00063       self.rays = []
00064       self.bodyid = 0
00065       self.request_contacts = 0
00066       self.request_bodies = 0
00067 
00068   def _get_types(self):
00069     """
00070     internal API method
00071     """
00072     return self._slot_types
00073 
00074   def serialize(self, buff):
00075     """
00076     serialize message into buffer
00077     :param buff: buffer, ``StringIO``
00078     """
00079     try:
00080       length = len(self.rays)
00081       buff.write(_struct_I.pack(length))
00082       for val1 in self.rays:
00083         buff.write(_struct_3f.pack(*val1.position))
00084         buff.write(_struct_3f.pack(*val1.direction))
00085       _x = self
00086       buff.write(_struct_i2B.pack(_x.bodyid, _x.request_contacts, _x.request_bodies))
00087     except struct.error as se: self._check_types(se)
00088     except TypeError as te: self._check_types(te)
00089 
00090   def deserialize(self, str):
00091     """
00092     unpack serialized message in str into this message instance
00093     :param str: byte array of serialized message, ``str``
00094     """
00095     try:
00096       if self.rays is None:
00097         self.rays = None
00098       end = 0
00099       start = end
00100       end += 4
00101       (length,) = _struct_I.unpack(str[start:end])
00102       self.rays = []
00103       for i in range(0, length):
00104         val1 = openraveros.msg.Ray()
00105         start = end
00106         end += 12
00107         val1.position = _struct_3f.unpack(str[start:end])
00108         start = end
00109         end += 12
00110         val1.direction = _struct_3f.unpack(str[start:end])
00111         self.rays.append(val1)
00112       _x = self
00113       start = end
00114       end += 6
00115       (_x.bodyid, _x.request_contacts, _x.request_bodies,) = _struct_i2B.unpack(str[start:end])
00116       return self
00117     except struct.error as e:
00118       raise genpy.DeserializationError(e) #most likely buffer underfill
00119 
00120 
00121   def serialize_numpy(self, buff, numpy):
00122     """
00123     serialize message with numpy array types into buffer
00124     :param buff: buffer, ``StringIO``
00125     :param numpy: numpy python module
00126     """
00127     try:
00128       length = len(self.rays)
00129       buff.write(_struct_I.pack(length))
00130       for val1 in self.rays:
00131         buff.write(val1.position.tostring())
00132         buff.write(val1.direction.tostring())
00133       _x = self
00134       buff.write(_struct_i2B.pack(_x.bodyid, _x.request_contacts, _x.request_bodies))
00135     except struct.error as se: self._check_types(se)
00136     except TypeError as te: self._check_types(te)
00137 
00138   def deserialize_numpy(self, str, numpy):
00139     """
00140     unpack serialized message in str into this message instance using numpy for array types
00141     :param str: byte array of serialized message, ``str``
00142     :param numpy: numpy python module
00143     """
00144     try:
00145       if self.rays is None:
00146         self.rays = None
00147       end = 0
00148       start = end
00149       end += 4
00150       (length,) = _struct_I.unpack(str[start:end])
00151       self.rays = []
00152       for i in range(0, length):
00153         val1 = openraveros.msg.Ray()
00154         start = end
00155         end += 12
00156         val1.position = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00157         start = end
00158         end += 12
00159         val1.direction = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00160         self.rays.append(val1)
00161       _x = self
00162       start = end
00163       end += 6
00164       (_x.bodyid, _x.request_contacts, _x.request_bodies,) = _struct_i2B.unpack(str[start:end])
00165       return self
00166     except struct.error as e:
00167       raise genpy.DeserializationError(e) #most likely buffer underfill
00168 
00169 _struct_I = genpy.struct_I
00170 _struct_i2B = struct.Struct("<i2B")
00171 _struct_3f = struct.Struct("<3f")
00172 """autogenerated by genpy from openraveros/env_raycollisionResponse.msg. Do not edit."""
00173 import sys
00174 python3 = True if sys.hexversion > 0x03000000 else False
00175 import genpy
00176 import struct
00177 
00178 import openraveros.msg
00179 
00180 class env_raycollisionResponse(genpy.Message):
00181   _md5sum = "fa24012519fc56ca2e98ba82ef8c795b"
00182   _type = "openraveros/env_raycollisionResponse"
00183   _has_header = False #flag to mark the presence of a Header object
00184   _full_text = """
00185 uint8[] collision
00186 Contact[] contacts
00187 int32[] hitbodies
00188 
00189 
00190 ================================================================================
00191 MSG: openraveros/Contact
00192 float32[3] position
00193 float32[3] normal
00194 
00195 """
00196   __slots__ = ['collision','contacts','hitbodies']
00197   _slot_types = ['uint8[]','openraveros/Contact[]','int32[]']
00198 
00199   def __init__(self, *args, **kwds):
00200     """
00201     Constructor. Any message fields that are implicitly/explicitly
00202     set to None will be assigned a default value. The recommend
00203     use is keyword arguments as this is more robust to future message
00204     changes.  You cannot mix in-order arguments and keyword arguments.
00205 
00206     The available fields are:
00207        collision,contacts,hitbodies
00208 
00209     :param args: complete set of field values, in .msg order
00210     :param kwds: use keyword arguments corresponding to message field names
00211     to set specific fields.
00212     """
00213     if args or kwds:
00214       super(env_raycollisionResponse, self).__init__(*args, **kwds)
00215       #message fields cannot be None, assign default values for those that are
00216       if self.collision is None:
00217         self.collision = ''
00218       if self.contacts is None:
00219         self.contacts = []
00220       if self.hitbodies is None:
00221         self.hitbodies = []
00222     else:
00223       self.collision = ''
00224       self.contacts = []
00225       self.hitbodies = []
00226 
00227   def _get_types(self):
00228     """
00229     internal API method
00230     """
00231     return self._slot_types
00232 
00233   def serialize(self, buff):
00234     """
00235     serialize message into buffer
00236     :param buff: buffer, ``StringIO``
00237     """
00238     try:
00239       _x = self.collision
00240       length = len(_x)
00241       # - if encoded as a list instead, serialize as bytes instead of string
00242       if type(_x) in [list, tuple]:
00243         buff.write(struct.pack('<I%sB'%length, length, *_x))
00244       else:
00245         buff.write(struct.pack('<I%ss'%length, length, _x))
00246       length = len(self.contacts)
00247       buff.write(_struct_I.pack(length))
00248       for val1 in self.contacts:
00249         buff.write(_struct_3f.pack(*val1.position))
00250         buff.write(_struct_3f.pack(*val1.normal))
00251       length = len(self.hitbodies)
00252       buff.write(_struct_I.pack(length))
00253       pattern = '<%si'%length
00254       buff.write(struct.pack(pattern, *self.hitbodies))
00255     except struct.error as se: self._check_types(se)
00256     except TypeError as te: self._check_types(te)
00257 
00258   def deserialize(self, str):
00259     """
00260     unpack serialized message in str into this message instance
00261     :param str: byte array of serialized message, ``str``
00262     """
00263     try:
00264       if self.contacts is None:
00265         self.contacts = None
00266       end = 0
00267       start = end
00268       end += 4
00269       (length,) = _struct_I.unpack(str[start:end])
00270       start = end
00271       end += length
00272       if python3:
00273         self.collision = str[start:end].decode('utf-8')
00274       else:
00275         self.collision = str[start:end]
00276       start = end
00277       end += 4
00278       (length,) = _struct_I.unpack(str[start:end])
00279       self.contacts = []
00280       for i in range(0, length):
00281         val1 = openraveros.msg.Contact()
00282         start = end
00283         end += 12
00284         val1.position = _struct_3f.unpack(str[start:end])
00285         start = end
00286         end += 12
00287         val1.normal = _struct_3f.unpack(str[start:end])
00288         self.contacts.append(val1)
00289       start = end
00290       end += 4
00291       (length,) = _struct_I.unpack(str[start:end])
00292       pattern = '<%si'%length
00293       start = end
00294       end += struct.calcsize(pattern)
00295       self.hitbodies = struct.unpack(pattern, str[start:end])
00296       return self
00297     except struct.error as e:
00298       raise genpy.DeserializationError(e) #most likely buffer underfill
00299 
00300 
00301   def serialize_numpy(self, buff, numpy):
00302     """
00303     serialize message with numpy array types into buffer
00304     :param buff: buffer, ``StringIO``
00305     :param numpy: numpy python module
00306     """
00307     try:
00308       _x = self.collision
00309       length = len(_x)
00310       # - if encoded as a list instead, serialize as bytes instead of string
00311       if type(_x) in [list, tuple]:
00312         buff.write(struct.pack('<I%sB'%length, length, *_x))
00313       else:
00314         buff.write(struct.pack('<I%ss'%length, length, _x))
00315       length = len(self.contacts)
00316       buff.write(_struct_I.pack(length))
00317       for val1 in self.contacts:
00318         buff.write(val1.position.tostring())
00319         buff.write(val1.normal.tostring())
00320       length = len(self.hitbodies)
00321       buff.write(_struct_I.pack(length))
00322       pattern = '<%si'%length
00323       buff.write(self.hitbodies.tostring())
00324     except struct.error as se: self._check_types(se)
00325     except TypeError as te: self._check_types(te)
00326 
00327   def deserialize_numpy(self, str, numpy):
00328     """
00329     unpack serialized message in str into this message instance using numpy for array types
00330     :param str: byte array of serialized message, ``str``
00331     :param numpy: numpy python module
00332     """
00333     try:
00334       if self.contacts is None:
00335         self.contacts = None
00336       end = 0
00337       start = end
00338       end += 4
00339       (length,) = _struct_I.unpack(str[start:end])
00340       start = end
00341       end += length
00342       if python3:
00343         self.collision = str[start:end].decode('utf-8')
00344       else:
00345         self.collision = str[start:end]
00346       start = end
00347       end += 4
00348       (length,) = _struct_I.unpack(str[start:end])
00349       self.contacts = []
00350       for i in range(0, length):
00351         val1 = openraveros.msg.Contact()
00352         start = end
00353         end += 12
00354         val1.position = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00355         start = end
00356         end += 12
00357         val1.normal = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00358         self.contacts.append(val1)
00359       start = end
00360       end += 4
00361       (length,) = _struct_I.unpack(str[start:end])
00362       pattern = '<%si'%length
00363       start = end
00364       end += struct.calcsize(pattern)
00365       self.hitbodies = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00366       return self
00367     except struct.error as e:
00368       raise genpy.DeserializationError(e) #most likely buffer underfill
00369 
00370 _struct_I = genpy.struct_I
00371 _struct_3f = struct.Struct("<3f")
00372 class env_raycollision(object):
00373   _type          = 'openraveros/env_raycollision'
00374   _md5sum = 'a7be61e01b06aa574f96aa2460b67c47'
00375   _request_class  = env_raycollisionRequest
00376   _response_class = env_raycollisionResponse
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


openraveros
Author(s): Rosen Diankov (rosen.diankov@gmail.com)
autogenerated on Sat Mar 23 2013 22:15:38