$search
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 = "c005c34273dc426c67a020a87bc24148" 00009 _type = "sensor_msgs/Range" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """# Single range reading from an active ranger that emits energy and reports 00012 # one range reading that is valid along an arc at the distance measured. 00013 # This message is not appropriate for fixed-range obstacle detectors, 00014 # such as the Sharp GP2D15. This message is also not appropriate for laser 00015 # scanners. See the LaserScan message if you are working with a laser scanner. 00016 00017 Header header # timestamp in the header is the time the ranger 00018 # returned the distance reading 00019 00020 # Radiation type enums 00021 # If you want a value added to this list, send an email to the ros-users list 00022 uint8 ULTRASOUND=0 00023 uint8 INFRARED=1 00024 00025 uint8 radiation_type # the type of radiation used by the sensor 00026 # (sound, IR, etc) [enum] 00027 00028 float32 field_of_view # the size of the arc that the distance reading is 00029 # valid for [rad] 00030 # the object causing the range reading may have 00031 # been anywhere within -field_of_view/2 and 00032 # field_of_view/2 at the measured range. 00033 # 0 angle corresponds to the x-axis of the sensor. 00034 00035 float32 min_range # minimum range value [m] 00036 float32 max_range # maximum range value [m] 00037 00038 float32 range # range data [m] 00039 # (Note: values < range_min or > range_max 00040 # should be discarded) 00041 00042 ================================================================================ 00043 MSG: std_msgs/Header 00044 # Standard metadata for higher-level stamped data types. 00045 # This is generally used to communicate timestamped data 00046 # in a particular coordinate frame. 00047 # 00048 # sequence ID: consecutively increasing ID 00049 uint32 seq 00050 #Two-integer timestamp that is expressed as: 00051 # * stamp.secs: seconds (stamp_secs) since epoch 00052 # * stamp.nsecs: nanoseconds since stamp_secs 00053 # time-handling sugar is provided by the client library 00054 time stamp 00055 #Frame this data is associated with 00056 # 0: no frame 00057 # 1: global frame 00058 string frame_id 00059 00060 """ 00061 # Pseudo-constants 00062 ULTRASOUND = 0 00063 INFRARED = 1 00064 00065 __slots__ = ['header','radiation_type','field_of_view','min_range','max_range','range'] 00066 _slot_types = ['Header','uint8','float32','float32','float32','float32'] 00067 00068 def __init__(self, *args, **kwds): 00069 """ 00070 Constructor. Any message fields that are implicitly/explicitly 00071 set to None will be assigned a default value. The recommend 00072 use is keyword arguments as this is more robust to future message 00073 changes. You cannot mix in-order arguments and keyword arguments. 00074 00075 The available fields are: 00076 header,radiation_type,field_of_view,min_range,max_range,range 00077 00078 @param args: complete set of field values, in .msg order 00079 @param kwds: use keyword arguments corresponding to message field names 00080 to set specific fields. 00081 """ 00082 if args or kwds: 00083 super(Range, self).__init__(*args, **kwds) 00084 #message fields cannot be None, assign default values for those that are 00085 if self.header is None: 00086 self.header = std_msgs.msg._Header.Header() 00087 if self.radiation_type is None: 00088 self.radiation_type = 0 00089 if self.field_of_view is None: 00090 self.field_of_view = 0. 00091 if self.min_range is None: 00092 self.min_range = 0. 00093 if self.max_range is None: 00094 self.max_range = 0. 00095 if self.range is None: 00096 self.range = 0. 00097 else: 00098 self.header = std_msgs.msg._Header.Header() 00099 self.radiation_type = 0 00100 self.field_of_view = 0. 00101 self.min_range = 0. 00102 self.max_range = 0. 00103 self.range = 0. 00104 00105 def _get_types(self): 00106 """ 00107 internal API method 00108 """ 00109 return self._slot_types 00110 00111 def serialize(self, buff): 00112 """ 00113 serialize message into buffer 00114 @param buff: buffer 00115 @type buff: StringIO 00116 """ 00117 try: 00118 _x = self 00119 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00120 _x = self.header.frame_id 00121 length = len(_x) 00122 buff.write(struct.pack('<I%ss'%length, length, _x)) 00123 _x = self 00124 buff.write(_struct_B4f.pack(_x.radiation_type, _x.field_of_view, _x.min_range, _x.max_range, _x.range)) 00125 except struct.error as se: self._check_types(se) 00126 except TypeError as te: self._check_types(te) 00127 00128 def deserialize(self, str): 00129 """ 00130 unpack serialized message in str into this message instance 00131 @param str: byte array of serialized message 00132 @type str: str 00133 """ 00134 try: 00135 if self.header is None: 00136 self.header = std_msgs.msg._Header.Header() 00137 end = 0 00138 _x = self 00139 start = end 00140 end += 12 00141 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00142 start = end 00143 end += 4 00144 (length,) = _struct_I.unpack(str[start:end]) 00145 start = end 00146 end += length 00147 self.header.frame_id = str[start:end] 00148 _x = self 00149 start = end 00150 end += 17 00151 (_x.radiation_type, _x.field_of_view, _x.min_range, _x.max_range, _x.range,) = _struct_B4f.unpack(str[start:end]) 00152 return self 00153 except struct.error as e: 00154 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00155 00156 00157 def serialize_numpy(self, buff, numpy): 00158 """ 00159 serialize message with numpy array types into buffer 00160 @param buff: buffer 00161 @type buff: StringIO 00162 @param numpy: numpy python module 00163 @type numpy module 00164 """ 00165 try: 00166 _x = self 00167 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00168 _x = self.header.frame_id 00169 length = len(_x) 00170 buff.write(struct.pack('<I%ss'%length, length, _x)) 00171 _x = self 00172 buff.write(_struct_B4f.pack(_x.radiation_type, _x.field_of_view, _x.min_range, _x.max_range, _x.range)) 00173 except struct.error as se: self._check_types(se) 00174 except TypeError as te: self._check_types(te) 00175 00176 def deserialize_numpy(self, str, numpy): 00177 """ 00178 unpack serialized message in str into this message instance using numpy for array types 00179 @param str: byte array of serialized message 00180 @type str: str 00181 @param numpy: numpy python module 00182 @type numpy: module 00183 """ 00184 try: 00185 if self.header is None: 00186 self.header = std_msgs.msg._Header.Header() 00187 end = 0 00188 _x = self 00189 start = end 00190 end += 12 00191 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00192 start = end 00193 end += 4 00194 (length,) = _struct_I.unpack(str[start:end]) 00195 start = end 00196 end += length 00197 self.header.frame_id = str[start:end] 00198 _x = self 00199 start = end 00200 end += 17 00201 (_x.radiation_type, _x.field_of_view, _x.min_range, _x.max_range, _x.range,) = _struct_B4f.unpack(str[start:end]) 00202 return self 00203 except struct.error as e: 00204 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00205 00206 _struct_I = roslib.message.struct_I 00207 _struct_3I = struct.Struct("<3I") 00208 _struct_B4f = struct.Struct("<B4f")