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