00001 """autogenerated by genpy from sr_robot_msgs/MidProxDataAll.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 sr_robot_msgs.msg
00008 import std_msgs.msg
00009
00010 class MidProxDataAll(genpy.Message):
00011 _md5sum = "1e9012ec0a19b9d9e5a6680de1b6d873"
00012 _type = "sr_robot_msgs/MidProxDataAll"
00013 _has_header = True
00014 _full_text = """Header header
00015 MidProxData[5] sensors
00016
00017 ================================================================================
00018 MSG: std_msgs/Header
00019 # Standard metadata for higher-level stamped data types.
00020 # This is generally used to communicate timestamped data
00021 # in a particular coordinate frame.
00022 #
00023 # sequence ID: consecutively increasing ID
00024 uint32 seq
00025 #Two-integer timestamp that is expressed as:
00026 # * stamp.secs: seconds (stamp_secs) since epoch
00027 # * stamp.nsecs: nanoseconds since stamp_secs
00028 # time-handling sugar is provided by the client library
00029 time stamp
00030 #Frame this data is associated with
00031 # 0: no frame
00032 # 1: global frame
00033 string frame_id
00034
00035 ================================================================================
00036 MSG: sr_robot_msgs/MidProxData
00037 uint16[4] middle
00038 uint16[4] proximal
00039
00040 """
00041 __slots__ = ['header','sensors']
00042 _slot_types = ['std_msgs/Header','sr_robot_msgs/MidProxData[5]']
00043
00044 def __init__(self, *args, **kwds):
00045 """
00046 Constructor. Any message fields that are implicitly/explicitly
00047 set to None will be assigned a default value. The recommend
00048 use is keyword arguments as this is more robust to future message
00049 changes. You cannot mix in-order arguments and keyword arguments.
00050
00051 The available fields are:
00052 header,sensors
00053
00054 :param args: complete set of field values, in .msg order
00055 :param kwds: use keyword arguments corresponding to message field names
00056 to set specific fields.
00057 """
00058 if args or kwds:
00059 super(MidProxDataAll, self).__init__(*args, **kwds)
00060
00061 if self.header is None:
00062 self.header = std_msgs.msg.Header()
00063 if self.sensors is None:
00064 self.sensors = [sr_robot_msgs.msg.MidProxData(),sr_robot_msgs.msg.MidProxData(),sr_robot_msgs.msg.MidProxData(),sr_robot_msgs.msg.MidProxData(),sr_robot_msgs.msg.MidProxData()]
00065 else:
00066 self.header = std_msgs.msg.Header()
00067 self.sensors = [sr_robot_msgs.msg.MidProxData(),sr_robot_msgs.msg.MidProxData(),sr_robot_msgs.msg.MidProxData(),sr_robot_msgs.msg.MidProxData(),sr_robot_msgs.msg.MidProxData()]
00068
00069 def _get_types(self):
00070 """
00071 internal API method
00072 """
00073 return self._slot_types
00074
00075 def serialize(self, buff):
00076 """
00077 serialize message into buffer
00078 :param buff: buffer, ``StringIO``
00079 """
00080 try:
00081 _x = self
00082 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00083 _x = self.header.frame_id
00084 length = len(_x)
00085 if python3 or type(_x) == unicode:
00086 _x = _x.encode('utf-8')
00087 length = len(_x)
00088 buff.write(struct.pack('<I%ss'%length, length, _x))
00089 for val1 in self.sensors:
00090 buff.write(_struct_4H.pack(*val1.middle))
00091 buff.write(_struct_4H.pack(*val1.proximal))
00092 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00093 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00094
00095 def deserialize(self, str):
00096 """
00097 unpack serialized message in str into this message instance
00098 :param str: byte array of serialized message, ``str``
00099 """
00100 try:
00101 if self.header is None:
00102 self.header = std_msgs.msg.Header()
00103 if self.sensors is None:
00104 self.sensors = None
00105 end = 0
00106 _x = self
00107 start = end
00108 end += 12
00109 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00110 start = end
00111 end += 4
00112 (length,) = _struct_I.unpack(str[start:end])
00113 start = end
00114 end += length
00115 if python3:
00116 self.header.frame_id = str[start:end].decode('utf-8')
00117 else:
00118 self.header.frame_id = str[start:end]
00119 self.sensors = []
00120 for i in range(0, 5):
00121 val1 = sr_robot_msgs.msg.MidProxData()
00122 start = end
00123 end += 8
00124 val1.middle = _struct_4H.unpack(str[start:end])
00125 start = end
00126 end += 8
00127 val1.proximal = _struct_4H.unpack(str[start:end])
00128 self.sensors.append(val1)
00129 return self
00130 except struct.error as e:
00131 raise genpy.DeserializationError(e)
00132
00133
00134 def serialize_numpy(self, buff, numpy):
00135 """
00136 serialize message with numpy array types into buffer
00137 :param buff: buffer, ``StringIO``
00138 :param numpy: numpy python module
00139 """
00140 try:
00141 _x = self
00142 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00143 _x = self.header.frame_id
00144 length = len(_x)
00145 if python3 or type(_x) == unicode:
00146 _x = _x.encode('utf-8')
00147 length = len(_x)
00148 buff.write(struct.pack('<I%ss'%length, length, _x))
00149 for val1 in self.sensors:
00150 buff.write(val1.middle.tostring())
00151 buff.write(val1.proximal.tostring())
00152 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00153 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00154
00155 def deserialize_numpy(self, str, numpy):
00156 """
00157 unpack serialized message in str into this message instance using numpy for array types
00158 :param str: byte array of serialized message, ``str``
00159 :param numpy: numpy python module
00160 """
00161 try:
00162 if self.header is None:
00163 self.header = std_msgs.msg.Header()
00164 if self.sensors is None:
00165 self.sensors = None
00166 end = 0
00167 _x = self
00168 start = end
00169 end += 12
00170 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 start = end
00175 end += length
00176 if python3:
00177 self.header.frame_id = str[start:end].decode('utf-8')
00178 else:
00179 self.header.frame_id = str[start:end]
00180 self.sensors = []
00181 for i in range(0, 5):
00182 val1 = sr_robot_msgs.msg.MidProxData()
00183 start = end
00184 end += 8
00185 val1.middle = numpy.frombuffer(str[start:end], dtype=numpy.uint16, count=4)
00186 start = end
00187 end += 8
00188 val1.proximal = numpy.frombuffer(str[start:end], dtype=numpy.uint16, count=4)
00189 self.sensors.append(val1)
00190 return self
00191 except struct.error as e:
00192 raise genpy.DeserializationError(e)
00193
00194 _struct_I = genpy.struct_I
00195 _struct_3I = struct.Struct("<3I")
00196 _struct_4H = struct.Struct("<4H")