$search
00001 """autogenerated by genmsg_py from PowerSource.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class PowerSource(roslib.message.Message): 00007 _md5sum = "adbe384d7d69a337a7f2b6bf1d0139cb" 00008 _type = "clearpath_base/PowerSource" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """float32 charge 00011 int16 capacity 00012 bool present 00013 bool in_use 00014 uint8 description 00015 00016 """ 00017 __slots__ = ['charge','capacity','present','in_use','description'] 00018 _slot_types = ['float32','int16','bool','bool','uint8'] 00019 00020 def __init__(self, *args, **kwds): 00021 """ 00022 Constructor. Any message fields that are implicitly/explicitly 00023 set to None will be assigned a default value. The recommend 00024 use is keyword arguments as this is more robust to future message 00025 changes. You cannot mix in-order arguments and keyword arguments. 00026 00027 The available fields are: 00028 charge,capacity,present,in_use,description 00029 00030 @param args: complete set of field values, in .msg order 00031 @param kwds: use keyword arguments corresponding to message field names 00032 to set specific fields. 00033 """ 00034 if args or kwds: 00035 super(PowerSource, self).__init__(*args, **kwds) 00036 #message fields cannot be None, assign default values for those that are 00037 if self.charge is None: 00038 self.charge = 0. 00039 if self.capacity is None: 00040 self.capacity = 0 00041 if self.present is None: 00042 self.present = False 00043 if self.in_use is None: 00044 self.in_use = False 00045 if self.description is None: 00046 self.description = 0 00047 else: 00048 self.charge = 0. 00049 self.capacity = 0 00050 self.present = False 00051 self.in_use = False 00052 self.description = 0 00053 00054 def _get_types(self): 00055 """ 00056 internal API method 00057 """ 00058 return self._slot_types 00059 00060 def serialize(self, buff): 00061 """ 00062 serialize message into buffer 00063 @param buff: buffer 00064 @type buff: StringIO 00065 """ 00066 try: 00067 _x = self 00068 buff.write(_struct_fh3B.pack(_x.charge, _x.capacity, _x.present, _x.in_use, _x.description)) 00069 except struct.error as se: self._check_types(se) 00070 except TypeError as te: self._check_types(te) 00071 00072 def deserialize(self, str): 00073 """ 00074 unpack serialized message in str into this message instance 00075 @param str: byte array of serialized message 00076 @type str: str 00077 """ 00078 try: 00079 end = 0 00080 _x = self 00081 start = end 00082 end += 9 00083 (_x.charge, _x.capacity, _x.present, _x.in_use, _x.description,) = _struct_fh3B.unpack(str[start:end]) 00084 self.present = bool(self.present) 00085 self.in_use = bool(self.in_use) 00086 return self 00087 except struct.error as e: 00088 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00089 00090 00091 def serialize_numpy(self, buff, numpy): 00092 """ 00093 serialize message with numpy array types into buffer 00094 @param buff: buffer 00095 @type buff: StringIO 00096 @param numpy: numpy python module 00097 @type numpy module 00098 """ 00099 try: 00100 _x = self 00101 buff.write(_struct_fh3B.pack(_x.charge, _x.capacity, _x.present, _x.in_use, _x.description)) 00102 except struct.error as se: self._check_types(se) 00103 except TypeError as te: self._check_types(te) 00104 00105 def deserialize_numpy(self, str, numpy): 00106 """ 00107 unpack serialized message in str into this message instance using numpy for array types 00108 @param str: byte array of serialized message 00109 @type str: str 00110 @param numpy: numpy python module 00111 @type numpy: module 00112 """ 00113 try: 00114 end = 0 00115 _x = self 00116 start = end 00117 end += 9 00118 (_x.charge, _x.capacity, _x.present, _x.in_use, _x.description,) = _struct_fh3B.unpack(str[start:end]) 00119 self.present = bool(self.present) 00120 self.in_use = bool(self.in_use) 00121 return self 00122 except struct.error as e: 00123 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00124 00125 _struct_I = roslib.message.struct_I 00126 _struct_fh3B = struct.Struct("<fh3B")