00001 """autogenerated by genmsg_py from TestFixedArray.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class TestFixedArray(roslib.message.Message):
00007 _md5sum = "1557473dc09f1a01a00123a713c822a7"
00008 _type = "test_rospy/TestFixedArray"
00009 _has_header = False
00010 _full_text = """float32[1] f32_1
00011 float32[3] f32_3
00012 float64[1] f64_1
00013 float64[3] f64_3
00014 int8[1] i8_1
00015 int8[3] i8_3
00016 uint8[1] u8_1
00017 uint8[3] u8_3
00018 int32[1] i32_1
00019 int32[3] i32_3
00020 uint32[1] u32_1
00021 uint32[3] u32_3
00022 string[1] s_1
00023 string[3] s_3
00024 bool[1] b_1
00025 bool[3] b_3
00026 """
00027 __slots__ = ['f32_1','f32_3','f64_1','f64_3','i8_1','i8_3','u8_1','u8_3','i32_1','i32_3','u32_1','u32_3','s_1','s_3','b_1','b_3']
00028 _slot_types = ['float32[1]','float32[3]','float64[1]','float64[3]','int8[1]','int8[3]','uint8[1]','uint8[3]','int32[1]','int32[3]','uint32[1]','uint32[3]','string[1]','string[3]','bool[1]','bool[3]']
00029
00030 def __init__(self, *args, **kwds):
00031 """
00032 Constructor. Any message fields that are implicitly/explicitly
00033 set to None will be assigned a default value. The recommend
00034 use is keyword arguments as this is more robust to future message
00035 changes. You cannot mix in-order arguments and keyword arguments.
00036
00037 The available fields are:
00038 f32_1,f32_3,f64_1,f64_3,i8_1,i8_3,u8_1,u8_3,i32_1,i32_3,u32_1,u32_3,s_1,s_3,b_1,b_3
00039
00040 @param args: complete set of field values, in .msg order
00041 @param kwds: use keyword arguments corresponding to message field names
00042 to set specific fields.
00043 """
00044 if args or kwds:
00045 super(TestFixedArray, self).__init__(*args, **kwds)
00046
00047 if self.f32_1 is None:
00048 self.f32_1 = [0.]
00049 if self.f32_3 is None:
00050 self.f32_3 = [0.,0.,0.]
00051 if self.f64_1 is None:
00052 self.f64_1 = [0.]
00053 if self.f64_3 is None:
00054 self.f64_3 = [0.,0.,0.]
00055 if self.i8_1 is None:
00056 self.i8_1 = [0]
00057 if self.i8_3 is None:
00058 self.i8_3 = [0,0,0]
00059 if self.u8_1 is None:
00060 self.u8_1 = chr(0)*1
00061 if self.u8_3 is None:
00062 self.u8_3 = chr(0)*3
00063 if self.i32_1 is None:
00064 self.i32_1 = [0]
00065 if self.i32_3 is None:
00066 self.i32_3 = [0,0,0]
00067 if self.u32_1 is None:
00068 self.u32_1 = [0]
00069 if self.u32_3 is None:
00070 self.u32_3 = [0,0,0]
00071 if self.s_1 is None:
00072 self.s_1 = ['']
00073 if self.s_3 is None:
00074 self.s_3 = ['','','']
00075 if self.b_1 is None:
00076 self.b_1 = [False]
00077 if self.b_3 is None:
00078 self.b_3 = [False,False,False]
00079 else:
00080 self.f32_1 = [0.]
00081 self.f32_3 = [0.,0.,0.]
00082 self.f64_1 = [0.]
00083 self.f64_3 = [0.,0.,0.]
00084 self.i8_1 = [0]
00085 self.i8_3 = [0,0,0]
00086 self.u8_1 = chr(0)*1
00087 self.u8_3 = chr(0)*3
00088 self.i32_1 = [0]
00089 self.i32_3 = [0,0,0]
00090 self.u32_1 = [0]
00091 self.u32_3 = [0,0,0]
00092 self.s_1 = ['']
00093 self.s_3 = ['','','']
00094 self.b_1 = [False]
00095 self.b_3 = [False,False,False]
00096
00097 def _get_types(self):
00098 """
00099 internal API method
00100 """
00101 return self._slot_types
00102
00103 def serialize(self, buff):
00104 """
00105 serialize message into buffer
00106 @param buff: buffer
00107 @type buff: StringIO
00108 """
00109 try:
00110 buff.write(_struct_1f.pack(*self.f32_1))
00111 buff.write(_struct_3f.pack(*self.f32_3))
00112 buff.write(_struct_1d.pack(*self.f64_1))
00113 buff.write(_struct_3d.pack(*self.f64_3))
00114 buff.write(_struct_1b.pack(*self.i8_1))
00115 buff.write(_struct_3b.pack(*self.i8_3))
00116 _x = self.u8_1
00117
00118 if type(_x) in [list, tuple]:
00119 buff.write(_struct_1B.pack(*_x))
00120 else:
00121 buff.write(_struct_1s.pack(_x))
00122 _x = self.u8_3
00123
00124 if type(_x) in [list, tuple]:
00125 buff.write(_struct_3B.pack(*_x))
00126 else:
00127 buff.write(_struct_3s.pack(_x))
00128 buff.write(_struct_1i.pack(*self.i32_1))
00129 buff.write(_struct_3i.pack(*self.i32_3))
00130 buff.write(_struct_1I.pack(*self.u32_1))
00131 buff.write(_struct_3I.pack(*self.u32_3))
00132 for val1 in self.s_1:
00133 length = len(val1)
00134 buff.write(struct.pack('<I%ss'%length, length, val1))
00135 for val1 in self.s_3:
00136 length = len(val1)
00137 buff.write(struct.pack('<I%ss'%length, length, val1))
00138 buff.write(_struct_1B.pack(*self.b_1))
00139 buff.write(_struct_3B.pack(*self.b_3))
00140 except struct.error, se: self._check_types(se)
00141 except TypeError, te: self._check_types(te)
00142
00143 def deserialize(self, str):
00144 """
00145 unpack serialized message in str into this message instance
00146 @param str: byte array of serialized message
00147 @type str: str
00148 """
00149 try:
00150 end = 0
00151 start = end
00152 end += 4
00153 self.f32_1 = _struct_1f.unpack(str[start:end])
00154 start = end
00155 end += 12
00156 self.f32_3 = _struct_3f.unpack(str[start:end])
00157 start = end
00158 end += 8
00159 self.f64_1 = _struct_1d.unpack(str[start:end])
00160 start = end
00161 end += 24
00162 self.f64_3 = _struct_3d.unpack(str[start:end])
00163 start = end
00164 end += 1
00165 self.i8_1 = _struct_1b.unpack(str[start:end])
00166 start = end
00167 end += 3
00168 self.i8_3 = _struct_3b.unpack(str[start:end])
00169 start = end
00170 end += 1
00171 self.u8_1 = str[start:end]
00172 start = end
00173 end += 3
00174 self.u8_3 = str[start:end]
00175 start = end
00176 end += 4
00177 self.i32_1 = _struct_1i.unpack(str[start:end])
00178 start = end
00179 end += 12
00180 self.i32_3 = _struct_3i.unpack(str[start:end])
00181 start = end
00182 end += 4
00183 self.u32_1 = _struct_1I.unpack(str[start:end])
00184 start = end
00185 end += 12
00186 self.u32_3 = _struct_3I.unpack(str[start:end])
00187 self.s_1 = []
00188 for i in xrange(0, 1):
00189 start = end
00190 end += 4
00191 (length,) = _struct_I.unpack(str[start:end])
00192 start = end
00193 end += length
00194 val1 = str[start:end]
00195 self.s_1.append(val1)
00196 self.s_3 = []
00197 for i in xrange(0, 3):
00198 start = end
00199 end += 4
00200 (length,) = _struct_I.unpack(str[start:end])
00201 start = end
00202 end += length
00203 val1 = str[start:end]
00204 self.s_3.append(val1)
00205 start = end
00206 end += 1
00207 self.b_1 = _struct_1B.unpack(str[start:end])
00208 self.b_1 = map(bool, self.b_1)
00209 start = end
00210 end += 3
00211 self.b_3 = _struct_3B.unpack(str[start:end])
00212 self.b_3 = map(bool, self.b_3)
00213 return self
00214 except struct.error, e:
00215 raise roslib.message.DeserializationError(e)
00216
00217
00218 def serialize_numpy(self, buff, numpy):
00219 """
00220 serialize message with numpy array types into buffer
00221 @param buff: buffer
00222 @type buff: StringIO
00223 @param numpy: numpy python module
00224 @type numpy module
00225 """
00226 try:
00227 buff.write(self.f32_1.tostring())
00228 buff.write(self.f32_3.tostring())
00229 buff.write(self.f64_1.tostring())
00230 buff.write(self.f64_3.tostring())
00231 buff.write(self.i8_1.tostring())
00232 buff.write(self.i8_3.tostring())
00233 _x = self.u8_1
00234
00235 if type(_x) in [list, tuple]:
00236 buff.write(_struct_1B.pack(*_x))
00237 else:
00238 buff.write(_struct_1s.pack(_x))
00239 _x = self.u8_3
00240
00241 if type(_x) in [list, tuple]:
00242 buff.write(_struct_3B.pack(*_x))
00243 else:
00244 buff.write(_struct_3s.pack(_x))
00245 buff.write(self.i32_1.tostring())
00246 buff.write(self.i32_3.tostring())
00247 buff.write(self.u32_1.tostring())
00248 buff.write(self.u32_3.tostring())
00249 for val1 in self.s_1:
00250 length = len(val1)
00251 buff.write(struct.pack('<I%ss'%length, length, val1))
00252 for val1 in self.s_3:
00253 length = len(val1)
00254 buff.write(struct.pack('<I%ss'%length, length, val1))
00255 buff.write(self.b_1.tostring())
00256 buff.write(self.b_3.tostring())
00257 except struct.error, se: self._check_types(se)
00258 except TypeError, te: self._check_types(te)
00259
00260 def deserialize_numpy(self, str, numpy):
00261 """
00262 unpack serialized message in str into this message instance using numpy for array types
00263 @param str: byte array of serialized message
00264 @type str: str
00265 @param numpy: numpy python module
00266 @type numpy: module
00267 """
00268 try:
00269 end = 0
00270 start = end
00271 end += 4
00272 self.f32_1 = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=1)
00273 start = end
00274 end += 12
00275 self.f32_3 = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00276 start = end
00277 end += 8
00278 self.f64_1 = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=1)
00279 start = end
00280 end += 24
00281 self.f64_3 = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=3)
00282 start = end
00283 end += 1
00284 self.i8_1 = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=1)
00285 start = end
00286 end += 3
00287 self.i8_3 = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=3)
00288 start = end
00289 end += 1
00290 self.u8_1 = str[start:end]
00291 start = end
00292 end += 3
00293 self.u8_3 = str[start:end]
00294 start = end
00295 end += 4
00296 self.i32_1 = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=1)
00297 start = end
00298 end += 12
00299 self.i32_3 = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=3)
00300 start = end
00301 end += 4
00302 self.u32_1 = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=1)
00303 start = end
00304 end += 12
00305 self.u32_3 = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=3)
00306 self.s_1 = []
00307 for i in xrange(0, 1):
00308 start = end
00309 end += 4
00310 (length,) = _struct_I.unpack(str[start:end])
00311 start = end
00312 end += length
00313 val1 = str[start:end]
00314 self.s_1.append(val1)
00315 self.s_3 = []
00316 for i in xrange(0, 3):
00317 start = end
00318 end += 4
00319 (length,) = _struct_I.unpack(str[start:end])
00320 start = end
00321 end += length
00322 val1 = str[start:end]
00323 self.s_3.append(val1)
00324 start = end
00325 end += 1
00326 self.b_1 = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=1)
00327 self.b_1 = map(bool, self.b_1)
00328 start = end
00329 end += 3
00330 self.b_3 = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=3)
00331 self.b_3 = map(bool, self.b_3)
00332 return self
00333 except struct.error, e:
00334 raise roslib.message.DeserializationError(e)
00335
00336 _struct_I = roslib.message.struct_I
00337 _struct_1s = struct.Struct("<1s")
00338 _struct_3s = struct.Struct("<3s")
00339 _struct_3I = struct.Struct("<3I")
00340 _struct_1I = struct.Struct("<1I")
00341 _struct_3B = struct.Struct("<3B")
00342 _struct_1i = struct.Struct("<1i")
00343 _struct_3i = struct.Struct("<3i")
00344 _struct_1b = struct.Struct("<1b")
00345 _struct_1d = struct.Struct("<1d")
00346 _struct_1f = struct.Struct("<1f")
00347 _struct_1B = struct.Struct("<1B")
00348 _struct_3b = struct.Struct("<3b")
00349 _struct_3f = struct.Struct("<3f")
00350 _struct_3d = struct.Struct("<3d")