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


lse_sensor_msgs
Author(s): Gonçalo Cabrita and Pedro Sousa
autogenerated on Mon Jan 6 2014 11:25:04