00001 """autogenerated by genpy from fingertip_pressure/PressureInfo.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 geometry_msgs.msg
00008 import fingertip_pressure.msg
00009
00010 class PressureInfo(genpy.Message):
00011 _md5sum = "a11fc5bae3534aa023741e378743af5b"
00012 _type = "fingertip_pressure/PressureInfo"
00013 _has_header = False
00014 _full_text = """PressureInfoElement[] sensor # List of pressure sensors for which information is being published
00015
00016 ================================================================================
00017 MSG: fingertip_pressure/PressureInfoElement
00018 string frame_id # Frame ID
00019 geometry_msgs/Vector3[] center # Corner of sensor (meters)
00020 geometry_msgs/Vector3[] halfside1 # Half of one edge of sensor (meters)
00021 geometry_msgs/Vector3[] halfside2 # Half of perpendicular edge of sensor (meters)
00022 # Sensor corners are at center+-halfside1+-halfside2
00023 # Cross product of halfside1 and halfside2 points out
00024 float64[] force_per_unit # Multiply this by the raw sensor value to get a force
00025
00026 ================================================================================
00027 MSG: geometry_msgs/Vector3
00028 # This represents a vector in free space.
00029
00030 float64 x
00031 float64 y
00032 float64 z
00033 """
00034 __slots__ = ['sensor']
00035 _slot_types = ['fingertip_pressure/PressureInfoElement[]']
00036
00037 def __init__(self, *args, **kwds):
00038 """
00039 Constructor. Any message fields that are implicitly/explicitly
00040 set to None will be assigned a default value. The recommend
00041 use is keyword arguments as this is more robust to future message
00042 changes. You cannot mix in-order arguments and keyword arguments.
00043
00044 The available fields are:
00045 sensor
00046
00047 :param args: complete set of field values, in .msg order
00048 :param kwds: use keyword arguments corresponding to message field names
00049 to set specific fields.
00050 """
00051 if args or kwds:
00052 super(PressureInfo, self).__init__(*args, **kwds)
00053
00054 if self.sensor is None:
00055 self.sensor = []
00056 else:
00057 self.sensor = []
00058
00059 def _get_types(self):
00060 """
00061 internal API method
00062 """
00063 return self._slot_types
00064
00065 def serialize(self, buff):
00066 """
00067 serialize message into buffer
00068 :param buff: buffer, ``StringIO``
00069 """
00070 try:
00071 length = len(self.sensor)
00072 buff.write(_struct_I.pack(length))
00073 for val1 in self.sensor:
00074 _x = val1.frame_id
00075 length = len(_x)
00076 if python3 or type(_x) == unicode:
00077 _x = _x.encode('utf-8')
00078 length = len(_x)
00079 buff.write(struct.pack('<I%ss'%length, length, _x))
00080 length = len(val1.center)
00081 buff.write(_struct_I.pack(length))
00082 for val2 in val1.center:
00083 _x = val2
00084 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00085 length = len(val1.halfside1)
00086 buff.write(_struct_I.pack(length))
00087 for val2 in val1.halfside1:
00088 _x = val2
00089 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00090 length = len(val1.halfside2)
00091 buff.write(_struct_I.pack(length))
00092 for val2 in val1.halfside2:
00093 _x = val2
00094 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00095 length = len(val1.force_per_unit)
00096 buff.write(_struct_I.pack(length))
00097 pattern = '<%sd'%length
00098 buff.write(struct.pack(pattern, *val1.force_per_unit))
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.sensor is None:
00109 self.sensor = None
00110 end = 0
00111 start = end
00112 end += 4
00113 (length,) = _struct_I.unpack(str[start:end])
00114 self.sensor = []
00115 for i in range(0, length):
00116 val1 = fingertip_pressure.msg.PressureInfoElement()
00117 start = end
00118 end += 4
00119 (length,) = _struct_I.unpack(str[start:end])
00120 start = end
00121 end += length
00122 if python3:
00123 val1.frame_id = str[start:end].decode('utf-8')
00124 else:
00125 val1.frame_id = str[start:end]
00126 start = end
00127 end += 4
00128 (length,) = _struct_I.unpack(str[start:end])
00129 val1.center = []
00130 for i in range(0, length):
00131 val2 = geometry_msgs.msg.Vector3()
00132 _x = val2
00133 start = end
00134 end += 24
00135 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00136 val1.center.append(val2)
00137 start = end
00138 end += 4
00139 (length,) = _struct_I.unpack(str[start:end])
00140 val1.halfside1 = []
00141 for i in range(0, length):
00142 val2 = geometry_msgs.msg.Vector3()
00143 _x = val2
00144 start = end
00145 end += 24
00146 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00147 val1.halfside1.append(val2)
00148 start = end
00149 end += 4
00150 (length,) = _struct_I.unpack(str[start:end])
00151 val1.halfside2 = []
00152 for i in range(0, length):
00153 val2 = geometry_msgs.msg.Vector3()
00154 _x = val2
00155 start = end
00156 end += 24
00157 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00158 val1.halfside2.append(val2)
00159 start = end
00160 end += 4
00161 (length,) = _struct_I.unpack(str[start:end])
00162 pattern = '<%sd'%length
00163 start = end
00164 end += struct.calcsize(pattern)
00165 val1.force_per_unit = struct.unpack(pattern, str[start:end])
00166 self.sensor.append(val1)
00167 return self
00168 except struct.error as e:
00169 raise genpy.DeserializationError(e)
00170
00171
00172 def serialize_numpy(self, buff, numpy):
00173 """
00174 serialize message with numpy array types into buffer
00175 :param buff: buffer, ``StringIO``
00176 :param numpy: numpy python module
00177 """
00178 try:
00179 length = len(self.sensor)
00180 buff.write(_struct_I.pack(length))
00181 for val1 in self.sensor:
00182 _x = val1.frame_id
00183 length = len(_x)
00184 if python3 or type(_x) == unicode:
00185 _x = _x.encode('utf-8')
00186 length = len(_x)
00187 buff.write(struct.pack('<I%ss'%length, length, _x))
00188 length = len(val1.center)
00189 buff.write(_struct_I.pack(length))
00190 for val2 in val1.center:
00191 _x = val2
00192 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00193 length = len(val1.halfside1)
00194 buff.write(_struct_I.pack(length))
00195 for val2 in val1.halfside1:
00196 _x = val2
00197 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00198 length = len(val1.halfside2)
00199 buff.write(_struct_I.pack(length))
00200 for val2 in val1.halfside2:
00201 _x = val2
00202 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00203 length = len(val1.force_per_unit)
00204 buff.write(_struct_I.pack(length))
00205 pattern = '<%sd'%length
00206 buff.write(val1.force_per_unit.tostring())
00207 except struct.error as se: self._check_types(se)
00208 except TypeError as te: self._check_types(te)
00209
00210 def deserialize_numpy(self, str, numpy):
00211 """
00212 unpack serialized message in str into this message instance using numpy for array types
00213 :param str: byte array of serialized message, ``str``
00214 :param numpy: numpy python module
00215 """
00216 try:
00217 if self.sensor is None:
00218 self.sensor = None
00219 end = 0
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 self.sensor = []
00224 for i in range(0, length):
00225 val1 = fingertip_pressure.msg.PressureInfoElement()
00226 start = end
00227 end += 4
00228 (length,) = _struct_I.unpack(str[start:end])
00229 start = end
00230 end += length
00231 if python3:
00232 val1.frame_id = str[start:end].decode('utf-8')
00233 else:
00234 val1.frame_id = str[start:end]
00235 start = end
00236 end += 4
00237 (length,) = _struct_I.unpack(str[start:end])
00238 val1.center = []
00239 for i in range(0, length):
00240 val2 = geometry_msgs.msg.Vector3()
00241 _x = val2
00242 start = end
00243 end += 24
00244 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00245 val1.center.append(val2)
00246 start = end
00247 end += 4
00248 (length,) = _struct_I.unpack(str[start:end])
00249 val1.halfside1 = []
00250 for i in range(0, length):
00251 val2 = geometry_msgs.msg.Vector3()
00252 _x = val2
00253 start = end
00254 end += 24
00255 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00256 val1.halfside1.append(val2)
00257 start = end
00258 end += 4
00259 (length,) = _struct_I.unpack(str[start:end])
00260 val1.halfside2 = []
00261 for i in range(0, length):
00262 val2 = geometry_msgs.msg.Vector3()
00263 _x = val2
00264 start = end
00265 end += 24
00266 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00267 val1.halfside2.append(val2)
00268 start = end
00269 end += 4
00270 (length,) = _struct_I.unpack(str[start:end])
00271 pattern = '<%sd'%length
00272 start = end
00273 end += struct.calcsize(pattern)
00274 val1.force_per_unit = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00275 self.sensor.append(val1)
00276 return self
00277 except struct.error as e:
00278 raise genpy.DeserializationError(e)
00279
00280 _struct_I = genpy.struct_I
00281 _struct_3d = struct.Struct("<3d")