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