00001 """autogenerated by genpy from turtlebot_block_manipulation/BlockDetectionResult.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 geometry_msgs.msg
00008 import std_msgs.msg
00009
00010 class BlockDetectionResult(genpy.Message):
00011 _md5sum = "fe4272fcc0cf26cf952b16d66c620bd4"
00012 _type = "turtlebot_block_manipulation/BlockDetectionResult"
00013 _has_header = False
00014 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00015 #result definition
00016 geometry_msgs/PoseArray blocks
00017
00018 ================================================================================
00019 MSG: geometry_msgs/PoseArray
00020 # An array of poses with a header for global reference.
00021
00022 Header header
00023
00024 Pose[] poses
00025
00026 ================================================================================
00027 MSG: std_msgs/Header
00028 # Standard metadata for higher-level stamped data types.
00029 # This is generally used to communicate timestamped data
00030 # in a particular coordinate frame.
00031 #
00032 # sequence ID: consecutively increasing ID
00033 uint32 seq
00034 #Two-integer timestamp that is expressed as:
00035 # * stamp.secs: seconds (stamp_secs) since epoch
00036 # * stamp.nsecs: nanoseconds since stamp_secs
00037 # time-handling sugar is provided by the client library
00038 time stamp
00039 #Frame this data is associated with
00040 # 0: no frame
00041 # 1: global frame
00042 string frame_id
00043
00044 ================================================================================
00045 MSG: geometry_msgs/Pose
00046 # A representation of pose in free space, composed of postion and orientation.
00047 Point position
00048 Quaternion orientation
00049
00050 ================================================================================
00051 MSG: geometry_msgs/Point
00052 # This contains the position of a point in free space
00053 float64 x
00054 float64 y
00055 float64 z
00056
00057 ================================================================================
00058 MSG: geometry_msgs/Quaternion
00059 # This represents an orientation in free space in quaternion form.
00060
00061 float64 x
00062 float64 y
00063 float64 z
00064 float64 w
00065
00066 """
00067 __slots__ = ['blocks']
00068 _slot_types = ['geometry_msgs/PoseArray']
00069
00070 def __init__(self, *args, **kwds):
00071 """
00072 Constructor. Any message fields that are implicitly/explicitly
00073 set to None will be assigned a default value. The recommend
00074 use is keyword arguments as this is more robust to future message
00075 changes. You cannot mix in-order arguments and keyword arguments.
00076
00077 The available fields are:
00078 blocks
00079
00080 :param args: complete set of field values, in .msg order
00081 :param kwds: use keyword arguments corresponding to message field names
00082 to set specific fields.
00083 """
00084 if args or kwds:
00085 super(BlockDetectionResult, self).__init__(*args, **kwds)
00086
00087 if self.blocks is None:
00088 self.blocks = geometry_msgs.msg.PoseArray()
00089 else:
00090 self.blocks = geometry_msgs.msg.PoseArray()
00091
00092 def _get_types(self):
00093 """
00094 internal API method
00095 """
00096 return self._slot_types
00097
00098 def serialize(self, buff):
00099 """
00100 serialize message into buffer
00101 :param buff: buffer, ``StringIO``
00102 """
00103 try:
00104 _x = self
00105 buff.write(_struct_3I.pack(_x.blocks.header.seq, _x.blocks.header.stamp.secs, _x.blocks.header.stamp.nsecs))
00106 _x = self.blocks.header.frame_id
00107 length = len(_x)
00108 if python3 or type(_x) == unicode:
00109 _x = _x.encode('utf-8')
00110 length = len(_x)
00111 buff.write(struct.pack('<I%ss'%length, length, _x))
00112 length = len(self.blocks.poses)
00113 buff.write(_struct_I.pack(length))
00114 for val1 in self.blocks.poses:
00115 _v1 = val1.position
00116 _x = _v1
00117 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00118 _v2 = val1.orientation
00119 _x = _v2
00120 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00121 except struct.error as se: self._check_types(se)
00122 except TypeError as te: self._check_types(te)
00123
00124 def deserialize(self, str):
00125 """
00126 unpack serialized message in str into this message instance
00127 :param str: byte array of serialized message, ``str``
00128 """
00129 try:
00130 if self.blocks is None:
00131 self.blocks = geometry_msgs.msg.PoseArray()
00132 end = 0
00133 _x = self
00134 start = end
00135 end += 12
00136 (_x.blocks.header.seq, _x.blocks.header.stamp.secs, _x.blocks.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00137 start = end
00138 end += 4
00139 (length,) = _struct_I.unpack(str[start:end])
00140 start = end
00141 end += length
00142 if python3:
00143 self.blocks.header.frame_id = str[start:end].decode('utf-8')
00144 else:
00145 self.blocks.header.frame_id = str[start:end]
00146 start = end
00147 end += 4
00148 (length,) = _struct_I.unpack(str[start:end])
00149 self.blocks.poses = []
00150 for i in range(0, length):
00151 val1 = geometry_msgs.msg.Pose()
00152 _v3 = val1.position
00153 _x = _v3
00154 start = end
00155 end += 24
00156 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00157 _v4 = val1.orientation
00158 _x = _v4
00159 start = end
00160 end += 32
00161 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00162 self.blocks.poses.append(val1)
00163 return self
00164 except struct.error as e:
00165 raise genpy.DeserializationError(e)
00166
00167
00168 def serialize_numpy(self, buff, numpy):
00169 """
00170 serialize message with numpy array types into buffer
00171 :param buff: buffer, ``StringIO``
00172 :param numpy: numpy python module
00173 """
00174 try:
00175 _x = self
00176 buff.write(_struct_3I.pack(_x.blocks.header.seq, _x.blocks.header.stamp.secs, _x.blocks.header.stamp.nsecs))
00177 _x = self.blocks.header.frame_id
00178 length = len(_x)
00179 if python3 or type(_x) == unicode:
00180 _x = _x.encode('utf-8')
00181 length = len(_x)
00182 buff.write(struct.pack('<I%ss'%length, length, _x))
00183 length = len(self.blocks.poses)
00184 buff.write(_struct_I.pack(length))
00185 for val1 in self.blocks.poses:
00186 _v5 = val1.position
00187 _x = _v5
00188 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00189 _v6 = val1.orientation
00190 _x = _v6
00191 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00192 except struct.error as se: self._check_types(se)
00193 except TypeError as te: self._check_types(te)
00194
00195 def deserialize_numpy(self, str, numpy):
00196 """
00197 unpack serialized message in str into this message instance using numpy for array types
00198 :param str: byte array of serialized message, ``str``
00199 :param numpy: numpy python module
00200 """
00201 try:
00202 if self.blocks is None:
00203 self.blocks = geometry_msgs.msg.PoseArray()
00204 end = 0
00205 _x = self
00206 start = end
00207 end += 12
00208 (_x.blocks.header.seq, _x.blocks.header.stamp.secs, _x.blocks.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00209 start = end
00210 end += 4
00211 (length,) = _struct_I.unpack(str[start:end])
00212 start = end
00213 end += length
00214 if python3:
00215 self.blocks.header.frame_id = str[start:end].decode('utf-8')
00216 else:
00217 self.blocks.header.frame_id = str[start:end]
00218 start = end
00219 end += 4
00220 (length,) = _struct_I.unpack(str[start:end])
00221 self.blocks.poses = []
00222 for i in range(0, length):
00223 val1 = geometry_msgs.msg.Pose()
00224 _v7 = val1.position
00225 _x = _v7
00226 start = end
00227 end += 24
00228 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00229 _v8 = val1.orientation
00230 _x = _v8
00231 start = end
00232 end += 32
00233 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00234 self.blocks.poses.append(val1)
00235 return self
00236 except struct.error as e:
00237 raise genpy.DeserializationError(e)
00238
00239 _struct_I = genpy.struct_I
00240 _struct_3I = struct.Struct("<3I")
00241 _struct_4d = struct.Struct("<4d")
00242 _struct_3d = struct.Struct("<3d")