00001 """autogenerated by genpy from pr2_collision_monitor/JointErrorData.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class JointErrorData(genpy.Message):
00009 _md5sum = "fb0d47f57f198e4326fc72125346f291"
00010 _type = "pr2_collision_monitor/JointErrorData"
00011 _has_header = False
00012 _full_text = """string behavior
00013 string arm
00014 float32[] min_errors
00015 float32[] max_errors
00016
00017 """
00018 __slots__ = ['behavior','arm','min_errors','max_errors']
00019 _slot_types = ['string','string','float32[]','float32[]']
00020
00021 def __init__(self, *args, **kwds):
00022 """
00023 Constructor. Any message fields that are implicitly/explicitly
00024 set to None will be assigned a default value. The recommend
00025 use is keyword arguments as this is more robust to future message
00026 changes. You cannot mix in-order arguments and keyword arguments.
00027
00028 The available fields are:
00029 behavior,arm,min_errors,max_errors
00030
00031 :param args: complete set of field values, in .msg order
00032 :param kwds: use keyword arguments corresponding to message field names
00033 to set specific fields.
00034 """
00035 if args or kwds:
00036 super(JointErrorData, self).__init__(*args, **kwds)
00037
00038 if self.behavior is None:
00039 self.behavior = ''
00040 if self.arm is None:
00041 self.arm = ''
00042 if self.min_errors is None:
00043 self.min_errors = []
00044 if self.max_errors is None:
00045 self.max_errors = []
00046 else:
00047 self.behavior = ''
00048 self.arm = ''
00049 self.min_errors = []
00050 self.max_errors = []
00051
00052 def _get_types(self):
00053 """
00054 internal API method
00055 """
00056 return self._slot_types
00057
00058 def serialize(self, buff):
00059 """
00060 serialize message into buffer
00061 :param buff: buffer, ``StringIO``
00062 """
00063 try:
00064 _x = self.behavior
00065 length = len(_x)
00066 if python3 or type(_x) == unicode:
00067 _x = _x.encode('utf-8')
00068 length = len(_x)
00069 buff.write(struct.pack('<I%ss'%length, length, _x))
00070 _x = self.arm
00071 length = len(_x)
00072 if python3 or type(_x) == unicode:
00073 _x = _x.encode('utf-8')
00074 length = len(_x)
00075 buff.write(struct.pack('<I%ss'%length, length, _x))
00076 length = len(self.min_errors)
00077 buff.write(_struct_I.pack(length))
00078 pattern = '<%sf'%length
00079 buff.write(struct.pack(pattern, *self.min_errors))
00080 length = len(self.max_errors)
00081 buff.write(_struct_I.pack(length))
00082 pattern = '<%sf'%length
00083 buff.write(struct.pack(pattern, *self.max_errors))
00084 except struct.error as se: self._check_types(se)
00085 except TypeError as te: self._check_types(te)
00086
00087 def deserialize(self, str):
00088 """
00089 unpack serialized message in str into this message instance
00090 :param str: byte array of serialized message, ``str``
00091 """
00092 try:
00093 end = 0
00094 start = end
00095 end += 4
00096 (length,) = _struct_I.unpack(str[start:end])
00097 start = end
00098 end += length
00099 if python3:
00100 self.behavior = str[start:end].decode('utf-8')
00101 else:
00102 self.behavior = str[start:end]
00103 start = end
00104 end += 4
00105 (length,) = _struct_I.unpack(str[start:end])
00106 start = end
00107 end += length
00108 if python3:
00109 self.arm = str[start:end].decode('utf-8')
00110 else:
00111 self.arm = str[start:end]
00112 start = end
00113 end += 4
00114 (length,) = _struct_I.unpack(str[start:end])
00115 pattern = '<%sf'%length
00116 start = end
00117 end += struct.calcsize(pattern)
00118 self.min_errors = struct.unpack(pattern, str[start:end])
00119 start = end
00120 end += 4
00121 (length,) = _struct_I.unpack(str[start:end])
00122 pattern = '<%sf'%length
00123 start = end
00124 end += struct.calcsize(pattern)
00125 self.max_errors = struct.unpack(pattern, str[start:end])
00126 return self
00127 except struct.error as e:
00128 raise genpy.DeserializationError(e)
00129
00130
00131 def serialize_numpy(self, buff, numpy):
00132 """
00133 serialize message with numpy array types into buffer
00134 :param buff: buffer, ``StringIO``
00135 :param numpy: numpy python module
00136 """
00137 try:
00138 _x = self.behavior
00139 length = len(_x)
00140 if python3 or type(_x) == unicode:
00141 _x = _x.encode('utf-8')
00142 length = len(_x)
00143 buff.write(struct.pack('<I%ss'%length, length, _x))
00144 _x = self.arm
00145 length = len(_x)
00146 if python3 or type(_x) == unicode:
00147 _x = _x.encode('utf-8')
00148 length = len(_x)
00149 buff.write(struct.pack('<I%ss'%length, length, _x))
00150 length = len(self.min_errors)
00151 buff.write(_struct_I.pack(length))
00152 pattern = '<%sf'%length
00153 buff.write(self.min_errors.tostring())
00154 length = len(self.max_errors)
00155 buff.write(_struct_I.pack(length))
00156 pattern = '<%sf'%length
00157 buff.write(self.max_errors.tostring())
00158 except struct.error as se: self._check_types(se)
00159 except TypeError as te: self._check_types(te)
00160
00161 def deserialize_numpy(self, str, numpy):
00162 """
00163 unpack serialized message in str into this message instance using numpy for array types
00164 :param str: byte array of serialized message, ``str``
00165 :param numpy: numpy python module
00166 """
00167 try:
00168 end = 0
00169 start = end
00170 end += 4
00171 (length,) = _struct_I.unpack(str[start:end])
00172 start = end
00173 end += length
00174 if python3:
00175 self.behavior = str[start:end].decode('utf-8')
00176 else:
00177 self.behavior = str[start:end]
00178 start = end
00179 end += 4
00180 (length,) = _struct_I.unpack(str[start:end])
00181 start = end
00182 end += length
00183 if python3:
00184 self.arm = str[start:end].decode('utf-8')
00185 else:
00186 self.arm = str[start:end]
00187 start = end
00188 end += 4
00189 (length,) = _struct_I.unpack(str[start:end])
00190 pattern = '<%sf'%length
00191 start = end
00192 end += struct.calcsize(pattern)
00193 self.min_errors = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00194 start = end
00195 end += 4
00196 (length,) = _struct_I.unpack(str[start:end])
00197 pattern = '<%sf'%length
00198 start = end
00199 end += struct.calcsize(pattern)
00200 self.max_errors = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00201 return self
00202 except struct.error as e:
00203 raise genpy.DeserializationError(e)
00204
00205 _struct_I = genpy.struct_I