00001 """autogenerated by genmsg_py from PointCloud.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import test_roscpp_serialization_perf.msg
00006 import std_msgs.msg
00007
00008 class PointCloud(roslib.message.Message):
00009 _md5sum = "c47b5cedd2b77d241b27547ed7624840"
00010 _type = "test_roscpp_serialization_perf/PointCloud"
00011 _has_header = True
00012 _full_text = """Header header
00013 Point32[] pts
00014 ChannelFloat32[] chan
00015
00016 ================================================================================
00017 MSG: std_msgs/Header
00018 # Standard metadata for higher-level stamped data types.
00019 # This is generally used to communicate timestamped data
00020 # in a particular coordinate frame.
00021 #
00022 # sequence ID: consecutively increasing ID
00023 uint32 seq
00024 #Two-integer timestamp that is expressed as:
00025 # * stamp.secs: seconds (stamp_secs) since epoch
00026 # * stamp.nsecs: nanoseconds since stamp_secs
00027 # time-handling sugar is provided by the client library
00028 time stamp
00029 #Frame this data is associated with
00030 # 0: no frame
00031 # 1: global frame
00032 string frame_id
00033
00034 ================================================================================
00035 MSG: test_roscpp_serialization_perf/Point32
00036 float32 x
00037 float32 y
00038 float32 z
00039 ================================================================================
00040 MSG: test_roscpp_serialization_perf/ChannelFloat32
00041 string name
00042 float32[] vals
00043 """
00044 __slots__ = ['header','pts','chan']
00045 _slot_types = ['Header','test_roscpp_serialization_perf/Point32[]','test_roscpp_serialization_perf/ChannelFloat32[]']
00046
00047 def __init__(self, *args, **kwds):
00048 """
00049 Constructor. Any message fields that are implicitly/explicitly
00050 set to None will be assigned a default value. The recommend
00051 use is keyword arguments as this is more robust to future message
00052 changes. You cannot mix in-order arguments and keyword arguments.
00053
00054 The available fields are:
00055 header,pts,chan
00056
00057 @param args: complete set of field values, in .msg order
00058 @param kwds: use keyword arguments corresponding to message field names
00059 to set specific fields.
00060 """
00061 if args or kwds:
00062 super(PointCloud, self).__init__(*args, **kwds)
00063
00064 if self.header is None:
00065 self.header = std_msgs.msg._Header.Header()
00066 if self.pts is None:
00067 self.pts = []
00068 if self.chan is None:
00069 self.chan = []
00070 else:
00071 self.header = std_msgs.msg._Header.Header()
00072 self.pts = []
00073 self.chan = []
00074
00075 def _get_types(self):
00076 """
00077 internal API method
00078 """
00079 return self._slot_types
00080
00081 def serialize(self, buff):
00082 """
00083 serialize message into buffer
00084 @param buff: buffer
00085 @type buff: StringIO
00086 """
00087 try:
00088 _x = self
00089 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00090 _x = self.header.frame_id
00091 length = len(_x)
00092 buff.write(struct.pack('<I%ss'%length, length, _x))
00093 length = len(self.pts)
00094 buff.write(_struct_I.pack(length))
00095 for val1 in self.pts:
00096 _x = val1
00097 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00098 length = len(self.chan)
00099 buff.write(_struct_I.pack(length))
00100 for val1 in self.chan:
00101 _x = val1.name
00102 length = len(_x)
00103 buff.write(struct.pack('<I%ss'%length, length, _x))
00104 length = len(val1.vals)
00105 buff.write(_struct_I.pack(length))
00106 pattern = '<%sf'%length
00107 buff.write(struct.pack(pattern, *val1.vals))
00108 except struct.error, se: self._check_types(se)
00109 except TypeError, te: self._check_types(te)
00110
00111 def deserialize(self, str):
00112 """
00113 unpack serialized message in str into this message instance
00114 @param str: byte array of serialized message
00115 @type str: str
00116 """
00117 try:
00118 if self.header is None:
00119 self.header = std_msgs.msg._Header.Header()
00120 end = 0
00121 _x = self
00122 start = end
00123 end += 12
00124 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00125 start = end
00126 end += 4
00127 (length,) = _struct_I.unpack(str[start:end])
00128 start = end
00129 end += length
00130 self.header.frame_id = str[start:end]
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 self.pts = []
00135 for i in xrange(0, length):
00136 val1 = test_roscpp_serialization_perf.msg.Point32()
00137 _x = val1
00138 start = end
00139 end += 12
00140 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00141 self.pts.append(val1)
00142 start = end
00143 end += 4
00144 (length,) = _struct_I.unpack(str[start:end])
00145 self.chan = []
00146 for i in xrange(0, length):
00147 val1 = test_roscpp_serialization_perf.msg.ChannelFloat32()
00148 start = end
00149 end += 4
00150 (length,) = _struct_I.unpack(str[start:end])
00151 start = end
00152 end += length
00153 val1.name = str[start:end]
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 pattern = '<%sf'%length
00158 start = end
00159 end += struct.calcsize(pattern)
00160 val1.vals = struct.unpack(pattern, str[start:end])
00161 self.chan.append(val1)
00162 return self
00163 except struct.error, e:
00164 raise roslib.message.DeserializationError(e)
00165
00166
00167 def serialize_numpy(self, buff, numpy):
00168 """
00169 serialize message with numpy array types into buffer
00170 @param buff: buffer
00171 @type buff: StringIO
00172 @param numpy: numpy python module
00173 @type numpy module
00174 """
00175 try:
00176 _x = self
00177 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00178 _x = self.header.frame_id
00179 length = len(_x)
00180 buff.write(struct.pack('<I%ss'%length, length, _x))
00181 length = len(self.pts)
00182 buff.write(_struct_I.pack(length))
00183 for val1 in self.pts:
00184 _x = val1
00185 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00186 length = len(self.chan)
00187 buff.write(_struct_I.pack(length))
00188 for val1 in self.chan:
00189 _x = val1.name
00190 length = len(_x)
00191 buff.write(struct.pack('<I%ss'%length, length, _x))
00192 length = len(val1.vals)
00193 buff.write(_struct_I.pack(length))
00194 pattern = '<%sf'%length
00195 buff.write(val1.vals.tostring())
00196 except struct.error, se: self._check_types(se)
00197 except TypeError, te: self._check_types(te)
00198
00199 def deserialize_numpy(self, str, numpy):
00200 """
00201 unpack serialized message in str into this message instance using numpy for array types
00202 @param str: byte array of serialized message
00203 @type str: str
00204 @param numpy: numpy python module
00205 @type numpy: module
00206 """
00207 try:
00208 if self.header is None:
00209 self.header = std_msgs.msg._Header.Header()
00210 end = 0
00211 _x = self
00212 start = end
00213 end += 12
00214 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00215 start = end
00216 end += 4
00217 (length,) = _struct_I.unpack(str[start:end])
00218 start = end
00219 end += length
00220 self.header.frame_id = str[start:end]
00221 start = end
00222 end += 4
00223 (length,) = _struct_I.unpack(str[start:end])
00224 self.pts = []
00225 for i in xrange(0, length):
00226 val1 = test_roscpp_serialization_perf.msg.Point32()
00227 _x = val1
00228 start = end
00229 end += 12
00230 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00231 self.pts.append(val1)
00232 start = end
00233 end += 4
00234 (length,) = _struct_I.unpack(str[start:end])
00235 self.chan = []
00236 for i in xrange(0, length):
00237 val1 = test_roscpp_serialization_perf.msg.ChannelFloat32()
00238 start = end
00239 end += 4
00240 (length,) = _struct_I.unpack(str[start:end])
00241 start = end
00242 end += length
00243 val1.name = str[start:end]
00244 start = end
00245 end += 4
00246 (length,) = _struct_I.unpack(str[start:end])
00247 pattern = '<%sf'%length
00248 start = end
00249 end += struct.calcsize(pattern)
00250 val1.vals = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00251 self.chan.append(val1)
00252 return self
00253 except struct.error, e:
00254 raise roslib.message.DeserializationError(e)
00255
00256 _struct_I = roslib.message.struct_I
00257 _struct_3I = struct.Struct("<3I")
00258 _struct_3f = struct.Struct("<3f")