00001 """autogenerated by genmsg_py from Distance.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006
00007 class Distance(roslib.message.Message):
00008 _md5sum = "5cd97954696edc5d59dd80cb0218765a"
00009 _type = "clearpath_base/Distance"
00010 _has_header = True
00011 _full_text = """Header header
00012 float64[] distances
00013 ================================================================================
00014 MSG: std_msgs/Header
00015 # Standard metadata for higher-level stamped data types.
00016 # This is generally used to communicate timestamped data
00017 # in a particular coordinate frame.
00018 #
00019 # sequence ID: consecutively increasing ID
00020 uint32 seq
00021 #Two-integer timestamp that is expressed as:
00022 # * stamp.secs: seconds (stamp_secs) since epoch
00023 # * stamp.nsecs: nanoseconds since stamp_secs
00024 # time-handling sugar is provided by the client library
00025 time stamp
00026 #Frame this data is associated with
00027 # 0: no frame
00028 # 1: global frame
00029 string frame_id
00030
00031 """
00032 __slots__ = ['header','distances']
00033 _slot_types = ['Header','float64[]']
00034
00035 def __init__(self, *args, **kwds):
00036 """
00037 Constructor. Any message fields that are implicitly/explicitly
00038 set to None will be assigned a default value. The recommend
00039 use is keyword arguments as this is more robust to future message
00040 changes. You cannot mix in-order arguments and keyword arguments.
00041
00042 The available fields are:
00043 header,distances
00044
00045 @param args: complete set of field values, in .msg order
00046 @param kwds: use keyword arguments corresponding to message field names
00047 to set specific fields.
00048 """
00049 if args or kwds:
00050 super(Distance, self).__init__(*args, **kwds)
00051
00052 if self.header is None:
00053 self.header = std_msgs.msg._Header.Header()
00054 if self.distances is None:
00055 self.distances = []
00056 else:
00057 self.header = std_msgs.msg._Header.Header()
00058 self.distances = []
00059
00060 def _get_types(self):
00061 """
00062 internal API method
00063 """
00064 return self._slot_types
00065
00066 def serialize(self, buff):
00067 """
00068 serialize message into buffer
00069 @param buff: buffer
00070 @type buff: StringIO
00071 """
00072 try:
00073 _x = self
00074 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00075 _x = self.header.frame_id
00076 length = len(_x)
00077 buff.write(struct.pack('<I%ss'%length, length, _x))
00078 length = len(self.distances)
00079 buff.write(_struct_I.pack(length))
00080 pattern = '<%sd'%length
00081 buff.write(struct.pack(pattern, *self.distances))
00082 except struct.error, se: self._check_types(se)
00083 except TypeError, te: self._check_types(te)
00084
00085 def deserialize(self, str):
00086 """
00087 unpack serialized message in str into this message instance
00088 @param str: byte array of serialized message
00089 @type str: str
00090 """
00091 try:
00092 if self.header is None:
00093 self.header = std_msgs.msg._Header.Header()
00094 end = 0
00095 _x = self
00096 start = end
00097 end += 12
00098 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00099 start = end
00100 end += 4
00101 (length,) = _struct_I.unpack(str[start:end])
00102 start = end
00103 end += length
00104 self.header.frame_id = str[start:end]
00105 start = end
00106 end += 4
00107 (length,) = _struct_I.unpack(str[start:end])
00108 pattern = '<%sd'%length
00109 start = end
00110 end += struct.calcsize(pattern)
00111 self.distances = struct.unpack(pattern, str[start:end])
00112 return self
00113 except struct.error, e:
00114 raise roslib.message.DeserializationError(e)
00115
00116
00117 def serialize_numpy(self, buff, numpy):
00118 """
00119 serialize message with numpy array types into buffer
00120 @param buff: buffer
00121 @type buff: StringIO
00122 @param numpy: numpy python module
00123 @type numpy module
00124 """
00125 try:
00126 _x = self
00127 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00128 _x = self.header.frame_id
00129 length = len(_x)
00130 buff.write(struct.pack('<I%ss'%length, length, _x))
00131 length = len(self.distances)
00132 buff.write(_struct_I.pack(length))
00133 pattern = '<%sd'%length
00134 buff.write(self.distances.tostring())
00135 except struct.error, se: self._check_types(se)
00136 except TypeError, te: self._check_types(te)
00137
00138 def deserialize_numpy(self, str, numpy):
00139 """
00140 unpack serialized message in str into this message instance using numpy for array types
00141 @param str: byte array of serialized message
00142 @type str: str
00143 @param numpy: numpy python module
00144 @type numpy: module
00145 """
00146 try:
00147 if self.header is None:
00148 self.header = std_msgs.msg._Header.Header()
00149 end = 0
00150 _x = self
00151 start = end
00152 end += 12
00153 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 start = end
00158 end += length
00159 self.header.frame_id = str[start:end]
00160 start = end
00161 end += 4
00162 (length,) = _struct_I.unpack(str[start:end])
00163 pattern = '<%sd'%length
00164 start = end
00165 end += struct.calcsize(pattern)
00166 self.distances = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00167 return self
00168 except struct.error, e:
00169 raise roslib.message.DeserializationError(e)
00170
00171 _struct_I = roslib.message.struct_I
00172 _struct_3I = struct.Struct("<3I")