00001 """autogenerated by genmsg_py from Frame.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import sba.msg
00006 import geometry_msgs.msg
00007 import std_msgs.msg
00008
00009 class Frame(roslib.message.Message):
00010 _md5sum = "418ca143f82258a762de2cff21411737"
00011 _type = "sba/Frame"
00012 _has_header = True
00013 _full_text = """# New Frame
00014 Header header
00015
00016 # New nodes (generally just 1, but want to leave this open)
00017 CameraNode[] nodes
00018
00019 # New points added from the frame
00020 WorldPoint[] points
00021
00022 # New projections
00023 Projection[] projections
00024
00025 ================================================================================
00026 MSG: std_msgs/Header
00027 # Standard metadata for higher-level stamped data types.
00028 # This is generally used to communicate timestamped data
00029 # in a particular coordinate frame.
00030 #
00031 # sequence ID: consecutively increasing ID
00032 uint32 seq
00033 #Two-integer timestamp that is expressed as:
00034 # * stamp.secs: seconds (stamp_secs) since epoch
00035 # * stamp.nsecs: nanoseconds since stamp_secs
00036 # time-handling sugar is provided by the client library
00037 time stamp
00038 #Frame this data is associated with
00039 # 0: no frame
00040 # 1: global frame
00041 string frame_id
00042
00043 ================================================================================
00044 MSG: sba/CameraNode
00045 # Node Parameters
00046 uint32 index
00047
00048 # Contains a translation and rotation
00049 geometry_msgs/Transform transform
00050
00051 # Camera parameters from the K matrix
00052 float64 fx
00053 float64 fy
00054 float64 cx
00055 float64 cy
00056
00057 # Only relevant for a stereo camera
00058 float64 baseline
00059
00060 # Whether the camera is fixed in space: i.e., its position is known
00061 bool fixed
00062
00063 ================================================================================
00064 MSG: geometry_msgs/Transform
00065 # This represents the transform between two coordinate frames in free space.
00066
00067 Vector3 translation
00068 Quaternion rotation
00069
00070 ================================================================================
00071 MSG: geometry_msgs/Vector3
00072 # This represents a vector in free space.
00073
00074 float64 x
00075 float64 y
00076 float64 z
00077 ================================================================================
00078 MSG: geometry_msgs/Quaternion
00079 # This represents an orientation in free space in quaternion form.
00080
00081 float64 x
00082 float64 y
00083 float64 z
00084 float64 w
00085
00086 ================================================================================
00087 MSG: sba/WorldPoint
00088 # World Point parameters
00089
00090 # Point index
00091 uint32 index
00092
00093 # Coordinates in the world frame
00094 float64 x
00095 float64 y
00096 float64 z
00097 float64 w
00098
00099 ================================================================================
00100 MSG: sba/Projection
00101 # Projection
00102
00103 # Camera index
00104 uint32 camindex
00105
00106 # Point index
00107 uint32 pointindex
00108
00109 # Projection into the image plane
00110 float64 u
00111 float64 v
00112 float64 d
00113
00114 # Is this a stereo projection? (true if stereo, false if monocular)
00115 bool stereo
00116
00117 # Use a covariance matrix?
00118 bool usecovariance
00119
00120 # A 3x3 covariance matrix describing the error
00121 float64[9] covariance
00122
00123
00124 """
00125 __slots__ = ['header','nodes','points','projections']
00126 _slot_types = ['Header','sba/CameraNode[]','sba/WorldPoint[]','sba/Projection[]']
00127
00128 def __init__(self, *args, **kwds):
00129 """
00130 Constructor. Any message fields that are implicitly/explicitly
00131 set to None will be assigned a default value. The recommend
00132 use is keyword arguments as this is more robust to future message
00133 changes. You cannot mix in-order arguments and keyword arguments.
00134
00135 The available fields are:
00136 header,nodes,points,projections
00137
00138 @param args: complete set of field values, in .msg order
00139 @param kwds: use keyword arguments corresponding to message field names
00140 to set specific fields.
00141 """
00142 if args or kwds:
00143 super(Frame, self).__init__(*args, **kwds)
00144
00145 if self.header is None:
00146 self.header = std_msgs.msg._Header.Header()
00147 if self.nodes is None:
00148 self.nodes = []
00149 if self.points is None:
00150 self.points = []
00151 if self.projections is None:
00152 self.projections = []
00153 else:
00154 self.header = std_msgs.msg._Header.Header()
00155 self.nodes = []
00156 self.points = []
00157 self.projections = []
00158
00159 def _get_types(self):
00160 """
00161 internal API method
00162 """
00163 return self._slot_types
00164
00165 def serialize(self, buff):
00166 """
00167 serialize message into buffer
00168 @param buff: buffer
00169 @type buff: StringIO
00170 """
00171 try:
00172 _x = self
00173 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00174 _x = self.header.frame_id
00175 length = len(_x)
00176 buff.write(struct.pack('<I%ss'%length, length, _x))
00177 length = len(self.nodes)
00178 buff.write(_struct_I.pack(length))
00179 for val1 in self.nodes:
00180 buff.write(_struct_I.pack(val1.index))
00181 _v1 = val1.transform
00182 _v2 = _v1.translation
00183 _x = _v2
00184 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00185 _v3 = _v1.rotation
00186 _x = _v3
00187 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00188 _x = val1
00189 buff.write(_struct_5dB.pack(_x.fx, _x.fy, _x.cx, _x.cy, _x.baseline, _x.fixed))
00190 length = len(self.points)
00191 buff.write(_struct_I.pack(length))
00192 for val1 in self.points:
00193 _x = val1
00194 buff.write(_struct_I4d.pack(_x.index, _x.x, _x.y, _x.z, _x.w))
00195 length = len(self.projections)
00196 buff.write(_struct_I.pack(length))
00197 for val1 in self.projections:
00198 _x = val1
00199 buff.write(_struct_2I3d2B.pack(_x.camindex, _x.pointindex, _x.u, _x.v, _x.d, _x.stereo, _x.usecovariance))
00200 buff.write(_struct_9d.pack(*val1.covariance))
00201 except struct.error, se: self._check_types(se)
00202 except TypeError, te: self._check_types(te)
00203
00204 def deserialize(self, str):
00205 """
00206 unpack serialized message in str into this message instance
00207 @param str: byte array of serialized message
00208 @type str: str
00209 """
00210 try:
00211 if self.header is None:
00212 self.header = std_msgs.msg._Header.Header()
00213 end = 0
00214 _x = self
00215 start = end
00216 end += 12
00217 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00218 start = end
00219 end += 4
00220 (length,) = _struct_I.unpack(str[start:end])
00221 start = end
00222 end += length
00223 self.header.frame_id = str[start:end]
00224 start = end
00225 end += 4
00226 (length,) = _struct_I.unpack(str[start:end])
00227 self.nodes = []
00228 for i in xrange(0, length):
00229 val1 = sba.msg.CameraNode()
00230 start = end
00231 end += 4
00232 (val1.index,) = _struct_I.unpack(str[start:end])
00233 _v4 = val1.transform
00234 _v5 = _v4.translation
00235 _x = _v5
00236 start = end
00237 end += 24
00238 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00239 _v6 = _v4.rotation
00240 _x = _v6
00241 start = end
00242 end += 32
00243 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00244 _x = val1
00245 start = end
00246 end += 41
00247 (_x.fx, _x.fy, _x.cx, _x.cy, _x.baseline, _x.fixed,) = _struct_5dB.unpack(str[start:end])
00248 val1.fixed = bool(val1.fixed)
00249 self.nodes.append(val1)
00250 start = end
00251 end += 4
00252 (length,) = _struct_I.unpack(str[start:end])
00253 self.points = []
00254 for i in xrange(0, length):
00255 val1 = sba.msg.WorldPoint()
00256 _x = val1
00257 start = end
00258 end += 36
00259 (_x.index, _x.x, _x.y, _x.z, _x.w,) = _struct_I4d.unpack(str[start:end])
00260 self.points.append(val1)
00261 start = end
00262 end += 4
00263 (length,) = _struct_I.unpack(str[start:end])
00264 self.projections = []
00265 for i in xrange(0, length):
00266 val1 = sba.msg.Projection()
00267 _x = val1
00268 start = end
00269 end += 34
00270 (_x.camindex, _x.pointindex, _x.u, _x.v, _x.d, _x.stereo, _x.usecovariance,) = _struct_2I3d2B.unpack(str[start:end])
00271 val1.stereo = bool(val1.stereo)
00272 val1.usecovariance = bool(val1.usecovariance)
00273 start = end
00274 end += 72
00275 val1.covariance = _struct_9d.unpack(str[start:end])
00276 self.projections.append(val1)
00277 return self
00278 except struct.error, e:
00279 raise roslib.message.DeserializationError(e)
00280
00281
00282 def serialize_numpy(self, buff, numpy):
00283 """
00284 serialize message with numpy array types into buffer
00285 @param buff: buffer
00286 @type buff: StringIO
00287 @param numpy: numpy python module
00288 @type numpy module
00289 """
00290 try:
00291 _x = self
00292 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00293 _x = self.header.frame_id
00294 length = len(_x)
00295 buff.write(struct.pack('<I%ss'%length, length, _x))
00296 length = len(self.nodes)
00297 buff.write(_struct_I.pack(length))
00298 for val1 in self.nodes:
00299 buff.write(_struct_I.pack(val1.index))
00300 _v7 = val1.transform
00301 _v8 = _v7.translation
00302 _x = _v8
00303 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00304 _v9 = _v7.rotation
00305 _x = _v9
00306 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00307 _x = val1
00308 buff.write(_struct_5dB.pack(_x.fx, _x.fy, _x.cx, _x.cy, _x.baseline, _x.fixed))
00309 length = len(self.points)
00310 buff.write(_struct_I.pack(length))
00311 for val1 in self.points:
00312 _x = val1
00313 buff.write(_struct_I4d.pack(_x.index, _x.x, _x.y, _x.z, _x.w))
00314 length = len(self.projections)
00315 buff.write(_struct_I.pack(length))
00316 for val1 in self.projections:
00317 _x = val1
00318 buff.write(_struct_2I3d2B.pack(_x.camindex, _x.pointindex, _x.u, _x.v, _x.d, _x.stereo, _x.usecovariance))
00319 buff.write(val1.covariance.tostring())
00320 except struct.error, se: self._check_types(se)
00321 except TypeError, te: self._check_types(te)
00322
00323 def deserialize_numpy(self, str, numpy):
00324 """
00325 unpack serialized message in str into this message instance using numpy for array types
00326 @param str: byte array of serialized message
00327 @type str: str
00328 @param numpy: numpy python module
00329 @type numpy: module
00330 """
00331 try:
00332 if self.header is None:
00333 self.header = std_msgs.msg._Header.Header()
00334 end = 0
00335 _x = self
00336 start = end
00337 end += 12
00338 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00339 start = end
00340 end += 4
00341 (length,) = _struct_I.unpack(str[start:end])
00342 start = end
00343 end += length
00344 self.header.frame_id = str[start:end]
00345 start = end
00346 end += 4
00347 (length,) = _struct_I.unpack(str[start:end])
00348 self.nodes = []
00349 for i in xrange(0, length):
00350 val1 = sba.msg.CameraNode()
00351 start = end
00352 end += 4
00353 (val1.index,) = _struct_I.unpack(str[start:end])
00354 _v10 = val1.transform
00355 _v11 = _v10.translation
00356 _x = _v11
00357 start = end
00358 end += 24
00359 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00360 _v12 = _v10.rotation
00361 _x = _v12
00362 start = end
00363 end += 32
00364 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00365 _x = val1
00366 start = end
00367 end += 41
00368 (_x.fx, _x.fy, _x.cx, _x.cy, _x.baseline, _x.fixed,) = _struct_5dB.unpack(str[start:end])
00369 val1.fixed = bool(val1.fixed)
00370 self.nodes.append(val1)
00371 start = end
00372 end += 4
00373 (length,) = _struct_I.unpack(str[start:end])
00374 self.points = []
00375 for i in xrange(0, length):
00376 val1 = sba.msg.WorldPoint()
00377 _x = val1
00378 start = end
00379 end += 36
00380 (_x.index, _x.x, _x.y, _x.z, _x.w,) = _struct_I4d.unpack(str[start:end])
00381 self.points.append(val1)
00382 start = end
00383 end += 4
00384 (length,) = _struct_I.unpack(str[start:end])
00385 self.projections = []
00386 for i in xrange(0, length):
00387 val1 = sba.msg.Projection()
00388 _x = val1
00389 start = end
00390 end += 34
00391 (_x.camindex, _x.pointindex, _x.u, _x.v, _x.d, _x.stereo, _x.usecovariance,) = _struct_2I3d2B.unpack(str[start:end])
00392 val1.stereo = bool(val1.stereo)
00393 val1.usecovariance = bool(val1.usecovariance)
00394 start = end
00395 end += 72
00396 val1.covariance = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=9)
00397 self.projections.append(val1)
00398 return self
00399 except struct.error, e:
00400 raise roslib.message.DeserializationError(e)
00401
00402 _struct_I = roslib.message.struct_I
00403 _struct_I4d = struct.Struct("<I4d")
00404 _struct_2I3d2B = struct.Struct("<2I3d2B")
00405 _struct_9d = struct.Struct("<9d")
00406 _struct_5dB = struct.Struct("<5dB")
00407 _struct_3I = struct.Struct("<3I")
00408 _struct_4d = struct.Struct("<4d")
00409 _struct_3d = struct.Struct("<3d")