Go to the documentation of this file.00001 """autogenerated by genpy from openraveros/Contact.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class Contact(genpy.Message):
00009 _md5sum = "c9562f63c22950b69d077ce4cbc0cd3d"
00010 _type = "openraveros/Contact"
00011 _has_header = False
00012 _full_text = """float32[3] position
00013 float32[3] normal
00014
00015 """
00016 __slots__ = ['position','normal']
00017 _slot_types = ['float32[3]','float32[3]']
00018
00019 def __init__(self, *args, **kwds):
00020 """
00021 Constructor. Any message fields that are implicitly/explicitly
00022 set to None will be assigned a default value. The recommend
00023 use is keyword arguments as this is more robust to future message
00024 changes. You cannot mix in-order arguments and keyword arguments.
00025
00026 The available fields are:
00027 position,normal
00028
00029 :param args: complete set of field values, in .msg order
00030 :param kwds: use keyword arguments corresponding to message field names
00031 to set specific fields.
00032 """
00033 if args or kwds:
00034 super(Contact, self).__init__(*args, **kwds)
00035
00036 if self.position is None:
00037 self.position = [0.,0.,0.]
00038 if self.normal is None:
00039 self.normal = [0.,0.,0.]
00040 else:
00041 self.position = [0.,0.,0.]
00042 self.normal = [0.,0.,0.]
00043
00044 def _get_types(self):
00045 """
00046 internal API method
00047 """
00048 return self._slot_types
00049
00050 def serialize(self, buff):
00051 """
00052 serialize message into buffer
00053 :param buff: buffer, ``StringIO``
00054 """
00055 try:
00056 buff.write(_struct_3f.pack(*self.position))
00057 buff.write(_struct_3f.pack(*self.normal))
00058 except struct.error as se: self._check_types(se)
00059 except TypeError as te: self._check_types(te)
00060
00061 def deserialize(self, str):
00062 """
00063 unpack serialized message in str into this message instance
00064 :param str: byte array of serialized message, ``str``
00065 """
00066 try:
00067 end = 0
00068 start = end
00069 end += 12
00070 self.position = _struct_3f.unpack(str[start:end])
00071 start = end
00072 end += 12
00073 self.normal = _struct_3f.unpack(str[start:end])
00074 return self
00075 except struct.error as e:
00076 raise genpy.DeserializationError(e)
00077
00078
00079 def serialize_numpy(self, buff, numpy):
00080 """
00081 serialize message with numpy array types into buffer
00082 :param buff: buffer, ``StringIO``
00083 :param numpy: numpy python module
00084 """
00085 try:
00086 buff.write(self.position.tostring())
00087 buff.write(self.normal.tostring())
00088 except struct.error as se: self._check_types(se)
00089 except TypeError as te: self._check_types(te)
00090
00091 def deserialize_numpy(self, str, numpy):
00092 """
00093 unpack serialized message in str into this message instance using numpy for array types
00094 :param str: byte array of serialized message, ``str``
00095 :param numpy: numpy python module
00096 """
00097 try:
00098 end = 0
00099 start = end
00100 end += 12
00101 self.position = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00102 start = end
00103 end += 12
00104 self.normal = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00105 return self
00106 except struct.error as e:
00107 raise genpy.DeserializationError(e)
00108
00109 _struct_I = genpy.struct_I
00110 _struct_3f = struct.Struct("<3f")