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