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