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