Package tf :: Package msg :: Module _tfMessage
[hide private]
[frames] | no frames]

Source Code for Module tf.msg._tfMessage

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