_RangeSensor.py
Go to the documentation of this file.
00001 """autogenerated by genpy from corobot_phidgetIK/RangeSensor.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 RangeSensor(genpy.Message):
00010   _md5sum = "c9d1786e32e87107225d5ffacf468032"
00011   _type = "corobot_phidgetIK/RangeSensor"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """#Deprecated. Prefer to use the one in corobot_msgs package, which is exactly the same
00014 
00015 # Message used to transmit range data (infrared, ultrasounds...)
00016 
00017 Header header     # timestamp in the header is the time the distance was read
00018 
00019 # type enums
00020 uint8 ULTRASOUND=0
00021 uint8 INFRARED=1
00022 
00023 # The type of sensor represented by these data. The value can be ULTRASOUND or INFRARED.
00024 int8 type 
00025 
00026 #The number of sensors
00027 int8 numberSensors
00028 
00029 #The data for each sensor. The size of this array is the numberSensors variable.
00030 float32[] range
00031 
00032 ================================================================================
00033 MSG: std_msgs/Header
00034 # Standard metadata for higher-level stamped data types.
00035 # This is generally used to communicate timestamped data 
00036 # in a particular coordinate frame.
00037 # 
00038 # sequence ID: consecutively increasing ID 
00039 uint32 seq
00040 #Two-integer timestamp that is expressed as:
00041 # * stamp.secs: seconds (stamp_secs) since epoch
00042 # * stamp.nsecs: nanoseconds since stamp_secs
00043 # time-handling sugar is provided by the client library
00044 time stamp
00045 #Frame this data is associated with
00046 # 0: no frame
00047 # 1: global frame
00048 string frame_id
00049 
00050 """
00051   # Pseudo-constants
00052   ULTRASOUND = 0
00053   INFRARED = 1
00054 
00055   __slots__ = ['header','type','numberSensors','range']
00056   _slot_types = ['std_msgs/Header','int8','int8','float32[]']
00057 
00058   def __init__(self, *args, **kwds):
00059     """
00060     Constructor. Any message fields that are implicitly/explicitly
00061     set to None will be assigned a default value. The recommend
00062     use is keyword arguments as this is more robust to future message
00063     changes.  You cannot mix in-order arguments and keyword arguments.
00064 
00065     The available fields are:
00066        header,type,numberSensors,range
00067 
00068     :param args: complete set of field values, in .msg order
00069     :param kwds: use keyword arguments corresponding to message field names
00070     to set specific fields.
00071     """
00072     if args or kwds:
00073       super(RangeSensor, self).__init__(*args, **kwds)
00074       #message fields cannot be None, assign default values for those that are
00075       if self.header is None:
00076         self.header = std_msgs.msg.Header()
00077       if self.type is None:
00078         self.type = 0
00079       if self.numberSensors is None:
00080         self.numberSensors = 0
00081       if self.range is None:
00082         self.range = []
00083     else:
00084       self.header = std_msgs.msg.Header()
00085       self.type = 0
00086       self.numberSensors = 0
00087       self.range = []
00088 
00089   def _get_types(self):
00090     """
00091     internal API method
00092     """
00093     return self._slot_types
00094 
00095   def serialize(self, buff):
00096     """
00097     serialize message into buffer
00098     :param buff: buffer, ``StringIO``
00099     """
00100     try:
00101       _x = self
00102       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00103       _x = self.header.frame_id
00104       length = len(_x)
00105       if python3 or type(_x) == unicode:
00106         _x = _x.encode('utf-8')
00107         length = len(_x)
00108       buff.write(struct.pack('<I%ss'%length, length, _x))
00109       _x = self
00110       buff.write(_struct_2b.pack(_x.type, _x.numberSensors))
00111       length = len(self.range)
00112       buff.write(_struct_I.pack(length))
00113       pattern = '<%sf'%length
00114       buff.write(struct.pack(pattern, *self.range))
00115     except struct.error as se: self._check_types(se)
00116     except TypeError as te: self._check_types(te)
00117 
00118   def deserialize(self, str):
00119     """
00120     unpack serialized message in str into this message instance
00121     :param str: byte array of serialized message, ``str``
00122     """
00123     try:
00124       if self.header is None:
00125         self.header = std_msgs.msg.Header()
00126       end = 0
00127       _x = self
00128       start = end
00129       end += 12
00130       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00131       start = end
00132       end += 4
00133       (length,) = _struct_I.unpack(str[start:end])
00134       start = end
00135       end += length
00136       if python3:
00137         self.header.frame_id = str[start:end].decode('utf-8')
00138       else:
00139         self.header.frame_id = str[start:end]
00140       _x = self
00141       start = end
00142       end += 2
00143       (_x.type, _x.numberSensors,) = _struct_2b.unpack(str[start:end])
00144       start = end
00145       end += 4
00146       (length,) = _struct_I.unpack(str[start:end])
00147       pattern = '<%sf'%length
00148       start = end
00149       end += struct.calcsize(pattern)
00150       self.range = struct.unpack(pattern, str[start:end])
00151       return self
00152     except struct.error as e:
00153       raise genpy.DeserializationError(e) #most likely buffer underfill
00154 
00155 
00156   def serialize_numpy(self, buff, numpy):
00157     """
00158     serialize message with numpy array types into buffer
00159     :param buff: buffer, ``StringIO``
00160     :param numpy: numpy python module
00161     """
00162     try:
00163       _x = self
00164       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00165       _x = self.header.frame_id
00166       length = len(_x)
00167       if python3 or type(_x) == unicode:
00168         _x = _x.encode('utf-8')
00169         length = len(_x)
00170       buff.write(struct.pack('<I%ss'%length, length, _x))
00171       _x = self
00172       buff.write(_struct_2b.pack(_x.type, _x.numberSensors))
00173       length = len(self.range)
00174       buff.write(_struct_I.pack(length))
00175       pattern = '<%sf'%length
00176       buff.write(self.range.tostring())
00177     except struct.error as se: self._check_types(se)
00178     except TypeError as te: self._check_types(te)
00179 
00180   def deserialize_numpy(self, str, numpy):
00181     """
00182     unpack serialized message in str into this message instance using numpy for array types
00183     :param str: byte array of serialized message, ``str``
00184     :param numpy: numpy python module
00185     """
00186     try:
00187       if self.header is None:
00188         self.header = std_msgs.msg.Header()
00189       end = 0
00190       _x = self
00191       start = end
00192       end += 12
00193       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00194       start = end
00195       end += 4
00196       (length,) = _struct_I.unpack(str[start:end])
00197       start = end
00198       end += length
00199       if python3:
00200         self.header.frame_id = str[start:end].decode('utf-8')
00201       else:
00202         self.header.frame_id = str[start:end]
00203       _x = self
00204       start = end
00205       end += 2
00206       (_x.type, _x.numberSensors,) = _struct_2b.unpack(str[start:end])
00207       start = end
00208       end += 4
00209       (length,) = _struct_I.unpack(str[start:end])
00210       pattern = '<%sf'%length
00211       start = end
00212       end += struct.calcsize(pattern)
00213       self.range = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00214       return self
00215     except struct.error as e:
00216       raise genpy.DeserializationError(e) #most likely buffer underfill
00217 
00218 _struct_I = genpy.struct_I
00219 _struct_3I = struct.Struct("<3I")
00220 _struct_2b = struct.Struct("<2b")


corobot_phidget_ik
Author(s):
autogenerated on Wed Aug 26 2015 11:09:50