$search
00001 """autogenerated by genmsg_py from Polygon.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import geometry_msgs.msg 00006 00007 class Polygon(roslib.message.Message): 00008 _md5sum = "cd60a26494a087f577976f0329fa120e" 00009 _type = "geometry_msgs/Polygon" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """#A specification of a polygon where the first and last points are assumed to be connected 00012 geometry_msgs/Point32[] points 00013 00014 ================================================================================ 00015 MSG: geometry_msgs/Point32 00016 # This contains the position of a point in free space(with 32 bits of precision). 00017 # It is recommeded to use Point wherever possible instead of Point32. 00018 # 00019 # This recommendation is to promote interoperability. 00020 # 00021 # This message is designed to take up less space when sending 00022 # lots of points at once, as in the case of a PointCloud. 00023 00024 float32 x 00025 float32 y 00026 float32 z 00027 """ 00028 __slots__ = ['points'] 00029 _slot_types = ['geometry_msgs/Point32[]'] 00030 00031 def __init__(self, *args, **kwds): 00032 """ 00033 Constructor. Any message fields that are implicitly/explicitly 00034 set to None will be assigned a default value. The recommend 00035 use is keyword arguments as this is more robust to future message 00036 changes. You cannot mix in-order arguments and keyword arguments. 00037 00038 The available fields are: 00039 points 00040 00041 @param args: complete set of field values, in .msg order 00042 @param kwds: use keyword arguments corresponding to message field names 00043 to set specific fields. 00044 """ 00045 if args or kwds: 00046 super(Polygon, self).__init__(*args, **kwds) 00047 #message fields cannot be None, assign default values for those that are 00048 if self.points is None: 00049 self.points = [] 00050 else: 00051 self.points = [] 00052 00053 def _get_types(self): 00054 """ 00055 internal API method 00056 """ 00057 return self._slot_types 00058 00059 def serialize(self, buff): 00060 """ 00061 serialize message into buffer 00062 @param buff: buffer 00063 @type buff: StringIO 00064 """ 00065 try: 00066 length = len(self.points) 00067 buff.write(_struct_I.pack(length)) 00068 for val1 in self.points: 00069 _x = val1 00070 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z)) 00071 except struct.error as se: self._check_types(se) 00072 except TypeError as te: self._check_types(te) 00073 00074 def deserialize(self, str): 00075 """ 00076 unpack serialized message in str into this message instance 00077 @param str: byte array of serialized message 00078 @type str: str 00079 """ 00080 try: 00081 end = 0 00082 start = end 00083 end += 4 00084 (length,) = _struct_I.unpack(str[start:end]) 00085 self.points = [] 00086 for i in range(0, length): 00087 val1 = geometry_msgs.msg.Point32() 00088 _x = val1 00089 start = end 00090 end += 12 00091 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end]) 00092 self.points.append(val1) 00093 return self 00094 except struct.error as e: 00095 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00096 00097 00098 def serialize_numpy(self, buff, numpy): 00099 """ 00100 serialize message with numpy array types into buffer 00101 @param buff: buffer 00102 @type buff: StringIO 00103 @param numpy: numpy python module 00104 @type numpy module 00105 """ 00106 try: 00107 length = len(self.points) 00108 buff.write(_struct_I.pack(length)) 00109 for val1 in self.points: 00110 _x = val1 00111 buff.write(_struct_3f.pack(_x.x, _x.y, _x.z)) 00112 except struct.error as se: self._check_types(se) 00113 except TypeError as te: self._check_types(te) 00114 00115 def deserialize_numpy(self, str, numpy): 00116 """ 00117 unpack serialized message in str into this message instance using numpy for array types 00118 @param str: byte array of serialized message 00119 @type str: str 00120 @param numpy: numpy python module 00121 @type numpy: module 00122 """ 00123 try: 00124 end = 0 00125 start = end 00126 end += 4 00127 (length,) = _struct_I.unpack(str[start:end]) 00128 self.points = [] 00129 for i in range(0, length): 00130 val1 = geometry_msgs.msg.Point32() 00131 _x = val1 00132 start = end 00133 end += 12 00134 (_x.x, _x.y, _x.z,) = _struct_3f.unpack(str[start:end]) 00135 self.points.append(val1) 00136 return self 00137 except struct.error as e: 00138 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00139 00140 _struct_I = roslib.message.struct_I 00141 _struct_3f = struct.Struct("<3f")