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