_Test.py
Go to the documentation of this file.
00001 """autogenerated by genpy from roslisp_tutorials/Test.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 roslisp_tutorials.msg
00008 
00009 class Test(genpy.Message):
00010   _md5sum = "c56ee95e9378267df41b719464b064be"
00011   _type = "roslisp_tutorials/Test"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """Point[2] location
00014 int32[] orientation
00015 ================================================================================
00016 MSG: roslisp_tutorials/Point
00017 float32 x
00018 float32 y
00019 float32 z
00020 
00021 """
00022   __slots__ = ['location','orientation']
00023   _slot_types = ['roslisp_tutorials/Point[2]','int32[]']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        location,orientation
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(Test, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.location is None:
00043         self.location = [roslisp_tutorials.msg.Point(),roslisp_tutorials.msg.Point()]
00044       if self.orientation is None:
00045         self.orientation = []
00046     else:
00047       self.location = [roslisp_tutorials.msg.Point(),roslisp_tutorials.msg.Point()]
00048       self.orientation = []
00049 
00050   def _get_types(self):
00051     """
00052     internal API method
00053     """
00054     return self._slot_types
00055 
00056   def serialize(self, buff):
00057     """
00058     serialize message into buffer
00059     :param buff: buffer, ``StringIO``
00060     """
00061     try:
00062       for val1 in self.location:
00063         _x = val1
00064         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00065       length = len(self.orientation)
00066       buff.write(_struct_I.pack(length))
00067       pattern = '<%si'%length
00068       buff.write(struct.pack(pattern, *self.orientation))
00069     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00070     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00071 
00072   def deserialize(self, str):
00073     """
00074     unpack serialized message in str into this message instance
00075     :param str: byte array of serialized message, ``str``
00076     """
00077     try:
00078       if self.location is None:
00079         self.location = None
00080       end = 0
00081       self.location = []
00082       for i in range(0, 2):
00083         val1 = roslisp_tutorials.msg.Point()
00084         _x = val1
00085         start = end
00086         end += 12
00087         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00088         self.location.append(val1)
00089       start = end
00090       end += 4
00091       (length,) = _struct_I.unpack(str[start:end])
00092       pattern = '<%si'%length
00093       start = end
00094       end += struct.calcsize(pattern)
00095       self.orientation = struct.unpack(pattern, str[start:end])
00096       return self
00097     except struct.error as e:
00098       raise genpy.DeserializationError(e) #most likely buffer underfill
00099 
00100 
00101   def serialize_numpy(self, buff, numpy):
00102     """
00103     serialize message with numpy array types into buffer
00104     :param buff: buffer, ``StringIO``
00105     :param numpy: numpy python module
00106     """
00107     try:
00108       for val1 in self.location:
00109         _x = val1
00110         buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00111       length = len(self.orientation)
00112       buff.write(_struct_I.pack(length))
00113       pattern = '<%si'%length
00114       buff.write(self.orientation.tostring())
00115     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00116     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00117 
00118   def deserialize_numpy(self, str, numpy):
00119     """
00120     unpack serialized message in str into this message instance using numpy for array types
00121     :param str: byte array of serialized message, ``str``
00122     :param numpy: numpy python module
00123     """
00124     try:
00125       if self.location is None:
00126         self.location = None
00127       end = 0
00128       self.location = []
00129       for i in range(0, 2):
00130         val1 = roslisp_tutorials.msg.Point()
00131         _x = val1
00132         start = end
00133         end += 12
00134         (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00135         self.location.append(val1)
00136       start = end
00137       end += 4
00138       (length,) = _struct_I.unpack(str[start:end])
00139       pattern = '<%si'%length
00140       start = end
00141       end += struct.calcsize(pattern)
00142       self.orientation = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00143       return self
00144     except struct.error as e:
00145       raise genpy.DeserializationError(e) #most likely buffer underfill
00146 
00147 _struct_I = genpy.struct_I
00148 _struct_3f = struct.Struct("<3f")


roslisp_tutorials
Author(s): Bhaskara Marthi
autogenerated on Wed Apr 23 2014 10:28:02