_OrderedCollisionOperations.py
Go to the documentation of this file.
00001 """autogenerated by genpy from arm_navigation_msgs/OrderedCollisionOperations.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 arm_navigation_msgs.msg
00008 
00009 class OrderedCollisionOperations(genpy.Message):
00010   _md5sum = "f171f973b185d4d0121795080114026a"
00011   _type = "arm_navigation_msgs/OrderedCollisionOperations"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# A set of collision operations that will be performed in the order they are specified
00014 CollisionOperation[] collision_operations
00015 ================================================================================
00016 MSG: arm_navigation_msgs/CollisionOperation
00017 # A definition of a collision operation
00018 # E.g. ("gripper",COLLISION_SET_ALL,ENABLE) will enable collisions 
00019 # between the gripper and all objects in the collision space
00020 
00021 string object1
00022 string object2
00023 string COLLISION_SET_ALL="all"
00024 string COLLISION_SET_OBJECTS="objects"
00025 string COLLISION_SET_ATTACHED_OBJECTS="attached"
00026 
00027 # The penetration distance to which collisions are allowed. This is 0.0 by default.
00028 float64 penetration_distance
00029 
00030 # Flag that determines whether collisions will be enabled or disabled for the pair of objects specified above
00031 int32 operation
00032 int32 DISABLE=0
00033 int32 ENABLE=1
00034 
00035 """
00036   __slots__ = ['collision_operations']
00037   _slot_types = ['arm_navigation_msgs/CollisionOperation[]']
00038 
00039   def __init__(self, *args, **kwds):
00040     """
00041     Constructor. Any message fields that are implicitly/explicitly
00042     set to None will be assigned a default value. The recommend
00043     use is keyword arguments as this is more robust to future message
00044     changes.  You cannot mix in-order arguments and keyword arguments.
00045 
00046     The available fields are:
00047        collision_operations
00048 
00049     :param args: complete set of field values, in .msg order
00050     :param kwds: use keyword arguments corresponding to message field names
00051     to set specific fields.
00052     """
00053     if args or kwds:
00054       super(OrderedCollisionOperations, self).__init__(*args, **kwds)
00055       #message fields cannot be None, assign default values for those that are
00056       if self.collision_operations is None:
00057         self.collision_operations = []
00058     else:
00059       self.collision_operations = []
00060 
00061   def _get_types(self):
00062     """
00063     internal API method
00064     """
00065     return self._slot_types
00066 
00067   def serialize(self, buff):
00068     """
00069     serialize message into buffer
00070     :param buff: buffer, ``StringIO``
00071     """
00072     try:
00073       length = len(self.collision_operations)
00074       buff.write(_struct_I.pack(length))
00075       for val1 in self.collision_operations:
00076         _x = val1.object1
00077         length = len(_x)
00078         if python3 or type(_x) == unicode:
00079           _x = _x.encode('utf-8')
00080           length = len(_x)
00081         buff.write(struct.pack('<I%ss'%length, length, _x))
00082         _x = val1.object2
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         _x = val1
00089         buff.write(_struct_di.pack(_x.penetration_distance, _x.operation))
00090     except struct.error as se: self._check_types(se)
00091     except TypeError as te: self._check_types(te)
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.collision_operations is None:
00100         self.collision_operations = None
00101       end = 0
00102       start = end
00103       end += 4
00104       (length,) = _struct_I.unpack(str[start:end])
00105       self.collision_operations = []
00106       for i in range(0, length):
00107         val1 = arm_navigation_msgs.msg.CollisionOperation()
00108         start = end
00109         end += 4
00110         (length,) = _struct_I.unpack(str[start:end])
00111         start = end
00112         end += length
00113         if python3:
00114           val1.object1 = str[start:end].decode('utf-8')
00115         else:
00116           val1.object1 = str[start:end]
00117         start = end
00118         end += 4
00119         (length,) = _struct_I.unpack(str[start:end])
00120         start = end
00121         end += length
00122         if python3:
00123           val1.object2 = str[start:end].decode('utf-8')
00124         else:
00125           val1.object2 = str[start:end]
00126         _x = val1
00127         start = end
00128         end += 12
00129         (_x.penetration_distance, _x.operation,) = _struct_di.unpack(str[start:end])
00130         self.collision_operations.append(val1)
00131       return self
00132     except struct.error as e:
00133       raise genpy.DeserializationError(e) #most likely buffer underfill
00134 
00135 
00136   def serialize_numpy(self, buff, numpy):
00137     """
00138     serialize message with numpy array types into buffer
00139     :param buff: buffer, ``StringIO``
00140     :param numpy: numpy python module
00141     """
00142     try:
00143       length = len(self.collision_operations)
00144       buff.write(_struct_I.pack(length))
00145       for val1 in self.collision_operations:
00146         _x = val1.object1
00147         length = len(_x)
00148         if python3 or type(_x) == unicode:
00149           _x = _x.encode('utf-8')
00150           length = len(_x)
00151         buff.write(struct.pack('<I%ss'%length, length, _x))
00152         _x = val1.object2
00153         length = len(_x)
00154         if python3 or type(_x) == unicode:
00155           _x = _x.encode('utf-8')
00156           length = len(_x)
00157         buff.write(struct.pack('<I%ss'%length, length, _x))
00158         _x = val1
00159         buff.write(_struct_di.pack(_x.penetration_distance, _x.operation))
00160     except struct.error as se: self._check_types(se)
00161     except TypeError as te: self._check_types(te)
00162 
00163   def deserialize_numpy(self, str, numpy):
00164     """
00165     unpack serialized message in str into this message instance using numpy for array types
00166     :param str: byte array of serialized message, ``str``
00167     :param numpy: numpy python module
00168     """
00169     try:
00170       if self.collision_operations is None:
00171         self.collision_operations = None
00172       end = 0
00173       start = end
00174       end += 4
00175       (length,) = _struct_I.unpack(str[start:end])
00176       self.collision_operations = []
00177       for i in range(0, length):
00178         val1 = arm_navigation_msgs.msg.CollisionOperation()
00179         start = end
00180         end += 4
00181         (length,) = _struct_I.unpack(str[start:end])
00182         start = end
00183         end += length
00184         if python3:
00185           val1.object1 = str[start:end].decode('utf-8')
00186         else:
00187           val1.object1 = str[start:end]
00188         start = end
00189         end += 4
00190         (length,) = _struct_I.unpack(str[start:end])
00191         start = end
00192         end += length
00193         if python3:
00194           val1.object2 = str[start:end].decode('utf-8')
00195         else:
00196           val1.object2 = str[start:end]
00197         _x = val1
00198         start = end
00199         end += 12
00200         (_x.penetration_distance, _x.operation,) = _struct_di.unpack(str[start:end])
00201         self.collision_operations.append(val1)
00202       return self
00203     except struct.error as e:
00204       raise genpy.DeserializationError(e) #most likely buffer underfill
00205 
00206 _struct_I = genpy.struct_I
00207 _struct_di = struct.Struct("<di")


arm_navigation_msgs
Author(s): Gil Jones
autogenerated on Mon Dec 2 2013 12:31:50