00001 """autogenerated by genpy from quad_esc/Esc.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 Esc(genpy.Message):
00010 _md5sum = "9cb57d6c910468ba1ac95507a07f971f"
00011 _type = "quad_esc/Esc"
00012 _has_header = True
00013 _full_text = """Header header
00014 int32 Front_rpm
00015 int32 Front_pwm
00016 int32 Back_rpm
00017 int32 Back_pwm
00018 int32 Left_rpm
00019 int32 Left_pwm
00020 int32 Right_rpm
00021 int32 Right_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','Front_rpm','Front_pwm','Back_rpm','Back_pwm','Left_rpm','Left_pwm','Right_rpm','Right_pwm']
00043 _slot_types = ['std_msgs/Header','int32','int32','int32','int32','int32','int32','int32','int32']
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,Front_rpm,Front_pwm,Back_rpm,Back_pwm,Left_rpm,Left_pwm,Right_rpm,Right_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(Esc, self).__init__(*args, **kwds)
00061
00062 if self.header is None:
00063 self.header = std_msgs.msg.Header()
00064 if self.Front_rpm is None:
00065 self.Front_rpm = 0
00066 if self.Front_pwm is None:
00067 self.Front_pwm = 0
00068 if self.Back_rpm is None:
00069 self.Back_rpm = 0
00070 if self.Back_pwm is None:
00071 self.Back_pwm = 0
00072 if self.Left_rpm is None:
00073 self.Left_rpm = 0
00074 if self.Left_pwm is None:
00075 self.Left_pwm = 0
00076 if self.Right_rpm is None:
00077 self.Right_rpm = 0
00078 if self.Right_pwm is None:
00079 self.Right_pwm = 0
00080 else:
00081 self.header = std_msgs.msg.Header()
00082 self.Front_rpm = 0
00083 self.Front_pwm = 0
00084 self.Back_rpm = 0
00085 self.Back_pwm = 0
00086 self.Left_rpm = 0
00087 self.Left_pwm = 0
00088 self.Right_rpm = 0
00089 self.Right_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_8i.pack(_x.Front_rpm, _x.Front_pwm, _x.Back_rpm, _x.Back_pwm, _x.Left_rpm, _x.Left_pwm, _x.Right_rpm, _x.Right_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 += 32
00141 (_x.Front_rpm, _x.Front_pwm, _x.Back_rpm, _x.Back_pwm, _x.Left_rpm, _x.Left_pwm, _x.Right_rpm, _x.Right_pwm,) = _struct_8i.unpack(str[start:end])
00142 return self
00143 except struct.error as e:
00144 raise genpy.DeserializationError(e)
00145
00146
00147 def serialize_numpy(self, buff, numpy):
00148 """
00149 serialize message with numpy array types into buffer
00150 :param buff: buffer, ``StringIO``
00151 :param numpy: numpy python module
00152 """
00153 try:
00154 _x = self
00155 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00156 _x = self.header.frame_id
00157 length = len(_x)
00158 if python3 or type(_x) == unicode:
00159 _x = _x.encode('utf-8')
00160 length = len(_x)
00161 buff.write(struct.pack('<I%ss'%length, length, _x))
00162 _x = self
00163 buff.write(_struct_8i.pack(_x.Front_rpm, _x.Front_pwm, _x.Back_rpm, _x.Back_pwm, _x.Left_rpm, _x.Left_pwm, _x.Right_rpm, _x.Right_pwm))
00164 except struct.error as se: self._check_types(se)
00165 except TypeError as te: self._check_types(te)
00166
00167 def deserialize_numpy(self, str, numpy):
00168 """
00169 unpack serialized message in str into this message instance using numpy for array types
00170 :param str: byte array of serialized message, ``str``
00171 :param numpy: numpy python module
00172 """
00173 try:
00174 if self.header is None:
00175 self.header = std_msgs.msg.Header()
00176 end = 0
00177 _x = self
00178 start = end
00179 end += 12
00180 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00181 start = end
00182 end += 4
00183 (length,) = _struct_I.unpack(str[start:end])
00184 start = end
00185 end += length
00186 if python3:
00187 self.header.frame_id = str[start:end].decode('utf-8')
00188 else:
00189 self.header.frame_id = str[start:end]
00190 _x = self
00191 start = end
00192 end += 32
00193 (_x.Front_rpm, _x.Front_pwm, _x.Back_rpm, _x.Back_pwm, _x.Left_rpm, _x.Left_pwm, _x.Right_rpm, _x.Right_pwm,) = _struct_8i.unpack(str[start:end])
00194 return self
00195 except struct.error as e:
00196 raise genpy.DeserializationError(e)
00197
00198 _struct_I = genpy.struct_I
00199 _struct_3I = struct.Struct("<3I")
00200 _struct_8i = struct.Struct("<8i")