1 """autogenerated by genpy from eddiebot_node/LaptopChargeStatus.msg. Do not edit."""
2 import sys
3 python3 = True if sys.hexversion > 0x03000000 else False
4 import genpy
5 import struct
6
7 import std_msgs.msg
8
10 _md5sum = "201bffbb268bdae8f8389acae4ae6db2"
11 _type = "eddiebot_node/LaptopChargeStatus"
12 _has_header = True
13 _full_text = """uint8 DISCHARGING = 0
14 uint8 CHARGING = 1
15 uint8 CHARGED = 2
16
17 Header header
18 float32 voltage # Voltage in Volts
19 float32 rate # Negative when discharging (A)
20 float32 charge # Current charge in Ah
21 float32 capacity # Capacity in Ah (last full capacity)
22 float32 design_capacity # Capacity in Ah (design capacity)
23 int32 percentage # Charge percentage
24 uint8 charge_state # Enum
25 bool present # Should be an error if battery is not present
26 ================================================================================
27 MSG: std_msgs/Header
28 # Standard metadata for higher-level stamped data types.
29 # This is generally used to communicate timestamped data
30 # in a particular coordinate frame.
31 #
32 # sequence ID: consecutively increasing ID
33 uint32 seq
34 #Two-integer timestamp that is expressed as:
35 # * stamp.secs: seconds (stamp_secs) since epoch
36 # * stamp.nsecs: nanoseconds since stamp_secs
37 # time-handling sugar is provided by the client library
38 time stamp
39 #Frame this data is associated with
40 # 0: no frame
41 # 1: global frame
42 string frame_id
43
44 """
45
46 DISCHARGING = 0
47 CHARGING = 1
48 CHARGED = 2
49
50 __slots__ = ['header','voltage','rate','charge','capacity','design_capacity','percentage','charge_state','present']
51 _slot_types = ['std_msgs/Header','float32','float32','float32','float32','float32','int32','uint8','bool']
52
54 """
55 Constructor. Any message fields that are implicitly/explicitly
56 set to None will be assigned a default value. The recommend
57 use is keyword arguments as this is more robust to future message
58 changes. You cannot mix in-order arguments and keyword arguments.
59
60 The available fields are:
61 header,voltage,rate,charge,capacity,design_capacity,percentage,charge_state,present
62
63 :param args: complete set of field values, in .msg order
64 :param kwds: use keyword arguments corresponding to message field names
65 to set specific fields.
66 """
67 if args or kwds:
68 super(LaptopChargeStatus, self).__init__(*args, **kwds)
69
70 if self.header is None:
71 self.header = std_msgs.msg.Header()
72 if self.voltage is None:
73 self.voltage = 0.
74 if self.rate is None:
75 self.rate = 0.
76 if self.charge is None:
77 self.charge = 0.
78 if self.capacity is None:
79 self.capacity = 0.
80 if self.design_capacity is None:
81 self.design_capacity = 0.
82 if self.percentage is None:
83 self.percentage = 0
84 if self.charge_state is None:
85 self.charge_state = 0
86 if self.present is None:
87 self.present = False
88 else:
89 self.header = std_msgs.msg.Header()
90 self.voltage = 0.
91 self.rate = 0.
92 self.charge = 0.
93 self.capacity = 0.
94 self.design_capacity = 0.
95 self.percentage = 0
96 self.charge_state = 0
97 self.present = False
98
100 """
101 internal API method
102 """
103 return self._slot_types
104
106 """
107 serialize message into buffer
108 :param buff: buffer, ``StringIO``
109 """
110 try:
111 _x = self
112 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
113 _x = self.header.frame_id
114 length = len(_x)
115 if python3 or type(_x) == unicode:
116 _x = _x.encode('utf-8')
117 length = len(_x)
118 buff.write(struct.pack('<I%ss'%length, length, _x))
119 _x = self
120 buff.write(_struct_5fi2B.pack(_x.voltage, _x.rate, _x.charge, _x.capacity, _x.design_capacity, _x.percentage, _x.charge_state, _x.present))
121 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
122 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
123
125 """
126 unpack serialized message in str into this message instance
127 :param str: byte array of serialized message, ``str``
128 """
129 try:
130 if self.header is None:
131 self.header = std_msgs.msg.Header()
132 end = 0
133 _x = self
134 start = end
135 end += 12
136 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
137 start = end
138 end += 4
139 (length,) = _struct_I.unpack(str[start:end])
140 start = end
141 end += length
142 if python3:
143 self.header.frame_id = str[start:end].decode('utf-8')
144 else:
145 self.header.frame_id = str[start:end]
146 _x = self
147 start = end
148 end += 26
149 (_x.voltage, _x.rate, _x.charge, _x.capacity, _x.design_capacity, _x.percentage, _x.charge_state, _x.present,) = _struct_5fi2B.unpack(str[start:end])
150 self.present = bool(self.present)
151 return self
152 except struct.error as e:
153 raise genpy.DeserializationError(e)
154
155
157 """
158 serialize message with numpy array types into buffer
159 :param buff: buffer, ``StringIO``
160 :param numpy: numpy python module
161 """
162 try:
163 _x = self
164 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
165 _x = self.header.frame_id
166 length = len(_x)
167 if python3 or type(_x) == unicode:
168 _x = _x.encode('utf-8')
169 length = len(_x)
170 buff.write(struct.pack('<I%ss'%length, length, _x))
171 _x = self
172 buff.write(_struct_5fi2B.pack(_x.voltage, _x.rate, _x.charge, _x.capacity, _x.design_capacity, _x.percentage, _x.charge_state, _x.present))
173 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
174 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
175
177 """
178 unpack serialized message in str into this message instance using numpy for array types
179 :param str: byte array of serialized message, ``str``
180 :param numpy: numpy python module
181 """
182 try:
183 if self.header is None:
184 self.header = std_msgs.msg.Header()
185 end = 0
186 _x = self
187 start = end
188 end += 12
189 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
190 start = end
191 end += 4
192 (length,) = _struct_I.unpack(str[start:end])
193 start = end
194 end += length
195 if python3:
196 self.header.frame_id = str[start:end].decode('utf-8')
197 else:
198 self.header.frame_id = str[start:end]
199 _x = self
200 start = end
201 end += 26
202 (_x.voltage, _x.rate, _x.charge, _x.capacity, _x.design_capacity, _x.percentage, _x.charge_state, _x.present,) = _struct_5fi2B.unpack(str[start:end])
203 self.present = bool(self.present)
204 return self
205 except struct.error as e:
206 raise genpy.DeserializationError(e)
207
208 _struct_I = genpy.struct_I
209 _struct_3I = struct.Struct("<3I")
210 _struct_5fi2B = struct.Struct("<5fi2B")
211