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