$search
00001 """autogenerated by genmsg_py from GridCells.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import geometry_msgs.msg 00006 import std_msgs.msg 00007 00008 class GridCells(roslib.message.Message): 00009 _md5sum = "b9e4f5df6d28e272ebde00a3994830f5" 00010 _type = "nav_msgs/GridCells" 00011 _has_header = True #flag to mark the presence of a Header object 00012 _full_text = """#an array of cells in a 2D grid 00013 Header header 00014 float32 cell_width 00015 float32 cell_height 00016 geometry_msgs/Point[] cells 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: geometry_msgs/Point 00038 # This contains the position of a point in free space 00039 float64 x 00040 float64 y 00041 float64 z 00042 00043 """ 00044 __slots__ = ['header','cell_width','cell_height','cells'] 00045 _slot_types = ['Header','float32','float32','geometry_msgs/Point[]'] 00046 00047 def __init__(self, *args, **kwds): 00048 """ 00049 Constructor. Any message fields that are implicitly/explicitly 00050 set to None will be assigned a default value. The recommend 00051 use is keyword arguments as this is more robust to future message 00052 changes. You cannot mix in-order arguments and keyword arguments. 00053 00054 The available fields are: 00055 header,cell_width,cell_height,cells 00056 00057 @param args: complete set of field values, in .msg order 00058 @param kwds: use keyword arguments corresponding to message field names 00059 to set specific fields. 00060 """ 00061 if args or kwds: 00062 super(GridCells, self).__init__(*args, **kwds) 00063 #message fields cannot be None, assign default values for those that are 00064 if self.header is None: 00065 self.header = std_msgs.msg._Header.Header() 00066 if self.cell_width is None: 00067 self.cell_width = 0. 00068 if self.cell_height is None: 00069 self.cell_height = 0. 00070 if self.cells is None: 00071 self.cells = [] 00072 else: 00073 self.header = std_msgs.msg._Header.Header() 00074 self.cell_width = 0. 00075 self.cell_height = 0. 00076 self.cells = [] 00077 00078 def _get_types(self): 00079 """ 00080 internal API method 00081 """ 00082 return self._slot_types 00083 00084 def serialize(self, buff): 00085 """ 00086 serialize message into buffer 00087 @param buff: buffer 00088 @type buff: StringIO 00089 """ 00090 try: 00091 _x = self 00092 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00093 _x = self.header.frame_id 00094 length = len(_x) 00095 buff.write(struct.pack('<I%ss'%length, length, _x)) 00096 _x = self 00097 buff.write(_struct_2f.pack(_x.cell_width, _x.cell_height)) 00098 length = len(self.cells) 00099 buff.write(_struct_I.pack(length)) 00100 for val1 in self.cells: 00101 _x = val1 00102 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00103 except struct.error as se: self._check_types(se) 00104 except TypeError as te: self._check_types(te) 00105 00106 def deserialize(self, str): 00107 """ 00108 unpack serialized message in str into this message instance 00109 @param str: byte array of serialized message 00110 @type str: str 00111 """ 00112 try: 00113 if self.header is None: 00114 self.header = std_msgs.msg._Header.Header() 00115 end = 0 00116 _x = self 00117 start = end 00118 end += 12 00119 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00120 start = end 00121 end += 4 00122 (length,) = _struct_I.unpack(str[start:end]) 00123 start = end 00124 end += length 00125 self.header.frame_id = str[start:end] 00126 _x = self 00127 start = end 00128 end += 8 00129 (_x.cell_width, _x.cell_height,) = _struct_2f.unpack(str[start:end]) 00130 start = end 00131 end += 4 00132 (length,) = _struct_I.unpack(str[start:end]) 00133 self.cells = [] 00134 for i in range(0, length): 00135 val1 = geometry_msgs.msg.Point() 00136 _x = val1 00137 start = end 00138 end += 24 00139 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00140 self.cells.append(val1) 00141 return self 00142 except struct.error as e: 00143 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00144 00145 00146 def serialize_numpy(self, buff, numpy): 00147 """ 00148 serialize message with numpy array types into buffer 00149 @param buff: buffer 00150 @type buff: StringIO 00151 @param numpy: numpy python module 00152 @type numpy module 00153 """ 00154 try: 00155 _x = self 00156 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00157 _x = self.header.frame_id 00158 length = len(_x) 00159 buff.write(struct.pack('<I%ss'%length, length, _x)) 00160 _x = self 00161 buff.write(_struct_2f.pack(_x.cell_width, _x.cell_height)) 00162 length = len(self.cells) 00163 buff.write(_struct_I.pack(length)) 00164 for val1 in self.cells: 00165 _x = val1 00166 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00167 except struct.error as se: self._check_types(se) 00168 except TypeError as te: self._check_types(te) 00169 00170 def deserialize_numpy(self, str, numpy): 00171 """ 00172 unpack serialized message in str into this message instance using numpy for array types 00173 @param str: byte array of serialized message 00174 @type str: str 00175 @param numpy: numpy python module 00176 @type numpy: module 00177 """ 00178 try: 00179 if self.header is None: 00180 self.header = std_msgs.msg._Header.Header() 00181 end = 0 00182 _x = self 00183 start = end 00184 end += 12 00185 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00186 start = end 00187 end += 4 00188 (length,) = _struct_I.unpack(str[start:end]) 00189 start = end 00190 end += length 00191 self.header.frame_id = str[start:end] 00192 _x = self 00193 start = end 00194 end += 8 00195 (_x.cell_width, _x.cell_height,) = _struct_2f.unpack(str[start:end]) 00196 start = end 00197 end += 4 00198 (length,) = _struct_I.unpack(str[start:end]) 00199 self.cells = [] 00200 for i in range(0, length): 00201 val1 = geometry_msgs.msg.Point() 00202 _x = val1 00203 start = end 00204 end += 24 00205 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00206 self.cells.append(val1) 00207 return self 00208 except struct.error as e: 00209 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00210 00211 _struct_I = roslib.message.struct_I 00212 _struct_3I = struct.Struct("<3I") 00213 _struct_2f = struct.Struct("<2f") 00214 _struct_3d = struct.Struct("<3d")