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