$search
00001 """autogenerated by genmsg_py from PowerStatus.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import clearpath_base.msg 00006 import std_msgs.msg 00007 00008 class PowerStatus(roslib.message.Message): 00009 _md5sum = "f246c359530c58415aee4fe89d1aca04" 00010 _type = "clearpath_base/PowerStatus" 00011 _has_header = True #flag to mark the presence of a Header object 00012 _full_text = """Header header 00013 PowerSource[] sources 00014 00015 ================================================================================ 00016 MSG: std_msgs/Header 00017 # Standard metadata for higher-level stamped data types. 00018 # This is generally used to communicate timestamped data 00019 # in a particular coordinate frame. 00020 # 00021 # sequence ID: consecutively increasing ID 00022 uint32 seq 00023 #Two-integer timestamp that is expressed as: 00024 # * stamp.secs: seconds (stamp_secs) since epoch 00025 # * stamp.nsecs: nanoseconds since stamp_secs 00026 # time-handling sugar is provided by the client library 00027 time stamp 00028 #Frame this data is associated with 00029 # 0: no frame 00030 # 1: global frame 00031 string frame_id 00032 00033 ================================================================================ 00034 MSG: clearpath_base/PowerSource 00035 float32 charge 00036 int16 capacity 00037 bool present 00038 bool in_use 00039 uint8 description 00040 00041 """ 00042 __slots__ = ['header','sources'] 00043 _slot_types = ['Header','clearpath_base/PowerSource[]'] 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,sources 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(PowerStatus, self).__init__(*args, **kwds) 00061 #message fields cannot be None, assign default values for those that are 00062 if self.header is None: 00063 self.header = std_msgs.msg._Header.Header() 00064 if self.sources is None: 00065 self.sources = [] 00066 else: 00067 self.header = std_msgs.msg._Header.Header() 00068 self.sources = [] 00069 00070 def _get_types(self): 00071 """ 00072 internal API method 00073 """ 00074 return self._slot_types 00075 00076 def serialize(self, buff): 00077 """ 00078 serialize message into buffer 00079 @param buff: buffer 00080 @type buff: StringIO 00081 """ 00082 try: 00083 _x = self 00084 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00085 _x = self.header.frame_id 00086 length = len(_x) 00087 buff.write(struct.pack('<I%ss'%length, length, _x)) 00088 length = len(self.sources) 00089 buff.write(_struct_I.pack(length)) 00090 for val1 in self.sources: 00091 _x = val1 00092 buff.write(_struct_fh3B.pack(_x.charge, _x.capacity, _x.present, _x.in_use, _x.description)) 00093 except struct.error as se: self._check_types(se) 00094 except TypeError as te: self._check_types(te) 00095 00096 def deserialize(self, str): 00097 """ 00098 unpack serialized message in str into this message instance 00099 @param str: byte array of serialized message 00100 @type str: str 00101 """ 00102 try: 00103 if self.header is None: 00104 self.header = std_msgs.msg._Header.Header() 00105 end = 0 00106 _x = self 00107 start = end 00108 end += 12 00109 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00110 start = end 00111 end += 4 00112 (length,) = _struct_I.unpack(str[start:end]) 00113 start = end 00114 end += length 00115 self.header.frame_id = str[start:end] 00116 start = end 00117 end += 4 00118 (length,) = _struct_I.unpack(str[start:end]) 00119 self.sources = [] 00120 for i in range(0, length): 00121 val1 = clearpath_base.msg.PowerSource() 00122 _x = val1 00123 start = end 00124 end += 9 00125 (_x.charge, _x.capacity, _x.present, _x.in_use, _x.description,) = _struct_fh3B.unpack(str[start:end]) 00126 val1.present = bool(val1.present) 00127 val1.in_use = bool(val1.in_use) 00128 self.sources.append(val1) 00129 return self 00130 except struct.error as e: 00131 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00132 00133 00134 def serialize_numpy(self, buff, numpy): 00135 """ 00136 serialize message with numpy array types into buffer 00137 @param buff: buffer 00138 @type buff: StringIO 00139 @param numpy: numpy python module 00140 @type numpy module 00141 """ 00142 try: 00143 _x = self 00144 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00145 _x = self.header.frame_id 00146 length = len(_x) 00147 buff.write(struct.pack('<I%ss'%length, length, _x)) 00148 length = len(self.sources) 00149 buff.write(_struct_I.pack(length)) 00150 for val1 in self.sources: 00151 _x = val1 00152 buff.write(_struct_fh3B.pack(_x.charge, _x.capacity, _x.present, _x.in_use, _x.description)) 00153 except struct.error as se: self._check_types(se) 00154 except TypeError as te: self._check_types(te) 00155 00156 def deserialize_numpy(self, str, numpy): 00157 """ 00158 unpack serialized message in str into this message instance using numpy for array types 00159 @param str: byte array of serialized message 00160 @type str: str 00161 @param numpy: numpy python module 00162 @type numpy: module 00163 """ 00164 try: 00165 if self.header is None: 00166 self.header = std_msgs.msg._Header.Header() 00167 end = 0 00168 _x = self 00169 start = end 00170 end += 12 00171 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00172 start = end 00173 end += 4 00174 (length,) = _struct_I.unpack(str[start:end]) 00175 start = end 00176 end += length 00177 self.header.frame_id = str[start:end] 00178 start = end 00179 end += 4 00180 (length,) = _struct_I.unpack(str[start:end]) 00181 self.sources = [] 00182 for i in range(0, length): 00183 val1 = clearpath_base.msg.PowerSource() 00184 _x = val1 00185 start = end 00186 end += 9 00187 (_x.charge, _x.capacity, _x.present, _x.in_use, _x.description,) = _struct_fh3B.unpack(str[start:end]) 00188 val1.present = bool(val1.present) 00189 val1.in_use = bool(val1.in_use) 00190 self.sources.append(val1) 00191 return self 00192 except struct.error as e: 00193 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00194 00195 _struct_I = roslib.message.struct_I 00196 _struct_fh3B = struct.Struct("<fh3B") 00197 _struct_3I = struct.Struct("<3I")