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