00001 """autogenerated by genpy from tf2_msgs/TFMessage.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import geometry_msgs.msg
00008 import std_msgs.msg
00009
00010 class TFMessage(genpy.Message):
00011 _md5sum = "94810edda583a504dfda3829e70d7eec"
00012 _type = "tf2_msgs/TFMessage"
00013 _has_header = False
00014 _full_text = """geometry_msgs/TransformStamped[] transforms
00015
00016 ================================================================================
00017 MSG: geometry_msgs/TransformStamped
00018 # This expresses a transform from coordinate frame header.frame_id
00019 # to the coordinate frame child_frame_id
00020 #
00021 # This message is mostly used by the
00022 # <a href="http://www.ros.org/wiki/tf">tf</a> package.
00023 # See it's documentation for more information.
00024
00025 Header header
00026 string child_frame_id # the frame id of the child frame
00027 Transform transform
00028
00029 ================================================================================
00030 MSG: std_msgs/Header
00031 # Standard metadata for higher-level stamped data types.
00032 # This is generally used to communicate timestamped data
00033 # in a particular coordinate frame.
00034 #
00035 # sequence ID: consecutively increasing ID
00036 uint32 seq
00037 #Two-integer timestamp that is expressed as:
00038 # * stamp.secs: seconds (stamp_secs) since epoch
00039 # * stamp.nsecs: nanoseconds since stamp_secs
00040 # time-handling sugar is provided by the client library
00041 time stamp
00042 #Frame this data is associated with
00043 # 0: no frame
00044 # 1: global frame
00045 string frame_id
00046
00047 ================================================================================
00048 MSG: geometry_msgs/Transform
00049 # This represents the transform between two coordinate frames in free space.
00050
00051 Vector3 translation
00052 Quaternion rotation
00053
00054 ================================================================================
00055 MSG: geometry_msgs/Vector3
00056 # This represents a vector in free space.
00057
00058 float64 x
00059 float64 y
00060 float64 z
00061 ================================================================================
00062 MSG: geometry_msgs/Quaternion
00063 # This represents an orientation in free space in quaternion form.
00064
00065 float64 x
00066 float64 y
00067 float64 z
00068 float64 w
00069
00070 """
00071 __slots__ = ['transforms']
00072 _slot_types = ['geometry_msgs/TransformStamped[]']
00073
00074 def __init__(self, *args, **kwds):
00075 """
00076 Constructor. Any message fields that are implicitly/explicitly
00077 set to None will be assigned a default value. The recommend
00078 use is keyword arguments as this is more robust to future message
00079 changes. You cannot mix in-order arguments and keyword arguments.
00080
00081 The available fields are:
00082 transforms
00083
00084 :param args: complete set of field values, in .msg order
00085 :param kwds: use keyword arguments corresponding to message field names
00086 to set specific fields.
00087 """
00088 if args or kwds:
00089 super(TFMessage, self).__init__(*args, **kwds)
00090
00091 if self.transforms is None:
00092 self.transforms = []
00093 else:
00094 self.transforms = []
00095
00096 def _get_types(self):
00097 """
00098 internal API method
00099 """
00100 return self._slot_types
00101
00102 def serialize(self, buff):
00103 """
00104 serialize message into buffer
00105 :param buff: buffer, ``StringIO``
00106 """
00107 try:
00108 length = len(self.transforms)
00109 buff.write(_struct_I.pack(length))
00110 for val1 in self.transforms:
00111 _v1 = val1.header
00112 buff.write(_struct_I.pack(_v1.seq))
00113 _v2 = _v1.stamp
00114 _x = _v2
00115 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00116 _x = _v1.frame_id
00117 length = len(_x)
00118 if python3 or type(_x) == unicode:
00119 _x = _x.encode('utf-8')
00120 length = len(_x)
00121 buff.write(struct.pack('<I%ss'%length, length, _x))
00122 _x = val1.child_frame_id
00123 length = len(_x)
00124 if python3 or type(_x) == unicode:
00125 _x = _x.encode('utf-8')
00126 length = len(_x)
00127 buff.write(struct.pack('<I%ss'%length, length, _x))
00128 _v3 = val1.transform
00129 _v4 = _v3.translation
00130 _x = _v4
00131 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00132 _v5 = _v3.rotation
00133 _x = _v5
00134 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00135 except struct.error as se: self._check_types(se)
00136 except TypeError as te: self._check_types(te)
00137
00138 def deserialize(self, str):
00139 """
00140 unpack serialized message in str into this message instance
00141 :param str: byte array of serialized message, ``str``
00142 """
00143 try:
00144 if self.transforms is None:
00145 self.transforms = None
00146 end = 0
00147 start = end
00148 end += 4
00149 (length,) = _struct_I.unpack(str[start:end])
00150 self.transforms = []
00151 for i in range(0, length):
00152 val1 = geometry_msgs.msg.TransformStamped()
00153 _v6 = val1.header
00154 start = end
00155 end += 4
00156 (_v6.seq,) = _struct_I.unpack(str[start:end])
00157 _v7 = _v6.stamp
00158 _x = _v7
00159 start = end
00160 end += 8
00161 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00162 start = end
00163 end += 4
00164 (length,) = _struct_I.unpack(str[start:end])
00165 start = end
00166 end += length
00167 if python3:
00168 _v6.frame_id = str[start:end].decode('utf-8')
00169 else:
00170 _v6.frame_id = str[start:end]
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 start = end
00175 end += length
00176 if python3:
00177 val1.child_frame_id = str[start:end].decode('utf-8')
00178 else:
00179 val1.child_frame_id = str[start:end]
00180 _v8 = val1.transform
00181 _v9 = _v8.translation
00182 _x = _v9
00183 start = end
00184 end += 24
00185 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00186 _v10 = _v8.rotation
00187 _x = _v10
00188 start = end
00189 end += 32
00190 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00191 self.transforms.append(val1)
00192 return self
00193 except struct.error as e:
00194 raise genpy.DeserializationError(e)
00195
00196
00197 def serialize_numpy(self, buff, numpy):
00198 """
00199 serialize message with numpy array types into buffer
00200 :param buff: buffer, ``StringIO``
00201 :param numpy: numpy python module
00202 """
00203 try:
00204 length = len(self.transforms)
00205 buff.write(_struct_I.pack(length))
00206 for val1 in self.transforms:
00207 _v11 = val1.header
00208 buff.write(_struct_I.pack(_v11.seq))
00209 _v12 = _v11.stamp
00210 _x = _v12
00211 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00212 _x = _v11.frame_id
00213 length = len(_x)
00214 if python3 or type(_x) == unicode:
00215 _x = _x.encode('utf-8')
00216 length = len(_x)
00217 buff.write(struct.pack('<I%ss'%length, length, _x))
00218 _x = val1.child_frame_id
00219 length = len(_x)
00220 if python3 or type(_x) == unicode:
00221 _x = _x.encode('utf-8')
00222 length = len(_x)
00223 buff.write(struct.pack('<I%ss'%length, length, _x))
00224 _v13 = val1.transform
00225 _v14 = _v13.translation
00226 _x = _v14
00227 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00228 _v15 = _v13.rotation
00229 _x = _v15
00230 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00231 except struct.error as se: self._check_types(se)
00232 except TypeError as te: self._check_types(te)
00233
00234 def deserialize_numpy(self, str, numpy):
00235 """
00236 unpack serialized message in str into this message instance using numpy for array types
00237 :param str: byte array of serialized message, ``str``
00238 :param numpy: numpy python module
00239 """
00240 try:
00241 if self.transforms is None:
00242 self.transforms = None
00243 end = 0
00244 start = end
00245 end += 4
00246 (length,) = _struct_I.unpack(str[start:end])
00247 self.transforms = []
00248 for i in range(0, length):
00249 val1 = geometry_msgs.msg.TransformStamped()
00250 _v16 = val1.header
00251 start = end
00252 end += 4
00253 (_v16.seq,) = _struct_I.unpack(str[start:end])
00254 _v17 = _v16.stamp
00255 _x = _v17
00256 start = end
00257 end += 8
00258 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00259 start = end
00260 end += 4
00261 (length,) = _struct_I.unpack(str[start:end])
00262 start = end
00263 end += length
00264 if python3:
00265 _v16.frame_id = str[start:end].decode('utf-8')
00266 else:
00267 _v16.frame_id = str[start:end]
00268 start = end
00269 end += 4
00270 (length,) = _struct_I.unpack(str[start:end])
00271 start = end
00272 end += length
00273 if python3:
00274 val1.child_frame_id = str[start:end].decode('utf-8')
00275 else:
00276 val1.child_frame_id = str[start:end]
00277 _v18 = val1.transform
00278 _v19 = _v18.translation
00279 _x = _v19
00280 start = end
00281 end += 24
00282 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00283 _v20 = _v18.rotation
00284 _x = _v20
00285 start = end
00286 end += 32
00287 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00288 self.transforms.append(val1)
00289 return self
00290 except struct.error as e:
00291 raise genpy.DeserializationError(e)
00292
00293 _struct_I = genpy.struct_I
00294 _struct_4d = struct.Struct("<4d")
00295 _struct_2I = struct.Struct("<2I")
00296 _struct_3d = struct.Struct("<3d")