00001 """autogenerated by genmsg_py from CollisionMap.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import mapping_msgs.msg
00006 import geometry_msgs.msg
00007 import std_msgs.msg
00008
00009 class CollisionMap(roslib.message.Message):
00010 _md5sum = "18ca54db41ccebbe82f61f9801dede89"
00011 _type = "mapping_msgs/CollisionMap"
00012 _has_header = True
00013 _full_text = """#header for interpreting box positions
00014 Header header
00015
00016 #boxes for use in collision testing
00017 OrientedBoundingBox[] boxes
00018
00019 ================================================================================
00020 MSG: std_msgs/Header
00021 # Standard metadata for higher-level stamped data types.
00022 # This is generally used to communicate timestamped data
00023 # in a particular coordinate frame.
00024 #
00025 # sequence ID: consecutively increasing ID
00026 uint32 seq
00027 #Two-integer timestamp that is expressed as:
00028 # * stamp.secs: seconds (stamp_secs) since epoch
00029 # * stamp.nsecs: nanoseconds since stamp_secs
00030 # time-handling sugar is provided by the client library
00031 time stamp
00032 #Frame this data is associated with
00033 # 0: no frame
00034 # 1: global frame
00035 string frame_id
00036
00037 ================================================================================
00038 MSG: mapping_msgs/OrientedBoundingBox
00039 #the center of the box
00040 geometry_msgs/Point32 center
00041
00042 #the extents of the box, assuming the center is at the point
00043 geometry_msgs/Point32 extents
00044
00045 #the axis of the box
00046 geometry_msgs/Point32 axis
00047
00048 #the angle of rotation around the axis
00049 float32 angle
00050
00051 ================================================================================
00052 MSG: geometry_msgs/Point32
00053 # This contains the position of a point in free space(with 32 bits of precision).
00054 # It is recommeded to use Point wherever possible instead of Point32.
00055 #
00056 # This recommendation is to promote interoperability.
00057 #
00058 # This message is designed to take up less space when sending
00059 # lots of points at once, as in the case of a PointCloud.
00060
00061 float32 x
00062 float32 y
00063 float32 z
00064 """
00065 __slots__ = ['header','boxes']
00066 _slot_types = ['Header','mapping_msgs/OrientedBoundingBox[]']
00067
00068 def __init__(self, *args, **kwds):
00069 """
00070 Constructor. Any message fields that are implicitly/explicitly
00071 set to None will be assigned a default value. The recommend
00072 use is keyword arguments as this is more robust to future message
00073 changes. You cannot mix in-order arguments and keyword arguments.
00074
00075 The available fields are:
00076 header,boxes
00077
00078 @param args: complete set of field values, in .msg order
00079 @param kwds: use keyword arguments corresponding to message field names
00080 to set specific fields.
00081 """
00082 if args or kwds:
00083 super(CollisionMap, self).__init__(*args, **kwds)
00084
00085 if self.header is None:
00086 self.header = std_msgs.msg._Header.Header()
00087 if self.boxes is None:
00088 self.boxes = []
00089 else:
00090 self.header = std_msgs.msg._Header.Header()
00091 self.boxes = []
00092
00093 def _get_types(self):
00094 """
00095 internal API method
00096 """
00097 return self._slot_types
00098
00099 def serialize(self, buff):
00100 """
00101 serialize message into buffer
00102 @param buff: buffer
00103 @type buff: StringIO
00104 """
00105 try:
00106 _x = self
00107 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00108 _x = self.header.frame_id
00109 length = len(_x)
00110 buff.write(struct.pack('<I%ss'%length, length, _x))
00111 length = len(self.boxes)
00112 buff.write(_struct_I.pack(length))
00113 for val1 in self.boxes:
00114 _v1 = val1.center
00115 _x = _v1
00116 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00117 _v2 = val1.extents
00118 _x = _v2
00119 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00120 _v3 = val1.axis
00121 _x = _v3
00122 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00123 buff.write(_struct_f.pack(val1.angle))
00124 except struct.error, se: self._check_types(se)
00125 except TypeError, te: self._check_types(te)
00126
00127 def deserialize(self, str):
00128 """
00129 unpack serialized message in str into this message instance
00130 @param str: byte array of serialized message
00131 @type str: str
00132 """
00133 try:
00134 if self.header is None:
00135 self.header = std_msgs.msg._Header.Header()
00136 end = 0
00137 _x = self
00138 start = end
00139 end += 12
00140 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00141 start = end
00142 end += 4
00143 (length,) = _struct_I.unpack(str[start:end])
00144 start = end
00145 end += length
00146 self.header.frame_id = str[start:end]
00147 start = end
00148 end += 4
00149 (length,) = _struct_I.unpack(str[start:end])
00150 self.boxes = []
00151 for i in xrange(0, length):
00152 val1 = mapping_msgs.msg.OrientedBoundingBox()
00153 _v4 = val1.center
00154 _x = _v4
00155 start = end
00156 end += 12
00157 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00158 _v5 = val1.extents
00159 _x = _v5
00160 start = end
00161 end += 12
00162 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00163 _v6 = val1.axis
00164 _x = _v6
00165 start = end
00166 end += 12
00167 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00168 start = end
00169 end += 4
00170 (val1.angle,) = _struct_f.unpack(str[start:end])
00171 self.boxes.append(val1)
00172 return self
00173 except struct.error, e:
00174 raise roslib.message.DeserializationError(e)
00175
00176
00177 def serialize_numpy(self, buff, numpy):
00178 """
00179 serialize message with numpy array types into buffer
00180 @param buff: buffer
00181 @type buff: StringIO
00182 @param numpy: numpy python module
00183 @type numpy module
00184 """
00185 try:
00186 _x = self
00187 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00188 _x = self.header.frame_id
00189 length = len(_x)
00190 buff.write(struct.pack('<I%ss'%length, length, _x))
00191 length = len(self.boxes)
00192 buff.write(_struct_I.pack(length))
00193 for val1 in self.boxes:
00194 _v7 = val1.center
00195 _x = _v7
00196 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00197 _v8 = val1.extents
00198 _x = _v8
00199 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00200 _v9 = val1.axis
00201 _x = _v9
00202 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z))
00203 buff.write(_struct_f.pack(val1.angle))
00204 except struct.error, se: self._check_types(se)
00205 except TypeError, te: self._check_types(te)
00206
00207 def deserialize_numpy(self, str, numpy):
00208 """
00209 unpack serialized message in str into this message instance using numpy for array types
00210 @param str: byte array of serialized message
00211 @type str: str
00212 @param numpy: numpy python module
00213 @type numpy: module
00214 """
00215 try:
00216 if self.header is None:
00217 self.header = std_msgs.msg._Header.Header()
00218 end = 0
00219 _x = self
00220 start = end
00221 end += 12
00222 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00223 start = end
00224 end += 4
00225 (length,) = _struct_I.unpack(str[start:end])
00226 start = end
00227 end += length
00228 self.header.frame_id = str[start:end]
00229 start = end
00230 end += 4
00231 (length,) = _struct_I.unpack(str[start:end])
00232 self.boxes = []
00233 for i in xrange(0, length):
00234 val1 = mapping_msgs.msg.OrientedBoundingBox()
00235 _v10 = val1.center
00236 _x = _v10
00237 start = end
00238 end += 12
00239 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00240 _v11 = val1.extents
00241 _x = _v11
00242 start = end
00243 end += 12
00244 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00245 _v12 = val1.axis
00246 _x = _v12
00247 start = end
00248 end += 12
00249 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end])
00250 start = end
00251 end += 4
00252 (val1.angle,) = _struct_f.unpack(str[start:end])
00253 self.boxes.append(val1)
00254 return self
00255 except struct.error, e:
00256 raise roslib.message.DeserializationError(e)
00257
00258 _struct_I = roslib.message.struct_I
00259 _struct_3I = struct.Struct("<3I")
00260 _struct_3f = struct.Struct("<3f")
00261 _struct_f = struct.Struct("<f")