_MotorPWM.py
Go to the documentation of this file.
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 #flag to mark the presence of a Header object
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       #message fields cannot be None, assign default values for those that are
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       # - if encoded as a list instead, serialize as bytes instead of string
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(se)
00091     except TypeError as te: self._check_types(te)
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       if python3:
00121         self.pwm = str[start:end].decode('utf-8')
00122       else:
00123         self.pwm = str[start:end]
00124       return self
00125     except struct.error as e:
00126       raise genpy.DeserializationError(e) #most likely buffer underfill
00127 
00128 
00129   def serialize_numpy(self, buff, numpy):
00130     """
00131     serialize message with numpy array types into buffer
00132     :param buff: buffer, ``StringIO``
00133     :param numpy: numpy python module
00134     """
00135     try:
00136       _x = self
00137       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00138       _x = self.header.frame_id
00139       length = len(_x)
00140       if python3 or type(_x) == unicode:
00141         _x = _x.encode('utf-8')
00142         length = len(_x)
00143       buff.write(struct.pack('<I%ss'%length, length, _x))
00144       _x = self.pwm
00145       length = len(_x)
00146       # - if encoded as a list instead, serialize as bytes instead of string
00147       if type(_x) in [list, tuple]:
00148         buff.write(struct.pack('<I%sB'%length, length, *_x))
00149       else:
00150         buff.write(struct.pack('<I%ss'%length, length, _x))
00151     except struct.error as se: self._check_types(se)
00152     except TypeError as te: self._check_types(te)
00153 
00154   def deserialize_numpy(self, str, numpy):
00155     """
00156     unpack serialized message in str into this message instance using numpy for array types
00157     :param str: byte array of serialized message, ``str``
00158     :param numpy: numpy python module
00159     """
00160     try:
00161       if self.header is None:
00162         self.header = std_msgs.msg.Header()
00163       end = 0
00164       _x = self
00165       start = end
00166       end += 12
00167       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00168       start = end
00169       end += 4
00170       (length,) = _struct_I.unpack(str[start:end])
00171       start = end
00172       end += length
00173       if python3:
00174         self.header.frame_id = str[start:end].decode('utf-8')
00175       else:
00176         self.header.frame_id = str[start:end]
00177       start = end
00178       end += 4
00179       (length,) = _struct_I.unpack(str[start:end])
00180       start = end
00181       end += length
00182       if python3:
00183         self.pwm = str[start:end].decode('utf-8')
00184       else:
00185         self.pwm = str[start:end]
00186       return self
00187     except struct.error as e:
00188       raise genpy.DeserializationError(e) #most likely buffer underfill
00189 
00190 _struct_I = genpy.struct_I
00191 _struct_3I = struct.Struct("<3I")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


hector_uav_msgs
Author(s): Johannes Meyer
autogenerated on Mon Jul 15 2013 16:48:08