_ActiveDOFs.py
Go to the documentation of this file.
00001 """autogenerated by genpy from openraveros/ActiveDOFs.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class ActiveDOFs(genpy.Message):
00009   _md5sum = "360c4d1931d07ad7864b05990ca89900"
00010   _type = "openraveros/ActiveDOFs"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# specifies the active degrees of freedom of the robot
00013 
00014 # mask of active base degrees of freedom
00015 uint32 affine
00016 
00017 # active joints
00018 int32[] indices
00019 
00020 float32[3] rotationaxis
00021 
00022 # mask for affine dofs
00023 uint8 DOF_X = 1
00024 uint8 DOF_Y = 2
00025 uint8 DOF_Z = 4
00026 uint8 DOF_RotationAxis = 8
00027 uint8 DOF_Rotation3D = 16
00028 uint8 DOF_RotationQuat = 32
00029 
00030 """
00031   # Pseudo-constants
00032   DOF_X = 1
00033   DOF_Y = 2
00034   DOF_Z = 4
00035   DOF_RotationAxis = 8
00036   DOF_Rotation3D = 16
00037   DOF_RotationQuat = 32
00038 
00039   __slots__ = ['affine','indices','rotationaxis']
00040   _slot_types = ['uint32','int32[]','float32[3]']
00041 
00042   def __init__(self, *args, **kwds):
00043     """
00044     Constructor. Any message fields that are implicitly/explicitly
00045     set to None will be assigned a default value. The recommend
00046     use is keyword arguments as this is more robust to future message
00047     changes.  You cannot mix in-order arguments and keyword arguments.
00048 
00049     The available fields are:
00050        affine,indices,rotationaxis
00051 
00052     :param args: complete set of field values, in .msg order
00053     :param kwds: use keyword arguments corresponding to message field names
00054     to set specific fields.
00055     """
00056     if args or kwds:
00057       super(ActiveDOFs, self).__init__(*args, **kwds)
00058       #message fields cannot be None, assign default values for those that are
00059       if self.affine is None:
00060         self.affine = 0
00061       if self.indices is None:
00062         self.indices = []
00063       if self.rotationaxis is None:
00064         self.rotationaxis = [0.,0.,0.]
00065     else:
00066       self.affine = 0
00067       self.indices = []
00068       self.rotationaxis = [0.,0.,0.]
00069 
00070   def _get_types(self):
00071     """
00072     internal API method
00073     """
00074     return self._slot_types
00075 
00076   def serialize(self, buff):
00077     """
00078     serialize message into buffer
00079     :param buff: buffer, ``StringIO``
00080     """
00081     try:
00082       buff.write(_struct_I.pack(self.affine))
00083       length = len(self.indices)
00084       buff.write(_struct_I.pack(length))
00085       pattern = '<%si'%length
00086       buff.write(struct.pack(pattern, *self.indices))
00087       buff.write(_struct_3f.pack(*self.rotationaxis))
00088     except struct.error as se: self._check_types(se)
00089     except TypeError as te: self._check_types(te)
00090 
00091   def deserialize(self, str):
00092     """
00093     unpack serialized message in str into this message instance
00094     :param str: byte array of serialized message, ``str``
00095     """
00096     try:
00097       end = 0
00098       start = end
00099       end += 4
00100       (self.affine,) = _struct_I.unpack(str[start:end])
00101       start = end
00102       end += 4
00103       (length,) = _struct_I.unpack(str[start:end])
00104       pattern = '<%si'%length
00105       start = end
00106       end += struct.calcsize(pattern)
00107       self.indices = struct.unpack(pattern, str[start:end])
00108       start = end
00109       end += 12
00110       self.rotationaxis = _struct_3f.unpack(str[start:end])
00111       return self
00112     except struct.error as e:
00113       raise genpy.DeserializationError(e) #most likely buffer underfill
00114 
00115 
00116   def serialize_numpy(self, buff, numpy):
00117     """
00118     serialize message with numpy array types into buffer
00119     :param buff: buffer, ``StringIO``
00120     :param numpy: numpy python module
00121     """
00122     try:
00123       buff.write(_struct_I.pack(self.affine))
00124       length = len(self.indices)
00125       buff.write(_struct_I.pack(length))
00126       pattern = '<%si'%length
00127       buff.write(self.indices.tostring())
00128       buff.write(self.rotationaxis.tostring())
00129     except struct.error as se: self._check_types(se)
00130     except TypeError as te: self._check_types(te)
00131 
00132   def deserialize_numpy(self, str, numpy):
00133     """
00134     unpack serialized message in str into this message instance using numpy for array types
00135     :param str: byte array of serialized message, ``str``
00136     :param numpy: numpy python module
00137     """
00138     try:
00139       end = 0
00140       start = end
00141       end += 4
00142       (self.affine,) = _struct_I.unpack(str[start:end])
00143       start = end
00144       end += 4
00145       (length,) = _struct_I.unpack(str[start:end])
00146       pattern = '<%si'%length
00147       start = end
00148       end += struct.calcsize(pattern)
00149       self.indices = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00150       start = end
00151       end += 12
00152       self.rotationaxis = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00153       return self
00154     except struct.error as e:
00155       raise genpy.DeserializationError(e) #most likely buffer underfill
00156 
00157 _struct_I = genpy.struct_I
00158 _struct_3f = struct.Struct("<3f")
 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:37