_Ray.py
Go to the documentation of this file.
00001 """autogenerated by genpy from openraveros/Ray.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 Ray(genpy.Message):
00009   _md5sum = "f959602c8c2ec407852a35257f84293c"
00010   _type = "openraveros/Ray"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# defines a ray starting at position and going along direction
00013 float32[3] position
00014 float32[3] direction
00015 
00016 """
00017   __slots__ = ['position','direction']
00018   _slot_types = ['float32[3]','float32[3]']
00019 
00020   def __init__(self, *args, **kwds):
00021     """
00022     Constructor. Any message fields that are implicitly/explicitly
00023     set to None will be assigned a default value. The recommend
00024     use is keyword arguments as this is more robust to future message
00025     changes.  You cannot mix in-order arguments and keyword arguments.
00026 
00027     The available fields are:
00028        position,direction
00029 
00030     :param args: complete set of field values, in .msg order
00031     :param kwds: use keyword arguments corresponding to message field names
00032     to set specific fields.
00033     """
00034     if args or kwds:
00035       super(Ray, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.position is None:
00038         self.position = [0.,0.,0.]
00039       if self.direction is None:
00040         self.direction = [0.,0.,0.]
00041     else:
00042       self.position = [0.,0.,0.]
00043       self.direction = [0.,0.,0.]
00044 
00045   def _get_types(self):
00046     """
00047     internal API method
00048     """
00049     return self._slot_types
00050 
00051   def serialize(self, buff):
00052     """
00053     serialize message into buffer
00054     :param buff: buffer, ``StringIO``
00055     """
00056     try:
00057       buff.write(_struct_3f.pack(*self.position))
00058       buff.write(_struct_3f.pack(*self.direction))
00059     except struct.error as se: self._check_types(se)
00060     except TypeError as te: self._check_types(te)
00061 
00062   def deserialize(self, str):
00063     """
00064     unpack serialized message in str into this message instance
00065     :param str: byte array of serialized message, ``str``
00066     """
00067     try:
00068       end = 0
00069       start = end
00070       end += 12
00071       self.position = _struct_3f.unpack(str[start:end])
00072       start = end
00073       end += 12
00074       self.direction = _struct_3f.unpack(str[start:end])
00075       return self
00076     except struct.error as e:
00077       raise genpy.DeserializationError(e) #most likely buffer underfill
00078 
00079 
00080   def serialize_numpy(self, buff, numpy):
00081     """
00082     serialize message with numpy array types into buffer
00083     :param buff: buffer, ``StringIO``
00084     :param numpy: numpy python module
00085     """
00086     try:
00087       buff.write(self.position.tostring())
00088       buff.write(self.direction.tostring())
00089     except struct.error as se: self._check_types(se)
00090     except TypeError as te: self._check_types(te)
00091 
00092   def deserialize_numpy(self, str, numpy):
00093     """
00094     unpack serialized message in str into this message instance using numpy for array types
00095     :param str: byte array of serialized message, ``str``
00096     :param numpy: numpy python module
00097     """
00098     try:
00099       end = 0
00100       start = end
00101       end += 12
00102       self.position = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00103       start = end
00104       end += 12
00105       self.direction = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00106       return self
00107     except struct.error as e:
00108       raise genpy.DeserializationError(e) #most likely buffer underfill
00109 
00110 _struct_I = genpy.struct_I
00111 _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:39