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