_ShadowPST.py
Go to the documentation of this file.
00001 """autogenerated by genpy from sr_robot_msgs/ShadowPST.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 ShadowPST(genpy.Message):
00010   _md5sum = "ab86b3368a7316c12291b90583e1910e"
00011   _type = "sr_robot_msgs/ShadowPST"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 int16[] pressure
00015 int16[] temperature
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','pressure','temperature']
00037   _slot_types = ['std_msgs/Header','int16[]','int16[]']
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,pressure,temperature
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(ShadowPST, 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.pressure is None:
00059         self.pressure = []
00060       if self.temperature is None:
00061         self.temperature = []
00062     else:
00063       self.header = std_msgs.msg.Header()
00064       self.pressure = []
00065       self.temperature = []
00066 
00067   def _get_types(self):
00068     """
00069     internal API method
00070     """
00071     return self._slot_types
00072 
00073   def serialize(self, buff):
00074     """
00075     serialize message into buffer
00076     :param buff: buffer, ``StringIO``
00077     """
00078     try:
00079       _x = self
00080       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00081       _x = self.header.frame_id
00082       length = len(_x)
00083       if python3 or type(_x) == unicode:
00084         _x = _x.encode('utf-8')
00085         length = len(_x)
00086       buff.write(struct.pack('<I%ss'%length, length, _x))
00087       length = len(self.pressure)
00088       buff.write(_struct_I.pack(length))
00089       pattern = '<%sh'%length
00090       buff.write(struct.pack(pattern, *self.pressure))
00091       length = len(self.temperature)
00092       buff.write(_struct_I.pack(length))
00093       pattern = '<%sh'%length
00094       buff.write(struct.pack(pattern, *self.temperature))
00095     except struct.error as se: self._check_types(se)
00096     except TypeError as te: self._check_types(te)
00097 
00098   def deserialize(self, str):
00099     """
00100     unpack serialized message in str into this message instance
00101     :param str: byte array of serialized message, ``str``
00102     """
00103     try:
00104       if self.header is None:
00105         self.header = std_msgs.msg.Header()
00106       end = 0
00107       _x = self
00108       start = end
00109       end += 12
00110       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00111       start = end
00112       end += 4
00113       (length,) = _struct_I.unpack(str[start:end])
00114       start = end
00115       end += length
00116       if python3:
00117         self.header.frame_id = str[start:end].decode('utf-8')
00118       else:
00119         self.header.frame_id = str[start:end]
00120       start = end
00121       end += 4
00122       (length,) = _struct_I.unpack(str[start:end])
00123       pattern = '<%sh'%length
00124       start = end
00125       end += struct.calcsize(pattern)
00126       self.pressure = struct.unpack(pattern, str[start:end])
00127       start = end
00128       end += 4
00129       (length,) = _struct_I.unpack(str[start:end])
00130       pattern = '<%sh'%length
00131       start = end
00132       end += struct.calcsize(pattern)
00133       self.temperature = struct.unpack(pattern, str[start:end])
00134       return self
00135     except struct.error as e:
00136       raise genpy.DeserializationError(e) #most likely buffer underfill
00137 
00138 
00139   def serialize_numpy(self, buff, numpy):
00140     """
00141     serialize message with numpy array types into buffer
00142     :param buff: buffer, ``StringIO``
00143     :param numpy: numpy python module
00144     """
00145     try:
00146       _x = self
00147       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00148       _x = self.header.frame_id
00149       length = len(_x)
00150       if python3 or type(_x) == unicode:
00151         _x = _x.encode('utf-8')
00152         length = len(_x)
00153       buff.write(struct.pack('<I%ss'%length, length, _x))
00154       length = len(self.pressure)
00155       buff.write(_struct_I.pack(length))
00156       pattern = '<%sh'%length
00157       buff.write(self.pressure.tostring())
00158       length = len(self.temperature)
00159       buff.write(_struct_I.pack(length))
00160       pattern = '<%sh'%length
00161       buff.write(self.temperature.tostring())
00162     except struct.error as se: self._check_types(se)
00163     except TypeError as te: self._check_types(te)
00164 
00165   def deserialize_numpy(self, str, numpy):
00166     """
00167     unpack serialized message in str into this message instance using numpy for array types
00168     :param str: byte array of serialized message, ``str``
00169     :param numpy: numpy python module
00170     """
00171     try:
00172       if self.header is None:
00173         self.header = std_msgs.msg.Header()
00174       end = 0
00175       _x = self
00176       start = end
00177       end += 12
00178       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00179       start = end
00180       end += 4
00181       (length,) = _struct_I.unpack(str[start:end])
00182       start = end
00183       end += length
00184       if python3:
00185         self.header.frame_id = str[start:end].decode('utf-8')
00186       else:
00187         self.header.frame_id = str[start:end]
00188       start = end
00189       end += 4
00190       (length,) = _struct_I.unpack(str[start:end])
00191       pattern = '<%sh'%length
00192       start = end
00193       end += struct.calcsize(pattern)
00194       self.pressure = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length)
00195       start = end
00196       end += 4
00197       (length,) = _struct_I.unpack(str[start:end])
00198       pattern = '<%sh'%length
00199       start = end
00200       end += struct.calcsize(pattern)
00201       self.temperature = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length)
00202       return self
00203     except struct.error as e:
00204       raise genpy.DeserializationError(e) #most likely buffer underfill
00205 
00206 _struct_I = genpy.struct_I
00207 _struct_3I = struct.Struct("<3I")


sr_robot_msgs
Author(s): Ugo Cupcic/ugo@shadowrobot.com
autogenerated on Fri Jan 3 2014 12:01:40