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