00001 """autogenerated by genpy from openraveros/AttachedSensor.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 openraveros.msg
00008
00009 class AttachedSensor(genpy.Message):
00010 _md5sum = "416898d02cf5b45ec461b4ab2e67fbdd"
00011 _type = "openraveros/AttachedSensor"
00012 _has_header = False
00013 _full_text = """# information specific to an attached sensor for a robot
00014
00015 # name of sensor
00016 string name
00017
00018 # zero-based index of link sensor is attached to
00019 int8 attachedlink
00020
00021 # 3x4 matrix of the relative transform of the sensor frame with respect to the link frame
00022 AffineTransformMatrix trelative
00023
00024 # 3x4 matrix of the global transform of the sensor (ie, with link transform applied)
00025 AffineTransformMatrix tglobal
00026
00027 # type of sensor
00028 string type
00029
00030 ================================================================================
00031 MSG: openraveros/AffineTransformMatrix
00032 # column ordered 3x4 affine transformation, ie: the arrangement in memory is:
00033 # where the upper 3x3 matrix is orthonormal
00034 # [0] [3] [6] [9]
00035 # [1] [4] [7] [10]
00036 # [2] [5] [8] [11]
00037 float32[12] m
00038
00039 """
00040 __slots__ = ['name','attachedlink','trelative','tglobal','type']
00041 _slot_types = ['string','int8','openraveros/AffineTransformMatrix','openraveros/AffineTransformMatrix','string']
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 name,attachedlink,trelative,tglobal,type
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(AttachedSensor, self).__init__(*args, **kwds)
00059
00060 if self.name is None:
00061 self.name = ''
00062 if self.attachedlink is None:
00063 self.attachedlink = 0
00064 if self.trelative is None:
00065 self.trelative = openraveros.msg.AffineTransformMatrix()
00066 if self.tglobal is None:
00067 self.tglobal = openraveros.msg.AffineTransformMatrix()
00068 if self.type is None:
00069 self.type = ''
00070 else:
00071 self.name = ''
00072 self.attachedlink = 0
00073 self.trelative = openraveros.msg.AffineTransformMatrix()
00074 self.tglobal = openraveros.msg.AffineTransformMatrix()
00075 self.type = ''
00076
00077 def _get_types(self):
00078 """
00079 internal API method
00080 """
00081 return self._slot_types
00082
00083 def serialize(self, buff):
00084 """
00085 serialize message into buffer
00086 :param buff: buffer, ``StringIO``
00087 """
00088 try:
00089 _x = self.name
00090 length = len(_x)
00091 if python3 or type(_x) == unicode:
00092 _x = _x.encode('utf-8')
00093 length = len(_x)
00094 buff.write(struct.pack('<I%ss'%length, length, _x))
00095 buff.write(_struct_b.pack(self.attachedlink))
00096 buff.write(_struct_12f.pack(*self.trelative.m))
00097 buff.write(_struct_12f.pack(*self.tglobal.m))
00098 _x = self.type
00099 length = len(_x)
00100 if python3 or type(_x) == unicode:
00101 _x = _x.encode('utf-8')
00102 length = len(_x)
00103 buff.write(struct.pack('<I%ss'%length, length, _x))
00104 except struct.error as se: self._check_types(se)
00105 except TypeError as te: self._check_types(te)
00106
00107 def deserialize(self, str):
00108 """
00109 unpack serialized message in str into this message instance
00110 :param str: byte array of serialized message, ``str``
00111 """
00112 try:
00113 if self.trelative is None:
00114 self.trelative = openraveros.msg.AffineTransformMatrix()
00115 if self.tglobal is None:
00116 self.tglobal = openraveros.msg.AffineTransformMatrix()
00117 end = 0
00118 start = end
00119 end += 4
00120 (length,) = _struct_I.unpack(str[start:end])
00121 start = end
00122 end += length
00123 if python3:
00124 self.name = str[start:end].decode('utf-8')
00125 else:
00126 self.name = str[start:end]
00127 start = end
00128 end += 1
00129 (self.attachedlink,) = _struct_b.unpack(str[start:end])
00130 start = end
00131 end += 48
00132 self.trelative.m = _struct_12f.unpack(str[start:end])
00133 start = end
00134 end += 48
00135 self.tglobal.m = _struct_12f.unpack(str[start:end])
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 start = end
00140 end += length
00141 if python3:
00142 self.type = str[start:end].decode('utf-8')
00143 else:
00144 self.type = str[start:end]
00145 return self
00146 except struct.error as e:
00147 raise genpy.DeserializationError(e)
00148
00149
00150 def serialize_numpy(self, buff, numpy):
00151 """
00152 serialize message with numpy array types into buffer
00153 :param buff: buffer, ``StringIO``
00154 :param numpy: numpy python module
00155 """
00156 try:
00157 _x = self.name
00158 length = len(_x)
00159 if python3 or type(_x) == unicode:
00160 _x = _x.encode('utf-8')
00161 length = len(_x)
00162 buff.write(struct.pack('<I%ss'%length, length, _x))
00163 buff.write(_struct_b.pack(self.attachedlink))
00164 buff.write(self.trelative.m.tostring())
00165 buff.write(self.tglobal.m.tostring())
00166 _x = self.type
00167 length = len(_x)
00168 if python3 or type(_x) == unicode:
00169 _x = _x.encode('utf-8')
00170 length = len(_x)
00171 buff.write(struct.pack('<I%ss'%length, length, _x))
00172 except struct.error as se: self._check_types(se)
00173 except TypeError as te: self._check_types(te)
00174
00175 def deserialize_numpy(self, str, numpy):
00176 """
00177 unpack serialized message in str into this message instance using numpy for array types
00178 :param str: byte array of serialized message, ``str``
00179 :param numpy: numpy python module
00180 """
00181 try:
00182 if self.trelative is None:
00183 self.trelative = openraveros.msg.AffineTransformMatrix()
00184 if self.tglobal is None:
00185 self.tglobal = openraveros.msg.AffineTransformMatrix()
00186 end = 0
00187 start = end
00188 end += 4
00189 (length,) = _struct_I.unpack(str[start:end])
00190 start = end
00191 end += length
00192 if python3:
00193 self.name = str[start:end].decode('utf-8')
00194 else:
00195 self.name = str[start:end]
00196 start = end
00197 end += 1
00198 (self.attachedlink,) = _struct_b.unpack(str[start:end])
00199 start = end
00200 end += 48
00201 self.trelative.m = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=12)
00202 start = end
00203 end += 48
00204 self.tglobal.m = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=12)
00205 start = end
00206 end += 4
00207 (length,) = _struct_I.unpack(str[start:end])
00208 start = end
00209 end += length
00210 if python3:
00211 self.type = str[start:end].decode('utf-8')
00212 else:
00213 self.type = str[start:end]
00214 return self
00215 except struct.error as e:
00216 raise genpy.DeserializationError(e)
00217
00218 _struct_I = genpy.struct_I
00219 _struct_b = struct.Struct("<b")
00220 _struct_12f = struct.Struct("<12f")