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