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