00001 """autogenerated by genmsg_py from Observation.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class Observation(roslib.message.Message):
00007 _md5sum = "28e00e2d00322b881a7d7e5dce0b4103"
00008 _type = "art_msgs/Observation"
00009 _has_header = False
00010 _full_text = """# result returned from a single observer
00011 # TODO: move to a separate art_observers package
00012 # $Id: Observation.msg 644 2010-09-28 03:19:07Z jack.oquin $
00013
00014 int32 oid # observer ID
00015 string name # observer name
00016
00017 bool applicable # true if obseravation is applicable
00018 bool clear # true if clear to go
00019
00020 # optional time and distance to nearest obstacle
00021 # (only reported by some observers)
00022 float32 time
00023 float32 distance
00024 float32 velocity
00025 int32 nobjects # number of objects
00026
00027 """
00028 __slots__ = ['oid','name','applicable','clear','time','distance','velocity','nobjects']
00029 _slot_types = ['int32','string','bool','bool','float32','float32','float32','int32']
00030
00031 def __init__(self, *args, **kwds):
00032 """
00033 Constructor. Any message fields that are implicitly/explicitly
00034 set to None will be assigned a default value. The recommend
00035 use is keyword arguments as this is more robust to future message
00036 changes. You cannot mix in-order arguments and keyword arguments.
00037
00038 The available fields are:
00039 oid,name,applicable,clear,time,distance,velocity,nobjects
00040
00041 @param args: complete set of field values, in .msg order
00042 @param kwds: use keyword arguments corresponding to message field names
00043 to set specific fields.
00044 """
00045 if args or kwds:
00046 super(Observation, self).__init__(*args, **kwds)
00047
00048 if self.oid is None:
00049 self.oid = 0
00050 if self.name is None:
00051 self.name = ''
00052 if self.applicable is None:
00053 self.applicable = False
00054 if self.clear is None:
00055 self.clear = False
00056 if self.time is None:
00057 self.time = 0.
00058 if self.distance is None:
00059 self.distance = 0.
00060 if self.velocity is None:
00061 self.velocity = 0.
00062 if self.nobjects is None:
00063 self.nobjects = 0
00064 else:
00065 self.oid = 0
00066 self.name = ''
00067 self.applicable = False
00068 self.clear = False
00069 self.time = 0.
00070 self.distance = 0.
00071 self.velocity = 0.
00072 self.nobjects = 0
00073
00074 def _get_types(self):
00075 """
00076 internal API method
00077 """
00078 return self._slot_types
00079
00080 def serialize(self, buff):
00081 """
00082 serialize message into buffer
00083 @param buff: buffer
00084 @type buff: StringIO
00085 """
00086 try:
00087 buff.write(_struct_i.pack(self.oid))
00088 _x = self.name
00089 length = len(_x)
00090 buff.write(struct.pack('<I%ss'%length, length, _x))
00091 _x = self
00092 buff.write(_struct_2B3fi.pack(_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects))
00093 except struct.error, se: self._check_types(se)
00094 except TypeError, te: self._check_types(te)
00095
00096 def deserialize(self, str):
00097 """
00098 unpack serialized message in str into this message instance
00099 @param str: byte array of serialized message
00100 @type str: str
00101 """
00102 try:
00103 end = 0
00104 start = end
00105 end += 4
00106 (self.oid,) = _struct_i.unpack(str[start:end])
00107 start = end
00108 end += 4
00109 (length,) = _struct_I.unpack(str[start:end])
00110 start = end
00111 end += length
00112 self.name = str[start:end]
00113 _x = self
00114 start = end
00115 end += 18
00116 (_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects,) = _struct_2B3fi.unpack(str[start:end])
00117 self.applicable = bool(self.applicable)
00118 self.clear = bool(self.clear)
00119 return self
00120 except struct.error, e:
00121 raise roslib.message.DeserializationError(e)
00122
00123
00124 def serialize_numpy(self, buff, numpy):
00125 """
00126 serialize message with numpy array types into buffer
00127 @param buff: buffer
00128 @type buff: StringIO
00129 @param numpy: numpy python module
00130 @type numpy module
00131 """
00132 try:
00133 buff.write(_struct_i.pack(self.oid))
00134 _x = self.name
00135 length = len(_x)
00136 buff.write(struct.pack('<I%ss'%length, length, _x))
00137 _x = self
00138 buff.write(_struct_2B3fi.pack(_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects))
00139 except struct.error, se: self._check_types(se)
00140 except TypeError, te: self._check_types(te)
00141
00142 def deserialize_numpy(self, str, numpy):
00143 """
00144 unpack serialized message in str into this message instance using numpy for array types
00145 @param str: byte array of serialized message
00146 @type str: str
00147 @param numpy: numpy python module
00148 @type numpy: module
00149 """
00150 try:
00151 end = 0
00152 start = end
00153 end += 4
00154 (self.oid,) = _struct_i.unpack(str[start:end])
00155 start = end
00156 end += 4
00157 (length,) = _struct_I.unpack(str[start:end])
00158 start = end
00159 end += length
00160 self.name = str[start:end]
00161 _x = self
00162 start = end
00163 end += 18
00164 (_x.applicable, _x.clear, _x.time, _x.distance, _x.velocity, _x.nobjects,) = _struct_2B3fi.unpack(str[start:end])
00165 self.applicable = bool(self.applicable)
00166 self.clear = bool(self.clear)
00167 return self
00168 except struct.error, e:
00169 raise roslib.message.DeserializationError(e)
00170
00171 _struct_I = roslib.message.struct_I
00172 _struct_i = struct.Struct("<i")
00173 _struct_2B3fi = struct.Struct("<2B3fi")