00001 """autogenerated by genpy from sr_robot_msgs/UBI0All.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 UBI0All(genpy.Message):
00011 _md5sum = "22c64fd8e1fb1637211317013726a341"
00012 _type = "sr_robot_msgs/UBI0All"
00013 _has_header = True
00014 _full_text = """Header header
00015 UBI0[5] tactiles
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/UBI0
00037 uint16[12] distal
00038
00039 """
00040 __slots__ = ['header','tactiles']
00041 _slot_types = ['std_msgs/Header','sr_robot_msgs/UBI0[5]']
00042
00043 def __init__(self, *args, **kwds):
00044 """
00045 Constructor. Any message fields that are implicitly/explicitly
00046 set to None will be assigned a default value. The recommend
00047 use is keyword arguments as this is more robust to future message
00048 changes. You cannot mix in-order arguments and keyword arguments.
00049
00050 The available fields are:
00051 header,tactiles
00052
00053 :param args: complete set of field values, in .msg order
00054 :param kwds: use keyword arguments corresponding to message field names
00055 to set specific fields.
00056 """
00057 if args or kwds:
00058 super(UBI0All, self).__init__(*args, **kwds)
00059
00060 if self.header is None:
00061 self.header = std_msgs.msg.Header()
00062 if self.tactiles is None:
00063 self.tactiles = [sr_robot_msgs.msg.UBI0(),sr_robot_msgs.msg.UBI0(),sr_robot_msgs.msg.UBI0(),sr_robot_msgs.msg.UBI0(),sr_robot_msgs.msg.UBI0()]
00064 else:
00065 self.header = std_msgs.msg.Header()
00066 self.tactiles = [sr_robot_msgs.msg.UBI0(),sr_robot_msgs.msg.UBI0(),sr_robot_msgs.msg.UBI0(),sr_robot_msgs.msg.UBI0(),sr_robot_msgs.msg.UBI0()]
00067
00068 def _get_types(self):
00069 """
00070 internal API method
00071 """
00072 return self._slot_types
00073
00074 def serialize(self, buff):
00075 """
00076 serialize message into buffer
00077 :param buff: buffer, ``StringIO``
00078 """
00079 try:
00080 _x = self
00081 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00082 _x = self.header.frame_id
00083 length = len(_x)
00084 if python3 or type(_x) == unicode:
00085 _x = _x.encode('utf-8')
00086 length = len(_x)
00087 buff.write(struct.pack('<I%ss'%length, length, _x))
00088 for val1 in self.tactiles:
00089 buff.write(_struct_12H.pack(*val1.distal))
00090 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00091 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00092
00093 def deserialize(self, str):
00094 """
00095 unpack serialized message in str into this message instance
00096 :param str: byte array of serialized message, ``str``
00097 """
00098 try:
00099 if self.header is None:
00100 self.header = std_msgs.msg.Header()
00101 if self.tactiles is None:
00102 self.tactiles = None
00103 end = 0
00104 _x = self
00105 start = end
00106 end += 12
00107 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00108 start = end
00109 end += 4
00110 (length,) = _struct_I.unpack(str[start:end])
00111 start = end
00112 end += length
00113 if python3:
00114 self.header.frame_id = str[start:end].decode('utf-8')
00115 else:
00116 self.header.frame_id = str[start:end]
00117 self.tactiles = []
00118 for i in range(0, 5):
00119 val1 = sr_robot_msgs.msg.UBI0()
00120 start = end
00121 end += 24
00122 val1.distal = _struct_12H.unpack(str[start:end])
00123 self.tactiles.append(val1)
00124 return self
00125 except struct.error as e:
00126 raise genpy.DeserializationError(e)
00127
00128
00129 def serialize_numpy(self, buff, numpy):
00130 """
00131 serialize message with numpy array types into buffer
00132 :param buff: buffer, ``StringIO``
00133 :param numpy: numpy python module
00134 """
00135 try:
00136 _x = self
00137 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00138 _x = self.header.frame_id
00139 length = len(_x)
00140 if python3 or type(_x) == unicode:
00141 _x = _x.encode('utf-8')
00142 length = len(_x)
00143 buff.write(struct.pack('<I%ss'%length, length, _x))
00144 for val1 in self.tactiles:
00145 buff.write(val1.distal.tostring())
00146 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00147 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00148
00149 def deserialize_numpy(self, str, numpy):
00150 """
00151 unpack serialized message in str into this message instance using numpy for array types
00152 :param str: byte array of serialized message, ``str``
00153 :param numpy: numpy python module
00154 """
00155 try:
00156 if self.header is None:
00157 self.header = std_msgs.msg.Header()
00158 if self.tactiles is None:
00159 self.tactiles = None
00160 end = 0
00161 _x = self
00162 start = end
00163 end += 12
00164 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00165 start = end
00166 end += 4
00167 (length,) = _struct_I.unpack(str[start:end])
00168 start = end
00169 end += length
00170 if python3:
00171 self.header.frame_id = str[start:end].decode('utf-8')
00172 else:
00173 self.header.frame_id = str[start:end]
00174 self.tactiles = []
00175 for i in range(0, 5):
00176 val1 = sr_robot_msgs.msg.UBI0()
00177 start = end
00178 end += 24
00179 val1.distal = numpy.frombuffer(str[start:end], dtype=numpy.uint16, count=12)
00180 self.tactiles.append(val1)
00181 return self
00182 except struct.error as e:
00183 raise genpy.DeserializationError(e)
00184
00185 _struct_I = genpy.struct_I
00186 _struct_12H = struct.Struct("<12H")
00187 _struct_3I = struct.Struct("<3I")