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