_FloatArray.py
Go to the documentation of this file.
00001 """autogenerated by genpy from hrl_msgs/FloatArray.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 std_msgs.msg
00008 
00009 class FloatArray(genpy.Message):
00010   _md5sum = "fb60495edd59d3fcf90e173153ae8a9a"
00011   _type = "hrl_msgs/FloatArray"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 float64[] data
00015 
00016 
00017 ================================================================================
00018 MSG: std_msgs/Header
00019 # Standard metadata for higher-level stamped data types.
00020 # This is generally used to communicate timestamped data 
00021 # in a particular coordinate frame.
00022 # 
00023 # sequence ID: consecutively increasing ID 
00024 uint32 seq
00025 #Two-integer timestamp that is expressed as:
00026 # * stamp.secs: seconds (stamp_secs) since epoch
00027 # * stamp.nsecs: nanoseconds since stamp_secs
00028 # time-handling sugar is provided by the client library
00029 time stamp
00030 #Frame this data is associated with
00031 # 0: no frame
00032 # 1: global frame
00033 string frame_id
00034 
00035 """
00036   __slots__ = ['header','data']
00037   _slot_types = ['std_msgs/Header','float64[]']
00038 
00039   def __init__(self, *args, **kwds):
00040     """
00041     Constructor. Any message fields that are implicitly/explicitly
00042     set to None will be assigned a default value. The recommend
00043     use is keyword arguments as this is more robust to future message
00044     changes.  You cannot mix in-order arguments and keyword arguments.
00045 
00046     The available fields are:
00047        header,data
00048 
00049     :param args: complete set of field values, in .msg order
00050     :param kwds: use keyword arguments corresponding to message field names
00051     to set specific fields.
00052     """
00053     if args or kwds:
00054       super(FloatArray, self).__init__(*args, **kwds)
00055       #message fields cannot be None, assign default values for those that are
00056       if self.header is None:
00057         self.header = std_msgs.msg.Header()
00058       if self.data is None:
00059         self.data = []
00060     else:
00061       self.header = std_msgs.msg.Header()
00062       self.data = []
00063 
00064   def _get_types(self):
00065     """
00066     internal API method
00067     """
00068     return self._slot_types
00069 
00070   def serialize(self, buff):
00071     """
00072     serialize message into buffer
00073     :param buff: buffer, ``StringIO``
00074     """
00075     try:
00076       _x = self
00077       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00078       _x = self.header.frame_id
00079       length = len(_x)
00080       if python3 or type(_x) == unicode:
00081         _x = _x.encode('utf-8')
00082         length = len(_x)
00083       buff.write(struct.pack('<I%ss'%length, length, _x))
00084       length = len(self.data)
00085       buff.write(_struct_I.pack(length))
00086       pattern = '<%sd'%length
00087       buff.write(struct.pack(pattern, *self.data))
00088     except struct.error as se: self._check_types(se)
00089     except TypeError as te: self._check_types(te)
00090 
00091   def deserialize(self, str):
00092     """
00093     unpack serialized message in str into this message instance
00094     :param str: byte array of serialized message, ``str``
00095     """
00096     try:
00097       if self.header is None:
00098         self.header = std_msgs.msg.Header()
00099       end = 0
00100       _x = self
00101       start = end
00102       end += 12
00103       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00104       start = end
00105       end += 4
00106       (length,) = _struct_I.unpack(str[start:end])
00107       start = end
00108       end += length
00109       if python3:
00110         self.header.frame_id = str[start:end].decode('utf-8')
00111       else:
00112         self.header.frame_id = str[start:end]
00113       start = end
00114       end += 4
00115       (length,) = _struct_I.unpack(str[start:end])
00116       pattern = '<%sd'%length
00117       start = end
00118       end += struct.calcsize(pattern)
00119       self.data = struct.unpack(pattern, str[start:end])
00120       return self
00121     except struct.error as e:
00122       raise genpy.DeserializationError(e) #most likely buffer underfill
00123 
00124 
00125   def serialize_numpy(self, buff, numpy):
00126     """
00127     serialize message with numpy array types into buffer
00128     :param buff: buffer, ``StringIO``
00129     :param numpy: numpy python module
00130     """
00131     try:
00132       _x = self
00133       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00134       _x = self.header.frame_id
00135       length = len(_x)
00136       if python3 or type(_x) == unicode:
00137         _x = _x.encode('utf-8')
00138         length = len(_x)
00139       buff.write(struct.pack('<I%ss'%length, length, _x))
00140       length = len(self.data)
00141       buff.write(_struct_I.pack(length))
00142       pattern = '<%sd'%length
00143       buff.write(self.data.tostring())
00144     except struct.error as se: self._check_types(se)
00145     except TypeError as te: self._check_types(te)
00146 
00147   def deserialize_numpy(self, str, numpy):
00148     """
00149     unpack serialized message in str into this message instance using numpy for array types
00150     :param str: byte array of serialized message, ``str``
00151     :param numpy: numpy python module
00152     """
00153     try:
00154       if self.header is None:
00155         self.header = std_msgs.msg.Header()
00156       end = 0
00157       _x = self
00158       start = end
00159       end += 12
00160       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00161       start = end
00162       end += 4
00163       (length,) = _struct_I.unpack(str[start:end])
00164       start = end
00165       end += length
00166       if python3:
00167         self.header.frame_id = str[start:end].decode('utf-8')
00168       else:
00169         self.header.frame_id = str[start:end]
00170       start = end
00171       end += 4
00172       (length,) = _struct_I.unpack(str[start:end])
00173       pattern = '<%sd'%length
00174       start = end
00175       end += struct.calcsize(pattern)
00176       self.data = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00177       return self
00178     except struct.error as e:
00179       raise genpy.DeserializationError(e) #most likely buffer underfill
00180 
00181 _struct_I = genpy.struct_I
00182 _struct_3I = struct.Struct("<3I")


hrl_msgs
Author(s): Advait Jain
autogenerated on Wed Nov 27 2013 11:33:25