Package create_node :: Package msg :: Module _RoombaSensorState
[frames] | no frames]

Source Code for Module create_node.msg._RoombaSensorState

  1  # This Python file uses the following encoding: utf-8 
  2  """autogenerated by genpy from create_node/RoombaSensorState.msg. Do not edit.""" 
  3  import sys 
  4  python3 = True if sys.hexversion > 0x03000000 else False 
  5  import genpy 
  6  import struct 
  7   
  8  import std_msgs.msg 
  9   
10 -class RoombaSensorState(genpy.Message):
11 _md5sum = "9e8632c0937537603a670e96e85cd991" 12 _type = "create_node/RoombaSensorState" 13 _has_header = True #flag to mark the presence of a Header object 14 _full_text = """Header header 15 16 uint8 CHARGING_NOT_CHARGING = 0 17 uint8 CHARGING_CHARGING_RECOVERY = 1 18 uint8 CHARGING_CHARGING = 2 19 uint8 CHARGING_TRICKLE_CHARGING = 3 20 uint8 CHARGING_WAITING = 4 21 uint8 CHARGING_CHARGING_ERROR = 5 22 23 uint8 bumps_wheeldrops 24 bool wall 25 bool cliff_left 26 bool cliff_front_left 27 bool cliff_front_right 28 bool cliff_right 29 bool virtual_wall 30 uint8 motor_overcurrents 31 uint8 dirt_detector_left #roomba_only 32 uint8 dirt_detector_right #roomba_only 33 uint8 remote_opcode 34 uint8 buttons 35 int16 distance # mm 36 int16 angle # degrees 37 uint8 charging_state 38 uint16 voltage # mV 39 int16 current # mA 40 int8 temperature # C 41 uint16 charge # mAh 42 uint16 capacity # mAh 43 44 ================================================================================ 45 MSG: std_msgs/Header 46 # Standard metadata for higher-level stamped data types. 47 # This is generally used to communicate timestamped data 48 # in a particular coordinate frame. 49 # 50 # sequence ID: consecutively increasing ID 51 uint32 seq 52 #Two-integer timestamp that is expressed as: 53 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs') 54 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs') 55 # time-handling sugar is provided by the client library 56 time stamp 57 #Frame this data is associated with 58 # 0: no frame 59 # 1: global frame 60 string frame_id 61 """ 62 # Pseudo-constants 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
73 - def __init__(self, *args, **kwds):
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 #message fields cannot be None, assign default values for those that are 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
155 - def _get_types(self):
156 """ 157 internal API method 158 """ 159 return self._slot_types
160
161 - def serialize(self, buff):
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 if python3: 175 buff.write(struct.pack('<I%sB'%length, length, *_x)) 176 else: 177 buff.write(struct.pack('<I%ss'%length, length, _x)) 178 _x = self 179 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)) 180 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) 181 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
182
183 - def deserialize(self, str):
184 """ 185 unpack serialized message in str into this message instance 186 :param str: byte array of serialized message, ``str`` 187 """ 188 try: 189 if self.header is None: 190 self.header = std_msgs.msg.Header() 191 end = 0 192 _x = self 193 start = end 194 end += 12 195 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 196 start = end 197 end += 4 198 (length,) = _struct_I.unpack(str[start:end]) 199 start = end 200 end += length 201 if python3: 202 self.header.frame_id = str[start:end].decode('utf-8') 203 else: 204 self.header.frame_id = str[start:end] 205 _x = self 206 start = end 207 end += 26 208 (_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]) 209 self.wall = bool(self.wall) 210 self.cliff_left = bool(self.cliff_left) 211 self.cliff_front_left = bool(self.cliff_front_left) 212 self.cliff_front_right = bool(self.cliff_front_right) 213 self.cliff_right = bool(self.cliff_right) 214 self.virtual_wall = bool(self.virtual_wall) 215 return self 216 except struct.error as e: 217 raise genpy.DeserializationError(e) #most likely buffer underfill
218 219
220 - def serialize_numpy(self, buff, numpy):
221 """ 222 serialize message with numpy array types into buffer 223 :param buff: buffer, ``StringIO`` 224 :param numpy: numpy python module 225 """ 226 try: 227 _x = self 228 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 229 _x = self.header.frame_id 230 length = len(_x) 231 if python3 or type(_x) == unicode: 232 _x = _x.encode('utf-8') 233 length = len(_x) 234 if python3: 235 buff.write(struct.pack('<I%sB'%length, length, *_x)) 236 else: 237 buff.write(struct.pack('<I%ss'%length, length, _x)) 238 _x = self 239 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)) 240 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) 241 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
242
243 - def deserialize_numpy(self, str, numpy):
244 """ 245 unpack serialized message in str into this message instance using numpy for array types 246 :param str: byte array of serialized message, ``str`` 247 :param numpy: numpy python module 248 """ 249 try: 250 if self.header is None: 251 self.header = std_msgs.msg.Header() 252 end = 0 253 _x = self 254 start = end 255 end += 12 256 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 257 start = end 258 end += 4 259 (length,) = _struct_I.unpack(str[start:end]) 260 start = end 261 end += length 262 if python3: 263 self.header.frame_id = str[start:end].decode('utf-8') 264 else: 265 self.header.frame_id = str[start:end] 266 _x = self 267 start = end 268 end += 26 269 (_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]) 270 self.wall = bool(self.wall) 271 self.cliff_left = bool(self.cliff_left) 272 self.cliff_front_left = bool(self.cliff_front_left) 273 self.cliff_front_right = bool(self.cliff_front_right) 274 self.cliff_right = bool(self.cliff_right) 275 self.virtual_wall = bool(self.virtual_wall) 276 return self 277 except struct.error as e: 278 raise genpy.DeserializationError(e) #most likely buffer underfill
279 280 _struct_I = genpy.struct_I 281 _struct_3I = struct.Struct("<3I") 282 _struct_12B2hBHhb2H = struct.Struct("<12B2hBHhb2H") 283