1# This Python file uses the following encoding: utf-8 2"""autogenerated by genpy from tf/tfMessage.msg. Do not edit.""" 3import sys 4python3 = True if sys.hexversion > 0x03000000 else False 5import genpy 6import struct 7 8import geometry_msgs.msg 9import std_msgs.msg 10 11class tfMessage(genpy.Message): 12 _md5sum = "94810edda583a504dfda3829e70d7eec" 13 _type = "tf/tfMessage" 14 _has_header = False #flag to mark the presence of a Header object 15 _full_text = """geometry_msgs/TransformStamped[] transforms 16 17================================================================================ 18MSG: geometry_msgs/TransformStamped 19# This expresses a transform from coordinate frame header.frame_id 20# to the coordinate frame child_frame_id 21# 22# This message is mostly used by the 23# <a href="http://wiki.ros.org/tf">tf</a> package. 24# See its documentation for more information. 25 26Header header 27string child_frame_id # the frame id of the child frame 28Transform transform 29 30================================================================================ 31MSG: std_msgs/Header 32# Standard metadata for higher-level stamped data types. 33# This is generally used to communicate timestamped data 34# in a particular coordinate frame. 35# 36# sequence ID: consecutively increasing ID 37uint32 seq 38#Two-integer timestamp that is expressed as: 39# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs') 40# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs') 41# time-handling sugar is provided by the client library 42time stamp 43#Frame this data is associated with 44# 0: no frame 45# 1: global frame 46string frame_id 47 48================================================================================ 49MSG: geometry_msgs/Transform 50# This represents the transform between two coordinate frames in free space. 51 52Vector3 translation 53Quaternion rotation 54 55================================================================================ 56MSG: geometry_msgs/Vector3 57# This represents a vector in free space. 58 59float64 x 60float64 y 61float64 z 62================================================================================ 63MSG: geometry_msgs/Quaternion 64# This represents an orientation in free space in quaternion form. 65 66float64 x 67float64 y 68float64 z 69float64 w 70 71""" 72 __slots__ = ['transforms'] 73 _slot_types = ['geometry_msgs/TransformStamped[]'] 74 75 def __init__(self, *args, **kwds): 76 """ 77 Constructor. Any message fields that are implicitly/explicitly 78 set to None will be assigned a default value. The recommend 79 use is keyword arguments as this is more robust to future message 80 changes. You cannot mix in-order arguments and keyword arguments. 81 82 The available fields are: 83 transforms 84 85 :param args: complete set of field values, in .msg order 86 :param kwds: use keyword arguments corresponding to message field names 87 to set specific fields. 88 """ 89 if args or kwds: 90 super(tfMessage, self).__init__(*args, **kwds) 91 #message fields cannot be None, assign default values for those that are 92 if self.transforms is None: 93 self.transforms = [] 94 else: 95 self.transforms = [] 96 97 def _get_types(self): 98 """ 99 internal API method 100 """ 101 return self._slot_types 102 103 def serialize(self, buff): 104 """ 105 serialize message into buffer 106 :param buff: buffer, ``StringIO`` 107 """ 108 try: 109 length = len(self.transforms) 110 buff.write(_struct_I.pack(length)) 111 for val1 in self.transforms: 112 _v1 = val1.header 113 buff.write(_struct_I.pack(_v1.seq)) 114 _v2 = _v1.stamp 115 _x = _v2 116 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 117 _x = _v1.frame_id 118 length = len(_x) 119 if python3 or type(_x) == unicode: 120 _x = _x.encode('utf-8') 121 length = len(_x) 122 if python3: 123 buff.write(struct.pack('<I%sB'%length, length, *_x)) 124 else: 125 buff.write(struct.pack('<I%ss'%length, length, _x)) 126 _x = val1.child_frame_id 127 length = len(_x) 128 if python3 or type(_x) == unicode: 129 _x = _x.encode('utf-8') 130 length = len(_x) 131 if python3: 132 buff.write(struct.pack('<I%sB'%length, length, *_x)) 133 else: 134 buff.write(struct.pack('<I%ss'%length, length, _x)) 135 _v3 = val1.transform 136 _v4 = _v3.translation 137 _x = _v4 138 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 139 _v5 = _v3.rotation 140 _x = _v5 141 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w)) 142 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x)))) 143 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x)))) 144 145 def deserialize(self, str): 146 """ 147 unpack serialized message in str into this message instance 148 :param str: byte array of serialized message, ``str`` 149 """ 150 try: 151 if self.transforms is None: 152 self.transforms = None 153 end = 0 154 start = end 155 end += 4 156 (length,) = _struct_I.unpack(str[start:end]) 157 self.transforms = [] 158 for i in range(0, length): 159 val1 = geometry_msgs.msg.TransformStamped() 160 _v6 = val1.header 161 start = end 162 end += 4 163 (_v6.seq,) = _struct_I.unpack(str[start:end]) 164 _v7 = _v6.stamp 165 _x = _v7 166 start = end 167 end += 8 168 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 169 start = end 170 end += 4 171 (length,) = _struct_I.unpack(str[start:end]) 172 start = end 173 end += length 174 if python3: 175 _v6.frame_id = str[start:end].decode('utf-8') 176 else: 177 _v6.frame_id = str[start:end] 178 start = end 179 end += 4 180 (length,) = _struct_I.unpack(str[start:end]) 181 start = end 182 end += length 183 if python3: 184 val1.child_frame_id = str[start:end].decode('utf-8') 185 else: 186 val1.child_frame_id = str[start:end] 187 _v8 = val1.transform 188 _v9 = _v8.translation 189 _x = _v9 190 start = end 191 end += 24 192 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 193 _v10 = _v8.rotation 194 _x = _v10 195 start = end 196 end += 32 197 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end]) 198 self.transforms.append(val1) 199 return self 200 except struct.error as e: 201 raise genpy.DeserializationError(e) #most likely buffer underfill 202 203 204 def serialize_numpy(self, buff, numpy): 205 """ 206 serialize message with numpy array types into buffer 207 :param buff: buffer, ``StringIO`` 208 :param numpy: numpy python module 209 """ 210 try: 211 length = len(self.transforms) 212 buff.write(_struct_I.pack(length)) 213 for val1 in self.transforms: 214 _v11 = val1.header 215 buff.write(_struct_I.pack(_v11.seq)) 216 _v12 = _v11.stamp 217 _x = _v12 218 buff.write(_struct_2I.pack(_x.secs, _x.nsecs)) 219 _x = _v11.frame_id 220 length = len(_x) 221 if python3 or type(_x) == unicode: 222 _x = _x.encode('utf-8') 223 length = len(_x) 224 if python3: 225 buff.write(struct.pack('<I%sB'%length, length, *_x)) 226 else: 227 buff.write(struct.pack('<I%ss'%length, length, _x)) 228 _x = val1.child_frame_id 229 length = len(_x) 230 if python3 or type(_x) == unicode: 231 _x = _x.encode('utf-8') 232 length = len(_x) 233 if python3: 234 buff.write(struct.pack('<I%sB'%length, length, *_x)) 235 else: 236 buff.write(struct.pack('<I%ss'%length, length, _x)) 237 _v13 = val1.transform 238 _v14 = _v13.translation 239 _x = _v14 240 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 241 _v15 = _v13.rotation 242 _x = _v15 243 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w)) 244 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x)))) 245 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x)))) 246 247 def deserialize_numpy(self, str, numpy): 248 """ 249 unpack serialized message in str into this message instance using numpy for array types 250 :param str: byte array of serialized message, ``str`` 251 :param numpy: numpy python module 252 """ 253 try: 254 if self.transforms is None: 255 self.transforms = None 256 end = 0 257 start = end 258 end += 4 259 (length,) = _struct_I.unpack(str[start:end]) 260 self.transforms = [] 261 for i in range(0, length): 262 val1 = geometry_msgs.msg.TransformStamped() 263 _v16 = val1.header 264 start = end 265 end += 4 266 (_v16.seq,) = _struct_I.unpack(str[start:end]) 267 _v17 = _v16.stamp 268 _x = _v17 269 start = end 270 end += 8 271 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end]) 272 start = end 273 end += 4 274 (length,) = _struct_I.unpack(str[start:end]) 275 start = end 276 end += length 277 if python3: 278 _v16.frame_id = str[start:end].decode('utf-8') 279 else: 280 _v16.frame_id = str[start:end] 281 start = end 282 end += 4 283 (length,) = _struct_I.unpack(str[start:end]) 284 start = end 285 end += length 286 if python3: 287 val1.child_frame_id = str[start:end].decode('utf-8') 288 else: 289 val1.child_frame_id = str[start:end] 290 _v18 = val1.transform 291 _v19 = _v18.translation 292 _x = _v19 293 start = end 294 end += 24 295 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 296 _v20 = _v18.rotation 297 _x = _v20 298 start = end 299 end += 32 300 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end]) 301 self.transforms.append(val1) 302 return self 303 except struct.error as e: 304 raise genpy.DeserializationError(e) #most likely buffer underfill 305 306_struct_I = genpy.struct_I 307_struct_4d = struct.Struct("<4d") 308_struct_2I = struct.Struct("<2I") 309_struct_3d = struct.Struct("<3d") 310