1 """autogenerated by genpy from create_node/RoombaSensorState.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 = "9e8632c0937537603a670e96e85cd991"
11 _type = "create_node/RoombaSensorState"
12 _has_header = True
13 _full_text = """Header header
14
15 uint8 CHARGING_NOT_CHARGING = 0
16 uint8 CHARGING_CHARGING_RECOVERY = 1
17 uint8 CHARGING_CHARGING = 2
18 uint8 CHARGING_TRICKLE_CHARGING = 3
19 uint8 CHARGING_WAITING = 4
20 uint8 CHARGING_CHARGING_ERROR = 5
21
22 uint8 bumps_wheeldrops
23 bool wall
24 bool cliff_left
25 bool cliff_front_left
26 bool cliff_front_right
27 bool cliff_right
28 bool virtual_wall
29 uint8 motor_overcurrents
30 uint8 dirt_detector_left #roomba_only
31 uint8 dirt_detector_right #roomba_only
32 uint8 remote_opcode
33 uint8 buttons
34 int16 distance # mm
35 int16 angle # degrees
36 uint8 charging_state
37 uint16 voltage # mV
38 int16 current # mA
39 int8 temperature # C
40 uint16 charge # mAh
41 uint16 capacity # mAh
42
43 ================================================================================
44 MSG: std_msgs/Header
45 # Standard metadata for higher-level stamped data types.
46 # This is generally used to communicate timestamped data
47 # in a particular coordinate frame.
48 #
49 # sequence ID: consecutively increasing ID
50 uint32 seq
51 #Two-integer timestamp that is expressed as:
52 # * stamp.secs: seconds (stamp_secs) since epoch
53 # * stamp.nsecs: nanoseconds since stamp_secs
54 # time-handling sugar is provided by the client library
55 time stamp
56 #Frame this data is associated with
57 # 0: no frame
58 # 1: global frame
59 string frame_id
60
61 """
62
63 CHARGING_NOT_CHARGING = 0
64 CHARGING_CHARGING_RECOVERY = 1
65 CHARGING_CHARGING = 2
66 CHARGING_TRICKLE_CHARGING = 3
67 CHARGING_WAITING = 4
68 CHARGING_CHARGING_ERROR = 5
69
70 __slots__ = ['header','bumps_wheeldrops','wall','cliff_left','cliff_front_left','cliff_front_right','cliff_right','virtual_wall','motor_overcurrents','dirt_detector_left','dirt_detector_right','remote_opcode','buttons','distance','angle','charging_state','voltage','current','temperature','charge','capacity']
71 _slot_types = ['std_msgs/Header','uint8','bool','bool','bool','bool','bool','bool','uint8','uint8','uint8','uint8','uint8','int16','int16','uint8','uint16','int16','int8','uint16','uint16']
72
74 """
75 Constructor. Any message fields that are implicitly/explicitly
76 set to None will be assigned a default value. The recommend
77 use is keyword arguments as this is more robust to future message
78 changes. You cannot mix in-order arguments and keyword arguments.
79
80 The available fields are:
81 header,bumps_wheeldrops,wall,cliff_left,cliff_front_left,cliff_front_right,cliff_right,virtual_wall,motor_overcurrents,dirt_detector_left,dirt_detector_right,remote_opcode,buttons,distance,angle,charging_state,voltage,current,temperature,charge,capacity
82
83 :param args: complete set of field values, in .msg order
84 :param kwds: use keyword arguments corresponding to message field names
85 to set specific fields.
86 """
87 if args or kwds:
88 super(RoombaSensorState, self).__init__(*args, **kwds)
89
90 if self.header is None:
91 self.header = std_msgs.msg.Header()
92 if self.bumps_wheeldrops is None:
93 self.bumps_wheeldrops = 0
94 if self.wall is None:
95 self.wall = False
96 if self.cliff_left is None:
97 self.cliff_left = False
98 if self.cliff_front_left is None:
99 self.cliff_front_left = False
100 if self.cliff_front_right is None:
101 self.cliff_front_right = False
102 if self.cliff_right is None:
103 self.cliff_right = False
104 if self.virtual_wall is None:
105 self.virtual_wall = False
106 if self.motor_overcurrents is None:
107 self.motor_overcurrents = 0
108 if self.dirt_detector_left is None:
109 self.dirt_detector_left = 0
110 if self.dirt_detector_right is None:
111 self.dirt_detector_right = 0
112 if self.remote_opcode is None:
113 self.remote_opcode = 0
114 if self.buttons is None:
115 self.buttons = 0
116 if self.distance is None:
117 self.distance = 0
118 if self.angle is None:
119 self.angle = 0
120 if self.charging_state is None:
121 self.charging_state = 0
122 if self.voltage is None:
123 self.voltage = 0
124 if self.current is None:
125 self.current = 0
126 if self.temperature is None:
127 self.temperature = 0
128 if self.charge is None:
129 self.charge = 0
130 if self.capacity is None:
131 self.capacity = 0
132 else:
133 self.header = std_msgs.msg.Header()
134 self.bumps_wheeldrops = 0
135 self.wall = False
136 self.cliff_left = False
137 self.cliff_front_left = False
138 self.cliff_front_right = False
139 self.cliff_right = False
140 self.virtual_wall = False
141 self.motor_overcurrents = 0
142 self.dirt_detector_left = 0
143 self.dirt_detector_right = 0
144 self.remote_opcode = 0
145 self.buttons = 0
146 self.distance = 0
147 self.angle = 0
148 self.charging_state = 0
149 self.voltage = 0
150 self.current = 0
151 self.temperature = 0
152 self.charge = 0
153 self.capacity = 0
154
156 """
157 internal API method
158 """
159 return self._slot_types
160
162 """
163 serialize message into buffer
164 :param buff: buffer, ``StringIO``
165 """
166 try:
167 _x = self
168 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
169 _x = self.header.frame_id
170 length = len(_x)
171 if python3 or type(_x) == unicode:
172 _x = _x.encode('utf-8')
173 length = len(_x)
174 buff.write(struct.pack('<I%ss'%length, length, _x))
175 _x = self
176 buff.write(_struct_12B2hBHhb2H.pack(_x.bumps_wheeldrops, _x.wall, _x.cliff_left, _x.cliff_front_left, _x.cliff_front_right, _x.cliff_right, _x.virtual_wall, _x.motor_overcurrents, _x.dirt_detector_left, _x.dirt_detector_right, _x.remote_opcode, _x.buttons, _x.distance, _x.angle, _x.charging_state, _x.voltage, _x.current, _x.temperature, _x.charge, _x.capacity))
177 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
178 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
179
181 """
182 unpack serialized message in str into this message instance
183 :param str: byte array of serialized message, ``str``
184 """
185 try:
186 if self.header is None:
187 self.header = std_msgs.msg.Header()
188 end = 0
189 _x = self
190 start = end
191 end += 12
192 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
193 start = end
194 end += 4
195 (length,) = _struct_I.unpack(str[start:end])
196 start = end
197 end += length
198 if python3:
199 self.header.frame_id = str[start:end].decode('utf-8')
200 else:
201 self.header.frame_id = str[start:end]
202 _x = self
203 start = end
204 end += 26
205 (_x.bumps_wheeldrops, _x.wall, _x.cliff_left, _x.cliff_front_left, _x.cliff_front_right, _x.cliff_right, _x.virtual_wall, _x.motor_overcurrents, _x.dirt_detector_left, _x.dirt_detector_right, _x.remote_opcode, _x.buttons, _x.distance, _x.angle, _x.charging_state, _x.voltage, _x.current, _x.temperature, _x.charge, _x.capacity,) = _struct_12B2hBHhb2H.unpack(str[start:end])
206 self.wall = bool(self.wall)
207 self.cliff_left = bool(self.cliff_left)
208 self.cliff_front_left = bool(self.cliff_front_left)
209 self.cliff_front_right = bool(self.cliff_front_right)
210 self.cliff_right = bool(self.cliff_right)
211 self.virtual_wall = bool(self.virtual_wall)
212 return self
213 except struct.error as e:
214 raise genpy.DeserializationError(e)
215
216
218 """
219 serialize message with numpy array types into buffer
220 :param buff: buffer, ``StringIO``
221 :param numpy: numpy python module
222 """
223 try:
224 _x = self
225 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
226 _x = self.header.frame_id
227 length = len(_x)
228 if python3 or type(_x) == unicode:
229 _x = _x.encode('utf-8')
230 length = len(_x)
231 buff.write(struct.pack('<I%ss'%length, length, _x))
232 _x = self
233 buff.write(_struct_12B2hBHhb2H.pack(_x.bumps_wheeldrops, _x.wall, _x.cliff_left, _x.cliff_front_left, _x.cliff_front_right, _x.cliff_right, _x.virtual_wall, _x.motor_overcurrents, _x.dirt_detector_left, _x.dirt_detector_right, _x.remote_opcode, _x.buttons, _x.distance, _x.angle, _x.charging_state, _x.voltage, _x.current, _x.temperature, _x.charge, _x.capacity))
234 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
235 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
236
238 """
239 unpack serialized message in str into this message instance using numpy for array types
240 :param str: byte array of serialized message, ``str``
241 :param numpy: numpy python module
242 """
243 try:
244 if self.header is None:
245 self.header = std_msgs.msg.Header()
246 end = 0
247 _x = self
248 start = end
249 end += 12
250 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
251 start = end
252 end += 4
253 (length,) = _struct_I.unpack(str[start:end])
254 start = end
255 end += length
256 if python3:
257 self.header.frame_id = str[start:end].decode('utf-8')
258 else:
259 self.header.frame_id = str[start:end]
260 _x = self
261 start = end
262 end += 26
263 (_x.bumps_wheeldrops, _x.wall, _x.cliff_left, _x.cliff_front_left, _x.cliff_front_right, _x.cliff_right, _x.virtual_wall, _x.motor_overcurrents, _x.dirt_detector_left, _x.dirt_detector_right, _x.remote_opcode, _x.buttons, _x.distance, _x.angle, _x.charging_state, _x.voltage, _x.current, _x.temperature, _x.charge, _x.capacity,) = _struct_12B2hBHhb2H.unpack(str[start:end])
264 self.wall = bool(self.wall)
265 self.cliff_left = bool(self.cliff_left)
266 self.cliff_front_left = bool(self.cliff_front_left)
267 self.cliff_front_right = bool(self.cliff_front_right)
268 self.cliff_right = bool(self.cliff_right)
269 self.virtual_wall = bool(self.virtual_wall)
270 return self
271 except struct.error as e:
272 raise genpy.DeserializationError(e)
273
274 _struct_I = genpy.struct_I
275 _struct_3I = struct.Struct("<3I")
276 _struct_12B2hBHhb2H = struct.Struct("<12B2hBHhb2H")
277