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

Source Code for Module master_discovery_fkie.msg._LinkStatesStamped

  1  """autogenerated by genpy from master_discovery_fkie/LinkStatesStamped.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 master_discovery_fkie.msg 
  8  import std_msgs.msg 
  9   
10 -class LinkStatesStamped(genpy.Message):
11 _md5sum = "b7c41a46488485ec6593097b0cabe904" 12 _type = "master_discovery_fkie/LinkStatesStamped" 13 _has_header = True #flag to mark the presence of a Header object 14 _full_text = """Header header 15 master_discovery_fkie/LinkState[] links 16 ================================================================================ 17 MSG: std_msgs/Header 18 # Standard metadata for higher-level stamped data types. 19 # This is generally used to communicate timestamped data 20 # in a particular coordinate frame. 21 # 22 # sequence ID: consecutively increasing ID 23 uint32 seq 24 #Two-integer timestamp that is expressed as: 25 # * stamp.secs: seconds (stamp_secs) since epoch 26 # * stamp.nsecs: nanoseconds since stamp_secs 27 # time-handling sugar is provided by the client library 28 time stamp 29 #Frame this data is associated with 30 # 0: no frame 31 # 1: global frame 32 string frame_id 33 34 ================================================================================ 35 MSG: master_discovery_fkie/LinkState 36 string destination 37 float32 quality 38 """ 39 __slots__ = ['header','links'] 40 _slot_types = ['std_msgs/Header','master_discovery_fkie/LinkState[]'] 41
42 - def __init__(self, *args, **kwds):
43 """ 44 Constructor. Any message fields that are implicitly/explicitly 45 set to None will be assigned a default value. The recommend 46 use is keyword arguments as this is more robust to future message 47 changes. You cannot mix in-order arguments and keyword arguments. 48 49 The available fields are: 50 header,links 51 52 :param args: complete set of field values, in .msg order 53 :param kwds: use keyword arguments corresponding to message field names 54 to set specific fields. 55 """ 56 if args or kwds: 57 super(LinkStatesStamped, self).__init__(*args, **kwds) 58 #message fields cannot be None, assign default values for those that are 59 if self.header is None: 60 self.header = std_msgs.msg.Header() 61 if self.links is None: 62 self.links = [] 63 else: 64 self.header = std_msgs.msg.Header() 65 self.links = []
66
67 - def _get_types(self):
68 """ 69 internal API method 70 """ 71 return self._slot_types
72
73 - def serialize(self, buff):
74 """ 75 serialize message into buffer 76 :param buff: buffer, ``StringIO`` 77 """ 78 try: 79 _x = self 80 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 81 _x = self.header.frame_id 82 length = len(_x) 83 if python3 or type(_x) == unicode: 84 _x = _x.encode('utf-8') 85 length = len(_x) 86 buff.write(struct.pack('<I%ss'%length, length, _x)) 87 length = len(self.links) 88 buff.write(_struct_I.pack(length)) 89 for val1 in self.links: 90 _x = val1.destination 91 length = len(_x) 92 if python3 or type(_x) == unicode: 93 _x = _x.encode('utf-8') 94 length = len(_x) 95 buff.write(struct.pack('<I%ss'%length, length, _x)) 96 buff.write(_struct_f.pack(val1.quality)) 97 except struct.error as se: self._check_types(se) 98 except TypeError as te: self._check_types(te)
99
100 - def deserialize(self, str):
101 """ 102 unpack serialized message in str into this message instance 103 :param str: byte array of serialized message, ``str`` 104 """ 105 try: 106 if self.header is None: 107 self.header = std_msgs.msg.Header() 108 if self.links is None: 109 self.links = None 110 end = 0 111 _x = self 112 start = end 113 end += 12 114 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 115 start = end 116 end += 4 117 (length,) = _struct_I.unpack(str[start:end]) 118 start = end 119 end += length 120 if python3: 121 self.header.frame_id = str[start:end].decode('utf-8') 122 else: 123 self.header.frame_id = str[start:end] 124 start = end 125 end += 4 126 (length,) = _struct_I.unpack(str[start:end]) 127 self.links = [] 128 for i in range(0, length): 129 val1 = master_discovery_fkie.msg.LinkState() 130 start = end 131 end += 4 132 (length,) = _struct_I.unpack(str[start:end]) 133 start = end 134 end += length 135 if python3: 136 val1.destination = str[start:end].decode('utf-8') 137 else: 138 val1.destination = str[start:end] 139 start = end 140 end += 4 141 (val1.quality,) = _struct_f.unpack(str[start:end]) 142 self.links.append(val1) 143 return self 144 except struct.error as e: 145 raise genpy.DeserializationError(e) #most likely buffer underfill
146 147
148 - def serialize_numpy(self, buff, numpy):
149 """ 150 serialize message with numpy array types into buffer 151 :param buff: buffer, ``StringIO`` 152 :param numpy: numpy python module 153 """ 154 try: 155 _x = self 156 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 157 _x = self.header.frame_id 158 length = len(_x) 159 if python3 or type(_x) == unicode: 160 _x = _x.encode('utf-8') 161 length = len(_x) 162 buff.write(struct.pack('<I%ss'%length, length, _x)) 163 length = len(self.links) 164 buff.write(_struct_I.pack(length)) 165 for val1 in self.links: 166 _x = val1.destination 167 length = len(_x) 168 if python3 or type(_x) == unicode: 169 _x = _x.encode('utf-8') 170 length = len(_x) 171 buff.write(struct.pack('<I%ss'%length, length, _x)) 172 buff.write(_struct_f.pack(val1.quality)) 173 except struct.error as se: self._check_types(se) 174 except TypeError as te: self._check_types(te)
175
176 - def deserialize_numpy(self, str, numpy):
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 if self.links is None: 186 self.links = None 187 end = 0 188 _x = self 189 start = end 190 end += 12 191 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 192 start = end 193 end += 4 194 (length,) = _struct_I.unpack(str[start:end]) 195 start = end 196 end += length 197 if python3: 198 self.header.frame_id = str[start:end].decode('utf-8') 199 else: 200 self.header.frame_id = str[start:end] 201 start = end 202 end += 4 203 (length,) = _struct_I.unpack(str[start:end]) 204 self.links = [] 205 for i in range(0, length): 206 val1 = master_discovery_fkie.msg.LinkState() 207 start = end 208 end += 4 209 (length,) = _struct_I.unpack(str[start:end]) 210 start = end 211 end += length 212 if python3: 213 val1.destination = str[start:end].decode('utf-8') 214 else: 215 val1.destination = str[start:end] 216 start = end 217 end += 4 218 (val1.quality,) = _struct_f.unpack(str[start:end]) 219 self.links.append(val1) 220 return self 221 except struct.error as e: 222 raise genpy.DeserializationError(e) #most likely buffer underfill
223 224 _struct_I = genpy.struct_I 225 _struct_3I = struct.Struct("<3I") 226 _struct_f = struct.Struct("<f") 227