_AllowedCollisionMatrix.py
Go to the documentation of this file.
00001 """autogenerated by genpy from arm_navigation_msgs/AllowedCollisionMatrix.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 AllowedCollisionMatrix(genpy.Message):
00010   _md5sum = "c5785d58d2d0b6270738f65222dbec5d"
00011   _type = "arm_navigation_msgs/AllowedCollisionMatrix"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# the list of link names in the matrix
00014 string[] link_names
00015 
00016 # the individual entries in the allowed collision matrix
00017 # symmetric, with same order as link_names
00018 AllowedCollisionEntry[] entries
00019 
00020 ================================================================================
00021 MSG: arm_navigation_msgs/AllowedCollisionEntry
00022 # whether or not collision checking is enabled
00023 bool[] enabled
00024 
00025 """
00026   __slots__ = ['link_names','entries']
00027   _slot_types = ['string[]','arm_navigation_msgs/AllowedCollisionEntry[]']
00028 
00029   def __init__(self, *args, **kwds):
00030     """
00031     Constructor. Any message fields that are implicitly/explicitly
00032     set to None will be assigned a default value. The recommend
00033     use is keyword arguments as this is more robust to future message
00034     changes.  You cannot mix in-order arguments and keyword arguments.
00035 
00036     The available fields are:
00037        link_names,entries
00038 
00039     :param args: complete set of field values, in .msg order
00040     :param kwds: use keyword arguments corresponding to message field names
00041     to set specific fields.
00042     """
00043     if args or kwds:
00044       super(AllowedCollisionMatrix, self).__init__(*args, **kwds)
00045       #message fields cannot be None, assign default values for those that are
00046       if self.link_names is None:
00047         self.link_names = []
00048       if self.entries is None:
00049         self.entries = []
00050     else:
00051       self.link_names = []
00052       self.entries = []
00053 
00054   def _get_types(self):
00055     """
00056     internal API method
00057     """
00058     return self._slot_types
00059 
00060   def serialize(self, buff):
00061     """
00062     serialize message into buffer
00063     :param buff: buffer, ``StringIO``
00064     """
00065     try:
00066       length = len(self.link_names)
00067       buff.write(_struct_I.pack(length))
00068       for val1 in self.link_names:
00069         length = len(val1)
00070         if python3 or type(val1) == unicode:
00071           val1 = val1.encode('utf-8')
00072           length = len(val1)
00073         buff.write(struct.pack('<I%ss'%length, length, val1))
00074       length = len(self.entries)
00075       buff.write(_struct_I.pack(length))
00076       for val1 in self.entries:
00077         length = len(val1.enabled)
00078         buff.write(_struct_I.pack(length))
00079         pattern = '<%sB'%length
00080         buff.write(struct.pack(pattern, *val1.enabled))
00081     except struct.error as se: self._check_types(se)
00082     except TypeError as te: self._check_types(te)
00083 
00084   def deserialize(self, str):
00085     """
00086     unpack serialized message in str into this message instance
00087     :param str: byte array of serialized message, ``str``
00088     """
00089     try:
00090       if self.entries is None:
00091         self.entries = None
00092       end = 0
00093       start = end
00094       end += 4
00095       (length,) = _struct_I.unpack(str[start:end])
00096       self.link_names = []
00097       for i in range(0, length):
00098         start = end
00099         end += 4
00100         (length,) = _struct_I.unpack(str[start:end])
00101         start = end
00102         end += length
00103         if python3:
00104           val1 = str[start:end].decode('utf-8')
00105         else:
00106           val1 = str[start:end]
00107         self.link_names.append(val1)
00108       start = end
00109       end += 4
00110       (length,) = _struct_I.unpack(str[start:end])
00111       self.entries = []
00112       for i in range(0, length):
00113         val1 = arm_navigation_msgs.msg.AllowedCollisionEntry()
00114         start = end
00115         end += 4
00116         (length,) = _struct_I.unpack(str[start:end])
00117         pattern = '<%sB'%length
00118         start = end
00119         end += struct.calcsize(pattern)
00120         val1.enabled = struct.unpack(pattern, str[start:end])
00121         val1.enabled = map(bool, val1.enabled)
00122         self.entries.append(val1)
00123       return self
00124     except struct.error as e:
00125       raise genpy.DeserializationError(e) #most likely buffer underfill
00126 
00127 
00128   def serialize_numpy(self, buff, numpy):
00129     """
00130     serialize message with numpy array types into buffer
00131     :param buff: buffer, ``StringIO``
00132     :param numpy: numpy python module
00133     """
00134     try:
00135       length = len(self.link_names)
00136       buff.write(_struct_I.pack(length))
00137       for val1 in self.link_names:
00138         length = len(val1)
00139         if python3 or type(val1) == unicode:
00140           val1 = val1.encode('utf-8')
00141           length = len(val1)
00142         buff.write(struct.pack('<I%ss'%length, length, val1))
00143       length = len(self.entries)
00144       buff.write(_struct_I.pack(length))
00145       for val1 in self.entries:
00146         length = len(val1.enabled)
00147         buff.write(_struct_I.pack(length))
00148         pattern = '<%sB'%length
00149         buff.write(val1.enabled.tostring())
00150     except struct.error as se: self._check_types(se)
00151     except TypeError as te: self._check_types(te)
00152 
00153   def deserialize_numpy(self, str, numpy):
00154     """
00155     unpack serialized message in str into this message instance using numpy for array types
00156     :param str: byte array of serialized message, ``str``
00157     :param numpy: numpy python module
00158     """
00159     try:
00160       if self.entries is None:
00161         self.entries = None
00162       end = 0
00163       start = end
00164       end += 4
00165       (length,) = _struct_I.unpack(str[start:end])
00166       self.link_names = []
00167       for i in range(0, length):
00168         start = end
00169         end += 4
00170         (length,) = _struct_I.unpack(str[start:end])
00171         start = end
00172         end += length
00173         if python3:
00174           val1 = str[start:end].decode('utf-8')
00175         else:
00176           val1 = str[start:end]
00177         self.link_names.append(val1)
00178       start = end
00179       end += 4
00180       (length,) = _struct_I.unpack(str[start:end])
00181       self.entries = []
00182       for i in range(0, length):
00183         val1 = arm_navigation_msgs.msg.AllowedCollisionEntry()
00184         start = end
00185         end += 4
00186         (length,) = _struct_I.unpack(str[start:end])
00187         pattern = '<%sB'%length
00188         start = end
00189         end += struct.calcsize(pattern)
00190         val1.enabled = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=length)
00191         val1.enabled = map(bool, val1.enabled)
00192         self.entries.append(val1)
00193       return self
00194     except struct.error as e:
00195       raise genpy.DeserializationError(e) #most likely buffer underfill
00196 
00197 _struct_I = genpy.struct_I


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