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