_Manipulator.py
Go to the documentation of this file.
00001 """autogenerated by genpy from openraveros/Manipulator.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 Manipulator(genpy.Message):
00010   _md5sum = "60775f163caf6091aa7df7e34e3cf146"
00011   _type = "openraveros/Manipulator"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# information specific to a manipulator for a robot
00014 
00015 # zero-based index of base link that manipulator is attached to
00016 int8 baselink
00017 
00018 # zero-based index of link defining the end-effector
00019 int8 eelink
00020 
00021 # 3x4 matrix of the grasp frame relative to the end-effector link
00022 AffineTransformMatrix tgrasp
00023 
00024 # zero-based hand joint indices
00025 uint8[] handjoints
00026 
00027 # zero-based arm joints indices (from base to end-effector)
00028 uint8[] armjoints
00029 
00030 # name of ik solver using
00031 string iksolvername
00032 
00033 # manipulator name
00034 string name
00035 
00036 ================================================================================
00037 MSG: openraveros/AffineTransformMatrix
00038 # column ordered 3x4 affine transformation, ie: the arrangement in memory is:
00039 # where the upper 3x3 matrix is orthonormal
00040 # [0] [3] [6] [9]
00041 # [1] [4] [7] [10]
00042 # [2] [5] [8] [11]
00043 float32[12] m
00044 
00045 """
00046   __slots__ = ['baselink','eelink','tgrasp','handjoints','armjoints','iksolvername','name']
00047   _slot_types = ['int8','int8','openraveros/AffineTransformMatrix','uint8[]','uint8[]','string','string']
00048 
00049   def __init__(self, *args, **kwds):
00050     """
00051     Constructor. Any message fields that are implicitly/explicitly
00052     set to None will be assigned a default value. The recommend
00053     use is keyword arguments as this is more robust to future message
00054     changes.  You cannot mix in-order arguments and keyword arguments.
00055 
00056     The available fields are:
00057        baselink,eelink,tgrasp,handjoints,armjoints,iksolvername,name
00058 
00059     :param args: complete set of field values, in .msg order
00060     :param kwds: use keyword arguments corresponding to message field names
00061     to set specific fields.
00062     """
00063     if args or kwds:
00064       super(Manipulator, self).__init__(*args, **kwds)
00065       #message fields cannot be None, assign default values for those that are
00066       if self.baselink is None:
00067         self.baselink = 0
00068       if self.eelink is None:
00069         self.eelink = 0
00070       if self.tgrasp is None:
00071         self.tgrasp = openraveros.msg.AffineTransformMatrix()
00072       if self.handjoints is None:
00073         self.handjoints = ''
00074       if self.armjoints is None:
00075         self.armjoints = ''
00076       if self.iksolvername is None:
00077         self.iksolvername = ''
00078       if self.name is None:
00079         self.name = ''
00080     else:
00081       self.baselink = 0
00082       self.eelink = 0
00083       self.tgrasp = openraveros.msg.AffineTransformMatrix()
00084       self.handjoints = ''
00085       self.armjoints = ''
00086       self.iksolvername = ''
00087       self.name = ''
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_2b.pack(_x.baselink, _x.eelink))
00103       buff.write(_struct_12f.pack(*self.tgrasp.m))
00104       _x = self.handjoints
00105       length = len(_x)
00106       # - if encoded as a list instead, serialize as bytes instead of string
00107       if type(_x) in [list, tuple]:
00108         buff.write(struct.pack('<I%sB'%length, length, *_x))
00109       else:
00110         buff.write(struct.pack('<I%ss'%length, length, _x))
00111       _x = self.armjoints
00112       length = len(_x)
00113       # - if encoded as a list instead, serialize as bytes instead of string
00114       if type(_x) in [list, tuple]:
00115         buff.write(struct.pack('<I%sB'%length, length, *_x))
00116       else:
00117         buff.write(struct.pack('<I%ss'%length, length, _x))
00118       _x = self.iksolvername
00119       length = len(_x)
00120       if python3 or type(_x) == unicode:
00121         _x = _x.encode('utf-8')
00122         length = len(_x)
00123       buff.write(struct.pack('<I%ss'%length, length, _x))
00124       _x = self.name
00125       length = len(_x)
00126       if python3 or type(_x) == unicode:
00127         _x = _x.encode('utf-8')
00128         length = len(_x)
00129       buff.write(struct.pack('<I%ss'%length, length, _x))
00130     except struct.error as se: self._check_types(se)
00131     except TypeError as te: self._check_types(te)
00132 
00133   def deserialize(self, str):
00134     """
00135     unpack serialized message in str into this message instance
00136     :param str: byte array of serialized message, ``str``
00137     """
00138     try:
00139       if self.tgrasp is None:
00140         self.tgrasp = openraveros.msg.AffineTransformMatrix()
00141       end = 0
00142       _x = self
00143       start = end
00144       end += 2
00145       (_x.baselink, _x.eelink,) = _struct_2b.unpack(str[start:end])
00146       start = end
00147       end += 48
00148       self.tgrasp.m = _struct_12f.unpack(str[start:end])
00149       start = end
00150       end += 4
00151       (length,) = _struct_I.unpack(str[start:end])
00152       start = end
00153       end += length
00154       if python3:
00155         self.handjoints = str[start:end].decode('utf-8')
00156       else:
00157         self.handjoints = str[start:end]
00158       start = end
00159       end += 4
00160       (length,) = _struct_I.unpack(str[start:end])
00161       start = end
00162       end += length
00163       if python3:
00164         self.armjoints = str[start:end].decode('utf-8')
00165       else:
00166         self.armjoints = str[start:end]
00167       start = end
00168       end += 4
00169       (length,) = _struct_I.unpack(str[start:end])
00170       start = end
00171       end += length
00172       if python3:
00173         self.iksolvername = str[start:end].decode('utf-8')
00174       else:
00175         self.iksolvername = str[start:end]
00176       start = end
00177       end += 4
00178       (length,) = _struct_I.unpack(str[start:end])
00179       start = end
00180       end += length
00181       if python3:
00182         self.name = str[start:end].decode('utf-8')
00183       else:
00184         self.name = str[start:end]
00185       return self
00186     except struct.error as e:
00187       raise genpy.DeserializationError(e) #most likely buffer underfill
00188 
00189 
00190   def serialize_numpy(self, buff, numpy):
00191     """
00192     serialize message with numpy array types into buffer
00193     :param buff: buffer, ``StringIO``
00194     :param numpy: numpy python module
00195     """
00196     try:
00197       _x = self
00198       buff.write(_struct_2b.pack(_x.baselink, _x.eelink))
00199       buff.write(self.tgrasp.m.tostring())
00200       _x = self.handjoints
00201       length = len(_x)
00202       # - if encoded as a list instead, serialize as bytes instead of string
00203       if type(_x) in [list, tuple]:
00204         buff.write(struct.pack('<I%sB'%length, length, *_x))
00205       else:
00206         buff.write(struct.pack('<I%ss'%length, length, _x))
00207       _x = self.armjoints
00208       length = len(_x)
00209       # - if encoded as a list instead, serialize as bytes instead of string
00210       if type(_x) in [list, tuple]:
00211         buff.write(struct.pack('<I%sB'%length, length, *_x))
00212       else:
00213         buff.write(struct.pack('<I%ss'%length, length, _x))
00214       _x = self.iksolvername
00215       length = len(_x)
00216       if python3 or type(_x) == unicode:
00217         _x = _x.encode('utf-8')
00218         length = len(_x)
00219       buff.write(struct.pack('<I%ss'%length, length, _x))
00220       _x = self.name
00221       length = len(_x)
00222       if python3 or type(_x) == unicode:
00223         _x = _x.encode('utf-8')
00224         length = len(_x)
00225       buff.write(struct.pack('<I%ss'%length, length, _x))
00226     except struct.error as se: self._check_types(se)
00227     except TypeError as te: self._check_types(te)
00228 
00229   def deserialize_numpy(self, str, numpy):
00230     """
00231     unpack serialized message in str into this message instance using numpy for array types
00232     :param str: byte array of serialized message, ``str``
00233     :param numpy: numpy python module
00234     """
00235     try:
00236       if self.tgrasp is None:
00237         self.tgrasp = openraveros.msg.AffineTransformMatrix()
00238       end = 0
00239       _x = self
00240       start = end
00241       end += 2
00242       (_x.baselink, _x.eelink,) = _struct_2b.unpack(str[start:end])
00243       start = end
00244       end += 48
00245       self.tgrasp.m = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=12)
00246       start = end
00247       end += 4
00248       (length,) = _struct_I.unpack(str[start:end])
00249       start = end
00250       end += length
00251       if python3:
00252         self.handjoints = str[start:end].decode('utf-8')
00253       else:
00254         self.handjoints = str[start:end]
00255       start = end
00256       end += 4
00257       (length,) = _struct_I.unpack(str[start:end])
00258       start = end
00259       end += length
00260       if python3:
00261         self.armjoints = str[start:end].decode('utf-8')
00262       else:
00263         self.armjoints = str[start:end]
00264       start = end
00265       end += 4
00266       (length,) = _struct_I.unpack(str[start:end])
00267       start = end
00268       end += length
00269       if python3:
00270         self.iksolvername = str[start:end].decode('utf-8')
00271       else:
00272         self.iksolvername = str[start:end]
00273       start = end
00274       end += 4
00275       (length,) = _struct_I.unpack(str[start:end])
00276       start = end
00277       end += length
00278       if python3:
00279         self.name = str[start:end].decode('utf-8')
00280       else:
00281         self.name = str[start:end]
00282       return self
00283     except struct.error as e:
00284       raise genpy.DeserializationError(e) #most likely buffer underfill
00285 
00286 _struct_I = genpy.struct_I
00287 _struct_12f = struct.Struct("<12f")
00288 _struct_2b = struct.Struct("<2b")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


openraveros
Author(s): Rosen Diankov (rosen.diankov@gmail.com)
autogenerated on Sat Mar 23 2013 22:15:38