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