Package master_discovery_fkie :: Package msg :: Module _ROSMaster
[frames] | no frames]

Source Code for Module master_discovery_fkie.msg._ROSMaster

  1  """autogenerated by genpy from master_discovery_fkie/ROSMaster.msg. Do not edit.""" 
  2  import sys 
  3  python3 = True if sys.hexversion > 0x03000000 else False 
  4  import genpy 
  5  import struct 
  6   
  7   
8 -class ROSMaster(genpy.Message):
9 _md5sum = "08ea76968a3be2b8b1c6550b39616f72" 10 _type = "master_discovery_fkie/ROSMaster" 11 _has_header = False #flag to mark the presence of a Header object 12 _full_text = """string name 13 # ROS Master URI 14 string uri 15 # The timestamp of the state of the remoter ROS master 16 float64 timestamp 17 # The timestamp of the state of the remoter ROS master, without the changes maked while a synchronization. 18 float64 timestamp_local 19 bool online 20 string discoverer_name 21 string monitoruri 22 """ 23 __slots__ = ['name','uri','timestamp','timestamp_local','online','discoverer_name','monitoruri'] 24 _slot_types = ['string','string','float64','float64','bool','string','string'] 25
26 - def __init__(self, *args, **kwds):
27 """ 28 Constructor. Any message fields that are implicitly/explicitly 29 set to None will be assigned a default value. The recommend 30 use is keyword arguments as this is more robust to future message 31 changes. You cannot mix in-order arguments and keyword arguments. 32 33 The available fields are: 34 name,uri,timestamp,timestamp_local,online,discoverer_name,monitoruri 35 36 :param args: complete set of field values, in .msg order 37 :param kwds: use keyword arguments corresponding to message field names 38 to set specific fields. 39 """ 40 if args or kwds: 41 super(ROSMaster, self).__init__(*args, **kwds) 42 #message fields cannot be None, assign default values for those that are 43 if self.name is None: 44 self.name = '' 45 if self.uri is None: 46 self.uri = '' 47 if self.timestamp is None: 48 self.timestamp = 0. 49 if self.timestamp_local is None: 50 self.timestamp_local = 0. 51 if self.online is None: 52 self.online = False 53 if self.discoverer_name is None: 54 self.discoverer_name = '' 55 if self.monitoruri is None: 56 self.monitoruri = '' 57 else: 58 self.name = '' 59 self.uri = '' 60 self.timestamp = 0. 61 self.timestamp_local = 0. 62 self.online = False 63 self.discoverer_name = '' 64 self.monitoruri = ''
65
66 - def _get_types(self):
67 """ 68 internal API method 69 """ 70 return self._slot_types
71
72 - def serialize(self, buff):
73 """ 74 serialize message into buffer 75 :param buff: buffer, ``StringIO`` 76 """ 77 try: 78 _x = self.name 79 length = len(_x) 80 if python3 or type(_x) == unicode: 81 _x = _x.encode('utf-8') 82 length = len(_x) 83 buff.write(struct.pack('<I%ss'%length, length, _x)) 84 _x = self.uri 85 length = len(_x) 86 if python3 or type(_x) == unicode: 87 _x = _x.encode('utf-8') 88 length = len(_x) 89 buff.write(struct.pack('<I%ss'%length, length, _x)) 90 _x = self 91 buff.write(_struct_2dB.pack(_x.timestamp, _x.timestamp_local, _x.online)) 92 _x = self.discoverer_name 93 length = len(_x) 94 if python3 or type(_x) == unicode: 95 _x = _x.encode('utf-8') 96 length = len(_x) 97 buff.write(struct.pack('<I%ss'%length, length, _x)) 98 _x = self.monitoruri 99 length = len(_x) 100 if python3 or type(_x) == unicode: 101 _x = _x.encode('utf-8') 102 length = len(_x) 103 buff.write(struct.pack('<I%ss'%length, length, _x)) 104 except struct.error as se: self._check_types(se) 105 except TypeError as te: self._check_types(te)
106
107 - def deserialize(self, str):
108 """ 109 unpack serialized message in str into this message instance 110 :param str: byte array of serialized message, ``str`` 111 """ 112 try: 113 end = 0 114 start = end 115 end += 4 116 (length,) = _struct_I.unpack(str[start:end]) 117 start = end 118 end += length 119 if python3: 120 self.name = str[start:end].decode('utf-8') 121 else: 122 self.name = str[start:end] 123 start = end 124 end += 4 125 (length,) = _struct_I.unpack(str[start:end]) 126 start = end 127 end += length 128 if python3: 129 self.uri = str[start:end].decode('utf-8') 130 else: 131 self.uri = str[start:end] 132 _x = self 133 start = end 134 end += 17 135 (_x.timestamp, _x.timestamp_local, _x.online,) = _struct_2dB.unpack(str[start:end]) 136 self.online = bool(self.online) 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.discoverer_name = str[start:end].decode('utf-8') 144 else: 145 self.discoverer_name = str[start:end] 146 start = end 147 end += 4 148 (length,) = _struct_I.unpack(str[start:end]) 149 start = end 150 end += length 151 if python3: 152 self.monitoruri = str[start:end].decode('utf-8') 153 else: 154 self.monitoruri = str[start:end] 155 return self 156 except struct.error as e: 157 raise genpy.DeserializationError(e) #most likely buffer underfill
158 159
160 - def serialize_numpy(self, buff, numpy):
161 """ 162 serialize message with numpy array types into buffer 163 :param buff: buffer, ``StringIO`` 164 :param numpy: numpy python module 165 """ 166 try: 167 _x = self.name 168 length = len(_x) 169 if python3 or type(_x) == unicode: 170 _x = _x.encode('utf-8') 171 length = len(_x) 172 buff.write(struct.pack('<I%ss'%length, length, _x)) 173 _x = self.uri 174 length = len(_x) 175 if python3 or type(_x) == unicode: 176 _x = _x.encode('utf-8') 177 length = len(_x) 178 buff.write(struct.pack('<I%ss'%length, length, _x)) 179 _x = self 180 buff.write(_struct_2dB.pack(_x.timestamp, _x.timestamp_local, _x.online)) 181 _x = self.discoverer_name 182 length = len(_x) 183 if python3 or type(_x) == unicode: 184 _x = _x.encode('utf-8') 185 length = len(_x) 186 buff.write(struct.pack('<I%ss'%length, length, _x)) 187 _x = self.monitoruri 188 length = len(_x) 189 if python3 or type(_x) == unicode: 190 _x = _x.encode('utf-8') 191 length = len(_x) 192 buff.write(struct.pack('<I%ss'%length, length, _x)) 193 except struct.error as se: self._check_types(se) 194 except TypeError as te: self._check_types(te)
195
196 - def deserialize_numpy(self, str, numpy):
197 """ 198 unpack serialized message in str into this message instance using numpy for array types 199 :param str: byte array of serialized message, ``str`` 200 :param numpy: numpy python module 201 """ 202 try: 203 end = 0 204 start = end 205 end += 4 206 (length,) = _struct_I.unpack(str[start:end]) 207 start = end 208 end += length 209 if python3: 210 self.name = str[start:end].decode('utf-8') 211 else: 212 self.name = str[start:end] 213 start = end 214 end += 4 215 (length,) = _struct_I.unpack(str[start:end]) 216 start = end 217 end += length 218 if python3: 219 self.uri = str[start:end].decode('utf-8') 220 else: 221 self.uri = str[start:end] 222 _x = self 223 start = end 224 end += 17 225 (_x.timestamp, _x.timestamp_local, _x.online,) = _struct_2dB.unpack(str[start:end]) 226 self.online = bool(self.online) 227 start = end 228 end += 4 229 (length,) = _struct_I.unpack(str[start:end]) 230 start = end 231 end += length 232 if python3: 233 self.discoverer_name = str[start:end].decode('utf-8') 234 else: 235 self.discoverer_name = str[start:end] 236 start = end 237 end += 4 238 (length,) = _struct_I.unpack(str[start:end]) 239 start = end 240 end += length 241 if python3: 242 self.monitoruri = str[start:end].decode('utf-8') 243 else: 244 self.monitoruri = str[start:end] 245 return self 246 except struct.error as e: 247 raise genpy.DeserializationError(e) #most likely buffer underfill
248 249 _struct_I = genpy.struct_I 250 _struct_2dB = struct.Struct("<2dB") 251