00001 """autogenerated by genpy from sba/Projection.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class Projection(genpy.Message):
00009 _md5sum = "3d5a2ac666ca0038812f550185cfc756"
00010 _type = "sba/Projection"
00011 _has_header = False
00012 _full_text = """# Projection
00013
00014 # Camera index
00015 uint32 camindex
00016
00017 # Point index
00018 uint32 pointindex
00019
00020 # Projection into the image plane
00021 float64 u
00022 float64 v
00023 float64 d
00024
00025 # Is this a stereo projection? (true if stereo, false if monocular)
00026 bool stereo
00027
00028 # Use a covariance matrix?
00029 bool usecovariance
00030
00031 # A 3x3 covariance matrix describing the error
00032 float64[9] covariance
00033
00034
00035 """
00036 __slots__ = ['camindex','pointindex','u','v','d','stereo','usecovariance','covariance']
00037 _slot_types = ['uint32','uint32','float64','float64','float64','bool','bool','float64[9]']
00038
00039 def __init__(self, *args, **kwds):
00040 """
00041 Constructor. Any message fields that are implicitly/explicitly
00042 set to None will be assigned a default value. The recommend
00043 use is keyword arguments as this is more robust to future message
00044 changes. You cannot mix in-order arguments and keyword arguments.
00045
00046 The available fields are:
00047 camindex,pointindex,u,v,d,stereo,usecovariance,covariance
00048
00049 :param args: complete set of field values, in .msg order
00050 :param kwds: use keyword arguments corresponding to message field names
00051 to set specific fields.
00052 """
00053 if args or kwds:
00054 super(Projection, self).__init__(*args, **kwds)
00055
00056 if self.camindex is None:
00057 self.camindex = 0
00058 if self.pointindex is None:
00059 self.pointindex = 0
00060 if self.u is None:
00061 self.u = 0.
00062 if self.v is None:
00063 self.v = 0.
00064 if self.d is None:
00065 self.d = 0.
00066 if self.stereo is None:
00067 self.stereo = False
00068 if self.usecovariance is None:
00069 self.usecovariance = False
00070 if self.covariance is None:
00071 self.covariance = [0.,0.,0.,0.,0.,0.,0.,0.,0.]
00072 else:
00073 self.camindex = 0
00074 self.pointindex = 0
00075 self.u = 0.
00076 self.v = 0.
00077 self.d = 0.
00078 self.stereo = False
00079 self.usecovariance = False
00080 self.covariance = [0.,0.,0.,0.,0.,0.,0.,0.,0.]
00081
00082 def _get_types(self):
00083 """
00084 internal API method
00085 """
00086 return self._slot_types
00087
00088 def serialize(self, buff):
00089 """
00090 serialize message into buffer
00091 :param buff: buffer, ``StringIO``
00092 """
00093 try:
00094 _x = self
00095 buff.write(_struct_2I3d2B.pack(_x.camindex, _x.pointindex, _x.u, _x.v, _x.d, _x.stereo, _x.usecovariance))
00096 buff.write(_struct_9d.pack(*self.covariance))
00097 except struct.error as se: self._check_types(se)
00098 except TypeError as te: self._check_types(te)
00099
00100 def deserialize(self, str):
00101 """
00102 unpack serialized message in str into this message instance
00103 :param str: byte array of serialized message, ``str``
00104 """
00105 try:
00106 end = 0
00107 _x = self
00108 start = end
00109 end += 34
00110 (_x.camindex, _x.pointindex, _x.u, _x.v, _x.d, _x.stereo, _x.usecovariance,) = _struct_2I3d2B.unpack(str[start:end])
00111 self.stereo = bool(self.stereo)
00112 self.usecovariance = bool(self.usecovariance)
00113 start = end
00114 end += 72
00115 self.covariance = _struct_9d.unpack(str[start:end])
00116 return self
00117 except struct.error as e:
00118 raise genpy.DeserializationError(e)
00119
00120
00121 def serialize_numpy(self, buff, numpy):
00122 """
00123 serialize message with numpy array types into buffer
00124 :param buff: buffer, ``StringIO``
00125 :param numpy: numpy python module
00126 """
00127 try:
00128 _x = self
00129 buff.write(_struct_2I3d2B.pack(_x.camindex, _x.pointindex, _x.u, _x.v, _x.d, _x.stereo, _x.usecovariance))
00130 buff.write(self.covariance.tostring())
00131 except struct.error as se: self._check_types(se)
00132 except TypeError as te: self._check_types(te)
00133
00134 def deserialize_numpy(self, str, numpy):
00135 """
00136 unpack serialized message in str into this message instance using numpy for array types
00137 :param str: byte array of serialized message, ``str``
00138 :param numpy: numpy python module
00139 """
00140 try:
00141 end = 0
00142 _x = self
00143 start = end
00144 end += 34
00145 (_x.camindex, _x.pointindex, _x.u, _x.v, _x.d, _x.stereo, _x.usecovariance,) = _struct_2I3d2B.unpack(str[start:end])
00146 self.stereo = bool(self.stereo)
00147 self.usecovariance = bool(self.usecovariance)
00148 start = end
00149 end += 72
00150 self.covariance = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=9)
00151 return self
00152 except struct.error as e:
00153 raise genpy.DeserializationError(e)
00154
00155 _struct_I = genpy.struct_I
00156 _struct_2I3d2B = struct.Struct("<2I3d2B")
00157 _struct_9d = struct.Struct("<9d")