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


pr2_msgs
Author(s): Eric Berger and many others
autogenerated on Mon Jan 6 2014 11:34:07