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


erratic_player
Author(s): Maintained by Antons Rebguns
autogenerated on Sat Dec 28 2013 16:58:03