Package network_monitor_udp :: Package msg :: Module _UdpMonitor
[frames] | no frames]

Source Code for Module network_monitor_udp.msg._UdpMonitor

  1  """autogenerated by genpy from network_monitor_udp/UdpMonitor.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   
9 -class UdpMonitor(genpy.Message):
10 _md5sum = "61e78eeecffb9257ae40ca291408f8cc" 11 _type = "network_monitor_udp/UdpMonitor" 12 _has_header = True #flag to mark the presence of a Header object 13 _full_text = """Header header 14 15 # Summary of the client settings 16 string server_host 17 uint32 server_port 18 string source_interface 19 float32 packet_rate 20 uint32 packet_size 21 22 # Proportion of packets that have latencies within a bin. The first bin 23 # starts at zero, bins end at the value in latency_bin_values. 24 # len(latency_bin_values) = len(latency_bin_limits) + 1 25 float32[] latency_bin_limits 26 float32[] latency_bin_values 27 28 # Average latency in seconds and loss rate (between 0 and 1) for packets 29 # that fall within one of the bins. 30 float32 average_latency_fresh 31 float32 loss_fresh 32 33 # Average latency in seconds for all 34 # received packets, including very old ones. 35 float32 average_latency_all 36 37 ================================================================================ 38 MSG: std_msgs/Header 39 # Standard metadata for higher-level stamped data types. 40 # This is generally used to communicate timestamped data 41 # in a particular coordinate frame. 42 # 43 # sequence ID: consecutively increasing ID 44 uint32 seq 45 #Two-integer timestamp that is expressed as: 46 # * stamp.secs: seconds (stamp_secs) since epoch 47 # * stamp.nsecs: nanoseconds since stamp_secs 48 # time-handling sugar is provided by the client library 49 time stamp 50 #Frame this data is associated with 51 # 0: no frame 52 # 1: global frame 53 string frame_id 54 55 """ 56 __slots__ = ['header','server_host','server_port','source_interface','packet_rate','packet_size','latency_bin_limits','latency_bin_values','average_latency_fresh','loss_fresh','average_latency_all'] 57 _slot_types = ['std_msgs/Header','string','uint32','string','float32','uint32','float32[]','float32[]','float32','float32','float32'] 58
59 - def __init__(self, *args, **kwds):
60 """ 61 Constructor. Any message fields that are implicitly/explicitly 62 set to None will be assigned a default value. The recommend 63 use is keyword arguments as this is more robust to future message 64 changes. You cannot mix in-order arguments and keyword arguments. 65 66 The available fields are: 67 header,server_host,server_port,source_interface,packet_rate,packet_size,latency_bin_limits,latency_bin_values,average_latency_fresh,loss_fresh,average_latency_all 68 69 :param args: complete set of field values, in .msg order 70 :param kwds: use keyword arguments corresponding to message field names 71 to set specific fields. 72 """ 73 if args or kwds: 74 super(UdpMonitor, self).__init__(*args, **kwds) 75 #message fields cannot be None, assign default values for those that are 76 if self.header is None: 77 self.header = std_msgs.msg.Header() 78 if self.server_host is None: 79 self.server_host = '' 80 if self.server_port is None: 81 self.server_port = 0 82 if self.source_interface is None: 83 self.source_interface = '' 84 if self.packet_rate is None: 85 self.packet_rate = 0. 86 if self.packet_size is None: 87 self.packet_size = 0 88 if self.latency_bin_limits is None: 89 self.latency_bin_limits = [] 90 if self.latency_bin_values is None: 91 self.latency_bin_values = [] 92 if self.average_latency_fresh is None: 93 self.average_latency_fresh = 0. 94 if self.loss_fresh is None: 95 self.loss_fresh = 0. 96 if self.average_latency_all is None: 97 self.average_latency_all = 0. 98 else: 99 self.header = std_msgs.msg.Header() 100 self.server_host = '' 101 self.server_port = 0 102 self.source_interface = '' 103 self.packet_rate = 0. 104 self.packet_size = 0 105 self.latency_bin_limits = [] 106 self.latency_bin_values = [] 107 self.average_latency_fresh = 0. 108 self.loss_fresh = 0. 109 self.average_latency_all = 0.
110
111 - def _get_types(self):
112 """ 113 internal API method 114 """ 115 return self._slot_types
116
117 - def serialize(self, buff):
118 """ 119 serialize message into buffer 120 :param buff: buffer, ``StringIO`` 121 """ 122 try: 123 _x = self 124 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 125 _x = self.header.frame_id 126 length = len(_x) 127 if python3 or type(_x) == unicode: 128 _x = _x.encode('utf-8') 129 length = len(_x) 130 buff.write(struct.pack('<I%ss'%length, length, _x)) 131 _x = self.server_host 132 length = len(_x) 133 if python3 or type(_x) == unicode: 134 _x = _x.encode('utf-8') 135 length = len(_x) 136 buff.write(struct.pack('<I%ss'%length, length, _x)) 137 buff.write(_struct_I.pack(self.server_port)) 138 _x = self.source_interface 139 length = len(_x) 140 if python3 or type(_x) == unicode: 141 _x = _x.encode('utf-8') 142 length = len(_x) 143 buff.write(struct.pack('<I%ss'%length, length, _x)) 144 _x = self 145 buff.write(_struct_fI.pack(_x.packet_rate, _x.packet_size)) 146 length = len(self.latency_bin_limits) 147 buff.write(_struct_I.pack(length)) 148 pattern = '<%sf'%length 149 buff.write(struct.pack(pattern, *self.latency_bin_limits)) 150 length = len(self.latency_bin_values) 151 buff.write(_struct_I.pack(length)) 152 pattern = '<%sf'%length 153 buff.write(struct.pack(pattern, *self.latency_bin_values)) 154 _x = self 155 buff.write(_struct_3f.pack(_x.average_latency_fresh, _x.loss_fresh, _x.average_latency_all)) 156 except struct.error as se: self._check_types(se) 157 except TypeError as te: self._check_types(te)
158
159 - def deserialize(self, str):
160 """ 161 unpack serialized message in str into this message instance 162 :param str: byte array of serialized message, ``str`` 163 """ 164 try: 165 if self.header is None: 166 self.header = std_msgs.msg.Header() 167 end = 0 168 _x = self 169 start = end 170 end += 12 171 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 172 start = end 173 end += 4 174 (length,) = _struct_I.unpack(str[start:end]) 175 start = end 176 end += length 177 if python3: 178 self.header.frame_id = str[start:end].decode('utf-8') 179 else: 180 self.header.frame_id = str[start:end] 181 start = end 182 end += 4 183 (length,) = _struct_I.unpack(str[start:end]) 184 start = end 185 end += length 186 if python3: 187 self.server_host = str[start:end].decode('utf-8') 188 else: 189 self.server_host = str[start:end] 190 start = end 191 end += 4 192 (self.server_port,) = _struct_I.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.source_interface = str[start:end].decode('utf-8') 200 else: 201 self.source_interface = str[start:end] 202 _x = self 203 start = end 204 end += 8 205 (_x.packet_rate, _x.packet_size,) = _struct_fI.unpack(str[start:end]) 206 start = end 207 end += 4 208 (length,) = _struct_I.unpack(str[start:end]) 209 pattern = '<%sf'%length 210 start = end 211 end += struct.calcsize(pattern) 212 self.latency_bin_limits = struct.unpack(pattern, str[start:end]) 213 start = end 214 end += 4 215 (length,) = _struct_I.unpack(str[start:end]) 216 pattern = '<%sf'%length 217 start = end 218 end += struct.calcsize(pattern) 219 self.latency_bin_values = struct.unpack(pattern, str[start:end]) 220 _x = self 221 start = end 222 end += 12 223 (_x.average_latency_fresh, _x.loss_fresh, _x.average_latency_all,) = _struct_3f.unpack(str[start:end]) 224 return self 225 except struct.error as e: 226 raise genpy.DeserializationError(e) #most likely buffer underfill
227 228
229 - def serialize_numpy(self, buff, numpy):
230 """ 231 serialize message with numpy array types into buffer 232 :param buff: buffer, ``StringIO`` 233 :param numpy: numpy python module 234 """ 235 try: 236 _x = self 237 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 238 _x = self.header.frame_id 239 length = len(_x) 240 if python3 or type(_x) == unicode: 241 _x = _x.encode('utf-8') 242 length = len(_x) 243 buff.write(struct.pack('<I%ss'%length, length, _x)) 244 _x = self.server_host 245 length = len(_x) 246 if python3 or type(_x) == unicode: 247 _x = _x.encode('utf-8') 248 length = len(_x) 249 buff.write(struct.pack('<I%ss'%length, length, _x)) 250 buff.write(_struct_I.pack(self.server_port)) 251 _x = self.source_interface 252 length = len(_x) 253 if python3 or type(_x) == unicode: 254 _x = _x.encode('utf-8') 255 length = len(_x) 256 buff.write(struct.pack('<I%ss'%length, length, _x)) 257 _x = self 258 buff.write(_struct_fI.pack(_x.packet_rate, _x.packet_size)) 259 length = len(self.latency_bin_limits) 260 buff.write(_struct_I.pack(length)) 261 pattern = '<%sf'%length 262 buff.write(self.latency_bin_limits.tostring()) 263 length = len(self.latency_bin_values) 264 buff.write(_struct_I.pack(length)) 265 pattern = '<%sf'%length 266 buff.write(self.latency_bin_values.tostring()) 267 _x = self 268 buff.write(_struct_3f.pack(_x.average_latency_fresh, _x.loss_fresh, _x.average_latency_all)) 269 except struct.error as se: self._check_types(se) 270 except TypeError as te: self._check_types(te)
271
272 - def deserialize_numpy(self, str, numpy):
273 """ 274 unpack serialized message in str into this message instance using numpy for array types 275 :param str: byte array of serialized message, ``str`` 276 :param numpy: numpy python module 277 """ 278 try: 279 if self.header is None: 280 self.header = std_msgs.msg.Header() 281 end = 0 282 _x = self 283 start = end 284 end += 12 285 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 286 start = end 287 end += 4 288 (length,) = _struct_I.unpack(str[start:end]) 289 start = end 290 end += length 291 if python3: 292 self.header.frame_id = str[start:end].decode('utf-8') 293 else: 294 self.header.frame_id = str[start:end] 295 start = end 296 end += 4 297 (length,) = _struct_I.unpack(str[start:end]) 298 start = end 299 end += length 300 if python3: 301 self.server_host = str[start:end].decode('utf-8') 302 else: 303 self.server_host = str[start:end] 304 start = end 305 end += 4 306 (self.server_port,) = _struct_I.unpack(str[start:end]) 307 start = end 308 end += 4 309 (length,) = _struct_I.unpack(str[start:end]) 310 start = end 311 end += length 312 if python3: 313 self.source_interface = str[start:end].decode('utf-8') 314 else: 315 self.source_interface = str[start:end] 316 _x = self 317 start = end 318 end += 8 319 (_x.packet_rate, _x.packet_size,) = _struct_fI.unpack(str[start:end]) 320 start = end 321 end += 4 322 (length,) = _struct_I.unpack(str[start:end]) 323 pattern = '<%sf'%length 324 start = end 325 end += struct.calcsize(pattern) 326 self.latency_bin_limits = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 327 start = end 328 end += 4 329 (length,) = _struct_I.unpack(str[start:end]) 330 pattern = '<%sf'%length 331 start = end 332 end += struct.calcsize(pattern) 333 self.latency_bin_values = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 334 _x = self 335 start = end 336 end += 12 337 (_x.average_latency_fresh, _x.loss_fresh, _x.average_latency_all,) = _struct_3f.unpack(str[start:end]) 338 return self 339 except struct.error as e: 340 raise genpy.DeserializationError(e) #most likely buffer underfill
341 342 _struct_I = genpy.struct_I 343 _struct_fI = struct.Struct("<fI") 344 _struct_3I = struct.Struct("<3I") 345 _struct_3f = struct.Struct("<3f") 346