00001 """autogenerated by genmsg_py from Range.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006
00007 class Range(roslib.message.Message):
00008 _md5sum = "37a3243712d0ae8a8c4863ac843a1c75"
00009 _type = "nxt_msgs/Range"
00010 _has_header = True
00011 _full_text = """Header header
00012 float64 range
00013 float64 range_min
00014 float64 range_max
00015 float64 spread_angle
00016
00017 ================================================================================
00018 MSG: std_msgs/Header
00019 # Standard metadata for higher-level stamped data types.
00020 # This is generally used to communicate timestamped data
00021 # in a particular coordinate frame.
00022 #
00023 # sequence ID: consecutively increasing ID
00024 uint32 seq
00025 #Two-integer timestamp that is expressed as:
00026 # * stamp.secs: seconds (stamp_secs) since epoch
00027 # * stamp.nsecs: nanoseconds since stamp_secs
00028 # time-handling sugar is provided by the client library
00029 time stamp
00030 #Frame this data is associated with
00031 # 0: no frame
00032 # 1: global frame
00033 string frame_id
00034
00035 """
00036 __slots__ = ['header','range','range_min','range_max','spread_angle']
00037 _slot_types = ['Header','float64','float64','float64','float64']
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 header,range,range_min,range_max,spread_angle
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(Range, self).__init__(*args, **kwds)
00055
00056 if self.header is None:
00057 self.header = std_msgs.msg._Header.Header()
00058 if self.range is None:
00059 self.range = 0.
00060 if self.range_min is None:
00061 self.range_min = 0.
00062 if self.range_max is None:
00063 self.range_max = 0.
00064 if self.spread_angle is None:
00065 self.spread_angle = 0.
00066 else:
00067 self.header = std_msgs.msg._Header.Header()
00068 self.range = 0.
00069 self.range_min = 0.
00070 self.range_max = 0.
00071 self.spread_angle = 0.
00072
00073 def _get_types(self):
00074 """
00075 internal API method
00076 """
00077 return self._slot_types
00078
00079 def serialize(self, buff):
00080 """
00081 serialize message into buffer
00082 @param buff: buffer
00083 @type buff: StringIO
00084 """
00085 try:
00086 _x = self
00087 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00088 _x = self.header.frame_id
00089 length = len(_x)
00090 buff.write(struct.pack('<I%ss'%length, length, _x))
00091 _x = self
00092 buff.write(_struct_4d.pack(_x.range, _x.range_min, _x.range_max, _x.spread_angle))
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 if self.header is None:
00104 self.header = std_msgs.msg._Header.Header()
00105 end = 0
00106 _x = self
00107 start = end
00108 end += 12
00109 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00110 start = end
00111 end += 4
00112 (length,) = _struct_I.unpack(str[start:end])
00113 start = end
00114 end += length
00115 self.header.frame_id = str[start:end]
00116 _x = self
00117 start = end
00118 end += 32
00119 (_x.range, _x.range_min, _x.range_max, _x.spread_angle,) = _struct_4d.unpack(str[start:end])
00120 return self
00121 except struct.error, e:
00122 raise roslib.message.DeserializationError(e)
00123
00124
00125 def serialize_numpy(self, buff, numpy):
00126 """
00127 serialize message with numpy array types into buffer
00128 @param buff: buffer
00129 @type buff: StringIO
00130 @param numpy: numpy python module
00131 @type numpy module
00132 """
00133 try:
00134 _x = self
00135 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00136 _x = self.header.frame_id
00137 length = len(_x)
00138 buff.write(struct.pack('<I%ss'%length, length, _x))
00139 _x = self
00140 buff.write(_struct_4d.pack(_x.range, _x.range_min, _x.range_max, _x.spread_angle))
00141 except struct.error, se: self._check_types(se)
00142 except TypeError, te: self._check_types(te)
00143
00144 def deserialize_numpy(self, str, numpy):
00145 """
00146 unpack serialized message in str into this message instance using numpy for array types
00147 @param str: byte array of serialized message
00148 @type str: str
00149 @param numpy: numpy python module
00150 @type numpy: module
00151 """
00152 try:
00153 if self.header is None:
00154 self.header = std_msgs.msg._Header.Header()
00155 end = 0
00156 _x = self
00157 start = end
00158 end += 12
00159 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00160 start = end
00161 end += 4
00162 (length,) = _struct_I.unpack(str[start:end])
00163 start = end
00164 end += length
00165 self.header.frame_id = str[start:end]
00166 _x = self
00167 start = end
00168 end += 32
00169 (_x.range, _x.range_min, _x.range_max, _x.spread_angle,) = _struct_4d.unpack(str[start:end])
00170 return self
00171 except struct.error, e:
00172 raise roslib.message.DeserializationError(e)
00173
00174 _struct_I = roslib.message.struct_I
00175 _struct_3I = struct.Struct("<3I")
00176 _struct_4d = struct.Struct("<4d")