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